Merge "Check physical upside down for seamless rotation" into tm-dev am: 150cf0e72a am: fc2eaa4140
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17950067 Change-Id: Ib92a6e1c46e6f09746af4345232e80542503a010 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -702,17 +702,17 @@ public class DisplayRotation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean canRotateSeamlessly(int oldRotation, int newRotation) {
|
boolean canRotateSeamlessly(int oldRotation, int newRotation) {
|
||||||
|
// If the navigation bar can't change sides, then it will jump when we change orientations
|
||||||
|
// and we don't rotate seamlessly - unless that is allowed, eg. with gesture navigation
|
||||||
|
// where the navbar is low-profile enough that this isn't very noticeable.
|
||||||
|
if (mAllowSeamlessRotationDespiteNavBarMoving || mDisplayPolicy.navigationBarCanMove()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// For the upside down rotation we don't rotate seamlessly as the navigation bar moves
|
// For the upside down rotation we don't rotate seamlessly as the navigation bar moves
|
||||||
// position. Note most apps (using orientation:sensor or user as opposed to fullSensor)
|
// position. Note most apps (using orientation:sensor or user as opposed to fullSensor)
|
||||||
// will not enter the reverse portrait orientation, so actually the orientation won't change
|
// will not enter the reverse portrait orientation, so actually the orientation won't change
|
||||||
// at all.
|
// at all.
|
||||||
if (oldRotation == mUpsideDownRotation || newRotation == mUpsideDownRotation) {
|
return oldRotation != Surface.ROTATION_180 && newRotation != Surface.ROTATION_180;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// If the navigation bar can't change sides, then it will jump when we change orientations
|
|
||||||
// and we don't rotate seamlessly - unless that is allowed, eg. with gesture navigation
|
|
||||||
// where the navbar is low-profile enough that this isn't very noticeable.
|
|
||||||
return mAllowSeamlessRotationDespiteNavBarMoving || mDisplayPolicy.navigationBarCanMove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void markForSeamlessRotation(WindowState w, boolean seamlesslyRotated) {
|
void markForSeamlessRotation(WindowState w, boolean seamlesslyRotated) {
|
||||||
|
|||||||
@@ -721,14 +721,20 @@ public class DisplayRotationTests {
|
|||||||
doReturn(true).when(mMockDisplayPolicy).navigationBarCanMove();
|
doReturn(true).when(mMockDisplayPolicy).navigationBarCanMove();
|
||||||
doReturn(win).when(mMockDisplayPolicy).getTopFullscreenOpaqueWindow();
|
doReturn(win).when(mMockDisplayPolicy).getTopFullscreenOpaqueWindow();
|
||||||
mMockDisplayContent.mCurrentFocus = win;
|
mMockDisplayContent.mCurrentFocus = win;
|
||||||
mTarget.mUpsideDownRotation = Surface.ROTATION_180;
|
// This should not affect the condition of shouldRotateSeamlessly.
|
||||||
|
mTarget.mUpsideDownRotation = Surface.ROTATION_90;
|
||||||
|
|
||||||
doReturn(true).when(win.mActivityRecord).matchParentBounds();
|
doReturn(true).when(win.mActivityRecord).matchParentBounds();
|
||||||
// The focused fullscreen opaque window without override bounds should be able to be
|
// The focused fullscreen opaque window without override bounds should be able to be
|
||||||
// rotated seamlessly.
|
// rotated seamlessly.
|
||||||
assertTrue(mTarget.shouldRotateSeamlessly(
|
assertTrue(mTarget.shouldRotateSeamlessly(
|
||||||
Surface.ROTATION_0, Surface.ROTATION_90, false /* forceUpdate */));
|
Surface.ROTATION_0, Surface.ROTATION_90, false /* forceUpdate */));
|
||||||
|
// Reject any 180 degree because non-movable navbar will be placed in a different position.
|
||||||
|
doReturn(false).when(mMockDisplayPolicy).navigationBarCanMove();
|
||||||
|
assertFalse(mTarget.shouldRotateSeamlessly(
|
||||||
|
Surface.ROTATION_90, Surface.ROTATION_180, false /* forceUpdate */));
|
||||||
|
|
||||||
|
doReturn(true).when(mMockDisplayPolicy).navigationBarCanMove();
|
||||||
doReturn(false).when(win.mActivityRecord).matchParentBounds();
|
doReturn(false).when(win.mActivityRecord).matchParentBounds();
|
||||||
// No seamless rotation if the window may be positioned with offset after rotation.
|
// No seamless rotation if the window may be positioned with offset after rotation.
|
||||||
assertFalse(mTarget.shouldRotateSeamlessly(
|
assertFalse(mTarget.shouldRotateSeamlessly(
|
||||||
|
|||||||
Reference in New Issue
Block a user