Preopt APEX system server jars from prebuilts.
Similar to the previous CL, but for jars from prebuilts.
Test: manual - 1. Patch aosp/1818020 and aosp/1810840.
2. m SOONG_CONFIG_art_module_source_build=false com.android.art
Bug: 194150908
Change-Id: Idc0c73a78045a602ad3a91cb5071d291bd611015
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index c4794dc..4833a64 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -178,13 +178,19 @@
// If the exported java module provides a dex jar path then add it to the list of apexFiles.
path := child.(interface{ DexJarBuildPath() android.Path }).DexJarBuildPath()
if path != nil {
- p.apexFilesForAndroidMk = append(p.apexFilesForAndroidMk, apexFile{
+ af := apexFile{
module: child,
moduleDir: ctx.OtherModuleDir(child),
androidMkModuleName: name,
builtFile: path,
class: javaSharedLib,
- })
+ }
+ if module, ok := child.(java.DexpreopterInterface); ok {
+ for _, install := range module.DexpreoptBuiltInstalledForApex() {
+ af.requiredModuleNames = append(af.requiredModuleNames, install.FullModuleName())
+ }
+ }
+ p.apexFilesForAndroidMk = append(p.apexFilesForAndroidMk, af)
}
} else if tag == exportedBootclasspathFragmentTag {
// Visit the children of the bootclasspath_fragment.
@@ -195,6 +201,14 @@
})
}
+func (p *prebuiltCommon) addRequiredModules(entries *android.AndroidMkEntries) {
+ for _, fi := range p.apexFilesForAndroidMk {
+ entries.AddStrings("LOCAL_REQUIRED_MODULES", fi.requiredModuleNames...)
+ entries.AddStrings("LOCAL_TARGET_REQUIRED_MODULES", fi.targetRequiredModuleNames...)
+ entries.AddStrings("LOCAL_HOST_REQUIRED_MODULES", fi.hostRequiredModuleNames...)
+ }
+}
+
func (p *prebuiltCommon) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := []android.AndroidMkEntries{
{
@@ -213,6 +227,7 @@
if len(postInstallCommands) > 0 {
entries.SetString("LOCAL_POST_INSTALL_CMD", strings.Join(postInstallCommands, " && "))
}
+ p.addRequiredModules(entries)
},
},
},