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

Commit 3067a1dd authored by Shubham Ajmera's avatar Shubham Ajmera
Browse files

Add a system property support to disable background dexopt job

Bug: 34812714
Test: Verified the property value on the device
Change-Id: Ibfa46f90a8df772eb684c0e5bd421e46a5798a85
parent 0b1a7a35
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -99,6 +99,10 @@ public class BackgroundDexOptService extends JobService {
            getDowngradeUnusedAppsThresholdInMillis();

    public static void schedule(Context context) {
        if (isBackgroundDexoptDisabled()) {
            return;
        }

        JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);

        // Schedule a one-off job which scans installed packages and updates
@@ -477,4 +481,9 @@ public class BackgroundDexOptService extends JobService {
        }
        return TimeUnit.DAYS.toMillis(Long.parseLong(sysPropValue));
    }

    private static boolean isBackgroundDexoptDisabled() {
        return SystemProperties.getBoolean("pm.dexopt.disable_bg_dexopt" /* key */,
                false /* default */);
    }
}