Android基础:禁用apk流程

Android基础:禁用apk流程_第1张图片
image.png

禁用apk流程,在我们需要禁用一个apk时,我们会调用PackageManager的setApplicationEnabledSetting方法。下面分析其源码流程。

设置流程:

PackageManagerService.setApplicationEnabledSetting
PackageManagerService.setEnabledSetting
PackageSetting.setEnabled
PackageUserState.enabled 最后修改了PackageUserState状态

当我们启动一个禁用应用的activity时
adb shell am start -n com.ex.ex/.ablc.mm
会经过下面路径被拦截
调用流程:

ActivityManagerShellCommand.runStartActivity
ActivityManagerService.startActivityAsUser
ActivityStarter.startActivityMayWait
ActivityStackSupervisor.resolveIntent
PackageManagerService.resolveIntent
PackageManagerService.resolveIntentInternal
PackageManagerService.resolveIntentInternal
PackageManagerService.queryIntentActivitiesInternal
PackageManagerService.getActivityInfo
PackageManagerService.getActivityInfoInternal
Settings.isEnabledAndMatchLPr  //这里判断被禁用了,然后不启动

你可能感兴趣的:(Android基础:禁用apk流程)