Loading services/core/java/com/android/server/wm/AppWindowToken.java +25 −0 Original line number Diff line number Diff line Loading @@ -193,6 +193,11 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree Task mLastParent; /** * See {@link #canTurnScreenOn()} */ private boolean mCanTurnScreenOn = true; AppWindowToken(WindowManagerService service, IApplicationToken token, boolean voiceInteraction, DisplayContent dc, long inputDispatchingTimeoutNanos, boolean fullscreen, boolean showForAllUsers, int targetSdk, int orientation, int rotationAnimationHint, Loading Loading @@ -644,6 +649,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree if (DEBUG_ADD_REMOVE) Slog.v(TAG, "notifyAppResumed: wasStopped=" + wasStopped + " " + this); mAppStopped = false; // Allow the window to turn the screen on once the app is resumed again. setCanTurnScreenOn(true); if (!wasStopped) { destroySurfaces(true /*cleanupOnResume*/); } Loading Loading @@ -1640,6 +1647,24 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree mDisablePreviewScreenshots = disable; } /** * Sets whether the current launch can turn the screen on. See {@link #canTurnScreenOn()} */ void setCanTurnScreenOn(boolean canTurnScreenOn) { mCanTurnScreenOn = canTurnScreenOn; } /** * Indicates whether the current launch can turn the screen on. This is to prevent multiple * relayouts from turning the screen back on. The screen should only turn on at most * once per activity resume. * * @return true if the screen can be turned on. */ boolean canTurnScreenOn() { return mCanTurnScreenOn; } /** * Retrieves whether we'd like to generate a snapshot that's based solely on the theme. This is * the case when preview screenshots are disabled {@link #setDisablePreviewScreenshots} or when Loading services/core/java/com/android/server/wm/WindowStateAnimator.java +6 −1 Original line number Diff line number Diff line Loading @@ -1632,9 +1632,14 @@ class WindowStateAnimator { // hidden while the screen is turning off. // TODO(b/63773439): These cases should be eliminated, though we probably still // want to process mTurnOnScreen in this way for clarity. if (mWin.mTurnOnScreen) { if (mWin.mTurnOnScreen && mWin.mAppToken.canTurnScreenOn()) { if (DEBUG_VISIBILITY) Slog.v(TAG, "Show surface turning screen on: " + mWin); mWin.mTurnOnScreen = false; // The window should only turn the screen on once per resume, but // prepareSurfaceLocked can be called multiple times. Set canTurnScreenOn to // false so the window doesn't turn the screen on again during this resume. mWin.mAppToken.setCanTurnScreenOn(false); mAnimator.mBulkUpdateParams |= SET_TURN_ON_SCREEN; } } Loading Loading
services/core/java/com/android/server/wm/AppWindowToken.java +25 −0 Original line number Diff line number Diff line Loading @@ -193,6 +193,11 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree Task mLastParent; /** * See {@link #canTurnScreenOn()} */ private boolean mCanTurnScreenOn = true; AppWindowToken(WindowManagerService service, IApplicationToken token, boolean voiceInteraction, DisplayContent dc, long inputDispatchingTimeoutNanos, boolean fullscreen, boolean showForAllUsers, int targetSdk, int orientation, int rotationAnimationHint, Loading Loading @@ -644,6 +649,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree if (DEBUG_ADD_REMOVE) Slog.v(TAG, "notifyAppResumed: wasStopped=" + wasStopped + " " + this); mAppStopped = false; // Allow the window to turn the screen on once the app is resumed again. setCanTurnScreenOn(true); if (!wasStopped) { destroySurfaces(true /*cleanupOnResume*/); } Loading Loading @@ -1640,6 +1647,24 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree mDisablePreviewScreenshots = disable; } /** * Sets whether the current launch can turn the screen on. See {@link #canTurnScreenOn()} */ void setCanTurnScreenOn(boolean canTurnScreenOn) { mCanTurnScreenOn = canTurnScreenOn; } /** * Indicates whether the current launch can turn the screen on. This is to prevent multiple * relayouts from turning the screen back on. The screen should only turn on at most * once per activity resume. * * @return true if the screen can be turned on. */ boolean canTurnScreenOn() { return mCanTurnScreenOn; } /** * Retrieves whether we'd like to generate a snapshot that's based solely on the theme. This is * the case when preview screenshots are disabled {@link #setDisablePreviewScreenshots} or when Loading
services/core/java/com/android/server/wm/WindowStateAnimator.java +6 −1 Original line number Diff line number Diff line Loading @@ -1632,9 +1632,14 @@ class WindowStateAnimator { // hidden while the screen is turning off. // TODO(b/63773439): These cases should be eliminated, though we probably still // want to process mTurnOnScreen in this way for clarity. if (mWin.mTurnOnScreen) { if (mWin.mTurnOnScreen && mWin.mAppToken.canTurnScreenOn()) { if (DEBUG_VISIBILITY) Slog.v(TAG, "Show surface turning screen on: " + mWin); mWin.mTurnOnScreen = false; // The window should only turn the screen on once per resume, but // prepareSurfaceLocked can be called multiple times. Set canTurnScreenOn to // false so the window doesn't turn the screen on again during this resume. mWin.mAppToken.setCanTurnScreenOn(false); mAnimator.mBulkUpdateParams |= SET_TURN_ON_SCREEN; } } Loading