Merge "Fix charging reporting logic."

This commit is contained in:
TreeHugger Robot
2021-07-20 16:13:10 +00:00
committed by Android (Google) Code Review

View File

@@ -103,14 +103,8 @@ public final class BatteryController extends RestrictingController {
boolean reportChange = false;
for (int i = mTrackedTasks.size() - 1; i >= 0; i--) {
final JobStatus ts = mTrackedTasks.valueAt(i);
boolean previous = ts.setChargingConstraintSatisfied(nowElapsed, stablePower);
if (previous != stablePower) {
reportChange = true;
}
previous = ts.setBatteryNotLowConstraintSatisfied(nowElapsed, batteryNotLow);
if (previous != batteryNotLow) {
reportChange = true;
}
reportChange |= ts.setChargingConstraintSatisfied(nowElapsed, stablePower);
reportChange |= ts.setBatteryNotLowConstraintSatisfied(nowElapsed, batteryNotLow);
}
if (stablePower || batteryNotLow) {
// If one of our conditions has been satisfied, always schedule any newly ready jobs.