From 0932a821c04a1b99948aed9504ee4809a90da6a1 Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Wed, 4 May 2022 13:23:34 +0100 Subject: [PATCH] Extend hardcoded list of optional uses-libraries. This is a temporary workaround that should be replaced with build logic that would propagate optionality via generated exported-sdk-libs files. Bug: 214255490 Test: lunch aosp_cf_x86_64_phone-userdebug && m && launch_cvd \ && adb wait-for-device && adb root \ && adb logcat | grep -E 'ClassLoaderContext [a-z ]+ mismatch' # empty output, no errors at boot Change-Id: I05e22e5f72a9f936b6e0010240f5e71849a9b2b0 --- core/android_manifest.mk | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/core/android_manifest.mk b/core/android_manifest.mk index 254e09bc93..ff4926285f 100644 --- a/core/android_manifest.mk +++ b/core/android_manifest.mk @@ -87,13 +87,23 @@ ifeq ($(LOCAL_MODULE_CLASS),APPS) endif endif +# TODO: Replace this hardcoded list of optional uses-libraries with build logic +# that propagates optionality via the generated exported-sdk-libs files. +# Hardcodng doesn't scale and enforces a single choice on each library, while in +# reality this is a choice of the library users (which may differ). +my_optional_sdk_lib_names := \ + android.test.base \ + android.test.mock \ + androidx.window.extensions \ + androidx.window.sidecar + $(fixed_android_manifest): PRIVATE_MANIFEST_FIXER_FLAGS := $(my_manifest_fixer_flags) # These two libs are added as optional dependencies ( with # android:required set to false). This is because they haven't existed in pre-P # devices, but classes in them were in bootclasspath jars, etc. So making them # hard dependencies (andriod:required=true) would prevent apps from being # installed to such legacy devices. -$(fixed_android_manifest): PRIVATE_OPTIONAL_SDK_LIB_NAMES := android.test.base android.test.mock +$(fixed_android_manifest): PRIVATE_OPTIONAL_SDK_LIB_NAMES := $(my_optional_sdk_lib_names) $(fixed_android_manifest): $(MANIFEST_FIXER) $(fixed_android_manifest): $(main_android_manifest) echo $(PRIVATE_OPTIONAL_SDK_LIB_NAMES) | tr ' ' '\n' > $(PRIVATE_EXPORTED_SDK_LIBS_FILE).optional @@ -109,3 +119,5 @@ $(fixed_android_manifest): $(main_android_manifest) ) \ $< $@ rm $(PRIVATE_EXPORTED_SDK_LIBS_FILE).optional + +my_optional_sdk_lib_names :=