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

Commit 9f53412f authored by Todd Poynor's avatar Todd Poynor Committed by android-build-merger
Browse files

Merge "BackgroundDexOptService: skip low battery check if not present" am: e90cba21

am: f45d0cb9

Change-Id: I4192f48a73098b1fc20cacccc6acfec2e40d8e99
parents f2b27fc6 f45d0cb9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -144,6 +144,12 @@ public class BackgroundDexOptService extends JobService {
        Intent intent = registerReceiver(null, filter);
        int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
        int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
        boolean present = intent.getBooleanExtra(BatteryManager.EXTRA_PRESENT, true);

        if (!present) {
            // No battery, treat as if 100%, no possibility of draining battery.
            return 100;
        }

        if (level < 0 || scale <= 0) {
            // Battery data unavailable. This should never happen, so assume the worst.