Loading core/java/android/os/PowerManagerInternal.java +11 −1 Original line number Diff line number Diff line Loading @@ -229,12 +229,22 @@ public abstract class PowerManagerInternal { public abstract void uidIdle(int uid); /** * Checks if the wakefulness of the supplied group is interactive. */ public abstract boolean isGroupInteractive(int groupId); /** Returns if any of the default adjacent group is interactive. */ public abstract boolean isAnyDefaultAdjacentGroupInteractive(); /** Returns if the supplied group is adjacent to the default group. */ public abstract boolean isDefaultGroupAdjacent(int groupId); /** * Used to notify the power manager that wakelocks should be disabled. * * @param force {@code true} to activate force disable wakelocks, {@code false} to turn it off. */ public abstract void setForceDisableWakelocks(boolean force); /** Loading services/core/java/com/android/server/display/LogicalDisplayMapper.java +4 −5 Original line number Diff line number Diff line Loading @@ -1100,14 +1100,12 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { decidedGroupId = calculateGroupId(requiredGroupType, mDisplayGroups); groupName = requiredGroupType; } // Get the new display group if a change is needed, if display group name is empty and // {@code DisplayDeviceInfo.FLAG_OWN_DISPLAY_GROUP} is not set, and required group type // has not been decided, the display is assigned to the default display group. final boolean needsOwnDisplayGroup = (displayDeviceInfo.flags & DisplayDeviceInfo.FLAG_OWN_DISPLAY_GROUP) != 0 || !TextUtils.isEmpty(groupName); final boolean hasOwnDisplayGroup = groupId != Display.DEFAULT_DISPLAY_GROUP; final boolean needsDeviceDisplayGroup = !needsOwnDisplayGroup && linkedDeviceUniqueId != null; Loading @@ -1118,7 +1116,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { || hasDeviceDisplayGroup != needsDeviceDisplayGroup || decidedGroupId != Display.INVALID_DISPLAY_GROUP) { groupId = assignDisplayGroupIdLocked(needsOwnDisplayGroup, assignDisplayGroupIdLocked(needsDeviceDisplayGroup, needsOwnDisplayGroup, display.getLayoutGroupNameLocked(), needsDeviceDisplayGroup, linkedDeviceUniqueId, decidedGroupId); } Loading Loading @@ -1351,9 +1349,10 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { } } private int assignDisplayGroupIdLocked(boolean isOwnDisplayGroup, String displayGroupName, private int assignDisplayGroupIdLocked(boolean needsDeviceDisplayGroup, boolean isOwnDisplayGroup, String displayGroupName, boolean isDeviceDisplayGroup, Integer linkedDeviceUniqueId, int decidedGroupId) { if (decidedGroupId != Display.INVALID_DISPLAY_GROUP) { if (decidedGroupId != Display.INVALID_DISPLAY_GROUP && !needsDeviceDisplayGroup) { return decidedGroupId; } if (isDeviceDisplayGroup && linkedDeviceUniqueId != null) { Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +54 −10 Original line number Diff line number Diff line Loading @@ -1327,11 +1327,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } sleepDefaultDisplay(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, flags); goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, flags); return true; } private void sleepDefaultDisplay(long eventTime, int reason, int flags) { private void goToSleep(long eventTime, int reason, int flags) { mRequestedOrSleepingDefaultDisplay = true; mPowerManager.goToSleep(eventTime, reason, flags); } Loading Loading @@ -1369,7 +1369,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { Settings.Global.THEATER_MODE_ON, 1); if (mGoToSleepOnButtonPressTheaterMode && interactive) { sleepDefaultDisplay(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, 0); } } Loading Loading @@ -1542,7 +1542,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { case SHORT_PRESS_SLEEP_GO_TO_SLEEP: case SHORT_PRESS_SLEEP_GO_TO_SLEEP_AND_GO_HOME: Slog.i(TAG, "sleepRelease() calling goToSleep(GO_TO_SLEEP_REASON_SLEEP_BUTTON)"); sleepDefaultDisplay(eventTime, PowerManager.GO_TO_SLEEP_REASON_SLEEP_BUTTON, 0); goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_SLEEP_BUTTON, 0); break; } } Loading Loading @@ -4623,7 +4623,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } if ((mEndcallBehavior & Settings.System.END_BUTTON_BEHAVIOR_SLEEP) != 0) { sleepDefaultDisplay(event.getEventTime(), goToSleep(event.getEventTime(), PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, 0); isWakeKey = false; } Loading Loading @@ -5274,6 +5274,45 @@ public class PhoneWindowManager implements WindowManagerPolicy { mDeviceGoingToSleep = false; } // Both the default and default adjacent groups should be non interactive private boolean isReadyToSignalSleep(int displayGroupId) { if (!com.android.server.display.feature.flags.Flags.separateTimeouts()) { return displayGroupId == Display.DEFAULT_DISPLAY_GROUP; } // We only care about default and default-adjacent groups if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP && !mPowerManagerInternal.isDefaultGroupAdjacent(displayGroupId)) { return false; } boolean areAllDefaultAdjacentGroupsNonInteractive = !mPowerManagerInternal.isAnyDefaultAdjacentGroupInteractive(); boolean isDefaultGroupNonInteractive = !mPowerManagerInternal.isGroupInteractive(DEFAULT_DISPLAY); return areAllDefaultAdjacentGroupsNonInteractive && isDefaultGroupNonInteractive; } // Either of the default or default adjacent groups should be interactive private boolean isReadyToSignalWakeup(int displayGroupId) { if (!com.android.server.display.feature.flags.Flags.separateTimeouts()) { return displayGroupId == Display.DEFAULT_DISPLAY_GROUP; } // We only care about default and default-adjacent groups if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP && !mPowerManagerInternal.isDefaultGroupAdjacent(displayGroupId)) { return false; } boolean isAnyDefaultAdjacentGroupInteractive = mPowerManagerInternal.isAnyDefaultAdjacentGroupInteractive(); boolean isDefaultGroupInteractive = mPowerManagerInternal .isGroupInteractive(DEFAULT_DISPLAY); return isAnyDefaultAdjacentGroupInteractive || isDefaultGroupInteractive; } // Called on the PowerManager's Notifier thread. @Override public void startedGoingToSleep(int displayGroupId, Loading @@ -5284,7 +5323,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManagerPolicyConstants.translateSleepReasonToOffReason( pmSleepReason)) + ")"); } if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { if (!isReadyToSignalSleep(displayGroupId)) { return; } Loading @@ -5300,9 +5340,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { @Override public void finishedGoingToSleep(int displayGroupId, @PowerManager.GoToSleepReason int pmSleepReason) { if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { if (!isReadyToSignalSleep(displayGroupId)) { return; } EventLogTags.writeScreenToggled(0); if (DEBUG_WAKEUP) { Slog.i(TAG, "Finished going to sleep... (groupId=" + displayGroupId + " why=" Loading Loading @@ -5344,9 +5385,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManagerPolicyConstants.translateWakeReasonToOnReason( pmWakeReason)) + ")"); } if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { if (!isReadyToSignalWakeup(displayGroupId)) { return; } EventLogTags.writeScreenToggled(1); mIsGoingToSleepDefaultDisplay = false; Loading Loading @@ -5378,7 +5421,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManagerPolicyConstants.translateWakeReasonToOnReason( pmWakeReason)) + ")"); } if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { if (!isReadyToSignalWakeup(displayGroupId)) { return; } Loading Loading @@ -6043,7 +6087,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mWindowManagerFuncs.lockDeviceNow(); break; case LID_BEHAVIOR_SLEEP: sleepDefaultDisplay(SystemClock.uptimeMillis(), goToSleep(SystemClock.uptimeMillis(), PowerManager.GO_TO_SLEEP_REASON_LID_SWITCH, PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE); break; Loading services/core/java/com/android/server/power/PowerGroup.java +58 −3 Original line number Diff line number Diff line Loading @@ -107,6 +107,8 @@ public class PowerGroup { private final long mDimDuration; private final long mScreenOffTimeout; private boolean mDreamManagerAttemptedDozing; PowerGroup(int groupId, PowerGroupListener wakefulnessListener, Notifier notifier, DisplayManagerInternal displayManagerInternal, int wakefulness, boolean ready, boolean supportsSandman, long eventTime, PowerManagerFlags featureFlags, Loading Loading @@ -211,6 +213,12 @@ public class PowerGroup { mLastSleepReason = reason; } } // Since the group is transitioning to interactive wakefulness, we should reset the // previous attempt of doze made by DreamManager if (isInteractive(newWakefulness)) { setDreamManagerAttemptedDozingLocked(/* dreamManagerAttemptedDozing */ false); } mWakefulness = newWakefulness; mWakefulnessListener.onWakefulnessChangedLocked(mGroupId, mWakefulness, eventTime, reason, uid, opUid, opPackageName, details); Loading @@ -219,6 +227,33 @@ public class PowerGroup { return false; } /** * Sets the dreamManagerAttemptedDozing status, indicating if the DreamManager attempted to * put the group to doze. This being true doesn't necessarily mean that the group is dozing * as it can fail in that attempt */ public void setDreamManagerAttemptedDozingLocked(boolean dreamManagerAttemptedDozing) { Slog.i(TAG, "dreamManagerAttemptedDozing status changed to " + dreamManagerAttemptedDozing + " for group " + mGroupId); mDreamManagerAttemptedDozing = dreamManagerAttemptedDozing; } public boolean isDefaultOrAdjacentGroup() { return isDefaultGroupAdjacent() || getGroupId() == Display.DEFAULT_DISPLAY_GROUP; } /** * A group can transition from sleep to doze * 1. It is a default display * 2. com.android.server.display.feature.flags.Flags.separateTimeouts() is enabled * 3. Is non interactive */ public boolean canTransitionBetweenNonInteractiveStates() { return (com.android.server.display.feature.flags.Flags.separateTimeouts()) && (getGroupId() == Display.DEFAULT_DISPLAY_GROUP) && !isInteractive(getWakefulnessLocked()); } /** * Returns {@code true} if every display in this group has its requested state matching * its actual state. Loading Loading @@ -258,8 +293,7 @@ public class PowerGroup { return mPoweringOn; } @VisibleForTesting boolean isDefaultGroupAdjacent() { public boolean isDefaultGroupAdjacent() { return mIsDefaultGroupAdjacent; } Loading Loading @@ -324,9 +358,27 @@ public class PowerGroup { } boolean dozeLocked(long eventTime, int uid, @PowerManager.GoToSleepReason int reason) { if (eventTime < getLastWakeTimeLocked() || !isInteractive(mWakefulness)) { return dozeLocked(eventTime, uid, reason, false); } boolean dozeLocked(long eventTime, int uid, @PowerManager.GoToSleepReason int reason, boolean allowSleepToDozeTransition) { if (!com.android.server.display.feature.flags.Flags.separateTimeouts()) { allowSleepToDozeTransition = false; } if (eventTime < getLastWakeTimeLocked() || mWakefulness == WAKEFULNESS_DOZING) { return false; } if (mWakefulness == WAKEFULNESS_ASLEEP) { if (!allowSleepToDozeTransition) { return false; } if (mDreamManagerAttemptedDozing) { return false; } } Trace.traceBegin(Trace.TRACE_TAG_POWER, "powerOffDisplay"); try { Loading Loading @@ -586,6 +638,9 @@ public class PowerGroup { + "\nmDimDuration=" + mDimDuration + "\nmWakefulness=" + mWakefulness + "\nmIsDefaultGroupAdjacent=" + mIsDefaultGroupAdjacent + "\nmSupportsSandman=" + mSupportsSandman + "\nmDreamManagerAttemptedDozing=" + mDreamManagerAttemptedDozing + "\nmScreenOffTimeout=" + mScreenOffTimeout; } Loading services/core/java/com/android/server/power/PowerManagerService.java +134 −20 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
core/java/android/os/PowerManagerInternal.java +11 −1 Original line number Diff line number Diff line Loading @@ -229,12 +229,22 @@ public abstract class PowerManagerInternal { public abstract void uidIdle(int uid); /** * Checks if the wakefulness of the supplied group is interactive. */ public abstract boolean isGroupInteractive(int groupId); /** Returns if any of the default adjacent group is interactive. */ public abstract boolean isAnyDefaultAdjacentGroupInteractive(); /** Returns if the supplied group is adjacent to the default group. */ public abstract boolean isDefaultGroupAdjacent(int groupId); /** * Used to notify the power manager that wakelocks should be disabled. * * @param force {@code true} to activate force disable wakelocks, {@code false} to turn it off. */ public abstract void setForceDisableWakelocks(boolean force); /** Loading
services/core/java/com/android/server/display/LogicalDisplayMapper.java +4 −5 Original line number Diff line number Diff line Loading @@ -1100,14 +1100,12 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { decidedGroupId = calculateGroupId(requiredGroupType, mDisplayGroups); groupName = requiredGroupType; } // Get the new display group if a change is needed, if display group name is empty and // {@code DisplayDeviceInfo.FLAG_OWN_DISPLAY_GROUP} is not set, and required group type // has not been decided, the display is assigned to the default display group. final boolean needsOwnDisplayGroup = (displayDeviceInfo.flags & DisplayDeviceInfo.FLAG_OWN_DISPLAY_GROUP) != 0 || !TextUtils.isEmpty(groupName); final boolean hasOwnDisplayGroup = groupId != Display.DEFAULT_DISPLAY_GROUP; final boolean needsDeviceDisplayGroup = !needsOwnDisplayGroup && linkedDeviceUniqueId != null; Loading @@ -1118,7 +1116,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { || hasDeviceDisplayGroup != needsDeviceDisplayGroup || decidedGroupId != Display.INVALID_DISPLAY_GROUP) { groupId = assignDisplayGroupIdLocked(needsOwnDisplayGroup, assignDisplayGroupIdLocked(needsDeviceDisplayGroup, needsOwnDisplayGroup, display.getLayoutGroupNameLocked(), needsDeviceDisplayGroup, linkedDeviceUniqueId, decidedGroupId); } Loading Loading @@ -1351,9 +1349,10 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { } } private int assignDisplayGroupIdLocked(boolean isOwnDisplayGroup, String displayGroupName, private int assignDisplayGroupIdLocked(boolean needsDeviceDisplayGroup, boolean isOwnDisplayGroup, String displayGroupName, boolean isDeviceDisplayGroup, Integer linkedDeviceUniqueId, int decidedGroupId) { if (decidedGroupId != Display.INVALID_DISPLAY_GROUP) { if (decidedGroupId != Display.INVALID_DISPLAY_GROUP && !needsDeviceDisplayGroup) { return decidedGroupId; } if (isDeviceDisplayGroup && linkedDeviceUniqueId != null) { Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +54 −10 Original line number Diff line number Diff line Loading @@ -1327,11 +1327,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } sleepDefaultDisplay(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, flags); goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, flags); return true; } private void sleepDefaultDisplay(long eventTime, int reason, int flags) { private void goToSleep(long eventTime, int reason, int flags) { mRequestedOrSleepingDefaultDisplay = true; mPowerManager.goToSleep(eventTime, reason, flags); } Loading Loading @@ -1369,7 +1369,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { Settings.Global.THEATER_MODE_ON, 1); if (mGoToSleepOnButtonPressTheaterMode && interactive) { sleepDefaultDisplay(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, 0); } } Loading Loading @@ -1542,7 +1542,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { case SHORT_PRESS_SLEEP_GO_TO_SLEEP: case SHORT_PRESS_SLEEP_GO_TO_SLEEP_AND_GO_HOME: Slog.i(TAG, "sleepRelease() calling goToSleep(GO_TO_SLEEP_REASON_SLEEP_BUTTON)"); sleepDefaultDisplay(eventTime, PowerManager.GO_TO_SLEEP_REASON_SLEEP_BUTTON, 0); goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_SLEEP_BUTTON, 0); break; } } Loading Loading @@ -4623,7 +4623,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } if ((mEndcallBehavior & Settings.System.END_BUTTON_BEHAVIOR_SLEEP) != 0) { sleepDefaultDisplay(event.getEventTime(), goToSleep(event.getEventTime(), PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, 0); isWakeKey = false; } Loading Loading @@ -5274,6 +5274,45 @@ public class PhoneWindowManager implements WindowManagerPolicy { mDeviceGoingToSleep = false; } // Both the default and default adjacent groups should be non interactive private boolean isReadyToSignalSleep(int displayGroupId) { if (!com.android.server.display.feature.flags.Flags.separateTimeouts()) { return displayGroupId == Display.DEFAULT_DISPLAY_GROUP; } // We only care about default and default-adjacent groups if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP && !mPowerManagerInternal.isDefaultGroupAdjacent(displayGroupId)) { return false; } boolean areAllDefaultAdjacentGroupsNonInteractive = !mPowerManagerInternal.isAnyDefaultAdjacentGroupInteractive(); boolean isDefaultGroupNonInteractive = !mPowerManagerInternal.isGroupInteractive(DEFAULT_DISPLAY); return areAllDefaultAdjacentGroupsNonInteractive && isDefaultGroupNonInteractive; } // Either of the default or default adjacent groups should be interactive private boolean isReadyToSignalWakeup(int displayGroupId) { if (!com.android.server.display.feature.flags.Flags.separateTimeouts()) { return displayGroupId == Display.DEFAULT_DISPLAY_GROUP; } // We only care about default and default-adjacent groups if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP && !mPowerManagerInternal.isDefaultGroupAdjacent(displayGroupId)) { return false; } boolean isAnyDefaultAdjacentGroupInteractive = mPowerManagerInternal.isAnyDefaultAdjacentGroupInteractive(); boolean isDefaultGroupInteractive = mPowerManagerInternal .isGroupInteractive(DEFAULT_DISPLAY); return isAnyDefaultAdjacentGroupInteractive || isDefaultGroupInteractive; } // Called on the PowerManager's Notifier thread. @Override public void startedGoingToSleep(int displayGroupId, Loading @@ -5284,7 +5323,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManagerPolicyConstants.translateSleepReasonToOffReason( pmSleepReason)) + ")"); } if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { if (!isReadyToSignalSleep(displayGroupId)) { return; } Loading @@ -5300,9 +5340,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { @Override public void finishedGoingToSleep(int displayGroupId, @PowerManager.GoToSleepReason int pmSleepReason) { if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { if (!isReadyToSignalSleep(displayGroupId)) { return; } EventLogTags.writeScreenToggled(0); if (DEBUG_WAKEUP) { Slog.i(TAG, "Finished going to sleep... (groupId=" + displayGroupId + " why=" Loading Loading @@ -5344,9 +5385,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManagerPolicyConstants.translateWakeReasonToOnReason( pmWakeReason)) + ")"); } if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { if (!isReadyToSignalWakeup(displayGroupId)) { return; } EventLogTags.writeScreenToggled(1); mIsGoingToSleepDefaultDisplay = false; Loading Loading @@ -5378,7 +5421,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManagerPolicyConstants.translateWakeReasonToOnReason( pmWakeReason)) + ")"); } if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { if (!isReadyToSignalWakeup(displayGroupId)) { return; } Loading Loading @@ -6043,7 +6087,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mWindowManagerFuncs.lockDeviceNow(); break; case LID_BEHAVIOR_SLEEP: sleepDefaultDisplay(SystemClock.uptimeMillis(), goToSleep(SystemClock.uptimeMillis(), PowerManager.GO_TO_SLEEP_REASON_LID_SWITCH, PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE); break; Loading
services/core/java/com/android/server/power/PowerGroup.java +58 −3 Original line number Diff line number Diff line Loading @@ -107,6 +107,8 @@ public class PowerGroup { private final long mDimDuration; private final long mScreenOffTimeout; private boolean mDreamManagerAttemptedDozing; PowerGroup(int groupId, PowerGroupListener wakefulnessListener, Notifier notifier, DisplayManagerInternal displayManagerInternal, int wakefulness, boolean ready, boolean supportsSandman, long eventTime, PowerManagerFlags featureFlags, Loading Loading @@ -211,6 +213,12 @@ public class PowerGroup { mLastSleepReason = reason; } } // Since the group is transitioning to interactive wakefulness, we should reset the // previous attempt of doze made by DreamManager if (isInteractive(newWakefulness)) { setDreamManagerAttemptedDozingLocked(/* dreamManagerAttemptedDozing */ false); } mWakefulness = newWakefulness; mWakefulnessListener.onWakefulnessChangedLocked(mGroupId, mWakefulness, eventTime, reason, uid, opUid, opPackageName, details); Loading @@ -219,6 +227,33 @@ public class PowerGroup { return false; } /** * Sets the dreamManagerAttemptedDozing status, indicating if the DreamManager attempted to * put the group to doze. This being true doesn't necessarily mean that the group is dozing * as it can fail in that attempt */ public void setDreamManagerAttemptedDozingLocked(boolean dreamManagerAttemptedDozing) { Slog.i(TAG, "dreamManagerAttemptedDozing status changed to " + dreamManagerAttemptedDozing + " for group " + mGroupId); mDreamManagerAttemptedDozing = dreamManagerAttemptedDozing; } public boolean isDefaultOrAdjacentGroup() { return isDefaultGroupAdjacent() || getGroupId() == Display.DEFAULT_DISPLAY_GROUP; } /** * A group can transition from sleep to doze * 1. It is a default display * 2. com.android.server.display.feature.flags.Flags.separateTimeouts() is enabled * 3. Is non interactive */ public boolean canTransitionBetweenNonInteractiveStates() { return (com.android.server.display.feature.flags.Flags.separateTimeouts()) && (getGroupId() == Display.DEFAULT_DISPLAY_GROUP) && !isInteractive(getWakefulnessLocked()); } /** * Returns {@code true} if every display in this group has its requested state matching * its actual state. Loading Loading @@ -258,8 +293,7 @@ public class PowerGroup { return mPoweringOn; } @VisibleForTesting boolean isDefaultGroupAdjacent() { public boolean isDefaultGroupAdjacent() { return mIsDefaultGroupAdjacent; } Loading Loading @@ -324,9 +358,27 @@ public class PowerGroup { } boolean dozeLocked(long eventTime, int uid, @PowerManager.GoToSleepReason int reason) { if (eventTime < getLastWakeTimeLocked() || !isInteractive(mWakefulness)) { return dozeLocked(eventTime, uid, reason, false); } boolean dozeLocked(long eventTime, int uid, @PowerManager.GoToSleepReason int reason, boolean allowSleepToDozeTransition) { if (!com.android.server.display.feature.flags.Flags.separateTimeouts()) { allowSleepToDozeTransition = false; } if (eventTime < getLastWakeTimeLocked() || mWakefulness == WAKEFULNESS_DOZING) { return false; } if (mWakefulness == WAKEFULNESS_ASLEEP) { if (!allowSleepToDozeTransition) { return false; } if (mDreamManagerAttemptedDozing) { return false; } } Trace.traceBegin(Trace.TRACE_TAG_POWER, "powerOffDisplay"); try { Loading Loading @@ -586,6 +638,9 @@ public class PowerGroup { + "\nmDimDuration=" + mDimDuration + "\nmWakefulness=" + mWakefulness + "\nmIsDefaultGroupAdjacent=" + mIsDefaultGroupAdjacent + "\nmSupportsSandman=" + mSupportsSandman + "\nmDreamManagerAttemptedDozing=" + mDreamManagerAttemptedDozing + "\nmScreenOffTimeout=" + mScreenOffTimeout; } Loading
services/core/java/com/android/server/power/PowerManagerService.java +134 −20 File changed.Preview size limit exceeded, changes collapsed. Show changes