Merge "Do not force seamless rotation with animating rotated recents" into rvc-dev am: 9092277a89 am: c57d3b0c7b
Change-Id: I54be7ba0cd85d00e1926f6993927f8b8ff0e0450
This commit is contained in:
@@ -1486,8 +1486,16 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable ActivityRecord getFixedRotationLaunchingApp() {
|
/** Returns {@code true} if the top activity is transformed with the new rotation of display. */
|
||||||
return mFixedRotationLaunchingApp;
|
boolean hasTopFixedRotationLaunchingApp() {
|
||||||
|
return mFixedRotationLaunchingApp != null
|
||||||
|
// Ignore animating recents because it hasn't really become the top.
|
||||||
|
&& mFixedRotationLaunchingApp != mFixedRotationTransitionListener.mAnimatingRecents;
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
boolean isFixedRotationLaunchingApp(ActivityRecord r) {
|
||||||
|
return mFixedRotationLaunchingApp == r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
|||||||
@@ -582,7 +582,7 @@ public class DisplayRotation {
|
|||||||
boolean shouldRotateSeamlessly(int oldRotation, int newRotation, boolean forceUpdate) {
|
boolean shouldRotateSeamlessly(int oldRotation, int newRotation, boolean forceUpdate) {
|
||||||
// Display doesn't need to be frozen because application has been started in correct
|
// Display doesn't need to be frozen because application has been started in correct
|
||||||
// rotation already, so the rest of the windows can use seamless rotation.
|
// rotation already, so the rest of the windows can use seamless rotation.
|
||||||
if (mDisplayContent.getFixedRotationLaunchingApp() != null) {
|
if (mDisplayContent.hasTopFixedRotationLaunchingApp()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1412,7 +1412,7 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
|||||||
|
|
||||||
// The launching rotated app should not be cleared when waiting for remote rotation.
|
// The launching rotated app should not be cleared when waiting for remote rotation.
|
||||||
display.continueUpdateOrientationForDiffOrienLaunchingApp();
|
display.continueUpdateOrientationForDiffOrienLaunchingApp();
|
||||||
assertNotNull(display.getFixedRotationLaunchingApp());
|
assertTrue(display.isFixedRotationLaunchingApp(mActivity));
|
||||||
|
|
||||||
// Simulate the rotation has been updated to previous one, e.g. sensor updates before the
|
// Simulate the rotation has been updated to previous one, e.g. sensor updates before the
|
||||||
// remote rotation is completed.
|
// remote rotation is completed.
|
||||||
@@ -1441,7 +1441,7 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
|||||||
display.setFixedRotationLaunchingAppUnchecked(mActivity);
|
display.setFixedRotationLaunchingAppUnchecked(mActivity);
|
||||||
display.sendNewConfiguration();
|
display.sendNewConfiguration();
|
||||||
|
|
||||||
assertNull(display.getFixedRotationLaunchingApp());
|
assertFalse(display.hasTopFixedRotationLaunchingApp());
|
||||||
assertFalse(mActivity.hasFixedRotationTransform());
|
assertFalse(mActivity.hasFixedRotationTransform());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1497,7 +1497,7 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
|||||||
// rotation should be applied when creating snapshot surface if the display rotation may be
|
// rotation should be applied when creating snapshot surface if the display rotation may be
|
||||||
// changed according to the activity orientation.
|
// changed according to the activity orientation.
|
||||||
assertTrue(mActivity.hasFixedRotationTransform());
|
assertTrue(mActivity.hasFixedRotationTransform());
|
||||||
assertEquals(mActivity, mActivity.mDisplayContent.getFixedRotationLaunchingApp());
|
assertTrue(mActivity.mDisplayContent.isFixedRotationLaunchingApp(mActivity));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1147,6 +1147,24 @@ public class DisplayContentTests extends WindowTestsBase {
|
|||||||
assertNull(mDisplayContent.getFixedRotationAnimationController());
|
assertNull(mDisplayContent.getFixedRotationAnimationController());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRotateSeamlesslyWithFixedRotation() {
|
||||||
|
final DisplayRotation displayRotation = mDisplayContent.getDisplayRotation();
|
||||||
|
final ActivityRecord app = mAppWindow.mActivityRecord;
|
||||||
|
mDisplayContent.setFixedRotationLaunchingAppUnchecked(app);
|
||||||
|
mAppWindow.mAttrs.rotationAnimation = WindowManager.LayoutParams.ROTATION_ANIMATION_ROTATE;
|
||||||
|
|
||||||
|
// Use seamless rotation if the top app is rotated.
|
||||||
|
assertTrue(displayRotation.shouldRotateSeamlessly(ROTATION_0 /* oldRotation */,
|
||||||
|
ROTATION_90 /* newRotation */, false /* forceUpdate */));
|
||||||
|
|
||||||
|
mDisplayContent.mFixedRotationTransitionListener.onStartRecentsAnimation(app);
|
||||||
|
|
||||||
|
// Use normal rotation because animating recents is an intermediate state.
|
||||||
|
assertFalse(displayRotation.shouldRotateSeamlessly(ROTATION_0 /* oldRotation */,
|
||||||
|
ROTATION_90 /* newRotation */, false /* forceUpdate */));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRemoteRotation() {
|
public void testRemoteRotation() {
|
||||||
DisplayContent dc = createNewDisplay();
|
DisplayContent dc = createNewDisplay();
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
|
|||||||
|
|
||||||
initializeRecentsAnimationController(mController, homeActivity);
|
initializeRecentsAnimationController(mController, homeActivity);
|
||||||
|
|
||||||
assertEquals(homeActivity, mDefaultDisplay.getFixedRotationLaunchingApp());
|
assertTrue(mDefaultDisplay.isFixedRotationLaunchingApp(homeActivity));
|
||||||
|
|
||||||
// Check that the home app is in portrait
|
// Check that the home app is in portrait
|
||||||
assertEquals(Configuration.ORIENTATION_PORTRAIT,
|
assertEquals(Configuration.ORIENTATION_PORTRAIT,
|
||||||
@@ -353,7 +353,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
|
|||||||
// top rotated record should be cleared.
|
// top rotated record should be cleared.
|
||||||
mController.cleanupAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION);
|
mController.cleanupAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION);
|
||||||
assertFalse(homeActivity.hasFixedRotationTransform());
|
assertFalse(homeActivity.hasFixedRotationTransform());
|
||||||
assertNull(mDefaultDisplay.getFixedRotationLaunchingApp());
|
assertFalse(mDefaultDisplay.hasTopFixedRotationLaunchingApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -367,7 +367,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
|
|||||||
(mDefaultDisplay.getRotation() + 1) % 4);
|
(mDefaultDisplay.getRotation() + 1) % 4);
|
||||||
|
|
||||||
assertTrue(activity.hasFixedRotationTransform());
|
assertTrue(activity.hasFixedRotationTransform());
|
||||||
assertEquals(activity, mDefaultDisplay.getFixedRotationLaunchingApp());
|
assertTrue(mDefaultDisplay.isFixedRotationLaunchingApp(activity));
|
||||||
|
|
||||||
// Before the transition is done, the recents animation is triggered.
|
// Before the transition is done, the recents animation is triggered.
|
||||||
initializeRecentsAnimationController(mController, homeActivity);
|
initializeRecentsAnimationController(mController, homeActivity);
|
||||||
@@ -377,7 +377,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
|
|||||||
mController.cleanupAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION);
|
mController.cleanupAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION);
|
||||||
// The rotation transform should be cleared after updating orientation with display.
|
// The rotation transform should be cleared after updating orientation with display.
|
||||||
assertFalse(activity.hasFixedRotationTransform());
|
assertFalse(activity.hasFixedRotationTransform());
|
||||||
assertNull(mDefaultDisplay.getFixedRotationLaunchingApp());
|
assertFalse(mDefaultDisplay.hasTopFixedRotationLaunchingApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -436,7 +436,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
|
|||||||
// The transform state should keep because we expect to listen the signal from the
|
// The transform state should keep because we expect to listen the signal from the
|
||||||
// transition executed by moving the task to front.
|
// transition executed by moving the task to front.
|
||||||
assertTrue(homeActivity.hasFixedRotationTransform());
|
assertTrue(homeActivity.hasFixedRotationTransform());
|
||||||
assertEquals(homeActivity, mDefaultDisplay.getFixedRotationLaunchingApp());
|
assertTrue(mDefaultDisplay.isFixedRotationLaunchingApp(homeActivity));
|
||||||
|
|
||||||
mDefaultDisplay.mFixedRotationTransitionListener.onAppTransitionFinishedLocked(
|
mDefaultDisplay.mFixedRotationTransitionListener.onAppTransitionFinishedLocked(
|
||||||
homeActivity.token);
|
homeActivity.token);
|
||||||
|
|||||||
Reference in New Issue
Block a user