Move logic from dreamDisplayGroupNoUpdateLocked into PowerGroup.
Add onWakefulnessChangedCallback which is called whenever the wakefulness of a PowerGroup changes. Set the wakefulness for a new PowerGroup to WAKEFULNESS_AWAKE instead of the current global wakefulness. This way the newly added PowerGroup will not directly go to sleep if the device happens to be asleep. Introduce per power group lastWakeTime and lastSleepTime. Rename setGlobalWakefulnessLocked() to updateGlobalWakefulnessLocked(), getGlobalWakefulnessLocked() to recalculateGlobalWakefulnessLocked() and getWakefulnessLocked() to getGlobalWakefulnessLocked(). Rename dreamDisplayGroupNoUpdateLocked() to dreamPowerGroupLocked(). Rename sleepDisplayGroupNoUpdateLocked() to dozePowerGroupLocked(). Rename reallySleepDisplayGroupNoUpdateLocked() to sleepPowerGroupLocked(). Rename wakeDisplayGroupNoUpdateLocked() to wakePowerGroupLocked(). Test: atest FrameworksServicesTests:PowerManagerServiceTest Bug: 200653844 Change-Id: Ic90f3b0c116e8e9db7df730f1500c0e8b99fe677
Loading
Please register or sign in to comment