From df00ddecb6288f6d4bff4e6dbc260e3b837137a5 Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Fri, 29 May 2020 14:55:02 +0100 Subject: [PATCH] Don't use obsolete "org.apache.http.legacy.impl" in class loader context. This library no longer exists on device and "org.apache.http.legacy" should be used instead. The error lingered in the code for a while because the code was not exercised at all. (The only app that sets EnforceUsesLibraries is GoogleDialer (not in AOSP), and it specifies "org.apache.http.legacy" explicitly as an optional used library.) Test: lunch aosp_cf_x86_phone-userdebug && m Change-Id: I05fa115476315d35a8877fc42bd1c2042f72f2de --- dexpreopt/dexpreopt.go | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go index fc0356301..15d2ed22c 100644 --- a/dexpreopt/dexpreopt.go +++ b/dexpreopt/dexpreopt.go @@ -256,28 +256,22 @@ func dexpreoptCommand(ctx android.PathContext, globalSoong *GlobalSoongConfig, g filepath.Join("/system/framework", l+".jar")) } + // org.apache.http.legacy contains classes that were in the default classpath until API 28. + // If the targetSdkVersion in the manifest or APK is < 28, and the module does not explicitly + // depend on org.apache.http.legacy, then implicitly add it to the classpath for dexpreopt. const httpLegacy = "org.apache.http.legacy" - const httpLegacyImpl = "org.apache.http.legacy.impl" - - // org.apache.http.legacy contains classes that were in the default classpath until API 28. If the - // targetSdkVersion in the manifest or APK is < 28, and the module does not explicitly depend on - // org.apache.http.legacy, then implicitly add the classes to the classpath for dexpreopt. One the - // device the classes will be in a file called org.apache.http.legacy.impl.jar. - module.LibraryPaths[httpLegacyImpl] = module.LibraryPaths[httpLegacy] - - if !contains(module.UsesLibraries, httpLegacy) && !contains(module.PresentOptionalUsesLibraries, httpLegacy) { + if !contains(usesLibs, httpLegacy) { conditionalClassLoaderContextHost28 = append(conditionalClassLoaderContextHost28, - pathForLibrary(module, httpLegacyImpl)) + pathForLibrary(module, httpLegacy)) conditionalClassLoaderContextTarget28 = append(conditionalClassLoaderContextTarget28, - filepath.Join("/system/framework", httpLegacyImpl+".jar")) + filepath.Join("/system/framework", httpLegacy+".jar")) } - const hidlBase = "android.hidl.base-V1.0-java" - const hidlManager = "android.hidl.manager-V1.0-java" - // android.hidl.base-V1.0-java and android.hidl.manager-V1.0 contain classes that were in the default // classpath until API 29. If the targetSdkVersion in the manifest or APK is < 29 then implicitly add // the classes to the classpath for dexpreopt. + const hidlBase = "android.hidl.base-V1.0-java" + const hidlManager = "android.hidl.manager-V1.0-java" conditionalClassLoaderContextHost29 = append(conditionalClassLoaderContextHost29, pathForLibrary(module, hidlManager)) conditionalClassLoaderContextTarget29 = append(conditionalClassLoaderContextTarget29,