Merge "Update display orientation that was interrupted by recents animation" into rvc-dev
This commit is contained in:
@@ -5527,7 +5527,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
/**
|
/**
|
||||||
* The animating activity which shows the recents task list. It is set between
|
* The animating activity which shows the recents task list. It is set between
|
||||||
* {@link RecentsAnimationController#initialize} and
|
* {@link RecentsAnimationController#initialize} and
|
||||||
* {@link RecentsAnimationController#cancelAnimation}.
|
* {@link RecentsAnimationController#cleanupAnimation}.
|
||||||
*/
|
*/
|
||||||
private ActivityRecord mAnimatingRecents;
|
private ActivityRecord mAnimatingRecents;
|
||||||
|
|
||||||
@@ -5550,14 +5550,25 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
* If {@link #mAnimatingRecents} still has fixed rotation, it should be moved to top so we
|
* If {@link #mAnimatingRecents} still has fixed rotation, it should be moved to top so we
|
||||||
* don't clear {@link #mFixedRotationLaunchingApp} that will be handled by transition.
|
* don't clear {@link #mFixedRotationLaunchingApp} that will be handled by transition.
|
||||||
*/
|
*/
|
||||||
void onFinishRecentsAnimation() {
|
void onFinishRecentsAnimation(boolean moveRecentsToBack) {
|
||||||
final ActivityRecord animatingRecents = mAnimatingRecents;
|
final ActivityRecord animatingRecents = mAnimatingRecents;
|
||||||
mAnimatingRecents = null;
|
mAnimatingRecents = null;
|
||||||
if (animatingRecents != null && animatingRecents == mFixedRotationLaunchingApp
|
if (!moveRecentsToBack) {
|
||||||
&& !animatingRecents.hasFixedRotationTransform()) {
|
// The recents activity will be the top, such as staying at recents list or
|
||||||
// The recents activity won't be the top, such as giving up the swipe up gesture
|
// returning to home (if home and recents are the same activity).
|
||||||
// and return to the original top.
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (animatingRecents != null && animatingRecents == mFixedRotationLaunchingApp) {
|
||||||
|
// Because it won't affect display orientation, just finish the transform.
|
||||||
|
animatingRecents.finishFixedRotationTransform();
|
||||||
mFixedRotationLaunchingApp = null;
|
mFixedRotationLaunchingApp = null;
|
||||||
|
} else {
|
||||||
|
// If there is already a launching activity that is not the recents, before its
|
||||||
|
// transition is completed, the recents animation may be started. So if the recents
|
||||||
|
// activity won't be the top, the display orientation should be updated according
|
||||||
|
// to the current top activity.
|
||||||
|
continueUpdateOrientationForDiffOrienLaunchingApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -734,13 +734,10 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
if (reorderMode == REORDER_MOVE_TO_TOP || reorderMode == REORDER_KEEP_IN_PLACE) {
|
if (reorderMode == REORDER_MOVE_TO_TOP || reorderMode == REORDER_KEEP_IN_PLACE) {
|
||||||
mDisplayContent.mAppTransition.notifyAppTransitionFinishedLocked(
|
mDisplayContent.mAppTransition.notifyAppTransitionFinishedLocked(
|
||||||
mTargetActivityRecord.token);
|
mTargetActivityRecord.token);
|
||||||
} else {
|
|
||||||
// The target activity will be moved to original position (non-top). Since it won't
|
|
||||||
// affect display orientation, just finish the transform.
|
|
||||||
mTargetActivityRecord.finishFixedRotationTransform();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mDisplayContent.mFixedRotationTransitionListener.onFinishRecentsAnimation();
|
mDisplayContent.mFixedRotationTransitionListener.onFinishRecentsAnimation(
|
||||||
|
reorderMode == REORDER_MOVE_TO_ORIGINAL_POSITION /* moveRecentsToBack */);
|
||||||
|
|
||||||
// Notify that the animation has ended
|
// Notify that the animation has ended
|
||||||
if (mStatusBar != null) {
|
if (mStatusBar != null) {
|
||||||
|
|||||||
@@ -671,6 +671,11 @@ class WindowToken extends WindowContainer<WindowState> {
|
|||||||
pw.print(" waitingToShow=true");
|
pw.print(" waitingToShow=true");
|
||||||
}
|
}
|
||||||
pw.println();
|
pw.println();
|
||||||
|
if (hasFixedRotationTransform()) {
|
||||||
|
pw.print(prefix);
|
||||||
|
pw.print("fixedRotationConfig=");
|
||||||
|
pw.println(mFixedRotationTransformState.mRotatedOverrideConfiguration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.server.wm;
|
package com.android.server.wm;
|
||||||
|
|
||||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
|
||||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
||||||
import static android.view.Display.DEFAULT_DISPLAY;
|
import static android.view.Display.DEFAULT_DISPLAY;
|
||||||
@@ -159,7 +158,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
|
|||||||
hiddenActivity.setVisible(false);
|
hiddenActivity.setVisible(false);
|
||||||
mDefaultDisplay.getConfiguration().windowConfiguration.setRotation(
|
mDefaultDisplay.getConfiguration().windowConfiguration.setRotation(
|
||||||
mDefaultDisplay.getRotation());
|
mDefaultDisplay.getRotation());
|
||||||
mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray(), homeActivity);
|
initializeRecentsAnimationController(mController, homeActivity);
|
||||||
|
|
||||||
// Ensure that we are animating the target activity as well
|
// Ensure that we are animating the target activity as well
|
||||||
assertTrue(mController.isAnimatingTask(homeActivity.getTask()));
|
assertTrue(mController.isAnimatingTask(homeActivity.getTask()));
|
||||||
@@ -182,7 +181,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
|
|||||||
|
|
||||||
mDefaultDisplay.getConfiguration().windowConfiguration.setRotation(
|
mDefaultDisplay.getConfiguration().windowConfiguration.setRotation(
|
||||||
mDefaultDisplay.getRotation());
|
mDefaultDisplay.getRotation());
|
||||||
mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray(), homeActivity);
|
initializeRecentsAnimationController(mController, homeActivity);
|
||||||
mController.startAnimation();
|
mController.startAnimation();
|
||||||
|
|
||||||
// Ensure that we are animating the app and wallpaper target
|
// Ensure that we are animating the app and wallpaper target
|
||||||
@@ -205,7 +204,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
|
|||||||
|
|
||||||
mDefaultDisplay.getConfiguration().windowConfiguration.setRotation(
|
mDefaultDisplay.getConfiguration().windowConfiguration.setRotation(
|
||||||
mDefaultDisplay.getRotation());
|
mDefaultDisplay.getRotation());
|
||||||
mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray(), homeActivity);
|
initializeRecentsAnimationController(mController, homeActivity);
|
||||||
mController.startAnimation();
|
mController.startAnimation();
|
||||||
|
|
||||||
// Cancel the animation and ensure the controller is still running
|
// Cancel the animation and ensure the controller is still running
|
||||||
@@ -231,7 +230,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
|
|||||||
doReturn(true).when(mDefaultDisplay.mWallpaperController).isWallpaperVisible();
|
doReturn(true).when(mDefaultDisplay.mWallpaperController).isWallpaperVisible();
|
||||||
|
|
||||||
// Start and finish the animation
|
// Start and finish the animation
|
||||||
mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray(), homeActivity);
|
initializeRecentsAnimationController(mController, homeActivity);
|
||||||
mController.startAnimation();
|
mController.startAnimation();
|
||||||
|
|
||||||
assertTrue(mController.isAnimatingTask(homeActivity.getTask()));
|
assertTrue(mController.isAnimatingTask(homeActivity.getTask()));
|
||||||
@@ -342,7 +341,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
|
|||||||
assertEquals(Configuration.ORIENTATION_LANDSCAPE,
|
assertEquals(Configuration.ORIENTATION_LANDSCAPE,
|
||||||
mDefaultDisplay.getConfiguration().orientation);
|
mDefaultDisplay.getConfiguration().orientation);
|
||||||
|
|
||||||
mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray(), homeActivity);
|
initializeRecentsAnimationController(mController, homeActivity);
|
||||||
|
|
||||||
assertEquals(homeActivity, mDefaultDisplay.mFixedRotationLaunchingApp);
|
assertEquals(homeActivity, mDefaultDisplay.mFixedRotationLaunchingApp);
|
||||||
|
|
||||||
@@ -357,6 +356,30 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
|
|||||||
assertNull(mDefaultDisplay.mFixedRotationLaunchingApp);
|
assertNull(mDefaultDisplay.mFixedRotationLaunchingApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testClearFixedRotationLaunchingAppAfterCleanupAnimation() {
|
||||||
|
final ActivityRecord homeActivity = createHomeActivity();
|
||||||
|
homeActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
final ActivityRecord activity = createActivityRecord(mDefaultDisplay,
|
||||||
|
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
|
||||||
|
// Assume an activity is launching to different rotation.
|
||||||
|
mDefaultDisplay.setFixedRotationLaunchingApp(activity,
|
||||||
|
(mDefaultDisplay.getRotation() + 1) % 4);
|
||||||
|
|
||||||
|
assertTrue(activity.hasFixedRotationTransform());
|
||||||
|
assertEquals(activity, mDefaultDisplay.mFixedRotationLaunchingApp);
|
||||||
|
|
||||||
|
// Before the transition is done, the recents animation is triggered.
|
||||||
|
initializeRecentsAnimationController(mController, homeActivity);
|
||||||
|
assertFalse(homeActivity.hasFixedRotationTransform());
|
||||||
|
|
||||||
|
// Simulate giving up the swipe up gesture to keep the original activity as top.
|
||||||
|
mController.cleanupAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION);
|
||||||
|
// The rotation transform should be cleared after updating orientation with display.
|
||||||
|
assertFalse(activity.hasFixedRotationTransform());
|
||||||
|
assertNull(mDefaultDisplay.mFixedRotationLaunchingApp);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWallpaperHasFixedRotationApplied() {
|
public void testWallpaperHasFixedRotationApplied() {
|
||||||
mWm.mIsFixedRotationTransformEnabled = true;
|
mWm.mIsFixedRotationTransformEnabled = true;
|
||||||
@@ -394,7 +417,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
|
|||||||
doReturn(true).when(mDefaultDisplay.mWallpaperController).isWallpaperVisible();
|
doReturn(true).when(mDefaultDisplay.mWallpaperController).isWallpaperVisible();
|
||||||
|
|
||||||
// Start the recents animation
|
// Start the recents animation
|
||||||
mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray(), homeActivity);
|
initializeRecentsAnimationController(mController, homeActivity);
|
||||||
|
|
||||||
mDefaultDisplay.mWallpaperController.adjustWallpaperWindows();
|
mDefaultDisplay.mWallpaperController.adjustWallpaperWindows();
|
||||||
|
|
||||||
@@ -433,6 +456,11 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
|
|||||||
return homeActivity;
|
return homeActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void initializeRecentsAnimationController(RecentsAnimationController controller,
|
||||||
|
ActivityRecord activity) {
|
||||||
|
controller.initialize(activity.getActivityType(), new SparseBooleanArray(), activity);
|
||||||
|
}
|
||||||
|
|
||||||
private static void verifyNoMoreInteractionsExceptAsBinder(IInterface binder) {
|
private static void verifyNoMoreInteractionsExceptAsBinder(IInterface binder) {
|
||||||
verify(binder, atLeast(0)).asBinder();
|
verify(binder, atLeast(0)).asBinder();
|
||||||
verifyNoMoreInteractions(binder);
|
verifyNoMoreInteractions(binder);
|
||||||
|
|||||||
Reference in New Issue
Block a user