删除android默认APK的方法

asop默认会添加一下APK,定制ROM时可以使用如下方法删除

---

 core/main.mk    | 11 +++++++++++
 core/product.mk |  1 +
 2 files changed, 12 insertions(+)


diff --git a/core/main.mk b/core/main.mk
index 17bff18d..6f51381 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -594,6 +594,9 @@ ifdef FULL_BUILD
   # Filter out the overridden packages before doing expansion
   product_MODULES := $(filter-out $(foreach p, $(product_MODULES), \
       $(PACKAGES.$(p).OVERRIDES)), $(product_MODULES))
+  # Filter out the product overridden packages before doing expansion
+  product_MODULES := $(filter-out $(foreach p, $(product_MODULES), \
+      $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OVERRIDES_PACKAGES)), $(product_MODULES))
   $(call expand-required-modules,product_MODULES,$(product_MODULES))
   product_FILES := $(call module-installed-files, $(product_MODULES))
   ifeq (0,1)
@@ -645,6 +648,14 @@ endif
 #$(error filtered out
 #           $(filter-out $(modules_to_install),$(old_modules_to_install)))
 
+ifneq (,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OVERRIDES_PACKAGES))
+  #$(info PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OVERRIDES_PACKAGES=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OVERRIDES_PACKAGES))
+  modules_to_install := \
+      $(filter-out $(foreach p,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OVERRIDES_PACKAGES),$(p) %/$(p).apk), \
+          $(modules_to_install))
+  #$(info modules_to_install=$(modules_to_install))
+endif
+
 # Don't include any GNU targets in the SDK.  It's ok (and necessary)
 # to build the host tools, but nothing that's going to be installed
 # on the target (including static libraries).
diff --git a/core/product.mk b/core/product.mk
index a2f4abc..3bcc2cd 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -74,6 +74,7 @@ _product_var_list := \
     PRODUCT_PACKAGES_DEBUG \
     PRODUCT_PACKAGES_ENG \
     PRODUCT_PACKAGES_TESTS \
+    PRODUCT_OVERRIDES_PACKAGES \
     PRODUCT_DEVICE \
     PRODUCT_MANUFACTURER \
     PRODUCT_BRAND \
-- 
1.9.1

你可能感兴趣的:(android)