当前位置:   article > 正文

Android 系统 APP 裁剪_android filter-out

android filter-out

系统环境;

    目标系统: Android 8.1

    目标硬件: RK3399Pro ,  rockchip toybrick。

 

参考文献:     

Makefile中filter-out的函义:

https://www.jianshu.com/p/4837a05b9082

Makefile中foreach的函义:

https://blog.csdn.net/u012554768/article/details/46043193

 

裁剪文档:

https://blog.csdn.net/qq_23327993/article/details/90768627

 

步聚:

1.  添加编译环境变量 PRODUCT_DEL_PACKAGES,添加位置:build/make/core/product.mk中的_product_var_list:

  1. _product_var_list := \
  2. PRODUCT_NAME \
  3. PRODUCT_MODEL \
  4. PRODUCT_LOCALES \
  5. PRODUCT_AAPT_CONFIG \
  6. PRODUCT_AAPT_PREF_CONFIG \
  7. PRODUCT_AAPT_PREBUILT_DPI \
  8. PRODUCT_PACKAGES \
  9. PRODUCT_PACKAGES_DEBUG \
  10. PRODUCT_PACKAGES_ENG \
  11. PRODUCT_PACKAGES_TESTS \
  12. PRODUCT_DEL_PACKAGES \
  13. PRODUCT_DEVICE \
  14. PRODUCT_MANUFACTURER \
  15. PRODUCT_BRAND \
  16. PRODUCT_PROPERTY_OVERRIDES \
  17. PRODUCT_DEFAULT_PROPERTY_OVERRIDES \
  18. PRODUCT_CHARACTERISTICS \
  19. PRODUCT_COPY_FILES \
  20. PRODUCT_OTA_PUBLIC_KEYS \
  21. PRODUCT_EXTRA_RECOVERY_KEYS \
  22. PRODUCT_PACKAGE_OVERLAYS \
  23. DEVICE_PACKAGE_OVERLAYS \

2. 在相应的mk文件中给PRODUCT_DEL_PACKAGES赋值,如在device\rockchip\rk3399pro\rk3399pro.mk对PRODUCT_DEL_PACKAGES进行赋值;其值为要删除的APK。

  1. PRODUCT_DEL_PACKAGES += \
  2. SoundRecorder \
  3. Camera2 \
  4. Lightning \
  5. Email \
  6. Gallery2 \
  7. Music \
  8. NfcNci \
  9. MusicFX \
  10. Contacts \
  11. Calendar \
  12. ExactCalculator \
  13. Browser2 \
  14. DeskClock \
  15. EasterEgg

3. 在编译脚本中,增加对PRODUCT_PACKAGES的中字符串处理,删除掉PRODUCT_DEL_PACKAGES相应的字符串。

build/core/main.mk

  1. # The base list of modules to build for this product is specified
  2. # by the appropriate product definition file, which was included
  3. # by product_config.mk.
  4. product_MODULES := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)
  5. # Filter out the overridden packages before doing expansion
  6. product_MODULES := $(filter-out $(foreach p, $(product_MODULES), \
  7. $(PACKAGES.$(p).OVERRIDES)), $(product_MODULES))
  8. # Filter out executables as well
  9. product_MODULES := $(filter-out $(foreach m, $(product_MODULES), \
  10. $(EXECUTABLES.$(m).OVERRIDES)), $(product_MODULES))
  11. #Add by denglijun 20201202 for 裁剪App
  12. # Filter out executables as well
  13. #$(warning First product_MODULES:$(product_MODULES))
  14. product_sub_MODULES := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEL_PACKAGES)
  15. #product_MODULES := $(filter-out $(foreach z, $(product_sub_MODULES), \
  16. # $($(z))), $(product_MODULES))
  17. product_MODULES := $(filter-out $(product_sub_MODULES), $(product_MODULES))
  18. #$(warning product_sub_MODULES:$(product_sub_MODULES))
  19. #$(error product_MODULES:$(product_MODULES))

即可实现对删除。

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/174229
推荐阅读
相关标签
  

闽ICP备14008679号