本篇集中说明第三方应用集成 写法,以及怎么集成可卸载第三方应用。
写法
签名
- 自签名
android_app_import {
name: "SogouInput",
system_ext_specific: true,
presigned: true,
dex_preopt: {
enabled: false,
},
apk: "SogouInput_android_oem_baoneng.apk",
}
- 系统签名
# system signal
android_app_import {
name: "SogouInput",
system_ext_specific: true,
certificate: "platform",
apk: "SogouInput_android_oem_baoneng.apk",
}
集成位置
- system/app
android_app_import {
name: "SogouInput",
presigned: true,
dex_preopt: {
enabled: false,
},
apk: "SogouInput_android_oem_baoneng.apk",
}
- system_ext/app
android_app_import {
name: "SogouInput",
system_ext_specific: true,
presigned: true,
dex_preopt: {
enabled: false,
},
apk: "SogouInput_android_oem_baoneng.apk",
}
- system/pri-app
必须声明在permission白名单内。
aosp路径:frameworks/base/data/etc/
手机路径:system/etc/permission/
android_app_import {
name: "SogouInput",
privileged: true,
presigned: true,
dex_preopt: {
enabled: false,
},
apk: "SogouInput_android_oem_baoneng.apk",
}
- product/app
android_app_import {
name: "SogouInput",
product_specific: true,
presigned: true,
dex_preopt: {
enabled: false,
},
apk: "SogouInput_android_oem_baoneng.apk",
}
- vendor/app
android_app_import {
name: "SogouInput",
proprietary: true,
presigned: true,
dex_preopt: {
enabled: false,
},
apk: "SogouInput_android_oem_baoneng.apk",
}
第三方可卸载apk集成方法
- MTK 平台方案
- 将包名添加到配置文件(vendor\mediatek\proprietary\frameworks\base\data\etc\pms_sysapp_removable_system_list.txt)
- mk文件完成拷贝
// device/mediatek/common/
ifneq ($(strip $(MTK_BASIC_PACKAGE)), yes)
+ PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,vendor/mediatek/proprietary/frameworks/base/data/etc/pms_sysapp_grant_permission_list.txt:system/etc/permissions/pms_sysapp_grant_permission_list.txt)
PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,vendor/mediatek/proprietary/frameworks/base/data/etc/pms_sysapp_removable_system_list.txt:system/etc/permissions/pms_sysapp_removable_system_list.txt)
PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,vendor/mediatek/proprietary/frameworks/base/data/etc/pms_sysapp_removable_vendor_list.txt:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/pms_sysapp_removable_vendor_list.txt)
endif
- 源码分析
// PMS中添加
if ((pkg, updatedPkg, ps, scanFile))
return null;
//()
//MtkSystemServiceFactoryImpl (vendor/mediatak/proprietary/frameworkes/base/.../)
// (vendor/mediatak/proprietary/frameworkes/base/.../)
@Override
public boolean needSkipScanning( pkg,
PackageSetting updatedPkg, PackageSetting ps, File scanFile) {
if (!() &&
(isRemovableSysApp() || locationIsOperator(scanFile)) &&
(ps == null && updatedPkg == null)) {
if (()) {
if (isRemovableSysApp()
&& !()) {
(TAG, "New added removable sys app by OTA:" + );
return false;
}
if (locationIsOperator(scanFile)
&& ()
&& !()) {
(TAG, "New added operator app by OTA:" + );
return false;
}
}
(TAG, "Skip scanning uninstalled sys package " + );
return true;
} else if (ps == null && updatedPkg != null) {
(TAG, "Skip scanning uninstalled package: " + );
return true;
}
return false;
}
- 使用脚本方式安装
使用脚本的方式
参考
- 权限配置