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
32ifeq ($(enforce_rro_use_res_lib),true)
33  LOCAL_RES_LIBRARIES := $(enforce_rro_source_module)
34endif
35
36LOCAL_FULL_MANIFEST_FILE := $(rro_android_manifest_file)
37
38LOCAL_AAPT_FLAGS += --auto-add-overlay
39LOCAL_RESOURCE_DIR := $(enforce_rro_source_overlays)
40
41ifeq (product,$(enforce_rro_partition))
42  LOCAL_PRODUCT_MODULE := true
43else ifeq (vendor,$(enforce_rro_partition))
44  LOCAL_VENDOR_MODULE := true
45else
46  $(error Unsupported partition. Want: [vendor/product] Got: [$(enforce_rro_partition)])
47endif
48
49ifneq (,$(LOCAL_RES_LIBRARIES))
50  # Technically we are linking against the app (if only to grab its resources),
51  # and because it's potentially not building against the SDK, we can't either.
52  LOCAL_PRIVATE_PLATFORM_APIS := true
53else ifeq (framework-res,$(enforce_rro_source_module))
54  LOCAL_PRIVATE_PLATFORM_APIS := true
55else
56  LOCAL_SDK_VERSION := current
57endif
58
59include $(BUILD_RRO_PACKAGE)
60