framework

导航

android 可卸载应用流程

android 可卸载应用流程:
问题现象:发现长按预制的vendor\operator\app不会出现卸载按钮
1、launcher界面长按应用出现卸载按钮
packages\apps\Launcher3\src\com\android\launcher3\SecondaryDropTarget.java
@Override
public boolean supportsAccessibilityDrop(ItemInfo info, View view) {
if (view instanceof AppWidgetHostView) {
return (iconInfo.runtimeStatusFlags & FLAG_SYSTEM_NO) != 0; //关键字 FLAG_SYSTEM_NO

packages/apps/Launcher3/src/com/android/launcher3/model/data/AppInfo.java
info.runtimeStatusFlags |= (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0
? FLAG_SYSTEM_NO : FLAG_SYSTEM_YES;//说明是根据ApplicationInfo 是否有ApplicationInfo.FLAG_SYSTEM属性

发现
vendor/mediatek/proprietary/frameworks/base/services/core/java/com/mediatek/server/pm/PmsExtImpl.java
@Override
public ApplicationInfo updateApplicationInfoForRemovable(String nameForUid,
ApplicationInfo oldAppInfo) {
if (clearSystemFlag && oldAppInfo != null) {//这里根据pms_sysapp_removable_vendor_list列表中的包名清除了预制到系统中应用的FLAG_SYSTEM属性
newAppInfo = new ApplicationInfo(oldAppInfo);
newAppInfo.flags &= ~(ApplicationInfo.FLAG_SYSTEM
| ApplicationInfo.FLAG_UPDATED_SYSTEM_APP);
return newAppInfo;
}
所以找到问题关键pms_sysapp_removable_vendor_list可能不对

2、分析log:打开PmsExtImpl log可以看到 /system/etc/permissions/pms_sysapp_removable_vendor_list.txt does not exist! 原来R上检测文件位置是/system/etc/permissions/pms_sysapp_removable_vendor_list.txt
01-26 06:09:20.542925 1186 1186 D PmsExtImpl: initBeforeScan start
01-26 06:09:20.543080 1186 1186 D PmsExtImpl: BuildRemovableSystemAppSet start
01-26 06:09:20.543152 1186 1186 D PmsExtImpl: sGetRemovableSystemAppFromFile file=/system/etc/permissions/pms_sysapp_removable_system_list.txt
01-26 06:09:20.543804 1186 1186 D PmsExtImpl: sGetRemovableSystemAppFromFile file=/system/etc/permissions/pms_sysapp_removable_vendor_list.txt
01-26 06:09:20.544376 1186 1186 D PmsExtImpl: file in /system/etc/permissions/pms_sysapp_removable_vendor_list.txt does not exist! 报错提示
01-26 06:09:20.544494 1186 1186 D PmsExtImpl: sGetRemovableSystemAppFromFile file=/data/system/pms_sysapp_removable_list_bak.txt
01-26 06:09:20.545221 1186 1186 D PmsExtImpl: BuildRemovableSystemAppSet end
01-26 06:09:20.545395 1186 1186 D PmsExtImpl: BuildSkipScanAppSet start
01-26 06:09:20.545703 1186 1186 D PmsExtImpl: BuildSkipScanAppSet end
01-26 06:09:20.545783 1186 1186 D PmsExtImpl: initBeforeScan end
而我们pms_sysapp_removable_vendor_list的位置是vendor/etc/permissions/pms_sysapp_removable_vendor_list.txt

3、修改我们生成pms_sysapp_removable_vendor_list的位置 vendor\wheatek\common\Android.mk 编译验证即可
http://192.168.80.2:8080/#/c/WTK8788_R0_MP1_AP/+/193343/

 

posted on 2021-03-04 11:14  framework开发  阅读(653)  评论(0编辑  收藏  举报