Loading services/core/java/com/android/server/display/DisplayPowerController.java +2 −2 Original line number Diff line number Diff line Loading @@ -2094,14 +2094,14 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call && !mScreenOffBecauseOfProximity) { setReportedScreenState(REPORTED_TO_POLICY_SCREEN_OFF); unblockScreenOn(); mWindowManagerPolicy.screenTurnedOff(mDisplayId); mWindowManagerPolicy.screenTurnedOff(mDisplayId, mIsInTransition); } else if (!isOff && mReportedScreenStateToPolicy == REPORTED_TO_POLICY_SCREEN_TURNING_OFF) { // We told policy already that screen was turning off, but now we changed our minds. // Complete the full state transition on -> turningOff -> off. unblockScreenOff(); mWindowManagerPolicy.screenTurnedOff(mDisplayId); mWindowManagerPolicy.screenTurnedOff(mDisplayId, mIsInTransition); setReportedScreenState(REPORTED_TO_POLICY_SCREEN_OFF); } if (!isOff Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +5 −5 Original line number Diff line number Diff line Loading @@ -4756,11 +4756,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { // Called on the DisplayManager's DisplayPowerController thread. @Override public void screenTurnedOff(int displayId) { public void screenTurnedOff(int displayId, boolean isSwappingDisplay) { if (DEBUG_WAKEUP) Slog.i(TAG, "Display" + displayId + " turned off..."); if (displayId == DEFAULT_DISPLAY) { updateScreenOffSleepToken(true); updateScreenOffSleepToken(true, isSwappingDisplay); mRequestedOrSleepingDefaultDisplay = false; mDefaultDisplayPolicy.screenTurnedOff(); synchronized (mLock) { Loading Loading @@ -4811,7 +4811,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (displayId == DEFAULT_DISPLAY) { Trace.asyncTraceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "screenTurningOn", 0 /* cookie */); updateScreenOffSleepToken(false); updateScreenOffSleepToken(false /* acquire */, false /* isSwappingDisplay */); mDefaultDisplayPolicy.screenTurnedOn(screenOnListener); mBootAnimationDismissable = false; Loading Loading @@ -5330,9 +5330,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { } // TODO (multidisplay): Support multiple displays in WindowManagerPolicy. private void updateScreenOffSleepToken(boolean acquire) { private void updateScreenOffSleepToken(boolean acquire, boolean isSwappingDisplay) { if (acquire) { mScreenOffSleepTokenAcquirer.acquire(DEFAULT_DISPLAY); mScreenOffSleepTokenAcquirer.acquire(DEFAULT_DISPLAY, isSwappingDisplay); } else { mScreenOffSleepTokenAcquirer.release(DEFAULT_DISPLAY); } Loading services/core/java/com/android/server/policy/WindowManagerPolicy.java +3 −1 Original line number Diff line number Diff line Loading @@ -829,8 +829,10 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants { /** * Called when the display has turned off. * @param displayId The display to apply to. * @param isSwappingDisplay Whether the display is swapping to another physical display. */ public void screenTurnedOff(int displayId); void screenTurnedOff(int displayId, boolean isSwappingDisplay); public interface ScreenOnListener { void onScreenOn(); Loading services/core/java/com/android/server/wm/ActivityRecord.java +10 −0 Original line number Diff line number Diff line Loading @@ -8417,6 +8417,16 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return inTransitionSelfOrParent(); } boolean isDisplaySleepingAndSwapping() { for (int i = mDisplayContent.mAllSleepTokens.size() - 1; i >= 0; i--) { RootWindowContainer.SleepToken sleepToken = mDisplayContent.mAllSleepTokens.get(i); if (sleepToken.isDisplaySwapping()) { return true; } } return false; } /** * Whether this activity is letterboxed for fixed orientation. If letterboxed due to fixed * orientation then aspect ratio restrictions are also already respected. Loading services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java +7 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,13 @@ public abstract class ActivityTaskManagerInternal { */ void acquire(int displayId); /** * Acquires a sleep token. * @param displayId The display to apply to. * @param isSwappingDisplay Whether the display is swapping to another physical display. */ void acquire(int displayId, boolean isSwappingDisplay); /** * Releases the sleep token. * @param displayId The display to apply to. Loading Loading
services/core/java/com/android/server/display/DisplayPowerController.java +2 −2 Original line number Diff line number Diff line Loading @@ -2094,14 +2094,14 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call && !mScreenOffBecauseOfProximity) { setReportedScreenState(REPORTED_TO_POLICY_SCREEN_OFF); unblockScreenOn(); mWindowManagerPolicy.screenTurnedOff(mDisplayId); mWindowManagerPolicy.screenTurnedOff(mDisplayId, mIsInTransition); } else if (!isOff && mReportedScreenStateToPolicy == REPORTED_TO_POLICY_SCREEN_TURNING_OFF) { // We told policy already that screen was turning off, but now we changed our minds. // Complete the full state transition on -> turningOff -> off. unblockScreenOff(); mWindowManagerPolicy.screenTurnedOff(mDisplayId); mWindowManagerPolicy.screenTurnedOff(mDisplayId, mIsInTransition); setReportedScreenState(REPORTED_TO_POLICY_SCREEN_OFF); } if (!isOff Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +5 −5 Original line number Diff line number Diff line Loading @@ -4756,11 +4756,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { // Called on the DisplayManager's DisplayPowerController thread. @Override public void screenTurnedOff(int displayId) { public void screenTurnedOff(int displayId, boolean isSwappingDisplay) { if (DEBUG_WAKEUP) Slog.i(TAG, "Display" + displayId + " turned off..."); if (displayId == DEFAULT_DISPLAY) { updateScreenOffSleepToken(true); updateScreenOffSleepToken(true, isSwappingDisplay); mRequestedOrSleepingDefaultDisplay = false; mDefaultDisplayPolicy.screenTurnedOff(); synchronized (mLock) { Loading Loading @@ -4811,7 +4811,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (displayId == DEFAULT_DISPLAY) { Trace.asyncTraceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "screenTurningOn", 0 /* cookie */); updateScreenOffSleepToken(false); updateScreenOffSleepToken(false /* acquire */, false /* isSwappingDisplay */); mDefaultDisplayPolicy.screenTurnedOn(screenOnListener); mBootAnimationDismissable = false; Loading Loading @@ -5330,9 +5330,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { } // TODO (multidisplay): Support multiple displays in WindowManagerPolicy. private void updateScreenOffSleepToken(boolean acquire) { private void updateScreenOffSleepToken(boolean acquire, boolean isSwappingDisplay) { if (acquire) { mScreenOffSleepTokenAcquirer.acquire(DEFAULT_DISPLAY); mScreenOffSleepTokenAcquirer.acquire(DEFAULT_DISPLAY, isSwappingDisplay); } else { mScreenOffSleepTokenAcquirer.release(DEFAULT_DISPLAY); } Loading
services/core/java/com/android/server/policy/WindowManagerPolicy.java +3 −1 Original line number Diff line number Diff line Loading @@ -829,8 +829,10 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants { /** * Called when the display has turned off. * @param displayId The display to apply to. * @param isSwappingDisplay Whether the display is swapping to another physical display. */ public void screenTurnedOff(int displayId); void screenTurnedOff(int displayId, boolean isSwappingDisplay); public interface ScreenOnListener { void onScreenOn(); Loading
services/core/java/com/android/server/wm/ActivityRecord.java +10 −0 Original line number Diff line number Diff line Loading @@ -8417,6 +8417,16 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return inTransitionSelfOrParent(); } boolean isDisplaySleepingAndSwapping() { for (int i = mDisplayContent.mAllSleepTokens.size() - 1; i >= 0; i--) { RootWindowContainer.SleepToken sleepToken = mDisplayContent.mAllSleepTokens.get(i); if (sleepToken.isDisplaySwapping()) { return true; } } return false; } /** * Whether this activity is letterboxed for fixed orientation. If letterboxed due to fixed * orientation then aspect ratio restrictions are also already respected. Loading
services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java +7 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,13 @@ public abstract class ActivityTaskManagerInternal { */ void acquire(int displayId); /** * Acquires a sleep token. * @param displayId The display to apply to. * @param isSwappingDisplay Whether the display is swapping to another physical display. */ void acquire(int displayId, boolean isSwappingDisplay); /** * Releases the sleep token. * @param displayId The display to apply to. Loading