1include $(CLEAR_VARS)
2
3enforce_rro_module := $(enforce_rro_source_module)__auto_generated_rro_$(enforce_rro_partition)
4LOCAL_PACKAGE_NAME := $(enforce_rro_module)
5
6intermediates := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME),,COMMON)
7rro_android_manifest_file := $(intermediates)/AndroidManifest.xml
8
9ifeq (true,$(enforce_rro_source_is_manifest_package_name))
10  use_package_name_arg := --use-package-name
11else
12  use_package_name_arg :=
13$(rro_android_manifest_file): $(enforce_rro_source_manifest_package_info)
14endif
15
16$(rro_android_manifest_file): PRIVATE_PACKAGE_INFO := $(enforce_rro_source_manifest_package_info)
17$(rro_android_manifest_file): PRIVATE_USE_PACKAGE_NAME := $(use_package_name_arg)
18$(rro_android_manifest_file): PRIVATE_PARTITION := $(enforce_rro_partition)
19# There should be no duplicate overrides, but just in case, set the priority of
20# /product overlays to be higher than /vendor, to at least get deterministic results.
21$(rro_android_manifest_file): PRIVATE_PRIORITY := $(if $(filter product,$(enforce_rro_partition)),1,0)
22$(rro_android_manifest_file): build/make/tools/generate-enforce-rro-android-manifest.py
23	$(hide) build/make/tools/generate-enforce-rro-android-manifest.py \
24	    --package-info $(PRIVATE_PACKAGE_INFO) \
25	    $(PRIVATE_USE_PACKAGE_NAME) \
26	    --partition $(PRIVATE_PARTITION) \
27	    --priority $(PRIVATE_PRIORITY) \
28	    -o $@
29
30LOCAL_PATH:= $(intermediates)
31
32# TODO(b/187404676): remove this condition when the prebuilt for packges exporting resource exists.
33ifeq (,$(TARGET_BUILD_UNBUNDLED))
34ifeq ($(enforce_rro_use_res_lib),true)
35  LOCAL_RES_LIBRARIES := $(enforce_rro_source_module)
36endif
37endif
38
39LOCAL_FULL_MANIFEST_FILE := $(rro_android_manifest_file)
40
41LOCAL_AAPT_FLAGS += --auto-add-overlay
42LOCAL_RESOURCE_DIR := $(enforce_rro_source_overlays)
43
44ifeq (product,$(enforce_rro_partition))
45  LOCAL_PRODUCT_MODULE := true
46else ifeq (vendor,$(enforce_rro_partition))
47  LOCAL_VENDOR_MODULE := true
48else
49  $(error Unsupported partition. Want: [vendor/product] Got: [$(enforce_rro_partition)])
50endif
51ifneq (,$(TARGET_BUILD_UNBUNDLED))
52  LOCAL_SDK_VERSION := current
53else ifneq (,$(LOCAL_RES_LIBRARIES))
54  # Technically we are linking against the app (if only to grab its resources),
55  # and because it's potentially not building against the SDK, we can't either.
56  LOCAL_PRIVATE_PLATFORM_APIS := true
57else ifeq (framework-res,$(enforce_rro_source_module))
58  LOCAL_PRIVATE_PLATFORM_APIS := true
59else
60  LOCAL_SDK_VERSION := current
61endif
62
63include $(BUILD_RRO_PACKAGE)
64