summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
author Ulyana Trafimovich <skvadrik@google.com> 2020-09-14 09:18:39 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-09-14 09:18:39 +0000
commit2fc25bbd4cbd7ed8db2c1e83e6ec4710452fd6a0 (patch)
tree691660cab115653535633e2f898019f186d03aec /java
parentc977a21419ca93a20dae5c836fd2fe24b2af9e4e (diff)
parente3bb01dfacfa4199552899a4dd35bd9043cf0da0 (diff)
Merge changes from topic "uses-libs-21"
* changes: Treat "org.apache.http.legacy" as optional <uses-library> by default. Consistently use default install path for compatibility <uses-library>.
Diffstat (limited to 'java')
-rw-r--r--java/android_manifest.go12
-rwxr-xr-xjava/app.go38
-rw-r--r--java/java.go1
3 files changed, 12 insertions, 39 deletions
diff --git a/java/android_manifest.go b/java/android_manifest.go
index 41fcafe0c..62cd11203 100644
--- a/java/android_manifest.go
+++ b/java/android_manifest.go
@@ -42,16 +42,6 @@ var manifestMergerRule = pctx.AndroidStaticRule("manifestMerger",
},
"args", "libs")
-// These two libs are added as optional dependencies (<uses-library> 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 (android:required=true) would prevent apps from being
-// installed to such legacy devices.
-var optionalUsesLibs = []string{
- "android.test.base",
- "android.test.mock",
-}
-
// Uses manifest_fixer.py to inject minSdkVersion, etc. into an AndroidManifest.xml
func manifestFixer(ctx android.ModuleContext, manifest android.Path, sdkContext sdkContext, sdkLibraries dexpreopt.LibraryPaths,
isLibrary, useEmbeddedNativeLibs, usesNonSdkApis, useEmbeddedDex, hasNoCode bool, loggingParent string) android.Path {
@@ -81,7 +71,7 @@ func manifestFixer(ctx android.ModuleContext, manifest android.Path, sdkContext
}
for _, usesLib := range android.SortedStringKeys(sdkLibraries) {
- if inList(usesLib, optionalUsesLibs) {
+ if inList(usesLib, dexpreopt.OptionalCompatUsesLibs) {
args = append(args, "--optional-uses-library", usesLib)
} else {
args = append(args, "--uses-library", usesLib)
diff --git a/java/app.go b/java/app.go
index dbc09e9df..ae7373fc7 100755
--- a/java/app.go
+++ b/java/app.go
@@ -787,7 +787,7 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
// Add implicit SDK libraries to <uses-library> list.
for _, usesLib := range android.SortedStringKeys(a.aapt.sdkLibraries) {
- a.usesLibrary.addLib(usesLib, inList(usesLib, optionalUsesLibs))
+ a.usesLibrary.addLib(usesLib, inList(usesLib, dexpreopt.OptionalCompatUsesLibs))
}
// Check that the <uses-library> list is coherent with the manifest.
@@ -1947,11 +1947,8 @@ func (u *usesLibrary) deps(ctx android.BottomUpMutatorContext, hasFrameworkLibs
if hasFrameworkLibs {
// Dexpreopt needs paths to the dex jars of these libraries in order to construct
// class loader context for dex2oat. Add them as a dependency with a special tag.
- ctx.AddVariationDependencies(nil, usesLibCompatTag,
- "org.apache.http.legacy",
- "android.hidl.base-V1.0-java",
- "android.hidl.manager-V1.0-java")
- ctx.AddVariationDependencies(nil, usesLibCompatTag, optionalUsesLibs...)
+ ctx.AddVariationDependencies(nil, usesLibTag, dexpreopt.CompatUsesLibs...)
+ ctx.AddVariationDependencies(nil, usesLibTag, dexpreopt.OptionalCompatUsesLibs...)
}
}
}
@@ -1969,27 +1966,14 @@ func (u *usesLibrary) usesLibraryPaths(ctx android.ModuleContext) dexpreopt.Libr
usesLibPaths := make(dexpreopt.LibraryPaths)
if !ctx.Config().UnbundledBuild() {
- ctx.VisitDirectDeps(func(m android.Module) {
- tag := ctx.OtherModuleDependencyTag(m)
- if tag == usesLibTag || tag == usesLibCompatTag {
- dep := ctx.OtherModuleName(m)
-
- if lib, ok := m.(Dependency); ok {
- buildPath := lib.DexJarBuildPath()
- installPath := lib.DexJarInstallPath()
- if installPath == nil && tag == usesLibCompatTag {
- // assume that compatibility libraries are in /system/framework
- installPath = android.PathForModuleInstall(ctx, "framework", dep+".jar")
- }
- usesLibPaths.AddLibraryPath(ctx, dep, buildPath, installPath)
-
- } else if ctx.Config().AllowMissingDependencies() {
- ctx.AddMissingDependencies([]string{dep})
-
- } else {
- ctx.ModuleErrorf("module %q in uses_libs or optional_uses_libs must be "+
- "a java library", dep)
- }
+ ctx.VisitDirectDepsWithTag(usesLibTag, func(m android.Module) {
+ dep := ctx.OtherModuleName(m)
+ if lib, ok := m.(Dependency); ok {
+ usesLibPaths.AddLibraryPath(ctx, dep, lib.DexJarBuildPath(), lib.DexJarInstallPath())
+ } else if ctx.Config().AllowMissingDependencies() {
+ ctx.AddMissingDependencies([]string{dep})
+ } else {
+ ctx.ModuleErrorf("module %q in uses_libs or optional_uses_libs must be a java library", dep)
}
})
}
diff --git a/java/java.go b/java/java.go
index 9830c51f6..82518c9db 100644
--- a/java/java.go
+++ b/java/java.go
@@ -570,7 +570,6 @@ var (
certificateTag = dependencyTag{name: "certificate"}
instrumentationForTag = dependencyTag{name: "instrumentation_for"}
usesLibTag = dependencyTag{name: "uses-library"}
- usesLibCompatTag = dependencyTag{name: "uses-library-compat"}
extraLintCheckTag = dependencyTag{name: "extra-lint-check"}
)