Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75520d5c authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Use Keyguard orientation when unoccluding

If we are about to unocclude Keyguard, we already use its
orientation spec such that if both Keyguard and the activity
going aways share the same orientation spec, there is no
unnecessary orientation change.

Test: Launch SHOW_WHEN_LOCKED portrait activity, hold device
in landscape, toggle power button twice, press home, make sure
no orientation change when animating to Keyguard.
Test: go/wm-smoke

Change-Id: Ic5f110747de5f5f7d73adf83f5f53c7fd56d860c
Fixes: 38146081
parent 0d9c30cf
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2580,6 +2580,16 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
            // the screen based on the new activity order.
            boolean notUpdated = true;
            if (mStackSupervisor.isFocusedStack(this)) {

                // We have special rotation behavior when Keyguard is locked. Make sure all activity
                // visibilities are set correctly as well as the transition is updated if needed to
                // get the correct rotation behavior.
                // TODO: Remove this once visibilities are set correctly immediately when starting
                // an activity.
                if (mStackSupervisor.mKeyguardController.isKeyguardLocked()) {
                    mStackSupervisor.ensureActivitiesVisibleLocked(null /* starting */,
                            0 /* configChanges */, false /* preserveWindows */);
                }
                final Configuration config = mWindowManager.updateOrientationFromAppTokens(
                        mStackSupervisor.getDisplayOverrideConfiguration(mDisplayId),
                        next.mayFreezeScreenLocked(next.app) ? next.appToken : null, mDisplayId);
+3 −1
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG;
import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static com.android.server.wm.AppTransition.TRANSIT_KEYGUARD_UNOCCLUDE;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_BOOT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_DISPLAY;
@@ -3554,7 +3555,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo

            mLastWindowForcedOrientation = SCREEN_ORIENTATION_UNSPECIFIED;

            if (policy.isKeyguardShowingAndNotOccluded()) {
            if (policy.isKeyguardShowingAndNotOccluded()
                    || mService.mAppTransition.getAppTransition() == TRANSIT_KEYGUARD_UNOCCLUDE) {
                return mLastKeyguardForcedOrientation;
            }