RK3326 android10.0(Q) 预装APP可卸载不恢复补丁

122 阅读1分钟

问题原因

参照之前8.1的方案,直接在 device/rockchip/rk3326/ 对应文件中放置apk,发现编译后并未打包到系统中

经过搜索发现 device.mk 中对应的编译项已经被注释了,因为 Q 版本无法动态获取编译变量,所以需要手动指定位置

# Prebuild apps
#ifneq ($(strip $(TARGET_PRODUCT)), )
#    TARGET_DEVICE_DIR=$(shell test -d device && find device -maxdepth 4 -path '*/$(TARGET_PRODUCT)/BoardConfig.mk')
#    TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(TARGET_DEVICE_DIR)))
#    $(info device-rockchip-common TARGET_DEVICE_DIR: $(TARGET_DEVICE_DIR))
#    $(shell python $(LOCAL_PATH)/auto_generator.py $(TARGET_DEVICE_DIR) preinstall bundled_persist-app)
#    $(shell python $(LOCAL_PATH)/auto_generator.py $(TARGET_DEVICE_DIR) preinstall_del bundled_uninstall_back-app)
#    $(shell python $(LOCAL_PATH)/auto_generator.py $(TARGET_DEVICE_DIR) preinstall_del_forever bundled_uninstall_gone-app)
#    -include $(TARGET_DEVICE_DIR)/preinstall/preinstall.mk
#    -include $(TARGET_DEVICE_DIR)/preinstall_del/preinstall.mk
#    -include $(TARGET_DEVICE_DIR)/preinstall_del_forever/preinstall.mk
#endif

增加补丁

device/rockchip/common/device.mk
system/sepolicy/private/file_contexts
system/sepolicy/prebuilts/api/29.0/private/file_contexts

device/rockchip/common/device.mk

 #    -include $(TARGET_DEVICE_DIR)/preinstall_del_forever/preinstall.mk
 #endif
 
+$(shell python device/rockchip/common/auto_generator.py device/rockchip/rk3326/PX30_Android10 preinstall bundled_persist-app)
+$(shell python device/rockchip/common/auto_generator.py device/rockchip/rk3326/PX30_Android10 preinstall_del bundled_uninstall_back-app)
+$(shell python device/rockchip/common/auto_generator.py device/rockchip/rk3326/PX30_Android10 preinstall_del_forever bundled_uninstall_gone-app)
+-include device/rockchip/rk3326/PX30_Android10/preinstall/preinstall.mk
+-include device/rockchip/rk3326/PX30_Android10/preinstall_del/preinstall.mk
+-include device/rockchip/rk3326/PX30_Android10/preinstall_del_forever/preinstall.mk
+
 # Inherit product config
 ifeq ($(strip $(TARGET_BOARD_PLATFORM_PRODUCT)), atv)
   $(call inherit-product, device/google/atv/products/atv_base.mk)

system/sepolicy/private/file_contexts system/sepolicy/prebuilts/api/29.0/private/file_contexts

 /(odm|vendor/odm)/etc(/.*)?                   u:object_r:vendor_configs_file:s0
 /(odm|vendor/odm)/app(/.*)?                   u:object_r:vendor_app_file:s0
 /(odm|vendor/odm)/priv-app(/.*)?              u:object_r:vendor_app_file:s0
+/(odm|vendor/odm)/bundled_persist-app(/.*)?       u:object_r:vendor_app_file:s0
+/(odm|vendor/odm)/bundled_uninstall_back-app(/.*)? u:object_r:vendor_app_file:s0
+/(odm|vendor/odm)/bundled_uninstall_gone-app(/.*)? u:object_r:vendor_app_file:s0
 /(odm|vendor/odm)/overlay(/.*)?               u:object_r:vendor_overlay_file:s0
 /(odm|vendor/odm)/framework(/.*)?             u:object_r:vendor_framework_file:s0