Merge "Add cmdline as a compilation reason" am: d71e3c3dda

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1711188

Change-Id: I254cacf922ce8a7c7f7d7397a2e9987d22055cbe
This commit is contained in:
Calin Juravle
2021-05-24 15:26:23 +00:00
committed by Automerger Merge Worker
4 changed files with 8 additions and 9 deletions

View File

@@ -674,7 +674,6 @@ public class PackageManagerService extends IPackageManager.Stub
}
// Compilation reasons.
public static final int REASON_UNKNOWN = -1;
public static final int REASON_FIRST_BOOT = 0;
public static final int REASON_BOOT_AFTER_OTA = 1;
public static final int REASON_POST_BOOT = 2;
@@ -687,7 +686,8 @@ public class PackageManagerService extends IPackageManager.Stub
public static final int REASON_BACKGROUND_DEXOPT = 9;
public static final int REASON_AB_OTA = 10;
public static final int REASON_INACTIVE_PACKAGE_DOWNGRADE = 11;
public static final int REASON_SHARED = 12;
public static final int REASON_CMDLINE = 12;
public static final int REASON_SHARED = 13;
public static final int REASON_LAST = REASON_SHARED;
@@ -9969,7 +9969,7 @@ public class PackageManagerService extends IPackageManager.Stub
int flags = (checkProfiles ? DexoptOptions.DEXOPT_CHECK_FOR_PROFILES_UPDATES : 0) |
(force ? DexoptOptions.DEXOPT_FORCE : 0) |
(bootComplete ? DexoptOptions.DEXOPT_BOOT_COMPLETE : 0);
return performDexOpt(new DexoptOptions(packageName, REASON_UNKNOWN,
return performDexOpt(new DexoptOptions(packageName, REASON_CMDLINE,
targetCompilerFilter, splitName, flags));
}

View File

@@ -40,6 +40,7 @@ public class PackageManagerServiceCompilerMapping {
"bg-dexopt",
"ab-ota",
"inactive",
"cmdline",
// "shared" must be the last entry
"shared"
};
@@ -141,9 +142,6 @@ public class PackageManagerServiceCompilerMapping {
}
public static String getReasonName(int reason) {
if (reason == PackageManagerService.REASON_UNKNOWN) {
return "unknown";
}
if (reason < 0 || reason >= REASON_STRINGS.length) {
throw new IllegalArgumentException("reason " + reason + " invalid");
}

View File

@@ -607,6 +607,7 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
TRON_COMPILATION_REASON_INSTALL_BULK_SECONDARY_DOWNGRADED_WITH_DM = 19;
private static final int TRON_COMPILATION_REASON_BOOT_AFTER_OTA = 20;
private static final int TRON_COMPILATION_REASON_POST_BOOT = 21;
private static final int TRON_COMPILATION_REASON_CMDLINE = 22;
// The annotation to add as a suffix to the compilation reason when dexopt was
// performed with dex metadata.
@@ -617,7 +618,7 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
*/
private static int getCompilationReasonTronValue(String compilationReason) {
switch (compilationReason) {
case "unknown" : return TRON_COMPILATION_REASON_UNKNOWN;
case "cmdline" : return TRON_COMPILATION_REASON_CMDLINE;
case "error" : return TRON_COMPILATION_REASON_ERROR;
case "first-boot" : return TRON_COMPILATION_REASON_FIRST_BOOT;
case "boot-after-ota": return TRON_COMPILATION_REASON_BOOT_AFTER_OTA;

View File

@@ -59,8 +59,6 @@ public class ArtStatsLogUtils {
private static final Map<Integer, Integer> COMPILATION_REASON_MAP = new HashMap();
static {
COMPILATION_REASON_MAP.put(PackageManagerService.REASON_UNKNOWN, ArtStatsLog.
ART_DATUM_REPORTED__COMPILATION_REASON__ART_COMPILATION_REASON_UNKNOWN);
COMPILATION_REASON_MAP.put(PackageManagerService.REASON_FIRST_BOOT, ArtStatsLog.
ART_DATUM_REPORTED__COMPILATION_REASON__ART_COMPILATION_REASON_FIRST_BOOT);
COMPILATION_REASON_MAP.put(PackageManagerService.REASON_BOOT_AFTER_OTA, ArtStatsLog.
@@ -86,6 +84,8 @@ public class ArtStatsLogUtils {
COMPILATION_REASON_MAP.put(PackageManagerService.REASON_INACTIVE_PACKAGE_DOWNGRADE,
ArtStatsLog.
ART_DATUM_REPORTED__COMPILATION_REASON__ART_COMPILATION_REASON_INACTIVE);
COMPILATION_REASON_MAP.put(PackageManagerService.REASON_CMDLINE,
ArtStatsLog.ART_DATUM_REPORTED__COMPILATION_REASON__ART_COMPILATION_REASON_CMDLINE);
COMPILATION_REASON_MAP.put(PackageManagerService.REASON_SHARED,
ArtStatsLog.ART_DATUM_REPORTED__COMPILATION_REASON__ART_COMPILATION_REASON_SHARED);
}