1.adb shell "dumpsys window | grep mCurrentFocus"
result : mCurrentFocus=Window{4fa4c8b u0 com.google.android.dialer/ com.google.android.dialer.extensions.GoogleDialtactsActivity}
获取正在运行app的packagename 和defualt class
adb shell dumpsys activity | grep -i run
当前与用户交互的activity
2.adb shell pm list package -f | grep "dialer"
result: package:/system/app/AutoDialer/AutoDialer.apk=com.mediatek.autodialer
package:/product/priv-app/GoogleDialerGo/GoogleDialerGo.apk=com.google.android.dialer
get package list ;-f show path
3.aapt dump badging application.apk(get apk packageName)
package name:
launchable-activity
install apktool: sudo apt-get install apktool
3.1 copy apk to pc
adb pull phonePath pc
4.LOCAL_OVERRIDES_PACKAGES覆盖替换
预置的APK,要覆盖原生apk. 在第三方apk android.mk 添加LOCAL_OVERRIDES_PACKAGES
如: 需要预置第三方的浏览器,替换掉HTMLViewer,则在预置apk的mk文件中加入:
LOCAL_OVERRIDES_PACKAGES := HTMLViewer
并在out目录下把HTMLViewer.apk删除掉
alps/vendor/partner_gms/apps/GoogleDialer android.mk
5.apk setup
apk package: in framwork///values/config config_defaultDialer = com.android.dialer;
apk default_class define : ../alps/vendor/mediatek/proprietary/packages/services/Telecomm/res/values/config.xml dialer_default_class = com.android.dialer.app.DialtactsActivity
6. 查看系统信息
adb shell dumpsys activity top
6.通过adb shell命令查看当前与用户交互的activity
adb shell dumpsys activity | grep -i run