Dexpreopt standalone system server jars.
Standalone system server jars are dynamically loaded by system server using a `PathClassLoader` whose parent is `SYSTEMSERVERCLASSPATH`. They are listed in `PRODUCT_STANDALONE_SYSTEM_SERVER_JARS` and `PRODUCT_APEX_STANDALONE_SYSTEM_SERVER_JARS` in Makefile. We need to dexpreopt them to achieve better performance. Bug: 203198541 Test: m nothing Test: - 1. Add a standalone system server jar (e.g., by patching aosp/1906158) 2. Build a system image. 3. See the odex and vdex files generated in $ANDROID_PRODUCT_OUT/system/framework/oat/ 4. Flash the image to a device. 5. Run `atest art_standalone_dexpreopt_tests`. Change-Id: I358a62d34989c5c8eba12e18fe6167e0b72ff69d
This commit is contained in:
@@ -152,15 +152,16 @@ func (d *dexpreopter) dexpreoptDisabled(ctx android.BaseModuleContext) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
isApexSystemServerJar := global.AllApexSystemServerJars(ctx).ContainsJar(moduleName(ctx))
|
||||
if isApexVariant(ctx) {
|
||||
// Don't preopt APEX variant module unless the module is an APEX system server jar and we are
|
||||
// building the entire system image.
|
||||
if !global.ApexSystemServerJars.ContainsJar(moduleName(ctx)) || ctx.Config().UnbundledBuild() {
|
||||
if !isApexSystemServerJar || ctx.Config().UnbundledBuild() {
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
// Don't preopt the platform variant of an APEX system server jar to avoid conflicts.
|
||||
if global.ApexSystemServerJars.ContainsJar(moduleName(ctx)) {
|
||||
if isApexSystemServerJar {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -191,8 +192,8 @@ func (d *dexpreopter) odexOnSystemOther(ctx android.ModuleContext, installPath a
|
||||
func (d *dexpreopter) getInstallPath(
|
||||
ctx android.ModuleContext, defaultInstallPath android.InstallPath) android.InstallPath {
|
||||
global := dexpreopt.GetGlobalConfig(ctx)
|
||||
if global.ApexSystemServerJars.ContainsJar(moduleName(ctx)) {
|
||||
dexLocation := dexpreopt.GetSystemServerDexLocation(global, moduleName(ctx))
|
||||
if global.AllApexSystemServerJars(ctx).ContainsJar(moduleName(ctx)) {
|
||||
dexLocation := dexpreopt.GetSystemServerDexLocation(ctx, global, moduleName(ctx))
|
||||
return android.PathForModuleInPartitionInstall(ctx, "", strings.TrimPrefix(dexLocation, "/"))
|
||||
}
|
||||
if !d.dexpreoptDisabled(ctx) && isApexVariant(ctx) &&
|
||||
@@ -229,8 +230,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
|
||||
return
|
||||
}
|
||||
|
||||
isSystemServerJar := global.SystemServerJars.ContainsJar(moduleName(ctx)) ||
|
||||
global.ApexSystemServerJars.ContainsJar(moduleName(ctx))
|
||||
isSystemServerJar := global.AllSystemServerJars(ctx).ContainsJar(moduleName(ctx))
|
||||
|
||||
bootImage := defaultBootImageConfig(ctx)
|
||||
if global.UseArtImage {
|
||||
@@ -336,6 +336,8 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
|
||||
|
||||
dexpreoptRule.Build("dexpreopt", "dexpreopt")
|
||||
|
||||
isApexSystemServerJar := global.AllApexSystemServerJars(ctx).ContainsJar(moduleName(ctx))
|
||||
|
||||
for _, install := range dexpreoptRule.Installs() {
|
||||
// Remove the "/" prefix because the path should be relative to $ANDROID_PRODUCT_OUT.
|
||||
installDir := strings.TrimPrefix(filepath.Dir(install.To), "/")
|
||||
@@ -343,7 +345,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
|
||||
arch := filepath.Base(installDir)
|
||||
installPath := android.PathForModuleInPartitionInstall(ctx, "", installDir)
|
||||
|
||||
if global.ApexSystemServerJars.ContainsJar(moduleName(ctx)) {
|
||||
if isApexSystemServerJar {
|
||||
// APEX variants of java libraries are hidden from Make, so their dexpreopt
|
||||
// outputs need special handling. Currently, for APEX variants of java
|
||||
// libraries, only those in the system server classpath are handled here.
|
||||
@@ -362,7 +364,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
|
||||
}
|
||||
}
|
||||
|
||||
if !global.ApexSystemServerJars.ContainsJar(moduleName(ctx)) {
|
||||
if !isApexSystemServerJar {
|
||||
d.builtInstalled = dexpreoptRule.Installs().String()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user