From 6b68da06254e3d74c8d575c3e11f797ffd7c8176 Mon Sep 17 00:00:00 2001 From: Yang Ni Date: Wed, 26 Apr 2017 16:15:42 -0700 Subject: [PATCH] Do not package res unless RS target API < 21 Bug: 37626838 Since Lollipop, RS generated bitcode is embedded as strings in generated Java files, and no longer needed in the resources. This CL makes packaging resources conditional on RS target API, and not do so unless it is below 21. Test: mm in frameworks/rs/tests/java_api/Refocus, ImageProcessing2, and ImageProcessing_jb Change-Id: I79a90ed4b96cb78b22a64a35b539d9d67351f4c4 (cherry picked from commit e2c0901918d46d6e9920c71436bc1f896cbd425b) --- core/package_internal.mk | 15 +++++++++++++++ core/static_java_library.mk | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/core/package_internal.mk b/core/package_internal.mk index e51221116..f9f8e3590 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -367,8 +367,23 @@ endif # LOCAL_DATA_BINDING ifeq ($(need_compile_res),true) ifdef LOCAL_USE_AAPT2 my_compiled_res_base_dir := $(intermediates)/flat-res +renderscript_target_api := +ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API)) +renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API) +else +ifneq (,$(LOCAL_SDK_VERSION)) +# Set target-api for LOCAL_SDK_VERSIONs other than current. +ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION))) +renderscript_target_api := $(LOCAL_SDK_VERSION) +endif +endif # LOCAL_SDK_VERSION is set +endif # LOCAL_RENDERSCRIPT_TARGET_API is set +ifneq (,$(renderscript_target_api)) +ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true) my_generated_res_dirs := $(rs_generated_res_dir) my_generated_res_dirs_deps := $(RenderScript_file_stamp) +endif # renderscript_target_api < 21 +endif # renderscript_target_api is set # Add AAPT2 link specific flags. $(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --no-static-lib-packages include $(BUILD_SYSTEM)/aapt2.mk diff --git a/core/static_java_library.mk b/core/static_java_library.mk index bf72a8227..a8b010399 100644 --- a/core/static_java_library.mk +++ b/core/static_java_library.mk @@ -149,8 +149,23 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := ifdef LOCAL_USE_AAPT2 # One more level with name res so we can zip up the flat resources that can be linked by apps. my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res/res +renderscript_target_api := +ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API)) +renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API) +else +ifneq (,$(LOCAL_SDK_VERSION)) +# Set target-api for LOCAL_SDK_VERSIONs other than current. +ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION))) +renderscript_target_api := $(LOCAL_SDK_VERSION) +endif +endif # LOCAL_SDK_VERSION is set +endif # LOCAL_RENDERSCRIPT_TARGET_API is set +ifneq (,$(renderscript_target_api)) +ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true) my_generated_res_dirs := $(rs_generated_res_dir) my_generated_res_dirs_deps := $(RenderScript_file_stamp) +endif # renderscript_target_api < 21 +endif # renderscript_target_api is set include $(BUILD_SYSTEM)/aapt2.mk $(my_res_package) : $(framework_res_package_export_deps) else