Merge "Add android.test.base to class loader context for API version < 30." am: ad02d401ab
Change-Id: Ifa9b4e4d6ea5d01b487882db904e7ab6542133b6
This commit is contained in:
committed by
Automerger Merge Worker
commit
6200c519e2
@@ -241,6 +241,10 @@ func dexpreoptCommand(ctx android.PathContext, globalSoong *GlobalSoongConfig, g
|
|||||||
var conditionalClassLoaderContextHost29 android.Paths
|
var conditionalClassLoaderContextHost29 android.Paths
|
||||||
var conditionalClassLoaderContextTarget29 []string
|
var conditionalClassLoaderContextTarget29 []string
|
||||||
|
|
||||||
|
// Extra paths that will be appended to the class loader if the APK manifest has targetSdkVersion < 30
|
||||||
|
var conditionalClassLoaderContextHost30 android.Paths
|
||||||
|
var conditionalClassLoaderContextTarget30 []string
|
||||||
|
|
||||||
// A flag indicating if the '&' class loader context is used.
|
// A flag indicating if the '&' class loader context is used.
|
||||||
unknownClassLoaderContext := false
|
unknownClassLoaderContext := false
|
||||||
|
|
||||||
@@ -280,6 +284,17 @@ func dexpreoptCommand(ctx android.PathContext, globalSoong *GlobalSoongConfig, g
|
|||||||
pathForLibrary(module, hidlBase))
|
pathForLibrary(module, hidlBase))
|
||||||
conditionalClassLoaderContextTarget29 = append(conditionalClassLoaderContextTarget29,
|
conditionalClassLoaderContextTarget29 = append(conditionalClassLoaderContextTarget29,
|
||||||
filepath.Join("/system/framework", hidlBase+".jar"))
|
filepath.Join("/system/framework", hidlBase+".jar"))
|
||||||
|
|
||||||
|
// android.test.base contains classes that were in the default classpath until API 30.
|
||||||
|
// If the targetSdkVersion in the manifest or APK is < 30 then implicitly add it to the
|
||||||
|
// classpath for dexpreopt.
|
||||||
|
const testBase = "android.test.base"
|
||||||
|
if !contains(usesLibs, testBase) {
|
||||||
|
conditionalClassLoaderContextHost30 = append(conditionalClassLoaderContextHost30,
|
||||||
|
pathForLibrary(module, testBase))
|
||||||
|
conditionalClassLoaderContextTarget30 = append(conditionalClassLoaderContextTarget30,
|
||||||
|
filepath.Join("/system/framework", testBase+".jar"))
|
||||||
|
}
|
||||||
} else if jarIndex := android.IndexList(module.Name, systemServerJars); jarIndex >= 0 {
|
} else if jarIndex := android.IndexList(module.Name, systemServerJars); jarIndex >= 0 {
|
||||||
// System server jars should be dexpreopted together: class loader context of each jar
|
// System server jars should be dexpreopted together: class loader context of each jar
|
||||||
// should include all preceding jars on the system server classpath.
|
// should include all preceding jars on the system server classpath.
|
||||||
@@ -345,6 +360,11 @@ func dexpreoptCommand(ctx android.PathContext, globalSoong *GlobalSoongConfig, g
|
|||||||
Implicits(conditionalClassLoaderContextHost29)
|
Implicits(conditionalClassLoaderContextHost29)
|
||||||
rule.Command().Textf(`conditional_target_libs_29="%s"`,
|
rule.Command().Textf(`conditional_target_libs_29="%s"`,
|
||||||
strings.Join(conditionalClassLoaderContextTarget29, " "))
|
strings.Join(conditionalClassLoaderContextTarget29, " "))
|
||||||
|
rule.Command().Textf(`conditional_host_libs_30="%s"`,
|
||||||
|
strings.Join(conditionalClassLoaderContextHost30.Strings(), " ")).
|
||||||
|
Implicits(conditionalClassLoaderContextHost30)
|
||||||
|
rule.Command().Textf(`conditional_target_libs_30="%s"`,
|
||||||
|
strings.Join(conditionalClassLoaderContextTarget30, " "))
|
||||||
rule.Command().Text("source").Tool(globalSoong.ConstructContext).Input(module.DexPath)
|
rule.Command().Text("source").Tool(globalSoong.ConstructContext).Input(module.DexPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1863,6 +1863,7 @@ func (u *usesLibrary) deps(ctx android.BottomUpMutatorContext, hasFrameworkLibs
|
|||||||
"org.apache.http.legacy",
|
"org.apache.http.legacy",
|
||||||
"android.hidl.base-V1.0-java",
|
"android.hidl.base-V1.0-java",
|
||||||
"android.hidl.manager-V1.0-java")
|
"android.hidl.manager-V1.0-java")
|
||||||
|
ctx.AddVariationDependencies(nil, usesLibTag, optionalUsesLibs...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -230,6 +230,22 @@ func GatherRequiredDepsForTest() string {
|
|||||||
system_modules: "core-platform-api-stubs-system-modules",
|
system_modules: "core-platform-api-stubs-system-modules",
|
||||||
installable: true,
|
installable: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java_library {
|
||||||
|
name: "android.test.base",
|
||||||
|
srcs: ["a.java"],
|
||||||
|
sdk_version: "none",
|
||||||
|
system_modules: "core-platform-api-stubs-system-modules",
|
||||||
|
installable: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
java_library {
|
||||||
|
name: "android.test.mock",
|
||||||
|
srcs: ["a.java"],
|
||||||
|
sdk_version: "none",
|
||||||
|
system_modules: "core-platform-api-stubs-system-modules",
|
||||||
|
installable: true,
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
systemModules := []string{
|
systemModules := []string{
|
||||||
|
Reference in New Issue
Block a user