android mtk平台内置apk,可卸载恢复出厂设置还在
程序员文章站
2022-03-16 15:15:02
...
1.在源码的根目录下
cd vendor
mkdir customizeapk
在 customizeapk 下再次创建 custom 文件夹
将要编译的apk 放在custom目录中 注意文件名不要带空格、非法字符如中文符号、#、()等
2.编写android.mk,内容如下:
LOCAL_PATH:= $(my-dir)
copy_from := \
HAS_CUSTOM:= $(shell test -d $(LOCAL_PATH)/custom && echo yes)
ifeq ($(HAS_CUSTOM), yes)
$(shell mkdir -p $(TARGET_OUT)endor/operator/app)
copy_from += $(notdir $(wildcard $(LOCAL_PATH)/custom/*.apk))
endif
define expand_prebuilt_apks
$(foreach file1,$(1), \
$(eval include $(CLEAR_VARS)) \
$(eval LOCAL_MODULE := $(file1)) \
$(eval LOCAL_SRC_FILES := $(file1)) \
$(eval LOCAL_MODULE_CLASS := APPS) \
$(eval LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)) \
$(eval LOCAL_PRIVILEGED_MODULE := true) \
$(eval LOCAL_MODULE_TAGS := optional) \
$(eval LOCAL_CERTIFICATE := PRESIGNED) \
$(eval LOCAL_MODULE_PATH := $(TARGET_OUT)endor/operator/app) \
$(eval include $(BUILD_PREBUILT)) \
)
endef
$(call expand_prebuilt_apks, $(copy_from))
3.在build/target/product/common.mk中添加如下字段
define search_and_add_to_product_package2
$(foreach file1,$(1), \
$(eval PRODUCT_PACKAGES+= $(notdir $(wildcard $(file1)/*.$(strip $(2))))))
endef
$(call search_and_add_to_product_package2, vendor/customizeapk/custom , apk)
cd vendor
mkdir customizeapk
在 customizeapk 下再次创建 custom 文件夹
将要编译的apk 放在custom目录中 注意文件名不要带空格、非法字符如中文符号、#、()等
2.编写android.mk,内容如下:
LOCAL_PATH:= $(my-dir)
copy_from := \
HAS_CUSTOM:= $(shell test -d $(LOCAL_PATH)/custom && echo yes)
ifeq ($(HAS_CUSTOM), yes)
$(shell mkdir -p $(TARGET_OUT)endor/operator/app)
copy_from += $(notdir $(wildcard $(LOCAL_PATH)/custom/*.apk))
endif
define expand_prebuilt_apks
$(foreach file1,$(1), \
$(eval include $(CLEAR_VARS)) \
$(eval LOCAL_MODULE := $(file1)) \
$(eval LOCAL_SRC_FILES := $(file1)) \
$(eval LOCAL_MODULE_CLASS := APPS) \
$(eval LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)) \
$(eval LOCAL_PRIVILEGED_MODULE := true) \
$(eval LOCAL_MODULE_TAGS := optional) \
$(eval LOCAL_CERTIFICATE := PRESIGNED) \
$(eval LOCAL_MODULE_PATH := $(TARGET_OUT)endor/operator/app) \
$(eval include $(BUILD_PREBUILT)) \
)
endef
$(call expand_prebuilt_apks, $(copy_from))
3.在build/target/product/common.mk中添加如下字段
define search_and_add_to_product_package2
$(foreach file1,$(1), \
$(eval PRODUCT_PACKAGES+= $(notdir $(wildcard $(file1)/*.$(strip $(2))))))
endef
$(call search_and_add_to_product_package2, vendor/customizeapk/custom , apk)