Merge "Put DEVICE/PRODUCT overlays in different partitions"
am: 94fa0e75cb
Change-Id: I490160177bd0084721212d832dff8c0d721e2e14
This commit is contained in:
commit
fd946975d0
7 changed files with 82 additions and 25 deletions
|
@ -3312,10 +3312,12 @@ include $(BUILD_SYSTEM)/distdir.mk
|
|||
# $(4): Whether LOCAL_EXPORT_PACKAGE_RESOURCES is set or
|
||||
# not for the source module.
|
||||
# $(5): Resource overlay list.
|
||||
# $(6): Target partition
|
||||
###########################################################
|
||||
define append_enforce_rro_sources
|
||||
$(eval ENFORCE_RRO_SOURCES += \
|
||||
$(strip $(1))||$(strip $(2))||$(strip $(3))||$(strip $(4))||$(call normalize-path-list, $(strip $(5))))
|
||||
$(strip $(1))||$(strip $(2))||$(strip $(3))||$(strip $(4))||$(call normalize-path-list, $(strip $(5)))||$(strip $(6)) \
|
||||
)
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
|
@ -3330,6 +3332,7 @@ $(foreach source,$(ENFORCE_RRO_SOURCES), \
|
|||
$(eval enforce_rro_source_manifest_package_info := $(word 3,$(_o))) \
|
||||
$(eval enforce_rro_use_res_lib := $(word 4,$(_o))) \
|
||||
$(eval enforce_rro_source_overlays := $(subst :, ,$(word 5,$(_o)))) \
|
||||
$(eval enforce_rro_partition := $(word 6,$(_o))) \
|
||||
$(eval include $(BUILD_SYSTEM)/generate_enforce_rro.mk) \
|
||||
$(eval ALL_MODULES.$$(enforce_rro_source_module).REQUIRED += $$(LOCAL_PACKAGE_NAME)) \
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include $(CLEAR_VARS)
|
||||
|
||||
enforce_rro_module := $(enforce_rro_source_module)__auto_generated_rro
|
||||
enforce_rro_module := $(enforce_rro_source_module)__auto_generated_rro_$(enforce_rro_partition)
|
||||
LOCAL_PACKAGE_NAME := $(enforce_rro_module)
|
||||
|
||||
intermediates := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME),,COMMON)
|
||||
|
@ -14,10 +14,17 @@ $(rro_android_manifest_file): $(enforce_rro_source_manifest_package_info)
|
|||
endif
|
||||
|
||||
$(rro_android_manifest_file): PRIVATE_PACKAGE_INFO := $(enforce_rro_source_manifest_package_info)
|
||||
$(rro_android_manifest_file): PRIVATE_USE_PACKAGE_NAME := $(use_package_name_arg)
|
||||
$(rro_android_manifest_file): PRIVATE_PARTITION := $(enforce_rro_partition)
|
||||
# There should be no duplicate overrides, but just in case, set the priority of
|
||||
# /product overlays to be higher than /vendor, to at least get deterministic results.
|
||||
$(rro_android_manifest_file): PRIVATE_PRIORITY := $(if $(filter product,$(enforce_rro_partition)),1,0)
|
||||
$(rro_android_manifest_file): build/make/tools/generate-enforce-rro-android-manifest.py
|
||||
$(hide) build/make/tools/generate-enforce-rro-android-manifest.py \
|
||||
--package-info $(PRIVATE_PACKAGE_INFO) \
|
||||
$(use_package_name_arg) \
|
||||
$(PRIVATE_USE_PACKAGE_NAME) \
|
||||
--partition $(PRIVATE_PARTITION) \
|
||||
--priority $(PRIVATE_PRIORITY) \
|
||||
-o $@
|
||||
|
||||
LOCAL_PATH:= $(intermediates)
|
||||
|
@ -31,7 +38,14 @@ LOCAL_CERTIFICATE := platform
|
|||
|
||||
LOCAL_AAPT_FLAGS += --auto-add-overlay
|
||||
LOCAL_RESOURCE_DIR := $(enforce_rro_source_overlays)
|
||||
LOCAL_PRODUCT_MODULE := true
|
||||
|
||||
ifeq (product,$(enforce_rro_partition))
|
||||
LOCAL_PRODUCT_MODULE := true
|
||||
else ifeq (vendor,$(enforce_rro_partition))
|
||||
LOCAL_VENDOR_MODULE := true
|
||||
else
|
||||
$(error Unsupported partition. Want: [vendor/product] Got: [$(enforce_rro_partition)])
|
||||
endif
|
||||
|
||||
ifneq (,$(LOCAL_RES_LIBRARIES))
|
||||
# Technically we are linking against the app (if only to grab its resources),
|
||||
|
|
|
@ -25,7 +25,7 @@ ifdef BOARD_SYSTEMSDK_VERSIONS
|
|||
ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
|
||||
ifndef LOCAL_SDK_VERSION
|
||||
ifeq ($(_is_vendor_app),true)
|
||||
ifeq (,$(filter %__auto_generated_rro,$(LOCAL_MODULE)))
|
||||
ifeq (,$(filter %__auto_generated_rro_vendor,$(LOCAL_MODULE)))
|
||||
# Runtime resource overlays are exempted from building against System SDK.
|
||||
# TODO(b/35859726): remove this exception
|
||||
LOCAL_SDK_VERSION := system_current
|
||||
|
|
|
@ -1206,7 +1206,8 @@ ifdef FULL_BUILD
|
|||
# Fakes don't get installed, host files are irrelevant, and NDK stubs aren't installed to device.
|
||||
static_whitelist_patterns := $(TARGET_OUT_FAKE)/% $(HOST_OUT)/% $(SOONG_OUT_DIR)/ndk/%
|
||||
# RROs become REQUIRED by the source module, but are always placed on the vendor partition.
|
||||
static_whitelist_patterns += %__auto_generated_rro.apk
|
||||
static_whitelist_patterns += %__auto_generated_rro_product.apk
|
||||
static_whitelist_patterns += %__auto_generated_rro_vendor.apk
|
||||
# Auto-included targets are not considered
|
||||
static_whitelist_patterns += $(call module-installed-files,$(call auto-included-modules))
|
||||
# $(PRODUCT_OUT)/apex is where shared libraries in APEXes get installed.
|
||||
|
|
|
@ -132,21 +132,26 @@ else ifneq (,$(filter $(LOCAL_PACKAGE_NAME), $(PRODUCT_ENFORCE_RRO_TARGETS)))
|
|||
enforce_rro_enabled := true
|
||||
endif
|
||||
|
||||
all_package_resource_overlays := $(strip \
|
||||
product_package_overlays := $(strip \
|
||||
$(wildcard $(foreach dir, $(PRODUCT_PACKAGE_OVERLAYS), \
|
||||
$(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))) \
|
||||
$(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))))
|
||||
device_package_overlays := $(strip \
|
||||
$(wildcard $(foreach dir, $(DEVICE_PACKAGE_OVERLAYS), \
|
||||
$(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))))
|
||||
|
||||
static_resource_overlays :=
|
||||
runtime_resource_overlays :=
|
||||
runtime_resource_overlays_product :=
|
||||
runtime_resource_overlays_vendor :=
|
||||
ifdef enforce_rro_enabled
|
||||
ifneq ($(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS),)
|
||||
static_resource_overlays += $(filter $(addsuffix %,$(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS)),$(all_package_resource_overlays))
|
||||
# The PRODUCT_ exclusion variable applies to both inclusion variables..
|
||||
static_resource_overlays += $(filter $(addsuffix %,$(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS)),$(product_package_overlays))
|
||||
static_resource_overlays += $(filter $(addsuffix %,$(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS)),$(device_package_overlays))
|
||||
endif
|
||||
runtime_resource_overlays := $(filter-out $(static_resource_overlays),$(all_package_resource_overlays))
|
||||
runtime_resource_overlays_product := $(filter-out $(static_resource_overlays),$(product_package_overlays))
|
||||
runtime_resource_overlays_vendor := $(filter-out $(static_resource_overlays),$(device_package_overlays))
|
||||
else
|
||||
static_resource_overlays := $(all_package_resource_overlays)
|
||||
static_resource_overlays := $(product_package_overlays) $(device_package_overlays)
|
||||
endif
|
||||
|
||||
# Add the static overlays. Auto-RRO is created later, as it depends on
|
||||
|
@ -790,7 +795,7 @@ endif # skip_definition
|
|||
# Reset internal variables.
|
||||
all_res_assets :=
|
||||
|
||||
ifdef runtime_resource_overlays
|
||||
ifneq (,$(runtime_resource_overlays_product)$(runtime_resource_overlays_vendor))
|
||||
ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
|
||||
enforce_rro_use_res_lib := true
|
||||
else
|
||||
|
@ -805,11 +810,24 @@ ifdef runtime_resource_overlays
|
|||
enforce_rro_manifest_package_info := $(full_android_manifest)
|
||||
endif
|
||||
|
||||
$(call append_enforce_rro_sources, \
|
||||
$(my_register_name), \
|
||||
$(enforce_rro_is_manifest_package_name), \
|
||||
$(enforce_rro_manifest_package_info), \
|
||||
$(enforce_rro_use_res_lib), \
|
||||
$(runtime_resource_overlays) \
|
||||
)
|
||||
ifdef runtime_resource_overlays_product
|
||||
$(call append_enforce_rro_sources, \
|
||||
$(my_register_name), \
|
||||
$(enforce_rro_is_manifest_package_name), \
|
||||
$(enforce_rro_manifest_package_info), \
|
||||
$(enforce_rro_use_res_lib), \
|
||||
$(runtime_resource_overlays_product), \
|
||||
product \
|
||||
)
|
||||
endif
|
||||
ifdef runtime_resource_overlays_vendor
|
||||
$(call append_enforce_rro_sources, \
|
||||
$(my_register_name), \
|
||||
$(enforce_rro_is_manifest_package_name), \
|
||||
$(enforce_rro_manifest_package_info), \
|
||||
$(enforce_rro_use_res_lib), \
|
||||
$(runtime_resource_overlays_vendor), \
|
||||
vendor \
|
||||
)
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -159,13 +159,26 @@ my_common := COMMON
|
|||
include $(BUILD_SYSTEM)/link_type.mk
|
||||
endif # !LOCAL_IS_HOST_MODULE
|
||||
|
||||
ifneq (,$(LOCAL_SOONG_DEVICE_RRO_DIRS)$(LOCAL_SOONG_PRODUCT_RRO_DIRS))
|
||||
ifdef LOCAL_SOONG_DEVICE_RRO_DIRS
|
||||
$(call append_enforce_rro_sources, \
|
||||
$(my_register_name), \
|
||||
false, \
|
||||
$(LOCAL_FULL_MANIFEST_FILE), \
|
||||
$(if $(LOCAL_EXPORT_PACKAGE_RESOURCES),true,false), \
|
||||
$(LOCAL_SOONG_DEVICE_RRO_DIRS) $(LOCAL_SOONG_PRODUCT_RRO_DIRS))
|
||||
$(LOCAL_SOONG_DEVICE_RRO_DIRS), \
|
||||
vendor \
|
||||
)
|
||||
endif
|
||||
|
||||
ifdef LOCAL_SOONG_PRODUCT_RRO_DIRS
|
||||
$(call append_enforce_rro_sources, \
|
||||
$(my_register_name), \
|
||||
false, \
|
||||
$(LOCAL_FULL_MANIFEST_FILE), \
|
||||
$(if $(LOCAL_EXPORT_PACKAGE_RESOURCES),true,false), \
|
||||
$(LOCAL_SOONG_PRODUCT_RRO_DIRS), \
|
||||
product \
|
||||
)
|
||||
endif
|
||||
|
||||
SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE)
|
||||
|
|
|
@ -23,10 +23,10 @@ import os
|
|||
import sys
|
||||
|
||||
ANDROID_MANIFEST_TEMPLATE="""<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="%s.auto_generated_rro__"
|
||||
package="%s.auto_generated_rro_%s__"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<overlay android:targetPackage="%s" android:priority="0" android:isStatic="true"/>
|
||||
<overlay android:targetPackage="%s" android:priority="%s" android:isStatic="true"/>
|
||||
</manifest>
|
||||
"""
|
||||
|
||||
|
@ -39,6 +39,12 @@ def get_args():
|
|||
parser.add_argument(
|
||||
'-p', '--package-info', required=True,
|
||||
help='Manifest package name or manifest file path of source module.')
|
||||
parser.add_argument(
|
||||
'--partition', required=True,
|
||||
help='The partition this RRO package is installed on.')
|
||||
parser.add_argument(
|
||||
'--priority', required=True,
|
||||
help='The priority for the <overlay>.')
|
||||
parser.add_argument(
|
||||
'-o', '--output', required=True,
|
||||
help='Output manifest file path.')
|
||||
|
@ -48,6 +54,8 @@ def get_args():
|
|||
def main(argv):
|
||||
args = get_args()
|
||||
|
||||
partition = args.partition
|
||||
priority = args.priority
|
||||
if args.use_package_name:
|
||||
package_name = args.package_info
|
||||
else:
|
||||
|
@ -58,7 +66,7 @@ def main(argv):
|
|||
package_name = dom.documentElement.getAttribute('package')
|
||||
|
||||
with open(args.output, 'w+') as f:
|
||||
f.write(ANDROID_MANIFEST_TEMPLATE % (package_name, package_name))
|
||||
f.write(ANDROID_MANIFEST_TEMPLATE % (package_name, partition, package_name, priority))
|
||||
f.close()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue