blob: 7e2760066a75a6235d03b8b678f97982ef0d763b [file] [log] [blame]
Colin Cross8e404122014-02-06 14:45:37 -08001#
2# Copyright (C) 2008 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17###########################################################
18## Standard rules for building an application package.
19##
20## Additional inputs from base_rules.make:
21## LOCAL_PACKAGE_NAME: The name of the package; the directory
22## will be called this.
23##
24## MODULE, MODULE_PATH, and MODULE_SUFFIX will
25## be set for you.
26###########################################################
27
28# If this makefile is being read from within an inheritance,
29# use the new values.
30skip_definition:=
31ifdef LOCAL_PACKAGE_OVERRIDES
32 package_overridden := $(call set-inherited-package-variables)
33 ifeq ($(strip $(package_overridden)),)
34 skip_definition := true
35 endif
36endif
37
38ifndef skip_definition
39
40LOCAL_PACKAGE_NAME := $(strip $(LOCAL_PACKAGE_NAME))
41ifeq ($(LOCAL_PACKAGE_NAME),)
42$(error $(LOCAL_PATH): Package modules must define LOCAL_PACKAGE_NAME)
43endif
44
45ifneq ($(strip $(LOCAL_MODULE_SUFFIX)),)
46$(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE_SUFFIX)
47endif
48LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
49
50ifneq ($(strip $(LOCAL_MODULE)),)
51$(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE)
52endif
53LOCAL_MODULE := $(LOCAL_PACKAGE_NAME)
54
Colin Cross8e404122014-02-06 14:45:37 -080055ifneq ($(strip $(LOCAL_MODULE_CLASS)),)
56$(error $(LOCAL_PATH): Package modules may not set LOCAL_MODULE_CLASS)
57endif
58LOCAL_MODULE_CLASS := APPS
59
Ying Wangdd71c852015-12-04 13:59:18 -080060intermediates := $(call local-intermediates-dir)
61intermediates.COMMON := $(call local-intermediates-dir,COMMON)
62
Yohann Rousseld2a76c12015-02-05 16:10:58 +010063#################################
64include $(BUILD_SYSTEM)/configure_local_jack.mk
65#################################
Yohann Roussel37822c42015-01-09 10:36:40 +010066
Colin Cross8e404122014-02-06 14:45:37 -080067# Package LOCAL_MODULE_TAGS default to optional
68LOCAL_MODULE_TAGS := $(strip $(LOCAL_MODULE_TAGS))
69ifeq ($(LOCAL_MODULE_TAGS),)
70LOCAL_MODULE_TAGS := optional
71endif
72
73ifeq ($(filter tests, $(LOCAL_MODULE_TAGS)),)
74# Force localization check if it's not tagged as tests.
75LOCAL_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) -z
76endif
77
Ying Wang4cb04992014-07-29 10:34:30 -070078need_compile_asset :=
Colin Cross8e404122014-02-06 14:45:37 -080079ifeq (,$(LOCAL_ASSET_DIR))
80LOCAL_ASSET_DIR := $(LOCAL_PATH)/assets
Ying Wang4cb04992014-07-29 10:34:30 -070081else
82need_compile_asset := true
Colin Cross8e404122014-02-06 14:45:37 -080083endif
84
Ying Wang61291922014-06-25 13:23:58 -070085# LOCAL_RESOURCE_DIR may point to resource generated during the build
86need_compile_res :=
Colin Cross8e404122014-02-06 14:45:37 -080087ifeq (,$(LOCAL_RESOURCE_DIR))
88 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
Ying Wang61291922014-06-25 13:23:58 -070089else
90 need_compile_res := true
Dan Willemsenfa7ecfb2017-05-02 23:55:44 -070091 LOCAL_RESOURCE_DIR := $(foreach d,$(LOCAL_RESOURCE_DIR),$(call clean-path,$(d)))
Colin Cross8e404122014-02-06 14:45:37 -080092endif
93
94package_resource_overlays := $(strip \
95 $(wildcard $(foreach dir, $(PRODUCT_PACKAGE_OVERLAYS), \
96 $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))) \
97 $(wildcard $(foreach dir, $(DEVICE_PACKAGE_OVERLAYS), \
98 $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))))
99
Jaekyun Seok30706102017-02-02 00:44:58 +0900100enforce_rro_enabled :=
Jaekyun Seok2a209992017-03-30 11:25:02 +0900101ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),)
102 ifneq ($(package_resource_overlays),)
103 ifeq ($(PRODUCT_ENFORCE_RRO_TARGETS),*)
104 enforce_rro_enabled := true
105 else ifneq (,$(filter $(LOCAL_PACKAGE_NAME), $(PRODUCT_ENFORCE_RRO_TARGETS)))
Jaekyun Seok30706102017-02-02 00:44:58 +0900106 enforce_rro_enabled := true
107 endif
108 endif
109
110 ifdef enforce_rro_enabled
111 ifeq (,$(LOCAL_MODULE_PATH))
112 ifeq (true,$(LOCAL_PROPRIETARY_MODULE))
113 enforce_rro_enabled :=
114 else ifeq (true,$(LOCAL_OEM_MODULE))
115 enforce_rro_enabled :=
116 else ifeq (true,$(LOCAL_ODM_MODULE))
117 enforce_rro_enabled :=
118 endif
119 else ifeq ($(filter $(TARGET_OUT)/%,$(LOCAL_MODULE_PATH)),)
120 enforce_rro_enabled :=
121 endif
122 endif
123endif
124
Jaekyun Seokccee95e2017-09-01 17:23:25 +0900125ifdef enforce_rro_enabled
126 ifneq ($(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS),)
127 static_only_resource_overlays := $(filter $(addsuffix %,$(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS)),$(package_resource_overlays))
128 ifneq ($(static_only_resource_overlays),)
129 package_resource_overlays := $(filter-out $(static_only_resource_overlays),$(package_resource_overlays))
130 LOCAL_RESOURCE_DIR := $(static_only_resource_overlays) $(LOCAL_RESOURCE_DIR)
131 ifeq ($(package_resource_overlays),)
132 enforce_rro_enabled :=
133 endif
134 endif
135 endif
136else
Colin Cross8e404122014-02-06 14:45:37 -0800137LOCAL_RESOURCE_DIR := $(package_resource_overlays) $(LOCAL_RESOURCE_DIR)
Jaekyun Seok30706102017-02-02 00:44:58 +0900138endif
Colin Cross8e404122014-02-06 14:45:37 -0800139
Colin Cross2c321442014-02-12 13:06:30 -0800140all_assets := $(strip \
141 $(foreach dir, $(LOCAL_ASSET_DIR), \
142 $(addprefix $(dir)/, \
143 $(patsubst assets/%,%, \
144 $(call find-subdir-assets, $(dir)) \
145 ) \
146 ) \
147 ))
Colin Cross8e404122014-02-06 14:45:37 -0800148
Ying Wang4cb04992014-07-29 10:34:30 -0700149ifneq ($(all_assets),)
150need_compile_asset := true
151endif
152
Adam Lesinskie758f932016-02-26 11:13:43 -0800153my_res_package :=
Ying Wange295c3d2016-02-24 14:11:55 -0800154ifdef LOCAL_USE_AAPT2
Ying Wangdd71c852015-12-04 13:59:18 -0800155# In aapt2 the last takes precedence.
156my_resource_dirs := $(call reverse-list,$(LOCAL_RESOURCE_DIR))
Adam Lesinskie758f932016-02-26 11:13:43 -0800157my_res_dir :=
158my_overlay_res_dirs :=
159
160ifneq ($(LOCAL_STATIC_ANDROID_LIBRARIES),)
161# If we are using static android libraries, every source file becomes an overlay.
162# This is to emulate old AAPT behavior which simulated library support.
163my_res_dir :=
164my_overlay_res_dirs := $(my_resource_dirs)
165else
166# Without static libraries, the first directory is our directory, which can then be
167# overlaid by the rest. (First directory in my_resource_dirs is last directory in
168# $(LOCAL_RESOURCE_DIR) due to it being reversed.
169my_res_dir := $(firstword $(my_resource_dirs))
170my_overlay_res_dirs := $(wordlist 2,999,$(my_resource_dirs))
171endif
172
Ying Wangdd71c852015-12-04 13:59:18 -0800173my_overlay_resources := $(strip \
Adam Lesinskie758f932016-02-26 11:13:43 -0800174 $(foreach d,$(my_overlay_res_dirs),\
Ying Wangdd71c852015-12-04 13:59:18 -0800175 $(addprefix $(d)/, \
176 $(call find-subdir-assets,$(d)))))
177
Colin Crossfe109632016-11-29 11:12:56 -0800178my_res_resources := $(if $(my_res_dir),$(strip \
Ying Wangdd71c852015-12-04 13:59:18 -0800179 $(addprefix $(my_res_dir)/, \
Colin Crossfe109632016-11-29 11:12:56 -0800180 $(call find-subdir-assets,$(my_res_dir)))))
Ying Wangdd71c852015-12-04 13:59:18 -0800181
182all_resources := $(strip $(my_res_resources) $(my_overlay_resources))
183
184# The linked resource package.
185my_res_package := $(intermediates)/package-res.apk
186LOCAL_INTERMEDIATE_TARGETS += $(my_res_package)
187
Ying Wange5853972016-03-01 12:06:47 -0800188# Always run aapt2, because we need to at least compile the AndroidManifest.xml.
Ying Wangdd71c852015-12-04 13:59:18 -0800189need_compile_res := true
190
Ying Wange295c3d2016-02-24 14:11:55 -0800191else # LOCAL_USE_AAPT2
Colin Cross8e404122014-02-06 14:45:37 -0800192all_resources := $(strip \
193 $(foreach dir, $(LOCAL_RESOURCE_DIR), \
194 $(addprefix $(dir)/, \
195 $(patsubst res/%,%, \
196 $(call find-subdir-assets,$(dir)) \
197 ) \
198 ) \
199 ))
200
Adam Lesinski4c452052016-08-12 12:57:17 -0700201ifdef LOCAL_PACKAGE_SPLITS
202LOCAL_AAPT_FLAGS += $(addprefix --split ,$(LOCAL_PACKAGE_SPLITS))
203endif
204
Ying Wange295c3d2016-02-24 14:11:55 -0800205endif # LOCAL_USE_AAPT2
Ying Wangdd71c852015-12-04 13:59:18 -0800206
Ying Wang61291922014-06-25 13:23:58 -0700207ifneq ($(all_resources),)
208 need_compile_res := true
209endif
210
Colin Cross8e404122014-02-06 14:45:37 -0800211all_res_assets := $(strip $(all_assets) $(all_resources))
212
Colin Cross8e404122014-02-06 14:45:37 -0800213# If no assets or resources were found, clear the directory variables so
214# we don't try to build them.
Ying Wang4cb04992014-07-29 10:34:30 -0700215ifneq (true,$(need_compile_asset))
Colin Cross8e404122014-02-06 14:45:37 -0800216LOCAL_ASSET_DIR:=
217endif
Ying Wang61291922014-06-25 13:23:58 -0700218ifneq (true,$(need_compile_res))
Colin Cross8e404122014-02-06 14:45:37 -0800219LOCAL_RESOURCE_DIR:=
220R_file_stamp :=
221else
222# Make sure that R_file_stamp inherits the proper PRIVATE vars.
223# If R.stamp moves, be sure to update the framework makefile,
224# which has intimate knowledge of its location.
Ying Wang98ae7982014-12-18 14:53:52 -0800225R_file_stamp := $(intermediates.COMMON)/src/R.stamp
Colin Cross8e404122014-02-06 14:45:37 -0800226LOCAL_INTERMEDIATE_TARGETS += $(R_file_stamp)
227endif
228
229LOCAL_BUILT_MODULE_STEM := package.apk
Ying Wangaf9757e2014-07-17 21:24:42 -0700230LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE).apk
Colin Cross8e404122014-02-06 14:45:37 -0800231
232LOCAL_PROGUARD_ENABLED:=$(strip $(LOCAL_PROGUARD_ENABLED))
233ifndef LOCAL_PROGUARD_ENABLED
234ifneq ($(DISABLE_PROGUARD),true)
235 LOCAL_PROGUARD_ENABLED :=full
236endif
237endif
238ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
239 # the package explicitly request to disable proguard.
240 LOCAL_PROGUARD_ENABLED :=
241endif
242proguard_options_file :=
243ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
Ying Wang61291922014-06-25 13:23:58 -0700244ifeq ($(need_compile_res),true)
Ying Wang98ae7982014-12-18 14:53:52 -0800245 proguard_options_file := $(intermediates.COMMON)/proguard_options
Ying Wang61291922014-06-25 13:23:58 -0700246endif # need_compile_res
Colin Cross8e404122014-02-06 14:45:37 -0800247endif # !custom
248LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
249
Colin Cross79e2f732016-12-21 14:29:13 -0800250ifdef LOCAL_JACK_ENABLED
Yohann Rousselb4c49cb2014-09-08 14:45:14 +0200251ifndef LOCAL_JACK_PROGUARD_FLAGS
252 LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS)
253endif
254LOCAL_JACK_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_JACK_PROGUARD_FLAGS)
Colin Cross79e2f732016-12-21 14:29:13 -0800255endif # LOCAL_JACK_ENABLED
Yohann Rousselb4c49cb2014-09-08 14:45:14 +0200256
Colin Cross8e404122014-02-06 14:45:37 -0800257ifeq (true,$(EMMA_INSTRUMENT))
258ifndef LOCAL_EMMA_INSTRUMENT
Jeff Gastonaaae43c2017-04-11 16:36:46 -0700259# No jacoco for test apks.
Ying Wang324ffb22015-11-06 11:22:28 -0800260ifeq (,$(LOCAL_INSTRUMENTATION_FOR))
Colin Cross8e404122014-02-06 14:45:37 -0800261LOCAL_EMMA_INSTRUMENT := true
262endif # No test apk
263endif # LOCAL_EMMA_INSTRUMENT is not set
264else
265LOCAL_EMMA_INSTRUMENT := false
266endif # EMMA_INSTRUMENT is true
267
268ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
269ifeq (true,$(EMMA_INSTRUMENT_STATIC))
Colin Cross79e2f732016-12-21 14:29:13 -0800270ifneq ($(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),)
271# Only add jacocoagent if the package contains some java code
Sebastien Hertzdfce8ad2015-11-19 17:53:00 +0100272LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent
Colin Cross79e2f732016-12-21 14:29:13 -0800273endif # Contains java code
274else
Colin Cross8e404122014-02-06 14:45:37 -0800275ifdef LOCAL_SDK_VERSION
276ifdef TARGET_BUILD_APPS
Sebastien Hertz2319e562016-03-31 16:48:26 +0200277# In unbundled build, merge the coverage library into the apk.
Colin Cross79e2f732016-12-21 14:29:13 -0800278ifneq ($(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),)
279# Only add jacocoagent if the package contains some java code
Sebastien Hertzdfce8ad2015-11-19 17:53:00 +0100280LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent
Sebastien Hertz2319e562016-03-31 16:48:26 +0200281# Exclude jacoco classes from proguard
282LOCAL_PROGUARD_FLAGS += -include $(BUILD_SYSTEM)/proguard.jacoco.flags
283LOCAL_JACK_PROGUARD_FLAGS += -include $(BUILD_SYSTEM)/proguard.jacoco.flags
Colin Cross79e2f732016-12-21 14:29:13 -0800284endif # Contains java code
Colin Cross79e2f732016-12-21 14:29:13 -0800285else # ! TARGET_BUILD_APPS
286ifdef LOCAL_JACK_ENABLED
Sebastien Hertz2319e562016-03-31 16:48:26 +0200287# If build against the SDK in full build, core.jar is not used
288# so coverage classes are not present.
289# Jack needs jacoco on the classpath but we do not want it to be in
290# the final apk. While it is a static library, we add it to the
291# LOCAL_JAVA_LIBRARIES which are only present on the classpath.
292# Note: we have nothing to do for proguard since jacoco will be
293# on the classpath only, thus not modified during the compilation.
294LOCAL_JAVA_LIBRARIES += jacocoagent
Colin Cross79e2f732016-12-21 14:29:13 -0800295endif # ! LOCAL_JACK_ENABLED
296endif # ! TARGET_BUILD_APPS
Colin Cross8e404122014-02-06 14:45:37 -0800297endif # LOCAL_SDK_VERSION
Colin Cross79e2f732016-12-21 14:29:13 -0800298endif # EMMA_INSTRUMENT_STATIC
Colin Cross8e404122014-02-06 14:45:37 -0800299endif # LOCAL_EMMA_INSTRUMENT
300
301rs_compatibility_jni_libs :=
302
Ying Wanged0361f2015-04-19 09:55:39 -0700303ifeq ($(LOCAL_DATA_BINDING),true)
304data_binding_intermediates := $(intermediates.COMMON)/data-binding
305
306LOCAL_JAVACFLAGS += -processorpath $(DATA_BINDING_COMPILER) -s $(data_binding_intermediates)/anno-src
307LOCAL_JACK_FLAGS += --processorpath $(DATA_BINDING_COMPILER)
308
309LOCAL_STATIC_JAVA_LIBRARIES += databinding-baselibrary
310LOCAL_STATIC_JAVA_AAR_LIBRARIES += databinding-library databinding-adapters
311
312data_binding_res_in := $(LOCAL_RESOURCE_DIR)
313data_binding_res_out := $(data_binding_intermediates)/res
314
315# Replace with the processed merged res dir.
316LOCAL_RESOURCE_DIR := $(data_binding_res_out)
317
318LOCAL_AAPT_FLAGS += --auto-add-overlay --extra-packages com.android.databinding.library
319endif # LOCAL_DATA_BINDING
320
Ying Wange9dd9f22014-10-29 15:48:32 -0700321include $(BUILD_SYSTEM)/android_manifest.mk
322
Colin Cross8e404122014-02-06 14:45:37 -0800323#################################
324include $(BUILD_SYSTEM)/java.mk
325#################################
326
327LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION))
328ifeq ($(LOCAL_SDK_RES_VERSION),)
329 LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION)
330endif
331
Colin Cross8e404122014-02-06 14:45:37 -0800332$(LOCAL_INTERMEDIATE_TARGETS): \
333 PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
Colin Cross8e404122014-02-06 14:45:37 -0800334
Ying Wanged0361f2015-04-19 09:55:39 -0700335ifeq ($(LOCAL_DATA_BINDING),true)
336data_binding_stamp := $(data_binding_intermediates)/data-binding.stamp
337$(data_binding_stamp): PRIVATE_INTERMEDIATES := $(data_binding_intermediates)
338$(data_binding_stamp): PRIVATE_MANIFEST := $(full_android_manifest)
339# Generate code into $(LOCAL_INTERMEDIATE_SOURCE_DIR) so that the generated .java files
340# will be automatically picked up by function compile-java.
341$(data_binding_stamp): PRIVATE_SRC_OUT := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/data-binding
342$(data_binding_stamp): PRIVATE_XML_OUT := $(data_binding_intermediates)/xml
343$(data_binding_stamp): PRIVATE_RES_OUT := $(data_binding_res_out)
344$(data_binding_stamp): PRIVATE_RES_IN := $(data_binding_res_in)
345$(data_binding_stamp): PRIVATE_ANNO_SRC_DIR := $(data_binding_intermediates)/anno-src
346
347$(data_binding_stamp) : $(all_res_assets) $(full_android_manifest) \
348 $(DATA_BINDING_COMPILER)
349 @echo "Data-binding process: $@"
350 @rm -rf $(PRIVATE_INTERMEDIATES) $(PRIVATE_SRC_OUT) && \
351 mkdir -p $(PRIVATE_INTERMEDIATES) $(PRIVATE_SRC_OUT) \
352 $(PRIVATE_XML_OUT) $(PRIVATE_RES_OUT) $(PRIVATE_ANNO_SRC_DIR)
Colin Cross0851df82017-06-30 13:55:38 -0700353 $(hide) $(JAVA) -classpath $(DATA_BINDING_COMPILER) android.databinding.tool.MakeCopy \
Ying Wanged0361f2015-04-19 09:55:39 -0700354 $(PRIVATE_MANIFEST) $(PRIVATE_SRC_OUT) $(PRIVATE_XML_OUT) $(PRIVATE_RES_OUT) $(PRIVATE_RES_IN)
355 $(hide) touch $@
356
357# Make sure the data-binding process happens before javac and generation of R.java.
Colin Crossdfc45ec2017-05-26 15:22:02 -0700358$(R_file_stamp): $(data_binding_stamp)
359$(java_source_list_file): $(data_binding_stamp)
360$(full_classes_compiled_jar): $(data_binding_stamp)
Ying Wanged0361f2015-04-19 09:55:39 -0700361# The dependency path when jack is enabled
362$(built_dex_intermediate) : $(data_binding_stamp)
363endif # LOCAL_DATA_BINDING
364
Ying Wang61291922014-06-25 13:23:58 -0700365ifeq ($(need_compile_res),true)
Adam Lesinski4c452052016-08-12 12:57:17 -0700366
367###############################
368## APK splits
369built_apk_splits :=
370installed_apk_splits :=
371my_apk_split_configs :=
372
373ifdef LOCAL_PACKAGE_SPLITS
374my_apk_split_configs := $(LOCAL_PACKAGE_SPLITS)
375my_split_suffixes := $(subst $(comma),_,$(my_apk_split_configs))
Dan Willemsenf72308a2017-05-15 23:38:04 -0700376built_apk_splits := $(foreach s,$(my_split_suffixes),$(intermediates)/package_$(s).apk)
Adam Lesinski4c452052016-08-12 12:57:17 -0700377installed_apk_splits := $(foreach s,$(my_split_suffixes),$(my_module_path)/$(LOCAL_MODULE)_$(s).apk)
378endif
379
Ying Wange295c3d2016-02-24 14:11:55 -0800380ifdef LOCAL_USE_AAPT2
Ying Wangdd71c852015-12-04 13:59:18 -0800381my_compiled_res_base_dir := $(intermediates)/flat-res
Yang Nie2c09012017-04-26 16:15:42 -0700382renderscript_target_api :=
383ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
384renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
385else
386ifneq (,$(LOCAL_SDK_VERSION))
387# Set target-api for LOCAL_SDK_VERSIONs other than current.
388ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
389renderscript_target_api := $(LOCAL_SDK_VERSION)
390endif
391endif # LOCAL_SDK_VERSION is set
392endif # LOCAL_RENDERSCRIPT_TARGET_API is set
393ifneq (,$(renderscript_target_api))
394ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
Ying Wange295c3d2016-02-24 14:11:55 -0800395my_generated_res_dirs := $(rs_generated_res_dir)
396my_generated_res_dirs_deps := $(RenderScript_file_stamp)
Yang Nie2c09012017-04-26 16:15:42 -0700397endif # renderscript_target_api < 21
398endif # renderscript_target_api is set
Adam Lesinski981de832017-03-16 04:53:05 +0000399my_asset_dirs := $(LOCAL_ASSET_DIR)
400my_full_asset_paths := $(all_assets)
Adam Lesinskie758f932016-02-26 11:13:43 -0800401# Add AAPT2 link specific flags.
402$(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --no-static-lib-packages
Ying Wangdd71c852015-12-04 13:59:18 -0800403include $(BUILD_SYSTEM)/aapt2.mk
Ying Wange295c3d2016-02-24 14:11:55 -0800404else # LOCAL_USE_AAPT2
Colin Cross8e404122014-02-06 14:45:37 -0800405
406# Since we don't know where the real R.java file is going to end up,
407# we need to use another file to stand in its place. We'll just
408# copy the generated file to src/R.stamp, which means it will
409# have the same contents and timestamp as the actual file.
410#
411# At the same time, this will copy the R.java file to a central
412# 'R' directory to make it easier to add the files to an IDE.
413#
Colin Cross8e404122014-02-06 14:45:37 -0800414
415$(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := \
416 $(intermediates.COMMON)/public_resources.xml
417$(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
Dan Willemsenf439c332017-10-02 14:22:02 -0700418$(R_file_stamp): PRIVATE_RESOURCE_LIST := $(all_res_assets)
Colin Cross8e404122014-02-06 14:45:37 -0800419$(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT) | $(ACP)
420 @echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
Martin Arenlindfb6985e2015-09-15 15:52:56 +0200421 @rm -rf $@ && mkdir -p $(dir $@)
Colin Cross8e404122014-02-06 14:45:37 -0800422 $(create-resource-java-files)
Dan Willemsenba9b0fb2017-09-29 19:18:21 -0700423 $(call find-generated-R.java,$@)
Colin Cross8e404122014-02-06 14:45:37 -0800424
425$(proguard_options_file): $(R_file_stamp)
426
Ying Wangdbe23f52014-03-25 14:42:46 -0700427resource_export_package :=
Colin Cross8e404122014-02-06 14:45:37 -0800428ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
429# Put this module's resources into a PRODUCT-agnositc package that
430# other packages can use to build their own PRODUCT-agnostic R.java (etc.)
431# files.
432resource_export_package := $(intermediates.COMMON)/package-export.apk
433$(R_file_stamp): $(resource_export_package)
434
435# add-assets-to-package looks at PRODUCT_AAPT_CONFIG, but this target
436# can't know anything about PRODUCT. Clear it out just for this target.
437$(resource_export_package): PRIVATE_PRODUCT_AAPT_CONFIG :=
438$(resource_export_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
Dan Willemsenf439c332017-10-02 14:22:02 -0700439$(resource_export_package): PRIVATE_RESOURCE_LIST := $(all_res_assets)
Colin Cross8e404122014-02-06 14:45:37 -0800440$(resource_export_package): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT)
441 @echo "target Export Resources: $(PRIVATE_MODULE) ($@)"
442 $(create-empty-package)
443 $(add-assets-to-package)
444endif
445
Ying Wange295c3d2016-02-24 14:11:55 -0800446endif # LOCAL_USE_AAPT2
Ying Wangdd71c852015-12-04 13:59:18 -0800447
Colin Cross8e404122014-02-06 14:45:37 -0800448# Other modules should depend on the BUILT module if
449# they want to use this module's R.java file.
Colin Cross79e2f732016-12-21 14:29:13 -0800450$(LOCAL_BUILT_MODULE): $(R_file_stamp)
451
Colin Crossdfc45ec2017-05-26 15:22:02 -0700452# The R.java file must exist by the time the java source
453# list is generated
454$(java_source_list_file): $(R_file_stamp)
Colin Cross8e404122014-02-06 14:45:37 -0800455
Ying Wang61291922014-06-25 13:23:58 -0700456endif # need_compile_res
Colin Cross8e404122014-02-06 14:45:37 -0800457
458ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
459# We need to explicitly clear this var so that we don't
460# inherit the value from whomever caused us to be built.
461$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_INCLUDES :=
462else
463# Most packages should link against the resources defined by framework-res.
464# Even if they don't have their own resources, they may use framework
465# resources.
Michael Wright0fb087f2015-11-06 15:20:51 +0000466ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),)
Colin Cross8e404122014-02-06 14:45:37 -0800467# for released sdk versions, the platform resources were built into android.jar.
468framework_res_package_export := \
469 $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_RES_VERSION)/android.jar
470framework_res_package_export_deps := $(framework_res_package_export)
471else # LOCAL_SDK_RES_VERSION
472framework_res_package_export := \
473 $(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk
474# We can't depend directly on the export.apk file; it won't get its
475# PRIVATE_ vars set up correctly if we do. Instead, depend on the
476# corresponding R.stamp file, which lists the export.apk as a dependency.
477framework_res_package_export_deps := \
478 $(dir $(framework_res_package_export))src/R.stamp
479endif # LOCAL_SDK_RES_VERSION
Adam Lesinskide057c32014-03-13 18:48:27 -0700480all_library_res_package_exports := \
481 $(framework_res_package_export) \
Adam Lesinski5eebe0f2014-03-25 15:45:34 -0700482 $(foreach lib,$(LOCAL_RES_LIBRARIES),\
Adam Lesinskide057c32014-03-13 18:48:27 -0700483 $(call intermediates-dir-for,APPS,$(lib),,COMMON)/package-export.apk)
484
485all_library_res_package_export_deps := \
486 $(framework_res_package_export_deps) \
Adam Lesinski5eebe0f2014-03-25 15:45:34 -0700487 $(foreach lib,$(LOCAL_RES_LIBRARIES),\
Adam Lesinskide057c32014-03-13 18:48:27 -0700488 $(call intermediates-dir-for,APPS,$(lib),,COMMON)/src/R.stamp)
Ying Wangb5745642014-06-19 16:07:30 -0700489$(resource_export_package) $(R_file_stamp) $(LOCAL_BUILT_MODULE): $(all_library_res_package_export_deps)
Colin Cross8e404122014-02-06 14:45:37 -0800490$(LOCAL_INTERMEDIATE_TARGETS): \
Adam Lesinskide057c32014-03-13 18:48:27 -0700491 PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports)
Ying Wangdd71c852015-12-04 13:59:18 -0800492
Ying Wange295c3d2016-02-24 14:11:55 -0800493ifdef LOCAL_USE_AAPT2
Ying Wangdd71c852015-12-04 13:59:18 -0800494$(my_res_package) : $(all_library_res_package_export_deps)
495endif
Colin Cross8e404122014-02-06 14:45:37 -0800496endif # LOCAL_NO_STANDARD_LIBRARIES
497
498ifneq ($(full_classes_jar),)
499$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
Colin Cross79e2f732016-12-21 14:29:13 -0800500# Use the jarjar processed arhive as the initial package file.
Colin Crossffbf0a62017-03-29 12:58:15 -0700501$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
Colin Cross8e404122014-02-06 14:45:37 -0800502$(LOCAL_BUILT_MODULE): $(built_dex)
Ying Wang33360dd2015-01-14 14:23:56 -0800503else
504$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE :=
Colin Cross79e2f732016-12-21 14:29:13 -0800505$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE :=
Colin Cross8e404122014-02-06 14:45:37 -0800506endif # full_classes_jar
507
Ying Wang96bcad42014-04-17 13:38:04 -0700508include $(BUILD_SYSTEM)/install_jni_libs.mk
Colin Cross8e404122014-02-06 14:45:37 -0800509
510# Pick a key to sign the package with. If this package hasn't specified
511# an explicit certificate, use the default.
512# Secure release builds will have their packages signed after the fact,
513# so it's ok for these private keys to be in the clear.
514ifeq ($(LOCAL_CERTIFICATE),)
515 LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
516endif
517
518ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
519 # The special value "EXTERNAL" means that we will sign it with the
520 # default devkey, apply predexopt, but then expect the final .apk
521 # (after dexopting) to be signed by an outside tool.
522 LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
523 PACKAGES.$(LOCAL_PACKAGE_NAME).EXTERNAL_KEY := 1
524endif
525
526# If this is not an absolute certificate, assign it to a generic one.
527ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
528 LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE)
529endif
530private_key := $(LOCAL_CERTIFICATE).pk8
531certificate := $(LOCAL_CERTIFICATE).x509.pem
Shinichiro Hamaji641e61c2016-05-13 16:03:24 +0900532additional_certificates := $(foreach c,$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
Colin Cross8e404122014-02-06 14:45:37 -0800533
534$(LOCAL_BUILT_MODULE): $(private_key) $(certificate) $(SIGNAPK_JAR)
535$(LOCAL_BUILT_MODULE): PRIVATE_PRIVATE_KEY := $(private_key)
536$(LOCAL_BUILT_MODULE): PRIVATE_CERTIFICATE := $(certificate)
537
538PACKAGES.$(LOCAL_PACKAGE_NAME).PRIVATE_KEY := $(private_key)
539PACKAGES.$(LOCAL_PACKAGE_NAME).CERTIFICATE := $(certificate)
540
Shinichiro Hamaji641e61c2016-05-13 16:03:24 +0900541$(LOCAL_BUILT_MODULE): $(additional_certificates)
542$(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CERTIFICATES := $(additional_certificates)
Colin Cross8e404122014-02-06 14:45:37 -0800543
544# Define the rule to build the actual package.
Ying Wang8e20ef62014-06-24 20:01:52 -0700545# PRIVATE_JNI_SHARED_LIBRARIES is a list of <abi>:<path_of_built_lib>.
546$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis)
547# PRIVATE_JNI_SHARED_LIBRARIES_ABI is a list of ABI names.
548$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis)
Colin Cross8e404122014-02-06 14:45:37 -0800549ifneq ($(TARGET_BUILD_APPS),)
550 # Include all resources for unbundled apps.
551 LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true
552endif
553ifeq ($(LOCAL_AAPT_INCLUDE_ALL_RESOURCES),true)
Adam Lesinskie758f932016-02-26 11:13:43 -0800554 $(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG :=
555 $(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
Colin Cross8e404122014-02-06 14:45:37 -0800556else
Adam Lesinskie758f932016-02-26 11:13:43 -0800557 $(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG := $(PRODUCT_AAPT_CONFIG)
Ying Wang934008f2014-07-30 13:40:14 -0700558ifdef LOCAL_PACKAGE_SPLITS
Adam Lesinskie758f932016-02-26 11:13:43 -0800559 $(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
Ying Wang934008f2014-07-30 13:40:14 -0700560else
Adam Lesinskie758f932016-02-26 11:13:43 -0800561 $(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG)
Colin Cross8e404122014-02-06 14:45:37 -0800562endif
Ying Wang934008f2014-07-30 13:40:14 -0700563endif
Colin Cross303567c2017-08-03 03:17:34 +0000564
Colin Cross79e2f732016-12-21 14:29:13 -0800565$(LOCAL_BUILT_MODULE): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
Colin Cross303567c2017-08-03 03:17:34 +0000566$(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/resources
567$(LOCAL_BUILT_MODULE): PRIVATE_FULL_CLASSES_JAR := $(full_classes_jar)
Ying Wangdd71c852015-12-04 13:59:18 -0800568$(LOCAL_BUILT_MODULE) : $(jni_shared_libraries)
Colin Cross128800f2017-08-10 15:24:10 -0700569$(LOCAL_BUILT_MODULE) : $(JAR_ARGS)
Ying Wange295c3d2016-02-24 14:11:55 -0800570ifdef LOCAL_USE_AAPT2
Ying Wangdd71c852015-12-04 13:59:18 -0800571$(LOCAL_BUILT_MODULE): PRIVATE_RES_PACKAGE := $(my_res_package)
572$(LOCAL_BUILT_MODULE) : $(my_res_package) $(AAPT2) | $(ACP)
573else
Dan Willemsenf439c332017-10-02 14:22:02 -0700574$(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_LIST := $(all_res_assets)
Ying Wangdd71c852015-12-04 13:59:18 -0800575$(LOCAL_BUILT_MODULE) : $(all_res_assets) $(full_android_manifest) $(AAPT)
576endif
Colin Cross8e404122014-02-06 14:45:37 -0800577 @echo "target Package: $(PRIVATE_MODULE) ($@)"
Ying Wange295c3d2016-02-24 14:11:55 -0800578ifdef LOCAL_USE_AAPT2
Ying Wangdd71c852015-12-04 13:59:18 -0800579 $(call copy-file-to-new-target)
Ying Wang81ef4712016-03-31 10:10:42 -0700580else # ! LOCAL_USE_AAPT2
Colin Cross79e2f732016-12-21 14:29:13 -0800581ifdef LOCAL_JACK_ENABLED
Colin Cross8e404122014-02-06 14:45:37 -0800582 $(create-empty-package)
Colin Cross79e2f732016-12-21 14:29:13 -0800583else
584 $(if $(PRIVATE_SOURCE_ARCHIVE),\
585 $(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@),\
586 $(create-empty-package))
587endif
Colin Cross8e404122014-02-06 14:45:37 -0800588 $(add-assets-to-package)
Ying Wange295c3d2016-02-24 14:11:55 -0800589endif # LOCAL_USE_AAPT2
Colin Cross8e404122014-02-06 14:45:37 -0800590ifneq ($(jni_shared_libraries),)
591 $(add-jni-shared-libs-to-package)
592endif
Ying Wang8b27d182015-03-27 11:07:17 -0700593ifeq ($(full_classes_jar),)
594# We don't build jar, need to add the Java resources here.
595 $(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
Ying Wang3a61eeb2016-03-11 10:32:01 -0800596else # full_classes_jar
Colin Cross8e404122014-02-06 14:45:37 -0800597 $(add-dex-to-package)
Colin Cross303567c2017-08-03 03:17:34 +0000598ifdef LOCAL_USE_AAPT2
599ifndef LOCAL_JACK_ENABLED
600 $(call add-jar-resources-to-package,$@,$(PRIVATE_FULL_CLASSES_JAR),$(PRIVATE_RESOURCE_INTERMEDIATES_DIR))
601endif
602endif
Ying Wang3a61eeb2016-03-11 10:32:01 -0800603endif # full_classes_jar
Colin Cross79e2f732016-12-21 14:29:13 -0800604ifdef LOCAL_JACK_ENABLED
Yohann Rousselb4c49cb2014-09-08 14:45:14 +0200605 $(add-carried-jack-resources)
Colin Cross79e2f732016-12-21 14:29:13 -0800606endif
Colin Cross8e404122014-02-06 14:45:37 -0800607ifdef LOCAL_DEX_PREOPT
Ying Wang3a61eeb2016-03-11 10:32:01 -0800608ifneq ($(BUILD_PLATFORM_ZIP),)
609 @# Keep a copy of apk with classes.dex unstripped
610 $(hide) cp -f $@ $(dir $@)package.dex.apk
611endif # BUILD_PLATFORM_ZIP
Nicolas Geoffrayb06c30b2017-09-19 11:51:45 +0000612ifneq (true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))
613ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
614 @# No need to align, sign-package below will do it.
615 $(uncompress-dexs)
616endif # LOCAL_PRIVILEGED_MODULE
617endif # DONT_UNCOMPRESS_PRIV_APPS_DEXS
Colin Cross8e404122014-02-06 14:45:37 -0800618ifneq (nostripping,$(LOCAL_DEX_PREOPT))
619 $(call dexpreopt-remove-classes.dex,$@)
620endif
621endif
Kenny Rootdff37552015-04-15 12:09:32 -0700622 $(sign-package)
Colin Cross8e404122014-02-06 14:45:37 -0800623
Ying Wang36142f62014-05-21 16:13:33 -0700624###############################
Ying Wang8070b202014-12-01 17:46:56 -0800625## Build dpi-specific apks, if it's apps_only build.
626ifdef TARGET_BUILD_APPS
627ifdef LOCAL_DPI_VARIANTS
628$(foreach d, $(LOCAL_DPI_VARIANTS), \
629 $(eval my_dpi := $(d)) \
630 $(eval include $(BUILD_SYSTEM)/dpi_specific_apk.mk))
631endif
632endif
633
634###############################
Ying Wang36142f62014-05-21 16:13:33 -0700635## Rule to build the odex file
636ifdef LOCAL_DEX_PREOPT
637$(built_odex): PRIVATE_DEX_FILE := $(built_dex)
Ying Wangdb48da72014-09-13 11:26:39 -0700638# Use pattern rule - we may have multiple built odex files.
639$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(built_dex)
Ying Wang994c2262014-05-28 13:34:59 -0700640 $(hide) mkdir -p $(dir $@) && rm -f $@
Ying Wang36142f62014-05-21 16:13:33 -0700641 $(add-dex-to-package)
642 $(hide) mv $@ $@.input
643 $(call dexpreopt-one-file,$@.input,$@)
644 $(hide) rm $@.input
645endif
646
Ying Wang1425e2d2014-07-22 15:42:11 -0700647###############################
648## APK splits
649ifdef LOCAL_PACKAGE_SPLITS
Ying Wang7f625aa2014-07-23 10:27:57 -0700650# The splits should have been built in the same command building the base apk.
Alex Klyubin5b826ac2015-12-04 10:07:41 -0800651# This rule just runs signing.
Ying Wang7f625aa2014-07-23 10:27:57 -0700652# Note that we explicily check the existence of the split apk and remove the
653# built base apk if the split apk isn't there.
654# That way the build system will rerun the aapt after the user changes the splitting parameters.
Ying Wang1425e2d2014-07-22 15:42:11 -0700655$(built_apk_splits): PRIVATE_PRIVATE_KEY := $(private_key)
656$(built_apk_splits): PRIVATE_CERTIFICATE := $(certificate)
Dan Willemsenf72308a2017-05-15 23:38:04 -0700657$(built_apk_splits) : $(intermediates)/%.apk : $(LOCAL_BUILT_MODULE)
Ying Wang7f625aa2014-07-23 10:27:57 -0700658 $(hide) if [ ! -f $@ ]; then \
659 echo 'No $@ generated, check your apk splitting parameters.' 1>&2; \
660 rm $<; exit 1; \
661 fi
662 $(sign-package)
Ying Wang1425e2d2014-07-22 15:42:11 -0700663
664# Rules to install the splits
Dan Willemsenf72308a2017-05-15 23:38:04 -0700665$(installed_apk_splits) : $(my_module_path)/$(LOCAL_MODULE)_%.apk : $(intermediates)/package_%.apk
Ying Wang7f625aa2014-07-23 10:27:57 -0700666 @echo "Install: $@"
667 $(copy-file-to-new-target)
Ying Wang1425e2d2014-07-22 15:42:11 -0700668
669# Register the additional built and installed files.
670ALL_MODULES.$(my_register_name).INSTALLED += $(installed_apk_splits)
671ALL_MODULES.$(my_register_name).BUILT_INSTALLED += \
Dan Willemsenf72308a2017-05-15 23:38:04 -0700672 $(foreach s,$(my_split_suffixes),$(intermediates)/package_$(s).apk:$(my_module_path)/$(LOCAL_MODULE)_$(s).apk)
Ying Wang1425e2d2014-07-22 15:42:11 -0700673
674# Make sure to install the splits when you run "make <module_name>".
Colin Cross33886702016-09-20 16:01:28 -0700675$(my_all_targets): $(installed_apk_splits)
Ying Wang16243612015-06-03 12:43:50 -0700676
677ifdef LOCAL_COMPATIBILITY_SUITE
Ying Wang16243612015-06-03 12:43:50 -0700678
Simran Basi6bea37c2017-02-16 18:04:10 -0800679$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
680 $(eval my_compat_dist_$(suite) := $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
681 $(foreach s,$(my_split_suffixes),\
Dan Willemsenf72308a2017-05-15 23:38:04 -0700682 $(intermediates)/package_$(s).apk:$(dir)/$(LOCAL_MODULE)_$(s).apk))))
Ying Wang16243612015-06-03 12:43:50 -0700683
Simran Basi6bea37c2017-02-16 18:04:10 -0800684$(call create-suite-dependencies)
685
Ying Wang16243612015-06-03 12:43:50 -0700686endif # LOCAL_COMPATIBILITY_SUITE
Ying Wang1425e2d2014-07-22 15:42:11 -0700687endif # LOCAL_PACKAGE_SPLITS
688
Colin Cross8e404122014-02-06 14:45:37 -0800689# Save information about this package
690PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
691PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources)
Colin Cross8e404122014-02-06 14:45:37 -0800692
693PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME)
694
Colin Cross8e404122014-02-06 14:45:37 -0800695endif # skip_definition
696
697# Reset internal variables.
698all_res_assets :=
Jaekyun Seok30706102017-02-02 00:44:58 +0900699
700ifdef enforce_rro_enabled
701 ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
702 enforce_rro_use_res_lib := true
703 else
704 enforce_rro_use_res_lib := false
705 endif
706
707 ifdef LOCAL_MANIFEST_PACKAGE_NAME
708 enforce_rro_is_manifest_package_name := true
709 enforce_rro_manifest_package_info := $(LOCAL_MANIFEST_PACKAGE_NAME)
710 else
711 enforce_rro_is_manifest_package_name := false
712 enforce_rro_manifest_package_info := $(full_android_manifest)
713 endif
714
715$(call append_enforce_rro_sources, \
716 $(my_register_name), \
717 $(enforce_rro_is_manifest_package_name), \
718 $(enforce_rro_manifest_package_info), \
719 $(enforce_rro_use_res_lib), \
720 $(package_resource_overlays) \
721 )
Jaekyun Seok2a209992017-03-30 11:25:02 +0900722endif # enforce_rro_enabled