Dexpreopt standalone system server jars from prebuilts.
This change adds support for dexpreopting standalone system server jars from prebuilts. Bug: 203198541 Test: - 1. Add a standalone system server jar (e.g., by patching aosp/1906158) 2. Build and drop a module SDK and an APEX. 3. Build a system image from prebuilts. 4. See the odex and vdex files generated in $ANDROID_PRODUCT_OUT/system/framework/oat/ Change-Id: I8f4eaed10a1053cd560b8583efa12dc495f58db1
This commit is contained in:
@@ -182,7 +182,14 @@ func (j *TestHelperLibrary) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
}
|
||||
|
||||
func (prebuilt *Import) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
if prebuilt.hideApexVariantFromMake || !prebuilt.ContainingSdk().Unversioned() {
|
||||
if prebuilt.hideApexVariantFromMake {
|
||||
// For a library imported from a prebuilt APEX, we don't need a Make module for itself, as we
|
||||
// don't need to install it. However, we need to add its dexpreopt outputs as sub-modules, if it
|
||||
// is preopted.
|
||||
dexpreoptEntries := prebuilt.dexpreopter.AndroidMkEntriesForApex()
|
||||
return append(dexpreoptEntries, android.AndroidMkEntries{Disabled: true})
|
||||
}
|
||||
if !prebuilt.ContainingSdk().Unversioned() {
|
||||
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
||||
Disabled: true,
|
||||
}}
|
||||
|
@@ -115,6 +115,11 @@ func isApexVariant(ctx android.BaseModuleContext) bool {
|
||||
return !apexInfo.IsForPlatform()
|
||||
}
|
||||
|
||||
func forPrebuiltApex(ctx android.BaseModuleContext) bool {
|
||||
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
||||
return apexInfo.ForPrebuiltApex
|
||||
}
|
||||
|
||||
func moduleName(ctx android.BaseModuleContext) string {
|
||||
// Remove the "prebuilt_" prefix if the module is from a prebuilt because the prefix is not
|
||||
// expected by dexpreopter.
|
||||
@@ -134,7 +139,9 @@ func (d *dexpreopter) dexpreoptDisabled(ctx android.BaseModuleContext) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
if !ctx.Module().(DexpreopterInterface).IsInstallable() {
|
||||
// If the module is from a prebuilt APEX, it shouldn't be installable, but it can still be
|
||||
// dexpreopted.
|
||||
if !ctx.Module().(DexpreopterInterface).IsInstallable() && !forPrebuiltApex(ctx) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user