Merge "Allow to use fixed rotation with remote swipe-unlock animation" into sc-dev am: a03cc0627a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15066856 Change-Id: I7494c072edc1c65f8e709671f3af46ca53420328
This commit is contained in:
@@ -551,7 +551,13 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {
|
|||||||
}
|
}
|
||||||
final WindowManagerPolicy policy = mWmService.mPolicy;
|
final WindowManagerPolicy policy = mWmService.mPolicy;
|
||||||
if (policy.isKeyguardHostWindow(w.mAttrs)) {
|
if (policy.isKeyguardHostWindow(w.mAttrs)) {
|
||||||
if (mWmService.mKeyguardGoingAway) {
|
// Ignore the orientation of keyguard if it is going away or is not showing while
|
||||||
|
// the device is fully awake. In other words, use the orientation of keyguard if
|
||||||
|
// its window is visible while the device is going to sleep or is sleeping.
|
||||||
|
if (!mWmService.mAtmService.isKeyguardLocked()
|
||||||
|
&& mDisplayContent.getDisplayPolicy().isAwake()
|
||||||
|
// Device is not going to sleep.
|
||||||
|
&& policy.okToAnimate(true /* ignoreScreenOn */)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Consider unoccluding only when all unknown visibilities have been
|
// Consider unoccluding only when all unknown visibilities have been
|
||||||
|
|||||||
@@ -1564,12 +1564,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
// window was transferred ({@link #mSkipAppTransitionAnimation}).
|
// window was transferred ({@link #mSkipAppTransitionAnimation}).
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((mAppTransition.getTransitFlags()
|
|
||||||
& WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) != 0) {
|
|
||||||
// The transition may be finished before keyguard hidden. In order to avoid the
|
|
||||||
// intermediate orientation change, it is more stable to freeze the display.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (r.isState(RESUMED) && !r.getRootTask().mInResumeTopActivity) {
|
if (r.isState(RESUMED) && !r.getRootTask().mInResumeTopActivity) {
|
||||||
// If the activity is executing or has done the lifecycle callback, use normal
|
// If the activity is executing or has done the lifecycle callback, use normal
|
||||||
// rotation animation so the display info can be updated immediately (see
|
// rotation animation so the display info can be updated immediately (see
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ class KeyguardController {
|
|||||||
private boolean mAodShowing;
|
private boolean mAodShowing;
|
||||||
private boolean mKeyguardGoingAway;
|
private boolean mKeyguardGoingAway;
|
||||||
private boolean mDismissalRequested;
|
private boolean mDismissalRequested;
|
||||||
private int mBeforeUnoccludeTransit;
|
|
||||||
private final SparseArray<KeyguardDisplayState> mDisplayStates = new SparseArray<>();
|
private final SparseArray<KeyguardDisplayState> mDisplayStates = new SparseArray<>();
|
||||||
private final ActivityTaskManagerService mService;
|
private final ActivityTaskManagerService mService;
|
||||||
private RootWindowContainer mRootWindowContainer;
|
private RootWindowContainer mRootWindowContainer;
|
||||||
@@ -191,14 +190,11 @@ class KeyguardController {
|
|||||||
// Irrelevant to AOD.
|
// Irrelevant to AOD.
|
||||||
dismissMultiWindowModeForTaskIfNeeded(null /* currentTaskControllsingOcclusion */,
|
dismissMultiWindowModeForTaskIfNeeded(null /* currentTaskControllsingOcclusion */,
|
||||||
false /* turningScreenOn */);
|
false /* turningScreenOn */);
|
||||||
setKeyguardGoingAway(false);
|
mKeyguardGoingAway = false;
|
||||||
if (keyguardShowing) {
|
if (keyguardShowing) {
|
||||||
mDismissalRequested = false;
|
mDismissalRequested = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO(b/113840485): Check usage for non-default display
|
|
||||||
mWindowManager.setKeyguardOrAodShowingOnDefaultDisplay(
|
|
||||||
isKeyguardOrAodShowing(DEFAULT_DISPLAY));
|
|
||||||
|
|
||||||
// Update the sleep token first such that ensureActivitiesVisible has correct sleep token
|
// Update the sleep token first such that ensureActivitiesVisible has correct sleep token
|
||||||
// state when evaluating visibilities.
|
// state when evaluating visibilities.
|
||||||
@@ -219,8 +215,8 @@ class KeyguardController {
|
|||||||
}
|
}
|
||||||
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "keyguardGoingAway");
|
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "keyguardGoingAway");
|
||||||
mService.deferWindowLayout();
|
mService.deferWindowLayout();
|
||||||
|
mKeyguardGoingAway = true;
|
||||||
try {
|
try {
|
||||||
setKeyguardGoingAway(true);
|
|
||||||
EventLogTags.writeWmSetKeyguardShown(
|
EventLogTags.writeWmSetKeyguardShown(
|
||||||
1 /* keyguardShowing */,
|
1 /* keyguardShowing */,
|
||||||
mAodShowing ? 1 : 0,
|
mAodShowing ? 1 : 0,
|
||||||
@@ -258,11 +254,6 @@ class KeyguardController {
|
|||||||
mWindowManager.dismissKeyguard(callback, message);
|
mWindowManager.dismissKeyguard(callback, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setKeyguardGoingAway(boolean keyguardGoingAway) {
|
|
||||||
mKeyguardGoingAway = keyguardGoingAway;
|
|
||||||
mWindowManager.setKeyguardGoingAway(keyguardGoingAway);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void failCallback(IKeyguardDismissCallback callback) {
|
private void failCallback(IKeyguardDismissCallback callback) {
|
||||||
try {
|
try {
|
||||||
callback.onDismissError();
|
callback.onDismissError();
|
||||||
|
|||||||
@@ -483,10 +483,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
private final DisplayAreaPolicy.Provider mDisplayAreaPolicyProvider;
|
private final DisplayAreaPolicy.Provider mDisplayAreaPolicyProvider;
|
||||||
|
|
||||||
final private KeyguardDisableHandler mKeyguardDisableHandler;
|
final private KeyguardDisableHandler mKeyguardDisableHandler;
|
||||||
// TODO: eventually unify all keyguard state in a common place instead of having it spread over
|
|
||||||
// AM's KeyguardController and the policy's KeyguardServiceDelegate.
|
|
||||||
boolean mKeyguardGoingAway;
|
|
||||||
boolean mKeyguardOrAodShowingOnDefaultDisplay;
|
|
||||||
// VR Vr2d Display Id.
|
// VR Vr2d Display Id.
|
||||||
int mVr2dDisplayId = INVALID_DISPLAY;
|
int mVr2dDisplayId = INVALID_DISPLAY;
|
||||||
boolean mVrModeEnabled = false;
|
boolean mVrModeEnabled = false;
|
||||||
@@ -3072,17 +3069,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
mAtmInternal.notifyKeyguardFlagsChanged(callback, displayId);
|
mAtmInternal.notifyKeyguardFlagsChanged(callback, displayId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyguardGoingAway(boolean keyguardGoingAway) {
|
|
||||||
synchronized (mGlobalLock) {
|
|
||||||
mKeyguardGoingAway = keyguardGoingAway;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKeyguardOrAodShowingOnDefaultDisplay(boolean showing) {
|
|
||||||
synchronized (mGlobalLock) {
|
|
||||||
mKeyguardOrAodShowingOnDefaultDisplay = showing;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
// Misc IWindowSession methods
|
// Misc IWindowSession methods
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ import static org.mockito.Mockito.clearInvocations;
|
|||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.doAnswer;
|
||||||
import static org.mockito.Mockito.doCallRealMethod;
|
import static org.mockito.Mockito.doCallRealMethod;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.ActivityTaskManager;
|
import android.app.ActivityTaskManager;
|
||||||
import android.app.WindowConfiguration;
|
import android.app.WindowConfiguration;
|
||||||
import android.app.servertransaction.FixedRotationAdjustmentsItem;
|
import android.app.servertransaction.FixedRotationAdjustmentsItem;
|
||||||
@@ -792,15 +791,9 @@ public class DisplayContentTests extends WindowTestsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressLint("InlinedApi")
|
|
||||||
public void testOrientationDefinedByKeyguard() {
|
public void testOrientationDefinedByKeyguard() {
|
||||||
final DisplayContent dc = createNewDisplay();
|
final DisplayContent dc = mDisplayContent;
|
||||||
|
dc.getDisplayPolicy().setAwake(true);
|
||||||
// When display content is created its configuration is not yet initialized, which could
|
|
||||||
// cause unnecessary configuration propagation, so initialize it here.
|
|
||||||
final Configuration config = new Configuration();
|
|
||||||
dc.computeScreenConfiguration(config);
|
|
||||||
dc.onRequestedOverrideConfigurationChanged(config);
|
|
||||||
|
|
||||||
// Create a window that requests landscape orientation. It will define device orientation
|
// Create a window that requests landscape orientation. It will define device orientation
|
||||||
// by default.
|
// by default.
|
||||||
@@ -815,10 +808,12 @@ public class DisplayContentTests extends WindowTestsBase {
|
|||||||
SCREEN_ORIENTATION_LANDSCAPE, dc.getOrientation());
|
SCREEN_ORIENTATION_LANDSCAPE, dc.getOrientation());
|
||||||
|
|
||||||
keyguard.mAttrs.screenOrientation = SCREEN_ORIENTATION_PORTRAIT;
|
keyguard.mAttrs.screenOrientation = SCREEN_ORIENTATION_PORTRAIT;
|
||||||
|
mAtm.mKeyguardController.setKeyguardShown(true /* keyguardShowing */,
|
||||||
|
false /* aodShowing */);
|
||||||
assertEquals("Visible keyguard must influence device orientation",
|
assertEquals("Visible keyguard must influence device orientation",
|
||||||
SCREEN_ORIENTATION_PORTRAIT, dc.getOrientation());
|
SCREEN_ORIENTATION_PORTRAIT, dc.getOrientation());
|
||||||
|
|
||||||
mWm.setKeyguardGoingAway(true);
|
mAtm.mKeyguardController.keyguardGoingAway(0 /* flags */);
|
||||||
assertEquals("Keyguard that is going away must not influence device orientation",
|
assertEquals("Keyguard that is going away must not influence device orientation",
|
||||||
SCREEN_ORIENTATION_LANDSCAPE, dc.getOrientation());
|
SCREEN_ORIENTATION_LANDSCAPE, dc.getOrientation());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user