Android11 系统裁剪

硬件平台:QCS6125

软件平台:Android11

    系统裁剪APP的方式,定义一个build变量,赋予裁剪的APP名字,具体修改如下:

1、build添加变量定义。

diff --git a/core/main.mk b/core/main.mk
index 3bfd8326e..ffe6e44d5 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1076,6 +1076,8 @@ define product-installed-files
   $(eval ### Filter out the overridden packages and executables before doing expansion) \
   $(eval _pif_overrides := $(call module-overrides,$(_pif_modules))) \
   $(eval _pif_modules := $(filter-out $(_pif_overrides), $(_pif_modules))) \
+  $(eval _pif_dels := $(call get-product-var,$(1),PRODUCT_DEL_PACKAGES)) \
+  $(eval _pif_modules := $(filter-out $(_pif_dels), $(_pif_modules))) \
   $(eval ### Resolve the :32 :64 module name) \
   $(eval _pif_modules_32 := $(patsubst %:32,%,$(filter %:32, $(_pif_modules)))) \
   $(eval _pif_modules_64 := $(patsubst %:64,%,$(filter %:64, $(_pif_modules)))) \
diff --git a/core/product.mk b/core/product.mk
index d691617c7..0e78421e1 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -287,6 +287,9 @@ _product_single_value_vars += PRODUCT_ODM_BASE_FS_PATH
 # The first API level this product shipped with
 _product_single_value_vars += PRODUCT_SHIPPING_API_LEVEL
 
+# delete product packages
+_product_single_value_vars += PRODUCT_DEL_PACKAGES
+
 _product_list_vars += VENDOR_PRODUCT_RESTRICT_VENDOR_FILES
 _product_list_vars += VENDOR_EXCEPTION_MODULES
 _product_list_vars += VENDOR_EXCEPTION_PATHS

2、修改device目录下的makefile,添加具体的package

diff --git a/qssi.mk b/qssi.mk
index c037c97..3cbfd41 100644
--- a/qssi.mk
+++ b/qssi.mk
@@ -32,6 +32,27 @@ BOARD_AVB_ENABLE := true
 # SHIPPING_API_LEVEL to 28 if it was not set earlier (this is generally set earlier via build.sh per-target)
 SHIPPING_API_LEVEL := 30
 
+PRODUCT_DEL_PACKAGES += \
+    PrintSpooler \
+    Stk \
+    Mms \
+    MusicFX \
+    Dialer \
+    Contacts \
+    EasterEgg \
+    QuickSearchBox \
+    com.qualcomm.location \
+    FM2 \
+    NQNfcNci \
+    SimAppDialog \
+    LiveWallpapersPicker \
+    DocumentsUI \
+    Cam2test \
+    SnapdragonMusic \
+    DeskClock \
+    QDCMMobileApp \
+    Calendar
+
 $(call inherit-product-if-exists, vendor/qcom/defs/product-defs/system/cne_url*.mk)

修改后,编译一次,看out下相关app是否已经不存在即生效了。

你可能感兴趣的:(build,makefile,系统裁剪,android)