From e14f80b2d3454b7828be6aed6289b114d893de5f Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Thu, 15 Jul 2021 15:05:48 +0100 Subject: [PATCH] Fix handling of "prebuilt_" prefix in classLoaderContextForUsesLibDeps. Changes: - Cut off "prebuilt_" prefix from `dep`, not `libName`, because `dep` is used to replace library name in `usesLibraryProperties`, and these properties are specified without "prebuilt_" prefix. - Do not remove "prebuilt_" prefix on the return value of `ProvidesUsesLib()`: this boils down to `provides_uses_lib` property which is specified without the prefix. Bug: 193425964 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' -C1 # empty output, no errors Change-Id: I6cb65040027023d12ca0bc132d60c2c245174c40 --- java/app.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/app.go b/java/app.go index d464e38c0..4456b22dc 100755 --- a/java/app.go +++ b/java/app.go @@ -1262,12 +1262,12 @@ func (u *usesLibrary) classLoaderContextForUsesLibDeps(ctx android.ModuleContext return } - dep := ctx.OtherModuleName(m) + dep := android.RemoveOptionalPrebuiltPrefix(ctx.OtherModuleName(m)) if lib, ok := m.(UsesLibraryDependency); ok { - libName := android.RemoveOptionalPrebuiltPrefix(dep) + libName := dep if ulib, ok := m.(ProvidesUsesLib); ok && ulib.ProvidesUsesLib() != nil { - libName = android.RemoveOptionalPrebuiltPrefix(*ulib.ProvidesUsesLib()) + libName = *ulib.ProvidesUsesLib() // Replace module name with library name in `uses_libs`/`optional_uses_libs` in // order to pass verify_uses_libraries check (which compares these properties // against library names written in the manifest).