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:
Jiakai Zhang
2021-12-14 18:54:06 +00:00
parent f25ab75d63
commit 389a647320
7 changed files with 140 additions and 35 deletions

View File

@@ -100,6 +100,48 @@ type GlobalConfig struct {
RelaxUsesLibraryCheck bool
}
var allPlatformSystemServerJarsKey = android.NewOnceKey("allPlatformSystemServerJars")
// Returns all jars on the platform that system_server loads, including those on classpath and those
// loaded dynamically.
func (g *GlobalConfig) AllPlatformSystemServerJars(ctx android.PathContext) *android.ConfiguredJarList {
return ctx.Config().Once(allPlatformSystemServerJarsKey, func() interface{} {
res := g.SystemServerJars.AppendList(&g.StandaloneSystemServerJars)
return &res
}).(*android.ConfiguredJarList)
}
var allApexSystemServerJarsKey = android.NewOnceKey("allApexSystemServerJars")
// Returns all jars delivered via apex that system_server loads, including those on classpath and
// those loaded dynamically.
func (g *GlobalConfig) AllApexSystemServerJars(ctx android.PathContext) *android.ConfiguredJarList {
return ctx.Config().Once(allApexSystemServerJarsKey, func() interface{} {
res := g.ApexSystemServerJars.AppendList(&g.ApexStandaloneSystemServerJars)
return &res
}).(*android.ConfiguredJarList)
}
var allSystemServerClasspathJarsKey = android.NewOnceKey("allSystemServerClasspathJars")
// Returns all system_server classpath jars.
func (g *GlobalConfig) AllSystemServerClasspathJars(ctx android.PathContext) *android.ConfiguredJarList {
return ctx.Config().Once(allSystemServerClasspathJarsKey, func() interface{} {
res := g.SystemServerJars.AppendList(&g.ApexSystemServerJars)
return &res
}).(*android.ConfiguredJarList)
}
var allSystemServerJarsKey = android.NewOnceKey("allSystemServerJars")
// Returns all jars that system_server loads.
func (g *GlobalConfig) AllSystemServerJars(ctx android.PathContext) *android.ConfiguredJarList {
return ctx.Config().Once(allSystemServerJarsKey, func() interface{} {
res := g.AllPlatformSystemServerJars(ctx).AppendList(g.AllApexSystemServerJars(ctx))
return &res
}).(*android.ConfiguredJarList)
}
// GlobalSoongConfig contains the global config that is generated from Soong,
// stored in dexpreopt_soong.config.
type GlobalSoongConfig struct {