Loading core/java/android/app/Activity.java +5 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ import android.os.IBinder; import android.os.Looper; import android.os.Parcelable; import android.os.PersistableBundle; import android.os.PowerManager; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager.ServiceNotFoundException; Loading Loading @@ -8722,13 +8723,16 @@ public class Activity extends ContextThemeWrapper * the activity is visible after the screen is turned on when the lockscreen is up. In addition, * if this flag is set and the activity calls {@link * KeyguardManager#requestDismissKeyguard(Activity, KeyguardManager.KeyguardDismissCallback)} * the screen will turn on. * the screen will turn on. If the screen is off and device is not secured, this flag can turn * screen on and dismiss keyguard to make this activity visible and resume, which can be used to * replace {@link PowerManager#ACQUIRE_CAUSES_WAKEUP} * * @param turnScreenOn {@code true} to turn on the screen; {@code false} otherwise. * * @see #setShowWhenLocked(boolean) * @see android.R.attr#turnScreenOn * @see android.R.attr#showWhenLocked * @see KeyguardManager#isDeviceSecure() */ public void setTurnScreenOn(boolean turnScreenOn) { try { Loading services/core/java/com/android/server/wm/KeyguardController.java +32 −7 Original line number Diff line number Diff line Loading @@ -167,7 +167,8 @@ class KeyguardController { if (keyguardChanged) { // Irrelevant to AOD. dismissMultiWindowModeForTaskIfNeeded(null /* currentTaskControllsingOcclusion */); dismissMultiWindowModeForTaskIfNeeded(null /* currentTaskControllsingOcclusion */, false /* turningScreenOn */); setKeyguardGoingAway(false); if (keyguardShowing) { mDismissalRequested = false; Loading Loading @@ -369,7 +370,6 @@ class KeyguardController { mService.continueWindowLayout(); } } dismissMultiWindowModeForTaskIfNeeded(currentTaskControllingOcclusion); } /** Loading Loading @@ -398,6 +398,21 @@ class KeyguardController { } } /** * Called when somebody wants to turn screen on. */ private void handleTurnScreenOn(int displayId) { if (displayId != DEFAULT_DISPLAY) { return; } mStackSupervisor.wakeUp("handleTurnScreenOn"); if (mKeyguardShowing && canDismissKeyguard()) { mWindowManager.dismissKeyguard(null /* callback */, null /* message */); mDismissalRequested = true; } } boolean isDisplayOccluded(int displayId) { return getDisplayState(displayId).mOccluded; } Loading Loading @@ -433,14 +448,15 @@ class KeyguardController { } private void dismissMultiWindowModeForTaskIfNeeded( @Nullable Task currentTaskControllingOcclusion) { @Nullable Task currentTaskControllingOcclusion, boolean turningScreenOn) { // If turningScreenOn is true, it means that the visibility state has changed from // currentTaskControllingOcclusion and we should update windowing mode. // TODO(b/113840485): Handle docked stack for individual display. if (!mKeyguardShowing || !isDisplayOccluded(DEFAULT_DISPLAY)) { if (!turningScreenOn && (!mKeyguardShowing || !isDisplayOccluded(DEFAULT_DISPLAY))) { return; } // Dismiss split screen // The lock screen is currently showing, but is occluded by a window that can // show on top of the lock screen. In this can we want to dismiss the docked // stack since it will be complicated/risky to try to put the activity on top Loading Loading @@ -579,17 +595,26 @@ class KeyguardController { && controller.mWindowManager.isKeyguardSecure( controller.mService.getCurrentUserId()); boolean occludingChange = false; boolean turningScreenOn = false; if (mTopTurnScreenOnActivity != lastTurnScreenOnActivity && mTopTurnScreenOnActivity != null && !mService.mWindowManager.mPowerManager.isInteractive() && (mRequestDismissKeyguard || occludedByActivity)) { controller.mStackSupervisor.wakeUp("handleTurnScreenOn"); && (mRequestDismissKeyguard || occludedByActivity || controller.canDismissKeyguard())) { turningScreenOn = true; controller.handleTurnScreenOn(mDisplayId); mTopTurnScreenOnActivity.setCurrentLaunchCanTurnScreenOn(false); } if (lastOccluded != mOccluded) { occludingChange = true; controller.handleOccludedChanged(mDisplayId, task); } if (occludingChange || turningScreenOn) { controller.dismissMultiWindowModeForTaskIfNeeded(task, turningScreenOn); } } /** Loading Loading
core/java/android/app/Activity.java +5 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ import android.os.IBinder; import android.os.Looper; import android.os.Parcelable; import android.os.PersistableBundle; import android.os.PowerManager; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager.ServiceNotFoundException; Loading Loading @@ -8722,13 +8723,16 @@ public class Activity extends ContextThemeWrapper * the activity is visible after the screen is turned on when the lockscreen is up. In addition, * if this flag is set and the activity calls {@link * KeyguardManager#requestDismissKeyguard(Activity, KeyguardManager.KeyguardDismissCallback)} * the screen will turn on. * the screen will turn on. If the screen is off and device is not secured, this flag can turn * screen on and dismiss keyguard to make this activity visible and resume, which can be used to * replace {@link PowerManager#ACQUIRE_CAUSES_WAKEUP} * * @param turnScreenOn {@code true} to turn on the screen; {@code false} otherwise. * * @see #setShowWhenLocked(boolean) * @see android.R.attr#turnScreenOn * @see android.R.attr#showWhenLocked * @see KeyguardManager#isDeviceSecure() */ public void setTurnScreenOn(boolean turnScreenOn) { try { Loading
services/core/java/com/android/server/wm/KeyguardController.java +32 −7 Original line number Diff line number Diff line Loading @@ -167,7 +167,8 @@ class KeyguardController { if (keyguardChanged) { // Irrelevant to AOD. dismissMultiWindowModeForTaskIfNeeded(null /* currentTaskControllsingOcclusion */); dismissMultiWindowModeForTaskIfNeeded(null /* currentTaskControllsingOcclusion */, false /* turningScreenOn */); setKeyguardGoingAway(false); if (keyguardShowing) { mDismissalRequested = false; Loading Loading @@ -369,7 +370,6 @@ class KeyguardController { mService.continueWindowLayout(); } } dismissMultiWindowModeForTaskIfNeeded(currentTaskControllingOcclusion); } /** Loading Loading @@ -398,6 +398,21 @@ class KeyguardController { } } /** * Called when somebody wants to turn screen on. */ private void handleTurnScreenOn(int displayId) { if (displayId != DEFAULT_DISPLAY) { return; } mStackSupervisor.wakeUp("handleTurnScreenOn"); if (mKeyguardShowing && canDismissKeyguard()) { mWindowManager.dismissKeyguard(null /* callback */, null /* message */); mDismissalRequested = true; } } boolean isDisplayOccluded(int displayId) { return getDisplayState(displayId).mOccluded; } Loading Loading @@ -433,14 +448,15 @@ class KeyguardController { } private void dismissMultiWindowModeForTaskIfNeeded( @Nullable Task currentTaskControllingOcclusion) { @Nullable Task currentTaskControllingOcclusion, boolean turningScreenOn) { // If turningScreenOn is true, it means that the visibility state has changed from // currentTaskControllingOcclusion and we should update windowing mode. // TODO(b/113840485): Handle docked stack for individual display. if (!mKeyguardShowing || !isDisplayOccluded(DEFAULT_DISPLAY)) { if (!turningScreenOn && (!mKeyguardShowing || !isDisplayOccluded(DEFAULT_DISPLAY))) { return; } // Dismiss split screen // The lock screen is currently showing, but is occluded by a window that can // show on top of the lock screen. In this can we want to dismiss the docked // stack since it will be complicated/risky to try to put the activity on top Loading Loading @@ -579,17 +595,26 @@ class KeyguardController { && controller.mWindowManager.isKeyguardSecure( controller.mService.getCurrentUserId()); boolean occludingChange = false; boolean turningScreenOn = false; if (mTopTurnScreenOnActivity != lastTurnScreenOnActivity && mTopTurnScreenOnActivity != null && !mService.mWindowManager.mPowerManager.isInteractive() && (mRequestDismissKeyguard || occludedByActivity)) { controller.mStackSupervisor.wakeUp("handleTurnScreenOn"); && (mRequestDismissKeyguard || occludedByActivity || controller.canDismissKeyguard())) { turningScreenOn = true; controller.handleTurnScreenOn(mDisplayId); mTopTurnScreenOnActivity.setCurrentLaunchCanTurnScreenOn(false); } if (lastOccluded != mOccluded) { occludingChange = true; controller.handleOccludedChanged(mDisplayId, task); } if (occludingChange || turningScreenOn) { controller.dismissMultiWindowModeForTaskIfNeeded(task, turningScreenOn); } } /** Loading