Only generate app images for base APKs.
Generating app images for split APKs is meaningless because the runtime
can only load one app image per process.
Bug: 229268202
Test: atest ArtServiceTests
Ignore-AOSP-First: ART Services.
Change-Id: Ifc31a32656da762e531ce525c4d22248e2cf07fb
diff --git a/libartservice/service/java/com/android/server/art/DexOptimizer.java b/libartservice/service/java/com/android/server/art/DexOptimizer.java
index efc25f1..51443c6 100644
--- a/libartservice/service/java/com/android/server/art/DexOptimizer.java
+++ b/libartservice/service/java/com/android/server/art/DexOptimizer.java
@@ -141,7 +141,8 @@
Utils.check(Utils.implies(needsToBeShared, canBePublic));
PermissionSettings permissionSettings = getPermissionSettings(dexInfo, canBePublic);
- DexoptOptions dexoptOptions = getDexoptOptions(isProfileGuidedCompilerFilter);
+ DexoptOptions dexoptOptions =
+ getDexoptOptions(dexInfo, isProfileGuidedCompilerFilter);
for (Abi abi : getAllAbis(dexInfo)) {
@OptimizeResult.OptimizeStatus int status = OptimizeResult.OPTIMIZE_SKIPPED;
@@ -317,7 +318,8 @@
}
@NonNull
- private DexoptOptions getDexoptOptions(boolean isProfileGuidedFilter) {
+ private DexoptOptions getDexoptOptions(
+ @NonNull DexInfoType dexInfo, boolean isProfileGuidedFilter) {
DexoptOptions dexoptOptions = new DexoptOptions();
dexoptOptions.compilationReason = mParams.getReason();
dexoptOptions.targetSdkVersion = mPkg.getTargetSdkVersion();
@@ -325,7 +327,7 @@
// Generating a meaningful app image needs a profile to determine what to include in the
// image. Otherwise, the app image will be nearly empty.
dexoptOptions.generateAppImage =
- isProfileGuidedFilter && isAppImageAllowed() && isAppImageEnabled();
+ isProfileGuidedFilter && isAppImageAllowed(dexInfo) && isAppImageEnabled();
dexoptOptions.hiddenApiPolicyEnabled = isHiddenApiPolicyEnabled();
return dexoptOptions;
}
@@ -550,7 +552,7 @@
@NonNull protected abstract ProfilePath buildRefProfilePath(@NonNull DexInfoType dexInfo);
/** Returns true if app image (--app-image-fd) is allowed. */
- protected abstract boolean isAppImageAllowed();
+ protected abstract boolean isAppImageAllowed(@NonNull DexInfoType dexInfo);
/**
* Returns the data structure that represents the temporary profile to use during processing.