Loading core/java/android/os/PowerManagerInternal.java +1 −11 Original line number Diff line number Diff line Loading @@ -208,22 +208,12 @@ 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 +7 −7 Original line number Diff line number Diff line Loading @@ -1099,12 +1099,14 @@ 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 @@ -1115,7 +1117,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { || hasDeviceDisplayGroup != needsDeviceDisplayGroup || decidedGroupId != Display.INVALID_DISPLAY_GROUP) { groupId = assignDisplayGroupIdLocked(needsDeviceDisplayGroup, needsOwnDisplayGroup, assignDisplayGroupIdLocked(needsOwnDisplayGroup, display.getLayoutGroupNameLocked(), needsDeviceDisplayGroup, linkedDeviceUniqueId, decidedGroupId); } Loading @@ -1129,9 +1131,8 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { int reason = mDisplayGroupAllocator.getContentModeForDisplayLocked( display, displayDeviceInfo.type); if (groupId != Display.DEFAULT_DISPLAY_GROUP && (reason == REASON_PROJECTED || reason == REASON_EXTENDED || reason == REASON_NON_DESKTOP)) { if (reason == REASON_PROJECTED || reason == REASON_EXTENDED || reason == REASON_NON_DESKTOP) { newGroup.setFlags(DisplayGroup.FLAG_DEFAULT_GROUP_ADJACENT); } } Loading Loading @@ -1342,10 +1343,9 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { } } private int assignDisplayGroupIdLocked(boolean needsDeviceDisplayGroup, boolean isOwnDisplayGroup, String displayGroupName, private int assignDisplayGroupIdLocked(boolean isOwnDisplayGroup, String displayGroupName, boolean isDeviceDisplayGroup, Integer linkedDeviceUniqueId, int decidedGroupId) { if (decidedGroupId != Display.INVALID_DISPLAY_GROUP && !needsDeviceDisplayGroup) { if (decidedGroupId != Display.INVALID_DISPLAY_GROUP) { return decidedGroupId; } if (isDeviceDisplayGroup && linkedDeviceUniqueId != null) { Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +10 −54 Original line number Diff line number Diff line Loading @@ -1329,11 +1329,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, flags); sleepDefaultDisplay(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, flags); return true; } private void goToSleep(long eventTime, int reason, int flags) { private void sleepDefaultDisplay(long eventTime, int reason, int flags) { mRequestedOrSleepingDefaultDisplay = true; mPowerManager.goToSleep(eventTime, reason, flags); } Loading Loading @@ -1371,7 +1371,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { Settings.Global.THEATER_MODE_ON, 1); if (mGoToSleepOnButtonPressTheaterMode && interactive) { goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, sleepDefaultDisplay(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, 0); } } Loading Loading @@ -1544,7 +1544,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)"); goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_SLEEP_BUTTON, 0); sleepDefaultDisplay(eventTime, PowerManager.GO_TO_SLEEP_REASON_SLEEP_BUTTON, 0); break; } } Loading Loading @@ -4642,7 +4642,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } if ((mEndcallBehavior & Settings.System.END_BUTTON_BEHAVIOR_SLEEP) != 0) { goToSleep(event.getEventTime(), sleepDefaultDisplay(event.getEventTime(), PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, 0); isWakeKey = false; } Loading Loading @@ -5293,45 +5293,6 @@ 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 @@ -5342,8 +5303,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManagerPolicyConstants.translateSleepReasonToOffReason( pmSleepReason)) + ")"); } if (!isReadyToSignalSleep(displayGroupId)) { if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { return; } Loading @@ -5359,10 +5319,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { @Override public void finishedGoingToSleep(int displayGroupId, @PowerManager.GoToSleepReason int pmSleepReason) { if (!isReadyToSignalSleep(displayGroupId)) { if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { return; } EventLogTags.writeScreenToggled(0); if (DEBUG_WAKEUP) { Slog.i(TAG, "Finished going to sleep... (groupId=" + displayGroupId + " why=" Loading Loading @@ -5404,11 +5363,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManagerPolicyConstants.translateWakeReasonToOnReason( pmWakeReason)) + ")"); } if (!isReadyToSignalWakeup(displayGroupId)) { if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { return; } EventLogTags.writeScreenToggled(1); mIsGoingToSleepDefaultDisplay = false; Loading Loading @@ -5440,8 +5397,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManagerPolicyConstants.translateWakeReasonToOnReason( pmWakeReason)) + ")"); } if (!isReadyToSignalWakeup(displayGroupId)) { if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { return; } Loading Loading @@ -6106,7 +6062,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mWindowManagerFuncs.lockDeviceNow(); break; case LID_BEHAVIOR_SLEEP: goToSleep(SystemClock.uptimeMillis(), sleepDefaultDisplay(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 +3 −62 Original line number Diff line number Diff line Loading @@ -107,8 +107,6 @@ public class PowerGroup { private final long mDimDuration; private final long mScreenOffTimeout; private boolean mDreamManagerAttemptedDreaming; PowerGroup(int groupId, PowerGroupListener wakefulnessListener, Notifier notifier, DisplayManagerInternal displayManagerInternal, int wakefulness, boolean ready, boolean supportsSandman, long eventTime, PowerManagerFlags featureFlags, Loading Loading @@ -213,12 +211,6 @@ public class PowerGroup { mLastSleepReason = reason; } } // Since the group is transitioning to interactive wakefulness, we should reset the // previous attempt of dream made by DreamManager if (newWakefulness == WAKEFULNESS_AWAKE) { setDreamManagerAttemptedDreamingLocked(/* dreamManagerAttemptedDreaming */ false); } mWakefulness = newWakefulness; mWakefulnessListener.onWakefulnessChangedLocked(mGroupId, mWakefulness, eventTime, reason, uid, opUid, opPackageName, details); Loading @@ -227,43 +219,6 @@ public class PowerGroup { return false; } /** * Indicates if the power group already attempted to dream by the DreamManagerService. This * doesn't necessarily indicate that the group is dreaming, as DreamManagerService might * have failed */ public boolean dreamManagerAttemptedDreamingLocked() { return mDreamManagerAttemptedDreaming; } /** * Sets the dreamManagerAttemptedDreaming status, indicating if the DreamManager attempted to * put the group to dream. This being true doesn't necessarily mean that the group is dreaming * as it can fail in that attempt * @param dreamManagerAttemptedDreaming */ public void setDreamManagerAttemptedDreamingLocked(boolean dreamManagerAttemptedDreaming) { Slog.i(TAG, "dreamManagerAttemptedDreaming status changed to " + dreamManagerAttemptedDreaming + " for group " + mGroupId); mDreamManagerAttemptedDreaming = dreamManagerAttemptedDreaming; } 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 @@ -303,7 +258,8 @@ public class PowerGroup { return mPoweringOn; } public boolean isDefaultGroupAdjacent() { @VisibleForTesting boolean isDefaultGroupAdjacent() { return mIsDefaultGroupAdjacent; } Loading Loading @@ -368,20 +324,7 @@ public class PowerGroup { } boolean dozeLocked(long eventTime, int uid, @PowerManager.GoToSleepReason int reason) { 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 && !allowSleepToDozeTransition) { if (eventTime < getLastWakeTimeLocked() || !isInteractive(mWakefulness)) { return false; } Loading Loading @@ -643,8 +586,6 @@ public class PowerGroup { + "\nmDimDuration=" + mDimDuration + "\nmWakefulness=" + mWakefulness + "\nmIsDefaultGroupAdjacent=" + mIsDefaultGroupAdjacent + "\nmSupportsSandman=" + mSupportsSandman + "\nmDreamManagerAttemptedDreaming=" + mDreamManagerAttemptedDreaming + "\nmScreenOffTimeout=" + mScreenOffTimeout; } Loading services/core/java/com/android/server/power/PowerManagerService.java +20 −120 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
core/java/android/os/PowerManagerInternal.java +1 −11 Original line number Diff line number Diff line Loading @@ -208,22 +208,12 @@ 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 +7 −7 Original line number Diff line number Diff line Loading @@ -1099,12 +1099,14 @@ 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 @@ -1115,7 +1117,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { || hasDeviceDisplayGroup != needsDeviceDisplayGroup || decidedGroupId != Display.INVALID_DISPLAY_GROUP) { groupId = assignDisplayGroupIdLocked(needsDeviceDisplayGroup, needsOwnDisplayGroup, assignDisplayGroupIdLocked(needsOwnDisplayGroup, display.getLayoutGroupNameLocked(), needsDeviceDisplayGroup, linkedDeviceUniqueId, decidedGroupId); } Loading @@ -1129,9 +1131,8 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { int reason = mDisplayGroupAllocator.getContentModeForDisplayLocked( display, displayDeviceInfo.type); if (groupId != Display.DEFAULT_DISPLAY_GROUP && (reason == REASON_PROJECTED || reason == REASON_EXTENDED || reason == REASON_NON_DESKTOP)) { if (reason == REASON_PROJECTED || reason == REASON_EXTENDED || reason == REASON_NON_DESKTOP) { newGroup.setFlags(DisplayGroup.FLAG_DEFAULT_GROUP_ADJACENT); } } Loading Loading @@ -1342,10 +1343,9 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { } } private int assignDisplayGroupIdLocked(boolean needsDeviceDisplayGroup, boolean isOwnDisplayGroup, String displayGroupName, private int assignDisplayGroupIdLocked(boolean isOwnDisplayGroup, String displayGroupName, boolean isDeviceDisplayGroup, Integer linkedDeviceUniqueId, int decidedGroupId) { if (decidedGroupId != Display.INVALID_DISPLAY_GROUP && !needsDeviceDisplayGroup) { if (decidedGroupId != Display.INVALID_DISPLAY_GROUP) { return decidedGroupId; } if (isDeviceDisplayGroup && linkedDeviceUniqueId != null) { Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +10 −54 Original line number Diff line number Diff line Loading @@ -1329,11 +1329,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, flags); sleepDefaultDisplay(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, flags); return true; } private void goToSleep(long eventTime, int reason, int flags) { private void sleepDefaultDisplay(long eventTime, int reason, int flags) { mRequestedOrSleepingDefaultDisplay = true; mPowerManager.goToSleep(eventTime, reason, flags); } Loading Loading @@ -1371,7 +1371,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { Settings.Global.THEATER_MODE_ON, 1); if (mGoToSleepOnButtonPressTheaterMode && interactive) { goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, sleepDefaultDisplay(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, 0); } } Loading Loading @@ -1544,7 +1544,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)"); goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_SLEEP_BUTTON, 0); sleepDefaultDisplay(eventTime, PowerManager.GO_TO_SLEEP_REASON_SLEEP_BUTTON, 0); break; } } Loading Loading @@ -4642,7 +4642,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } if ((mEndcallBehavior & Settings.System.END_BUTTON_BEHAVIOR_SLEEP) != 0) { goToSleep(event.getEventTime(), sleepDefaultDisplay(event.getEventTime(), PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, 0); isWakeKey = false; } Loading Loading @@ -5293,45 +5293,6 @@ 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 @@ -5342,8 +5303,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManagerPolicyConstants.translateSleepReasonToOffReason( pmSleepReason)) + ")"); } if (!isReadyToSignalSleep(displayGroupId)) { if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { return; } Loading @@ -5359,10 +5319,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { @Override public void finishedGoingToSleep(int displayGroupId, @PowerManager.GoToSleepReason int pmSleepReason) { if (!isReadyToSignalSleep(displayGroupId)) { if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { return; } EventLogTags.writeScreenToggled(0); if (DEBUG_WAKEUP) { Slog.i(TAG, "Finished going to sleep... (groupId=" + displayGroupId + " why=" Loading Loading @@ -5404,11 +5363,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManagerPolicyConstants.translateWakeReasonToOnReason( pmWakeReason)) + ")"); } if (!isReadyToSignalWakeup(displayGroupId)) { if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { return; } EventLogTags.writeScreenToggled(1); mIsGoingToSleepDefaultDisplay = false; Loading Loading @@ -5440,8 +5397,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManagerPolicyConstants.translateWakeReasonToOnReason( pmWakeReason)) + ")"); } if (!isReadyToSignalWakeup(displayGroupId)) { if (displayGroupId != Display.DEFAULT_DISPLAY_GROUP) { return; } Loading Loading @@ -6106,7 +6062,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mWindowManagerFuncs.lockDeviceNow(); break; case LID_BEHAVIOR_SLEEP: goToSleep(SystemClock.uptimeMillis(), sleepDefaultDisplay(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 +3 −62 Original line number Diff line number Diff line Loading @@ -107,8 +107,6 @@ public class PowerGroup { private final long mDimDuration; private final long mScreenOffTimeout; private boolean mDreamManagerAttemptedDreaming; PowerGroup(int groupId, PowerGroupListener wakefulnessListener, Notifier notifier, DisplayManagerInternal displayManagerInternal, int wakefulness, boolean ready, boolean supportsSandman, long eventTime, PowerManagerFlags featureFlags, Loading Loading @@ -213,12 +211,6 @@ public class PowerGroup { mLastSleepReason = reason; } } // Since the group is transitioning to interactive wakefulness, we should reset the // previous attempt of dream made by DreamManager if (newWakefulness == WAKEFULNESS_AWAKE) { setDreamManagerAttemptedDreamingLocked(/* dreamManagerAttemptedDreaming */ false); } mWakefulness = newWakefulness; mWakefulnessListener.onWakefulnessChangedLocked(mGroupId, mWakefulness, eventTime, reason, uid, opUid, opPackageName, details); Loading @@ -227,43 +219,6 @@ public class PowerGroup { return false; } /** * Indicates if the power group already attempted to dream by the DreamManagerService. This * doesn't necessarily indicate that the group is dreaming, as DreamManagerService might * have failed */ public boolean dreamManagerAttemptedDreamingLocked() { return mDreamManagerAttemptedDreaming; } /** * Sets the dreamManagerAttemptedDreaming status, indicating if the DreamManager attempted to * put the group to dream. This being true doesn't necessarily mean that the group is dreaming * as it can fail in that attempt * @param dreamManagerAttemptedDreaming */ public void setDreamManagerAttemptedDreamingLocked(boolean dreamManagerAttemptedDreaming) { Slog.i(TAG, "dreamManagerAttemptedDreaming status changed to " + dreamManagerAttemptedDreaming + " for group " + mGroupId); mDreamManagerAttemptedDreaming = dreamManagerAttemptedDreaming; } 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 @@ -303,7 +258,8 @@ public class PowerGroup { return mPoweringOn; } public boolean isDefaultGroupAdjacent() { @VisibleForTesting boolean isDefaultGroupAdjacent() { return mIsDefaultGroupAdjacent; } Loading Loading @@ -368,20 +324,7 @@ public class PowerGroup { } boolean dozeLocked(long eventTime, int uid, @PowerManager.GoToSleepReason int reason) { 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 && !allowSleepToDozeTransition) { if (eventTime < getLastWakeTimeLocked() || !isInteractive(mWakefulness)) { return false; } Loading Loading @@ -643,8 +586,6 @@ public class PowerGroup { + "\nmDimDuration=" + mDimDuration + "\nmWakefulness=" + mWakefulness + "\nmIsDefaultGroupAdjacent=" + mIsDefaultGroupAdjacent + "\nmSupportsSandman=" + mSupportsSandman + "\nmDreamManagerAttemptedDreaming=" + mDreamManagerAttemptedDreaming + "\nmScreenOffTimeout=" + mScreenOffTimeout; } Loading
services/core/java/com/android/server/power/PowerManagerService.java +20 −120 File changed.Preview size limit exceeded, changes collapsed. Show changes