Revert "Revert "Inject minSdkVersion from the build system""
This reverts commit 4cd1a75d17
.
PackageParser no longer treats minSdkVersion=Q as targetSdkVersion=Q
when targetSdkVersion is set to a number.
Bug: 110167203
Bug: 110353795
Change-Id: Ib44743e4c49e59cd29a57af1bf885090e380b1b6
This commit is contained in:
parent
4cd1a75d17
commit
2d61e47f88
1 changed files with 22 additions and 5 deletions
|
@ -6,9 +6,9 @@ ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
|
|||
LOCAL_MANIFEST_FILE := AndroidManifest.xml
|
||||
endif
|
||||
ifdef LOCAL_FULL_MANIFEST_FILE
|
||||
full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
|
||||
main_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
|
||||
else
|
||||
full_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
|
||||
main_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
|
||||
endif
|
||||
|
||||
LOCAL_STATIC_JAVA_AAR_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_AAR_LIBRARIES))
|
||||
|
@ -32,18 +32,35 @@ ifdef LOCAL_STATIC_JAVA_AAR_LIBRARIES
|
|||
endif
|
||||
endif
|
||||
|
||||
full_android_manifest := $(intermediates.COMMON)/manifest/AndroidManifest.xml
|
||||
|
||||
ifdef LOCAL_MIN_SDK_VERSION
|
||||
$(full_android_manifest): PRIVATE_MIN_SDK_VERSION := $(LOCAL_MIN_SDK_VERSION)
|
||||
else ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
|
||||
$(full_android_manifest): PRIVATE_MIN_SDK_VERSION := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
|
||||
else
|
||||
$(full_android_manifest): PRIVATE_MIN_SDK_VERSION := $(DEFAULT_APP_TARGET_SDK)
|
||||
endif
|
||||
|
||||
# Set up rules to merge library manifest files
|
||||
ifneq (,$(strip $(my_full_libs_manifest_files)))
|
||||
|
||||
main_android_manifest := $(full_android_manifest)
|
||||
full_android_manifest := $(intermediates.COMMON)/manifest/AndroidManifest.xml
|
||||
$(full_android_manifest): PRIVATE_LIBS_MANIFESTS := $(my_full_libs_manifest_files)
|
||||
$(full_android_manifest): $(ANDROID_MANIFEST_MERGER_CLASSPATH)
|
||||
$(full_android_manifest): $(MANIFEST_FIXER)
|
||||
$(full_android_manifest) : $(main_android_manifest) $(my_full_libs_manifest_files)
|
||||
@echo "Merge android manifest files: $@ <-- $< $(PRIVATE_LIBS_MANIFESTS)"
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) $(ANDROID_MANIFEST_MERGER) --main $< \
|
||||
$(MANIFEST_FIXER) $< $@.tmp --minSdkVersion $(PRIVATE_MIN_SDK_VERSION)
|
||||
$(hide) $(ANDROID_MANIFEST_MERGER) --main $@.tmp \
|
||||
--libs $(call normalize-path-list,$(PRIVATE_LIBS_MANIFESTS)) \
|
||||
--out $@
|
||||
rm $@.tmp
|
||||
|
||||
else
|
||||
$(full_android_manifest): $(MANIFEST_FIXER)
|
||||
$(full_android_manifest): $(main_android_manifest)
|
||||
@echo "Fix manifest: $@"
|
||||
$(MANIFEST_FIXER) $< $@ --minSdkVersion $(PRIVATE_MIN_SDK_VERSION)
|
||||
|
||||
endif
|
||||
|
|
Loading…
Reference in a new issue