Pass --library to manifest_fixer.py for android libraries
manifest_fixer.py needs to know the difference between apps
and android libraries in order to change its behavior around
inserting targetSdkVersion.
Bug: 111347801
Test: m checkbuild
Change-Id: Ic21f1b98e3bcbd782612370c46134fc9dd157512
diff --git a/core/android_manifest.mk b/core/android_manifest.mk
index fc6b42d..13da10c 100644
--- a/core/android_manifest.mk
+++ b/core/android_manifest.mk
@@ -58,11 +58,16 @@
$(fixed_android_manifest): PRIVATE_EXPORTED_SDK_LIBS_FILE := $(my_exported_sdk_libs_file)
$(fixed_android_manifest): $(my_exported_sdk_libs_file)
+$(fixed_android_manifest): PRIVATE_MANIFEST_FIXER_FLAGS :=
+ifneq ($(LOCAL_MODULE_CLASS),APPS)
+$(fixed_android_manifest): PRIVATE_MANIFEST_FIXER_FLAGS := --library
+endif
$(fixed_android_manifest): $(MANIFEST_FIXER)
$(fixed_android_manifest): $(main_android_manifest)
@echo "Fix manifest: $@"
$(MANIFEST_FIXER) \
--minSdkVersion $(PRIVATE_MIN_SDK_VERSION) \
+ $(PRIVATE_MANIFEST_FIXER_FLAGS) \
$(if (PRIVATE_EXPORTED_SDK_LIBS_FILE),\
$$(cat $(PRIVATE_EXPORTED_SDK_LIBS_FILE) | sort -u | sed -e 's/^/\ --uses-library\ /' | tr '\n' ' ')) \
$< $@