Merge "Add cmdline as a compilation reason"

This commit is contained in:
Calin Juravle
2021-05-24 15:06:35 +00:00
committed by Gerrit Code Review
4 changed files with 8 additions and 9 deletions

View File

@@ -674,7 +674,6 @@ public class PackageManagerService extends IPackageManager.Stub
} }
// Compilation reasons. // Compilation reasons.
public static final int REASON_UNKNOWN = -1;
public static final int REASON_FIRST_BOOT = 0; public static final int REASON_FIRST_BOOT = 0;
public static final int REASON_BOOT_AFTER_OTA = 1; public static final int REASON_BOOT_AFTER_OTA = 1;
public static final int REASON_POST_BOOT = 2; 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_BACKGROUND_DEXOPT = 9;
public static final int REASON_AB_OTA = 10; public static final int REASON_AB_OTA = 10;
public static final int REASON_INACTIVE_PACKAGE_DOWNGRADE = 11; 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; 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) | int flags = (checkProfiles ? DexoptOptions.DEXOPT_CHECK_FOR_PROFILES_UPDATES : 0) |
(force ? DexoptOptions.DEXOPT_FORCE : 0) | (force ? DexoptOptions.DEXOPT_FORCE : 0) |
(bootComplete ? DexoptOptions.DEXOPT_BOOT_COMPLETE : 0); (bootComplete ? DexoptOptions.DEXOPT_BOOT_COMPLETE : 0);
return performDexOpt(new DexoptOptions(packageName, REASON_UNKNOWN, return performDexOpt(new DexoptOptions(packageName, REASON_CMDLINE,
targetCompilerFilter, splitName, flags)); targetCompilerFilter, splitName, flags));
} }

View File

@@ -40,6 +40,7 @@ public class PackageManagerServiceCompilerMapping {
"bg-dexopt", "bg-dexopt",
"ab-ota", "ab-ota",
"inactive", "inactive",
"cmdline",
// "shared" must be the last entry // "shared" must be the last entry
"shared" "shared"
}; };
@@ -141,9 +142,6 @@ public class PackageManagerServiceCompilerMapping {
} }
public static String getReasonName(int reason) { public static String getReasonName(int reason) {
if (reason == PackageManagerService.REASON_UNKNOWN) {
return "unknown";
}
if (reason < 0 || reason >= REASON_STRINGS.length) { if (reason < 0 || reason >= REASON_STRINGS.length) {
throw new IllegalArgumentException("reason " + reason + " invalid"); 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; 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_BOOT_AFTER_OTA = 20;
private static final int TRON_COMPILATION_REASON_POST_BOOT = 21; 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 // The annotation to add as a suffix to the compilation reason when dexopt was
// performed with dex metadata. // performed with dex metadata.
@@ -617,7 +618,7 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
*/ */
private static int getCompilationReasonTronValue(String compilationReason) { private static int getCompilationReasonTronValue(String compilationReason) {
switch (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 "error" : return TRON_COMPILATION_REASON_ERROR;
case "first-boot" : return TRON_COMPILATION_REASON_FIRST_BOOT; case "first-boot" : return TRON_COMPILATION_REASON_FIRST_BOOT;
case "boot-after-ota": return TRON_COMPILATION_REASON_BOOT_AFTER_OTA; 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(); private static final Map<Integer, Integer> COMPILATION_REASON_MAP = new HashMap();
static { 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. COMPILATION_REASON_MAP.put(PackageManagerService.REASON_FIRST_BOOT, ArtStatsLog.
ART_DATUM_REPORTED__COMPILATION_REASON__ART_COMPILATION_REASON_FIRST_BOOT); ART_DATUM_REPORTED__COMPILATION_REASON__ART_COMPILATION_REASON_FIRST_BOOT);
COMPILATION_REASON_MAP.put(PackageManagerService.REASON_BOOT_AFTER_OTA, ArtStatsLog. 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, COMPILATION_REASON_MAP.put(PackageManagerService.REASON_INACTIVE_PACKAGE_DOWNGRADE,
ArtStatsLog. ArtStatsLog.
ART_DATUM_REPORTED__COMPILATION_REASON__ART_COMPILATION_REASON_INACTIVE); 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, COMPILATION_REASON_MAP.put(PackageManagerService.REASON_SHARED,
ArtStatsLog.ART_DATUM_REPORTED__COMPILATION_REASON__ART_COMPILATION_REASON_SHARED); ArtStatsLog.ART_DATUM_REPORTED__COMPILATION_REASON__ART_COMPILATION_REASON_SHARED);
} }