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

Commit f45d0cb9 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

Change-Id: I451ea71fe64e3c309a8722a3d155453b1a609a8f
parents 794be8d4 e90cba21
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.