Home | History | Annotate | Download | only in core
      1 #
      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 
     29 # If this makefile is being read from within an inheritance,
     30 # use the new values.
     31 skip_definition:=
     32 ifdef LOCAL_PACKAGE_OVERRIDES
     33   package_overridden := $(call set-inherited-package-variables)
     34   ifeq ($(strip $(package_overridden)),)
     35     skip_definition := true
     36   endif
     37 endif
     38 
     39 ifndef skip_definition
     40 
     41 LOCAL_PACKAGE_NAME := $(strip $(LOCAL_PACKAGE_NAME))
     42 ifeq ($(LOCAL_PACKAGE_NAME),)
     43 $(error $(LOCAL_PATH): Package modules must define LOCAL_PACKAGE_NAME)
     44 endif
     45 
     46 ifneq ($(strip $(LOCAL_MODULE_SUFFIX)),)
     47 $(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE_SUFFIX)
     48 endif
     49 LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
     50 
     51 ifneq ($(strip $(LOCAL_MODULE)),)
     52 $(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE)
     53 endif
     54 LOCAL_MODULE := $(LOCAL_PACKAGE_NAME)
     55 
     56 ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
     57 LOCAL_MANIFEST_FILE := AndroidManifest.xml
     58 endif
     59 
     60 # If you need to put the MANIFEST_FILE outside of LOCAL_PATH
     61 # you can use FULL_MANIFEST_FILE
     62 ifeq ($(strip $(LOCAL_FULL_MANIFEST_FILE)),)
     63 LOCAL_FULL_MANIFEST_FILE := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
     64 endif
     65 
     66 ifneq ($(strip $(LOCAL_MODULE_CLASS)),)
     67 $(error $(LOCAL_PATH): Package modules may not set LOCAL_MODULE_CLASS)
     68 endif
     69 LOCAL_MODULE_CLASS := APPS
     70 
     71 # Package LOCAL_MODULE_TAGS default to optional
     72 LOCAL_MODULE_TAGS := $(strip $(LOCAL_MODULE_TAGS))
     73 ifeq ($(LOCAL_MODULE_TAGS),)
     74 LOCAL_MODULE_TAGS := optional
     75 endif
     76 
     77 ifeq ($(filter tests, $(LOCAL_MODULE_TAGS)),)
     78 # Force localization check if it's not tagged as tests.
     79 LOCAL_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) -z
     80 endif
     81 
     82 ifeq (,$(LOCAL_ASSET_DIR))
     83 LOCAL_ASSET_DIR := $(LOCAL_PATH)/assets
     84 endif
     85 
     86 ifeq (,$(LOCAL_RESOURCE_DIR))
     87   LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
     88 endif
     89 
     90 package_resource_overlays := $(strip \
     91     $(wildcard $(foreach dir, $(PRODUCT_PACKAGE_OVERLAYS), \
     92       $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))) \
     93     $(wildcard $(foreach dir, $(DEVICE_PACKAGE_OVERLAYS), \
     94       $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))))
     95 
     96 LOCAL_RESOURCE_DIR := $(package_resource_overlays) $(LOCAL_RESOURCE_DIR)
     97 
     98 all_assets := $(call find-subdir-assets,$(LOCAL_ASSET_DIR))
     99 all_assets := $(addprefix $(LOCAL_ASSET_DIR)/,$(patsubst assets/%,%,$(all_assets)))
    100 
    101 all_resources := $(strip \
    102     $(foreach dir, $(LOCAL_RESOURCE_DIR), \
    103       $(addprefix $(dir)/, \
    104         $(patsubst res/%,%, \
    105           $(call find-subdir-assets,$(dir)) \
    106          ) \
    107        ) \
    108      ))
    109 
    110 all_res_assets := $(strip $(all_assets) $(all_resources))
    111 
    112 package_expected_intermediates_COMMON := $(call local-intermediates-dir,COMMON)
    113 # If no assets or resources were found, clear the directory variables so
    114 # we don't try to build them.
    115 ifeq (,$(all_assets))
    116 LOCAL_ASSET_DIR:=
    117 endif
    118 ifeq (,$(all_resources))
    119 LOCAL_RESOURCE_DIR:=
    120 R_file_stamp :=
    121 else
    122 # Make sure that R_file_stamp inherits the proper PRIVATE vars.
    123 # If R.stamp moves, be sure to update the framework makefile,
    124 # which has intimate knowledge of its location.
    125 R_file_stamp := $(package_expected_intermediates_COMMON)/src/R.stamp
    126 LOCAL_INTERMEDIATE_TARGETS += $(R_file_stamp)
    127 endif
    128 
    129 LOCAL_BUILT_MODULE_STEM := package.apk
    130 
    131 LOCAL_PROGUARD_ENABLED:=$(strip $(LOCAL_PROGUARD_ENABLED))
    132 ifndef LOCAL_PROGUARD_ENABLED
    133 ifneq ($(DISABLE_PROGUARD),true)
    134     LOCAL_PROGUARD_ENABLED :=full
    135 endif
    136 endif
    137 ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
    138     # the package explicitly request to disable proguard.
    139     LOCAL_PROGUARD_ENABLED :=
    140 endif
    141 proguard_options_file :=
    142 ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
    143 ifneq ($(all_resources),)
    144     proguard_options_file := $(package_expected_intermediates_COMMON)/proguard_options
    145 endif # all_resources
    146 endif # !custom
    147 LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
    148 
    149 ifneq (true,$(WITH_DEXPREOPT))
    150 LOCAL_DEX_PREOPT :=
    151 else
    152 ifeq (,$(TARGET_BUILD_APPS))
    153 ifeq (,$(LOCAL_APK_LIBRARIES))
    154 ifneq (,$(LOCAL_SRC_FILES))
    155 ifndef LOCAL_DEX_PREOPT
    156 LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
    157 endif
    158 endif
    159 endif
    160 endif
    161 endif
    162 ifeq (false,$(LOCAL_DEX_PREOPT))
    163 LOCAL_DEX_PREOPT :=
    164 endif
    165 
    166 ifeq (true,$(EMMA_INSTRUMENT))
    167 ifndef LOCAL_EMMA_INSTRUMENT
    168 # No emma for test apks.
    169 ifeq (,$(filer tests,$(LOCAL_MODULE_TAGS))$(LOCAL_INSTRUMENTATION_FOR))
    170 LOCAL_EMMA_INSTRUMENT := true
    171 endif # No test apk
    172 endif # LOCAL_EMMA_INSTRUMENT is not set
    173 else
    174 LOCAL_EMMA_INSTRUMENT := false
    175 endif # EMMA_INSTRUMENT is true
    176 
    177 ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
    178 ifeq (true,$(EMMA_INSTRUMENT_STATIC))
    179 LOCAL_STATIC_JAVA_LIBRARIES += emma
    180 else
    181 ifdef LOCAL_SDK_VERSION
    182 ifdef TARGET_BUILD_APPS
    183 # In unbundled build merge the emma library into the apk.
    184 LOCAL_STATIC_JAVA_LIBRARIES += emma
    185 else
    186 # If build against the SDK in full build, core.jar is not used,
    187 # we have to use prebiult emma.jar to make Proguard happy;
    188 # Otherwise emma classes are included in core.jar.
    189 LOCAL_PROGUARD_FLAGS += -libraryjars $(EMMA_JAR)
    190 endif # full build
    191 endif # LOCAL_SDK_VERSION
    192 endif # EMMA_INSTRUMENT_STATIC
    193 endif # LOCAL_EMMA_INSTRUMENT
    194 
    195 rs_compatibility_jni_libs :=
    196 
    197 #################################
    198 include $(BUILD_SYSTEM)/java.mk
    199 #################################
    200 
    201 LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION))
    202 ifeq ($(LOCAL_SDK_RES_VERSION),)
    203   LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION)
    204 endif
    205 
    206 full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
    207 $(LOCAL_INTERMEDIATE_TARGETS): \
    208     PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
    209 ifneq (,$(filter-out current, $(LOCAL_SDK_VERSION)))
    210 $(LOCAL_INTERMEDIATE_TARGETS): \
    211     PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
    212 else
    213 $(LOCAL_INTERMEDIATE_TARGETS): \
    214     PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
    215 endif
    216 
    217 ifneq ($(all_resources),)
    218 
    219 # Since we don't know where the real R.java file is going to end up,
    220 # we need to use another file to stand in its place.  We'll just
    221 # copy the generated file to src/R.stamp, which means it will
    222 # have the same contents and timestamp as the actual file.
    223 #
    224 # At the same time, this will copy the R.java file to a central
    225 # 'R' directory to make it easier to add the files to an IDE.
    226 #
    227 #TODO: use PRIVATE_SOURCE_INTERMEDIATES_DIR instead of
    228 #      $(intermediates.COMMON)/src
    229 ifneq ($(package_expected_intermediates_COMMON),$(intermediates.COMMON))
    230   $(error $(LOCAL_MODULE): internal error: expected intermediates.COMMON "$(package_expected_intermediates_COMMON)" != intermediates.COMMON "$(intermediates.COMMON)")
    231 endif
    232 
    233 $(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := \
    234 			$(intermediates.COMMON)/public_resources.xml
    235 $(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
    236 $(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT) | $(ACP)
    237 	@echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
    238 	@rm -f $@
    239 	$(create-resource-java-files)
    240 	$(hide) for GENERATED_MANIFEST_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
    241 					-name Manifest.java 2> /dev/null`; do \
    242 		dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_MANIFEST_FILE`; \
    243 		mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
    244 		$(ACP) -fp $$GENERATED_MANIFEST_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
    245 	done;
    246 	$(hide) for GENERATED_R_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
    247 					-name R.java 2> /dev/null`; do \
    248 		dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_R_FILE`; \
    249 		mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
    250 		$(ACP) -fp $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \
    251 			|| exit 31; \
    252 		$(ACP) -fp $$GENERATED_R_FILE $@ || exit 32; \
    253 	done; \
    254 
    255 $(proguard_options_file): $(R_file_stamp)
    256 
    257 ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
    258 # Put this module's resources into a PRODUCT-agnositc package that
    259 # other packages can use to build their own PRODUCT-agnostic R.java (etc.)
    260 # files.
    261 resource_export_package := $(intermediates.COMMON)/package-export.apk
    262 $(R_file_stamp): $(resource_export_package)
    263 
    264 # add-assets-to-package looks at PRODUCT_AAPT_CONFIG, but this target
    265 # can't know anything about PRODUCT.  Clear it out just for this target.
    266 $(resource_export_package): PRIVATE_PRODUCT_AAPT_CONFIG :=
    267 $(resource_export_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
    268 $(resource_export_package): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT)
    269 	@echo "target Export Resources: $(PRIVATE_MODULE) ($@)"
    270 	$(create-empty-package)
    271 	$(add-assets-to-package)
    272 endif
    273 
    274 # Other modules should depend on the BUILT module if
    275 # they want to use this module's R.java file.
    276 $(LOCAL_BUILT_MODULE): $(R_file_stamp)
    277 
    278 ifneq ($(full_classes_jar),)
    279 # If full_classes_jar is non-empty, we're building sources.
    280 # If we're building sources, the initial javac step (which
    281 # produces full_classes_compiled_jar) needs to ensure the
    282 # R.java and Manifest.java files have been generated first.
    283 $(full_classes_compiled_jar): $(R_file_stamp)
    284 endif
    285 
    286 endif  # all_resources
    287 
    288 ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
    289 # We need to explicitly clear this var so that we don't
    290 # inherit the value from whomever caused us to be built.
    291 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_INCLUDES :=
    292 else
    293 # Most packages should link against the resources defined by framework-res.
    294 # Even if they don't have their own resources, they may use framework
    295 # resources.
    296 ifneq ($(filter-out current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current,$(LOCAL_SDK_RES_VERSION))),)
    297 # for released sdk versions, the platform resources were built into android.jar.
    298 framework_res_package_export := \
    299     $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_RES_VERSION)/android.jar
    300 framework_res_package_export_deps := $(framework_res_package_export)
    301 else # LOCAL_SDK_RES_VERSION
    302 framework_res_package_export := \
    303     $(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk
    304 # We can't depend directly on the export.apk file; it won't get its
    305 # PRIVATE_ vars set up correctly if we do.  Instead, depend on the
    306 # corresponding R.stamp file, which lists the export.apk as a dependency.
    307 framework_res_package_export_deps := \
    308     $(dir $(framework_res_package_export))src/R.stamp
    309 endif # LOCAL_SDK_RES_VERSION
    310 $(R_file_stamp): $(framework_res_package_export_deps)
    311 $(LOCAL_INTERMEDIATE_TARGETS): \
    312     PRIVATE_AAPT_INCLUDES := $(framework_res_package_export)
    313 endif # LOCAL_NO_STANDARD_LIBRARIES
    314 
    315 ifneq ($(full_classes_jar),)
    316 $(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
    317 $(LOCAL_BUILT_MODULE): $(built_dex)
    318 endif # full_classes_jar
    319 
    320 
    321 # Get the list of jni libraries to be included in the apk file.
    322 
    323 so_suffix := $($(my_prefix)SHLIB_SUFFIX)
    324 
    325 jni_shared_libraries := \
    326     $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
    327       $(addsuffix $(so_suffix), \
    328         $(LOCAL_JNI_SHARED_LIBRARIES)))
    329 
    330 # Include RS dynamically-generated libraries as well
    331 # Keep this ifneq, as the += otherwise adds spaces that need to be stripped.
    332 ifneq ($(rs_compatibility_jni_libs),)
    333 jni_shared_libraries += $(rs_compatibility_jni_libs)
    334 endif
    335 
    336 # App explicitly requires the prebuilt NDK libstlport_shared.so.
    337 # libstlport_shared.so should never go to the system image.
    338 # Instead it should be packaged into the apk.
    339 ifeq (stlport_shared,$(LOCAL_NDK_STL_VARIANT))
    340 ifndef LOCAL_SDK_VERSION
    341 $(error LOCAL_SDK_VERSION has to be defined together with LOCAL_NDK_STL_VARIANT, \
    342     LOCAL_PACKAGE_NAME=$(LOCAL_PACKAGE_NAME))
    343 endif
    344 jni_shared_libraries += \
    345     $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_shared.so
    346 endif
    347 
    348 # Set the abi directory used by the local JNI shared libraries.
    349 # (Doesn't change how the local shared libraries are compiled, just
    350 # sets where they are stored in the apk.)
    351 
    352 ifeq ($(LOCAL_JNI_SHARED_LIBRARIES_ABI),)
    353     jni_shared_libraries_abi := $(TARGET_CPU_ABI)
    354 else
    355     jni_shared_libraries_abi := $(LOCAL_JNI_SHARED_LIBRARIES_ABI)
    356 endif
    357 
    358 # Pick a key to sign the package with.  If this package hasn't specified
    359 # an explicit certificate, use the default.
    360 # Secure release builds will have their packages signed after the fact,
    361 # so it's ok for these private keys to be in the clear.
    362 ifeq ($(LOCAL_CERTIFICATE),)
    363     LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
    364 endif
    365 
    366 ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
    367   # The special value "EXTERNAL" means that we will sign it with the
    368   # default devkey, apply predexopt, but then expect the final .apk
    369   # (after dexopting) to be signed by an outside tool.
    370   LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
    371   PACKAGES.$(LOCAL_PACKAGE_NAME).EXTERNAL_KEY := 1
    372 endif
    373 
    374 # If this is not an absolute certificate, assign it to a generic one.
    375 ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
    376     LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE)
    377 endif
    378 private_key := $(LOCAL_CERTIFICATE).pk8
    379 certificate := $(LOCAL_CERTIFICATE).x509.pem
    380 
    381 $(LOCAL_BUILT_MODULE): $(private_key) $(certificate) $(SIGNAPK_JAR)
    382 $(LOCAL_BUILT_MODULE): PRIVATE_PRIVATE_KEY := $(private_key)
    383 $(LOCAL_BUILT_MODULE): PRIVATE_CERTIFICATE := $(certificate)
    384 
    385 PACKAGES.$(LOCAL_PACKAGE_NAME).PRIVATE_KEY := $(private_key)
    386 PACKAGES.$(LOCAL_PACKAGE_NAME).CERTIFICATE := $(certificate)
    387 
    388 $(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\
    389     $(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
    390 
    391 # Define the rule to build the actual package.
    392 $(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN)
    393 ifdef LOCAL_DEX_PREOPT
    394 # Make sure the boot jars get dexpreopt-ed first
    395 $(LOCAL_BUILT_MODULE): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT)
    396 endif
    397 $(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries)
    398 $(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abi)
    399 ifneq ($(TARGET_BUILD_APPS),)
    400     # Include all resources for unbundled apps.
    401     LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true
    402 endif
    403 ifeq ($(LOCAL_AAPT_INCLUDE_ALL_RESOURCES),true)
    404     $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG :=
    405     $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
    406 else
    407     $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG := $(PRODUCT_AAPT_CONFIG)
    408     $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG)
    409 endif
    410 $(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
    411 	@echo "target Package: $(PRIVATE_MODULE) ($@)"
    412 	$(create-empty-package)
    413 	$(add-assets-to-package)
    414 ifneq ($(jni_shared_libraries),)
    415 	$(add-jni-shared-libs-to-package)
    416 endif
    417 ifneq ($(full_classes_jar),)
    418 	$(add-dex-to-package)
    419 endif
    420 	$(add-carried-java-resources)
    421 ifneq ($(extra_jar_args),)
    422 	$(add-java-resources-to-package)
    423 endif
    424 	$(sign-package)
    425 ifdef LOCAL_DEX_PREOPT
    426 	$(hide) rm -f $(patsubst %.apk,%.odex,$@)
    427 	$(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@))
    428 ifneq (nostripping,$(LOCAL_DEX_PREOPT))
    429 	$(call dexpreopt-remove-classes.dex,$@)
    430 endif
    431 endif
    432 	@# Alignment must happen after all other zip operations.
    433 	$(align-package)
    434 
    435 ifdef LOCAL_DEX_PREOPT
    436 built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
    437 $(built_odex): $(LOCAL_BUILT_MODULE)
    438 endif
    439 
    440 # Save information about this package
    441 PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
    442 PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources)
    443 ifdef package_resource_overlays
    444 PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_OVERLAYS := $(package_resource_overlays)
    445 endif
    446 
    447 PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME)
    448 
    449 # Dist the files that can be bundled in system.img.
    450 # They include the jni shared libraries and the apk with jni libraries stripped.
    451 ifeq ($(LOCAL_DIST_BUNDLED_BINARIES),true)
    452 ifneq ($(filter $(LOCAL_PACKAGE_NAME),$(TARGET_BUILD_APPS)),)
    453 ifneq ($(strip $(jni_shared_libraries)),)
    454 dist_subdir := bundled_$(LOCAL_PACKAGE_NAME)
    455 $(foreach f, $(jni_shared_libraries), \
    456   $(call dist-for-goals, apps_only, $(f):$(dist_subdir)/$(notdir $(f))))
    457 
    458 apk_jni_stripped := $(intermediates)/jni_stripped/package.apk
    459 $(apk_jni_stripped): PRIVATE_JNI_SHARED_LIBRARIES := $(notdir $(jni_shared_libraries))
    460 $(apk_jni_stripped) : $(LOCAL_BUILT_MODULE) | $(ZIPALIGN)
    461 	@rm -rf $(dir $@) && mkdir -p $(dir $@)
    462 	$(hide) cp $< $@
    463 	$(hide) zip -d $@ $(foreach f,$(PRIVATE_JNI_SHARED_LIBRARIES),\*/$(f))
    464 	$(call align-package)
    465 
    466 $(call dist-for-goals, apps_only, $(apk_jni_stripped):$(dist_subdir)/$(LOCAL_PACKAGE_NAME).apk)
    467 
    468 endif  # jni_shared_libraries
    469 endif  # apps_only build
    470 endif  # LOCAL_DIST_BUNDLED_BINARIES
    471 
    472 # Lint phony targets
    473 .PHONY: lint-$(LOCAL_PACKAGE_NAME)
    474 lint-$(LOCAL_PACKAGE_NAME): PRIVATE_PATH := $(LOCAL_PATH)
    475 lint-$(LOCAL_PACKAGE_NAME): PRIVATE_LINT_FLAGS := $(LOCAL_LINT_FLAGS)
    476 lint-$(LOCAL_PACKAGE_NAME) :
    477 	@echo lint $(PRIVATE_PATH)
    478 	$(LINT) $(PRIVATE_LINT_FLAGS) $(PRIVATE_PATH)
    479 
    480 lintall : lint-$(LOCAL_PACKAGE_NAME)
    481 
    482 endif # skip_definition
    483 
    484 # Reset internal variables.
    485 all_res_assets :=
    486