From f5d91bb3b4cb907a4fbcd1ea6cf36b9d1a3094ed Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Wed, 4 May 2022 12:00:02 +0100 Subject: Revert "Don't add `uses_libs`/`optional_uses_libs` to the manifest_fixer." This reverts commit 0b1c70efbcbb0c8408f44964923f5b156d025936. The reverted commit was based on the idea that uses-libraries that are explicitly specified in build files should not be implicitly added to the manifest, as that would mean that anything added to the build files will flow to the manifest. Although this logic is correct, it prevents propagation of uses-libraries from dependencies, which is wrong: if a library has an explicit uses-library property in Android.bp, this property is expected to be propagated to the library's dependencies. Failing to do so would mean that every user of that library has to add uses-library property to their build files, which doesn't scale (see b/214255490 for example). 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: I6f420e76a89aa2f37be99f877711736640f2c361 --- java/base.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'java/base.go') diff --git a/java/base.go b/java/base.go index 4932c4831..4eba61871 100644 --- a/java/base.go +++ b/java/base.go @@ -720,8 +720,10 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) { if component, ok := dep.(SdkLibraryComponentDependency); ok { if lib := component.OptionalSdkLibraryImplementation(); lib != nil { // Add library as optional if it's one of the optional compatibility libs. - optional := android.InList(*lib, dexpreopt.OptionalCompatUsesLibs) - tag := makeUsesLibraryDependencyTag(dexpreopt.AnySdkVersion, optional, true) + tag := usesLibReqTag + if android.InList(*lib, dexpreopt.OptionalCompatUsesLibs) { + tag = usesLibOptTag + } ctx.AddVariationDependencies(nil, tag, *lib) } } -- cgit v1.2.3-59-g8ed1b