Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2fcf50c8 authored by Calin Juravle's avatar Calin Juravle
Browse files

Use the same reason for OTAs and First Boots

Quicken is now deprecated and there is no good reason to have OTAs
handled differently then first boots when it comes to the compiler
filter.

With this changes we will have:
- OTA and FirstBoot using pm.dexopt.first-boot reason
- BackgroudDexOptService# post-boot job using pm.dexopt.boot reason

Also, clean dalvik-cache pruning which is no longer a thing.

Test: m
Bug: 172114559
Change-Id: I75b388b211314bcc7cfee8d8394c3d81ffef2cc7
parent 0db5d441
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ public class BackgroundDexOptService extends JobService {
            // trade-off worth doing to save boot time work.
            int result = pm.performDexOptWithStatus(new DexoptOptions(
                    pkg,
                    PackageManagerService.REASON_BOOT,
                    PackageManagerService.REASON_POST_BOOT,
                    DexoptOptions.DEXOPT_BOOT_COMPLETE));
            if (result == PackageDexOptimizer.DEX_OPT_PERFORMED)  {
                updatedPackages.add(pkg);
+2 −1
Original line number Diff line number Diff line
@@ -687,7 +687,8 @@ public class PackageDexOptimizer {
        boolean generateCompactDex = true;
        switch (compilationReason) {
            case PackageManagerService.REASON_FIRST_BOOT:
            case PackageManagerService.REASON_BOOT:
            case PackageManagerService.REASON_BOOT_AFTER_OTA:
            case PackageManagerService.REASON_POST_BOOT:
            case PackageManagerService.REASON_INSTALL:
                 generateCompactDex = false;
        }
+14 −16
Original line number Diff line number Diff line
@@ -676,17 +676,18 @@ 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 = 1;
    public static final int REASON_INSTALL = 2;
    public static final int REASON_INSTALL_FAST = 3;
    public static final int REASON_INSTALL_BULK = 4;
    public static final int REASON_INSTALL_BULK_SECONDARY = 5;
    public static final int REASON_INSTALL_BULK_DOWNGRADED = 6;
    public static final int REASON_INSTALL_BULK_SECONDARY_DOWNGRADED = 7;
    public static final int REASON_BACKGROUND_DEXOPT = 8;
    public static final int REASON_AB_OTA = 9;
    public static final int REASON_INACTIVE_PACKAGE_DOWNGRADE = 10;
    public static final int REASON_SHARED = 11;
    public static final int REASON_BOOT_AFTER_OTA = 1;
    public static final int REASON_POST_BOOT = 2;
    public static final int REASON_INSTALL = 3;
    public static final int REASON_INSTALL_FAST = 4;
    public static final int REASON_INSTALL_BULK = 5;
    public static final int REASON_INSTALL_BULK_SECONDARY = 6;
    public static final int REASON_INSTALL_BULK_DOWNGRADED = 7;
    public static final int REASON_INSTALL_BULK_SECONDARY_DOWNGRADED = 8;
    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_LAST = REASON_SHARED;
@@ -9664,10 +9665,7 @@ public class PackageManagerService extends IPackageManager.Stub
        //       first boot, as they do not have profile data.
        boolean causeFirstBoot = isFirstBoot() || mIsPreNUpgrade;
        // We need to re-extract after a pruned cache, as AoT-ed files will be out of date.
        boolean causePrunedCache = VMRuntime.didPruneDalvikCache();
        if (!causeUpgrade && !causeFirstBoot && !causePrunedCache) {
        if (!causeUpgrade && !causeFirstBoot) {
            return;
        }
@@ -9684,7 +9682,7 @@ public class PackageManagerService extends IPackageManager.Stub
        final long startTime = System.nanoTime();
        final int[] stats = performDexOptUpgrade(pkgs, mIsPreNUpgrade /* showDialog */,
                    causeFirstBoot ? REASON_FIRST_BOOT : REASON_BOOT,
                    causeFirstBoot ? REASON_FIRST_BOOT : REASON_BOOT_AFTER_OTA,
                    false /* bootComplete */);
        final int elapsedTimeSeconds =
+2 −1
Original line number Diff line number Diff line
@@ -29,7 +29,8 @@ public class PackageManagerServiceCompilerMapping {
    // Names for compilation reasons.
    public static final String REASON_STRINGS[] = {
        "first-boot",
        "boot",
        "boot-after-ota",
        "post-boot",
        "install",
        "install-fast",
        "install-bulk",
+5 −2
Original line number Diff line number Diff line
@@ -587,7 +587,7 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
    private static final int TRON_COMPILATION_REASON_ERROR = 0;
    private static final int TRON_COMPILATION_REASON_UNKNOWN = 1;
    private static final int TRON_COMPILATION_REASON_FIRST_BOOT = 2;
    private static final int TRON_COMPILATION_REASON_BOOT = 3;
    private static final int TRON_COMPILATION_REASON_BOOT_DEPRECATED_SINCE_S = 3;
    private static final int TRON_COMPILATION_REASON_INSTALL = 4;
    private static final int TRON_COMPILATION_REASON_BG_DEXOPT = 5;
    private static final int TRON_COMPILATION_REASON_AB_OTA = 6;
@@ -605,6 +605,8 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
    private static final int TRON_COMPILATION_REASON_INSTALL_BULK_DOWNGRADED_WITH_DM = 18;
    private static final int
            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;

    // The annotation to add as a suffix to the compilation reason when dexopt was
    // performed with dex metadata.
@@ -618,7 +620,8 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
            case "unknown" : return TRON_COMPILATION_REASON_UNKNOWN;
            case "error" : return TRON_COMPILATION_REASON_ERROR;
            case "first-boot" : return TRON_COMPILATION_REASON_FIRST_BOOT;
            case "boot" : return TRON_COMPILATION_REASON_BOOT;
            case "boot-after-ota": return TRON_COMPILATION_REASON_BOOT_AFTER_OTA;
            case "post-boot" : return TRON_COMPILATION_REASON_POST_BOOT;
            case "install" : return TRON_COMPILATION_REASON_INSTALL;
            case "bg-dexopt" : return TRON_COMPILATION_REASON_BG_DEXOPT;
            case "ab-ota" : return TRON_COMPILATION_REASON_AB_OTA;
Loading