Loading dexpreopt/dexpreopt.go +34 −25 Original line number Diff line number Diff line Loading @@ -95,22 +95,6 @@ func GenerateDexpreoptRule(global GlobalConfig, module ModuleConfig) (rule *Rule rule = &Rule{} dexpreoptDisabled := contains(global.DisablePreoptModules, module.Name) if contains(global.BootJars, module.Name) { // Don't preopt individual boot jars, they will be preopted together dexpreoptDisabled = true } // If OnlyPreoptBootImageAndSystemServer=true and module is not in boot class path skip // Also preopt system server jars since selinux prevents system server from loading anything from // /data. If we don't do this they will need to be extracted which is not favorable for RAM usage // or performance. If PreoptExtractedApk is true, we ignore the only preopt boot image options. if global.OnlyPreoptBootImageAndSystemServer && !contains(global.BootJars, module.Name) && !contains(global.SystemServerJars, module.Name) && !module.PreoptExtractedApk { dexpreoptDisabled = true } generateProfile := module.ProfileClassListing != "" && !global.DisableGenerateProfile var profile string Loading @@ -118,7 +102,10 @@ func GenerateDexpreoptRule(global GlobalConfig, module ModuleConfig) (rule *Rule profile = profileCommand(global, module, rule) } if !dexpreoptDisabled { if !dexpreoptDisabled(global, module) { // Don't preopt individual boot jars, they will be preopted together. // This check is outside dexpreoptDisabled because they still need to be stripped. if !contains(global.BootJars, module.Name) { appImage := (generateProfile || module.ForceCreateAppImage || global.DefaultAppImages) && !module.NoCreateAppImage Loading @@ -132,10 +119,28 @@ func GenerateDexpreoptRule(global GlobalConfig, module ModuleConfig) (rule *Rule dexpreoptCommand(global, module, rule, profile, arch, imageLocation, appImage, generateDM) } } } return rule, nil } func dexpreoptDisabled(global GlobalConfig, module ModuleConfig) bool { if contains(global.DisablePreoptModules, module.Name) { return true } // If OnlyPreoptBootImageAndSystemServer=true and module is not in boot class path skip // Also preopt system server jars since selinux prevents system server from loading anything from // /data. If we don't do this they will need to be extracted which is not favorable for RAM usage // or performance. If PreoptExtractedApk is true, we ignore the only preopt boot image options. if global.OnlyPreoptBootImageAndSystemServer && !contains(global.BootJars, module.Name) && !contains(global.SystemServerJars, module.Name) && !module.PreoptExtractedApk { return true } return false } func profileCommand(global GlobalConfig, module ModuleConfig, rule *Rule) string { profilePath := filepath.Join(filepath.Dir(module.BuildPath), "profile.prof") profileInstalledPath := module.DexLocation + ".prof" Loading Loading @@ -445,6 +450,10 @@ func dexpreoptCommand(global GlobalConfig, module ModuleConfig, rule *Rule, prof func shouldStripDex(module ModuleConfig, global GlobalConfig) bool { strip := !global.DefaultNoStripping if dexpreoptDisabled(global, module) { strip = false } // Don't strip modules that are not on the system partition in case the oat/vdex version in system ROM // doesn't match the one in other partitions. It needs to be able to fall back to the APK for that case. if !strings.HasPrefix(module.DexLocation, SystemPartition) { Loading Loading
dexpreopt/dexpreopt.go +34 −25 Original line number Diff line number Diff line Loading @@ -95,22 +95,6 @@ func GenerateDexpreoptRule(global GlobalConfig, module ModuleConfig) (rule *Rule rule = &Rule{} dexpreoptDisabled := contains(global.DisablePreoptModules, module.Name) if contains(global.BootJars, module.Name) { // Don't preopt individual boot jars, they will be preopted together dexpreoptDisabled = true } // If OnlyPreoptBootImageAndSystemServer=true and module is not in boot class path skip // Also preopt system server jars since selinux prevents system server from loading anything from // /data. If we don't do this they will need to be extracted which is not favorable for RAM usage // or performance. If PreoptExtractedApk is true, we ignore the only preopt boot image options. if global.OnlyPreoptBootImageAndSystemServer && !contains(global.BootJars, module.Name) && !contains(global.SystemServerJars, module.Name) && !module.PreoptExtractedApk { dexpreoptDisabled = true } generateProfile := module.ProfileClassListing != "" && !global.DisableGenerateProfile var profile string Loading @@ -118,7 +102,10 @@ func GenerateDexpreoptRule(global GlobalConfig, module ModuleConfig) (rule *Rule profile = profileCommand(global, module, rule) } if !dexpreoptDisabled { if !dexpreoptDisabled(global, module) { // Don't preopt individual boot jars, they will be preopted together. // This check is outside dexpreoptDisabled because they still need to be stripped. if !contains(global.BootJars, module.Name) { appImage := (generateProfile || module.ForceCreateAppImage || global.DefaultAppImages) && !module.NoCreateAppImage Loading @@ -132,10 +119,28 @@ func GenerateDexpreoptRule(global GlobalConfig, module ModuleConfig) (rule *Rule dexpreoptCommand(global, module, rule, profile, arch, imageLocation, appImage, generateDM) } } } return rule, nil } func dexpreoptDisabled(global GlobalConfig, module ModuleConfig) bool { if contains(global.DisablePreoptModules, module.Name) { return true } // If OnlyPreoptBootImageAndSystemServer=true and module is not in boot class path skip // Also preopt system server jars since selinux prevents system server from loading anything from // /data. If we don't do this they will need to be extracted which is not favorable for RAM usage // or performance. If PreoptExtractedApk is true, we ignore the only preopt boot image options. if global.OnlyPreoptBootImageAndSystemServer && !contains(global.BootJars, module.Name) && !contains(global.SystemServerJars, module.Name) && !module.PreoptExtractedApk { return true } return false } func profileCommand(global GlobalConfig, module ModuleConfig, rule *Rule) string { profilePath := filepath.Join(filepath.Dir(module.BuildPath), "profile.prof") profileInstalledPath := module.DexLocation + ".prof" Loading Loading @@ -445,6 +450,10 @@ func dexpreoptCommand(global GlobalConfig, module ModuleConfig, rule *Rule, prof func shouldStripDex(module ModuleConfig, global GlobalConfig) bool { strip := !global.DefaultNoStripping if dexpreoptDisabled(global, module) { strip = false } // Don't strip modules that are not on the system partition in case the oat/vdex version in system ROM // doesn't match the one in other partitions. It needs to be able to fall back to the APK for that case. if !strings.HasPrefix(module.DexLocation, SystemPartition) { Loading