OSDN Git Service

Use Keyguard orientation when unoccluding
authorJorim Jaggi <jjaggi@google.com>
Thu, 24 Aug 2017 15:23:19 +0000 (17:23 +0200)
committerJorim Jaggi <jjaggi@google.com>
Mon, 28 Aug 2017 13:52:21 +0000 (15:52 +0200)
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

services/core/java/com/android/server/am/ActivityStack.java
services/core/java/com/android/server/wm/DisplayContent.java

index eb3177a..c67b0d8 100644 (file)
@@ -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);
index f0a375b..266ebf3 100644 (file)
@@ -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;
             }