Loading services/java/com/android/server/power/PowerManagerService.java +27 −14 Original line number Original line Diff line number Diff line Loading @@ -1282,15 +1282,25 @@ public final class PowerManagerService extends IPowerManager.Stub return changed; return changed; } } // Also used when exiting a dream to determine whether we should go back /** // to being fully awake or else go to sleep for good. * Returns true if the device should go to sleep now. * Also used when exiting a dream to determine whether we should go back * to being fully awake or else go to sleep for good. */ private boolean isItBedTimeYetLocked() { private boolean isItBedTimeYetLocked() { return mBootCompleted && !mStayOn return mBootCompleted && !isScreenBeingKeptOnLocked(); && (mWakeLockSummary } & (WAKE_LOCK_SCREEN_BRIGHT | WAKE_LOCK_SCREEN_DIM | WAKE_LOCK_PROXIMITY_SCREEN_OFF)) == 0 /** && (mUserActivitySummary * Returns true if the screen is being kept on by a wake lock, user activity & (USER_ACTIVITY_SCREEN_BRIGHT | USER_ACTIVITY_SCREEN_DIM)) == 0; * or the stay on while powered setting. */ private boolean isScreenBeingKeptOnLocked() { return mStayOn || (mWakeLockSummary & (WAKE_LOCK_SCREEN_BRIGHT | WAKE_LOCK_SCREEN_DIM | WAKE_LOCK_PROXIMITY_SCREEN_OFF)) != 0 || (mUserActivitySummary & (USER_ACTIVITY_SCREEN_BRIGHT | USER_ACTIVITY_SCREEN_DIM)) != 0; } } /** /** Loading @@ -1298,6 +1308,9 @@ public final class PowerManagerService extends IPowerManager.Stub */ */ private void updateDreamLocked(int dirty) { private void updateDreamLocked(int dirty) { if ((dirty & (DIRTY_WAKEFULNESS if ((dirty & (DIRTY_WAKEFULNESS | DIRTY_USER_ACTIVITY | DIRTY_WAKE_LOCKS | DIRTY_BOOT_COMPLETED | DIRTY_SETTINGS | DIRTY_SETTINGS | DIRTY_IS_POWERED | DIRTY_IS_POWERED | DIRTY_STAY_ON | DIRTY_STAY_ON Loading Loading @@ -1380,15 +1393,15 @@ public final class PowerManagerService extends IPowerManager.Stub } } /** /** * Returns true if the device is allowed to dream in its current state, * Returns true if the device is allowed to dream in its current state * assuming that there was either an explicit request to nap or the user activity * assuming that it is currently napping or dreaming. * timeout expired and no wake locks are held. */ */ private boolean canDreamLocked() { private boolean canDreamLocked() { return mIsPowered return mDreamsSupportedConfig && mDreamsSupportedConfig && mDreamsEnabledSetting && mDreamsEnabledSetting && mDisplayPowerRequest.screenState != DisplayPowerRequest.SCREEN_STATE_OFF; && mDisplayPowerRequest.screenState != DisplayPowerRequest.SCREEN_STATE_OFF && mBootCompleted && (mIsPowered || isScreenBeingKeptOnLocked()); } } /** /** Loading Loading
services/java/com/android/server/power/PowerManagerService.java +27 −14 Original line number Original line Diff line number Diff line Loading @@ -1282,15 +1282,25 @@ public final class PowerManagerService extends IPowerManager.Stub return changed; return changed; } } // Also used when exiting a dream to determine whether we should go back /** // to being fully awake or else go to sleep for good. * Returns true if the device should go to sleep now. * Also used when exiting a dream to determine whether we should go back * to being fully awake or else go to sleep for good. */ private boolean isItBedTimeYetLocked() { private boolean isItBedTimeYetLocked() { return mBootCompleted && !mStayOn return mBootCompleted && !isScreenBeingKeptOnLocked(); && (mWakeLockSummary } & (WAKE_LOCK_SCREEN_BRIGHT | WAKE_LOCK_SCREEN_DIM | WAKE_LOCK_PROXIMITY_SCREEN_OFF)) == 0 /** && (mUserActivitySummary * Returns true if the screen is being kept on by a wake lock, user activity & (USER_ACTIVITY_SCREEN_BRIGHT | USER_ACTIVITY_SCREEN_DIM)) == 0; * or the stay on while powered setting. */ private boolean isScreenBeingKeptOnLocked() { return mStayOn || (mWakeLockSummary & (WAKE_LOCK_SCREEN_BRIGHT | WAKE_LOCK_SCREEN_DIM | WAKE_LOCK_PROXIMITY_SCREEN_OFF)) != 0 || (mUserActivitySummary & (USER_ACTIVITY_SCREEN_BRIGHT | USER_ACTIVITY_SCREEN_DIM)) != 0; } } /** /** Loading @@ -1298,6 +1308,9 @@ public final class PowerManagerService extends IPowerManager.Stub */ */ private void updateDreamLocked(int dirty) { private void updateDreamLocked(int dirty) { if ((dirty & (DIRTY_WAKEFULNESS if ((dirty & (DIRTY_WAKEFULNESS | DIRTY_USER_ACTIVITY | DIRTY_WAKE_LOCKS | DIRTY_BOOT_COMPLETED | DIRTY_SETTINGS | DIRTY_SETTINGS | DIRTY_IS_POWERED | DIRTY_IS_POWERED | DIRTY_STAY_ON | DIRTY_STAY_ON Loading Loading @@ -1380,15 +1393,15 @@ public final class PowerManagerService extends IPowerManager.Stub } } /** /** * Returns true if the device is allowed to dream in its current state, * Returns true if the device is allowed to dream in its current state * assuming that there was either an explicit request to nap or the user activity * assuming that it is currently napping or dreaming. * timeout expired and no wake locks are held. */ */ private boolean canDreamLocked() { private boolean canDreamLocked() { return mIsPowered return mDreamsSupportedConfig && mDreamsSupportedConfig && mDreamsEnabledSetting && mDreamsEnabledSetting && mDisplayPowerRequest.screenState != DisplayPowerRequest.SCREEN_STATE_OFF; && mDisplayPowerRequest.screenState != DisplayPowerRequest.SCREEN_STATE_OFF && mBootCompleted && (mIsPowered || isScreenBeingKeptOnLocked()); } } /** /** Loading