Merge "Modify start/stop condition for mScreenDozeTimer."

This commit is contained in:
Treehugger Robot
2019-08-21 00:44:40 +00:00
committed by Gerrit Code Review

View File

@@ -4938,11 +4938,11 @@ public class BatteryStatsImpl extends BatteryStats {
final long uptime = mClocks.uptimeMillis();
boolean updateHistory = false;
if (isScreenDoze(state)) {
if (isScreenDoze(state) && !isScreenDoze(oldState)) {
mHistoryCur.states |= HistoryItem.STATE_SCREEN_DOZE_FLAG;
mScreenDozeTimer.startRunningLocked(elapsedRealtime);
updateHistory = true;
} else if (isScreenDoze(oldState)) {
} else if (isScreenDoze(oldState) && !isScreenDoze(state)) {
mHistoryCur.states &= ~HistoryItem.STATE_SCREEN_DOZE_FLAG;
mScreenDozeTimer.stopRunningLocked(elapsedRealtime);
updateHistory = true;