Loading services/core/java/com/android/server/wm/ActivityRecord.java +14 −4 Original line number Diff line number Diff line Loading @@ -2635,10 +2635,20 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (snapshot == null) { return false; } if (!snapshot.getTopActivityComponent().equals(mActivityComponent)) { // Obsoleted snapshot. return false; return isSnapshotComponentCompatible(snapshot) && isSnapshotOrientationCompatible(snapshot); } /** * Returns {@code true} if the top activity component of task snapshot equals to this activity. */ boolean isSnapshotComponentCompatible(@NonNull TaskSnapshot snapshot) { return snapshot.getTopActivityComponent().equals(mActivityComponent); } /** * Returns {@code true} if the orientation of task snapshot is compatible with this activity. */ boolean isSnapshotOrientationCompatible(@NonNull TaskSnapshot snapshot) { final int rotation = mDisplayContent.rotationForActivityInDifferentOrientation(this); final int currentRotation = task.getWindowConfiguration().getRotation(); final int targetRotation = rotation != ROTATION_UNDEFINED Loading services/core/java/com/android/server/wm/BackNavigationController.java +35 −16 Original line number Diff line number Diff line Loading @@ -956,6 +956,18 @@ class BackNavigationController { return; } // Start fixed rotation for previous activity before create animation. if (openingActivities.length == 1) { final ActivityRecord next = openingActivities[0]; final DisplayContent dc = next.mDisplayContent; dc.rotateInDifferentOrientationIfNeeded(next); if (next.hasFixedRotationTransform()) { // Set the record so we can recognize it to continue to update display // orientation if the previous activity becomes the top later. dc.setFixedRotationLaunchingApp(next, next.getWindowConfiguration().getRotation()); } } mOpenAnimAdaptor = new BackWindowAnimationAdaptorWrapper(true, mSwitchType, open); if (!mOpenAnimAdaptor.isValid()) { Slog.w(TAG, "compose animations fail, skip"); Loading Loading @@ -1621,16 +1633,6 @@ class BackNavigationController { } activity.mLaunchTaskBehind = true; // Handle fixed rotation launching app. final DisplayContent dc = activity.mDisplayContent; dc.rotateInDifferentOrientationIfNeeded(activity); if (activity.hasFixedRotationTransform()) { // Set the record so we can recognize it to continue to update display // orientation if the previous activity becomes the top later. dc.setFixedRotationLaunchingApp(activity, activity.getWindowConfiguration().getRotation()); } ProtoLog.d(WM_DEBUG_BACK_PREVIEW, "Setting Activity.mLauncherTaskBehind to true. Activity=%s", activity); activity.mTaskSupervisor.mStoppingActivities.remove(activity); Loading Loading @@ -1698,20 +1700,37 @@ class BackNavigationController { static TaskSnapshot getSnapshot(@NonNull WindowContainer w, ActivityRecord[] visibleOpenActivities) { TaskSnapshot snapshot = null; if (w.asTask() != null) { final Task task = w.asTask(); return task.mRootWindowContainer.mWindowManager.mTaskSnapshotController.getSnapshot( snapshot = task.mRootWindowContainer.mWindowManager.mTaskSnapshotController.getSnapshot( task.mTaskId, task.mUserId, false /* restoreFromDisk */, false /* isLowResolution */); } if (w.asActivityRecord() != null) { } else if (w.asActivityRecord() != null) { final ActivityRecord ar = w.asActivityRecord(); return ar.mWmService.mSnapshotController.mActivitySnapshotController snapshot = ar.mWmService.mSnapshotController.mActivitySnapshotController .getSnapshot(visibleOpenActivities); } return null; return isSnapshotCompatible(snapshot, visibleOpenActivities) ? snapshot : null; } static boolean isSnapshotCompatible(@NonNull TaskSnapshot snapshot, @NonNull ActivityRecord[] visibleOpenActivities) { if (snapshot == null) { return false; } boolean oneComponentMatch = false; for (int i = visibleOpenActivities.length - 1; i >= 0; --i) { final ActivityRecord ar = visibleOpenActivities[i]; if (!ar.isSnapshotOrientationCompatible(snapshot)) { return false; } oneComponentMatch |= ar.isSnapshotComponentCompatible(snapshot); } return oneComponentMatch; } void setWindowManager(WindowManagerService wm) { mWindowManagerService = wm; Loading services/core/java/com/android/server/wm/LetterboxUiController.java +1 −8 Original line number Diff line number Diff line Loading @@ -1424,7 +1424,7 @@ final class LetterboxUiController { @VisibleForTesting boolean shouldShowLetterboxUi(WindowState mainWindow) { if (mIsRelaunchingAfterRequestedOrientationChanged || !isSurfaceReadyToShow(mainWindow)) { if (mIsRelaunchingAfterRequestedOrientationChanged) { return mLastShouldShowLetterboxUi; } Loading @@ -1441,13 +1441,6 @@ final class LetterboxUiController { return shouldShowLetterboxUi; } @VisibleForTesting boolean isSurfaceReadyToShow(WindowState mainWindow) { return mainWindow.isDrawn() // Regular case // Waiting for relayoutWindow to call preserveSurface || mainWindow.isDragResizeChanged(); } @VisibleForTesting boolean isSurfaceVisible(WindowState mainWindow) { return mainWindow.isOnScreen() && (mActivityRecord.isVisible() Loading services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +0 −2 Original line number Diff line number Diff line Loading @@ -885,8 +885,6 @@ public class SizeCompatTests extends WindowTestsBase { assertEquals(window, mActivity.findMainWindow()); spyOn(mActivity.mLetterboxUiController); doReturn(true).when(mActivity.mLetterboxUiController) .isSurfaceReadyToShow(any()); doReturn(true).when(mActivity.mLetterboxUiController) .isSurfaceVisible(any()); Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +14 −4 Original line number Diff line number Diff line Loading @@ -2635,10 +2635,20 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (snapshot == null) { return false; } if (!snapshot.getTopActivityComponent().equals(mActivityComponent)) { // Obsoleted snapshot. return false; return isSnapshotComponentCompatible(snapshot) && isSnapshotOrientationCompatible(snapshot); } /** * Returns {@code true} if the top activity component of task snapshot equals to this activity. */ boolean isSnapshotComponentCompatible(@NonNull TaskSnapshot snapshot) { return snapshot.getTopActivityComponent().equals(mActivityComponent); } /** * Returns {@code true} if the orientation of task snapshot is compatible with this activity. */ boolean isSnapshotOrientationCompatible(@NonNull TaskSnapshot snapshot) { final int rotation = mDisplayContent.rotationForActivityInDifferentOrientation(this); final int currentRotation = task.getWindowConfiguration().getRotation(); final int targetRotation = rotation != ROTATION_UNDEFINED Loading
services/core/java/com/android/server/wm/BackNavigationController.java +35 −16 Original line number Diff line number Diff line Loading @@ -956,6 +956,18 @@ class BackNavigationController { return; } // Start fixed rotation for previous activity before create animation. if (openingActivities.length == 1) { final ActivityRecord next = openingActivities[0]; final DisplayContent dc = next.mDisplayContent; dc.rotateInDifferentOrientationIfNeeded(next); if (next.hasFixedRotationTransform()) { // Set the record so we can recognize it to continue to update display // orientation if the previous activity becomes the top later. dc.setFixedRotationLaunchingApp(next, next.getWindowConfiguration().getRotation()); } } mOpenAnimAdaptor = new BackWindowAnimationAdaptorWrapper(true, mSwitchType, open); if (!mOpenAnimAdaptor.isValid()) { Slog.w(TAG, "compose animations fail, skip"); Loading Loading @@ -1621,16 +1633,6 @@ class BackNavigationController { } activity.mLaunchTaskBehind = true; // Handle fixed rotation launching app. final DisplayContent dc = activity.mDisplayContent; dc.rotateInDifferentOrientationIfNeeded(activity); if (activity.hasFixedRotationTransform()) { // Set the record so we can recognize it to continue to update display // orientation if the previous activity becomes the top later. dc.setFixedRotationLaunchingApp(activity, activity.getWindowConfiguration().getRotation()); } ProtoLog.d(WM_DEBUG_BACK_PREVIEW, "Setting Activity.mLauncherTaskBehind to true. Activity=%s", activity); activity.mTaskSupervisor.mStoppingActivities.remove(activity); Loading Loading @@ -1698,20 +1700,37 @@ class BackNavigationController { static TaskSnapshot getSnapshot(@NonNull WindowContainer w, ActivityRecord[] visibleOpenActivities) { TaskSnapshot snapshot = null; if (w.asTask() != null) { final Task task = w.asTask(); return task.mRootWindowContainer.mWindowManager.mTaskSnapshotController.getSnapshot( snapshot = task.mRootWindowContainer.mWindowManager.mTaskSnapshotController.getSnapshot( task.mTaskId, task.mUserId, false /* restoreFromDisk */, false /* isLowResolution */); } if (w.asActivityRecord() != null) { } else if (w.asActivityRecord() != null) { final ActivityRecord ar = w.asActivityRecord(); return ar.mWmService.mSnapshotController.mActivitySnapshotController snapshot = ar.mWmService.mSnapshotController.mActivitySnapshotController .getSnapshot(visibleOpenActivities); } return null; return isSnapshotCompatible(snapshot, visibleOpenActivities) ? snapshot : null; } static boolean isSnapshotCompatible(@NonNull TaskSnapshot snapshot, @NonNull ActivityRecord[] visibleOpenActivities) { if (snapshot == null) { return false; } boolean oneComponentMatch = false; for (int i = visibleOpenActivities.length - 1; i >= 0; --i) { final ActivityRecord ar = visibleOpenActivities[i]; if (!ar.isSnapshotOrientationCompatible(snapshot)) { return false; } oneComponentMatch |= ar.isSnapshotComponentCompatible(snapshot); } return oneComponentMatch; } void setWindowManager(WindowManagerService wm) { mWindowManagerService = wm; Loading
services/core/java/com/android/server/wm/LetterboxUiController.java +1 −8 Original line number Diff line number Diff line Loading @@ -1424,7 +1424,7 @@ final class LetterboxUiController { @VisibleForTesting boolean shouldShowLetterboxUi(WindowState mainWindow) { if (mIsRelaunchingAfterRequestedOrientationChanged || !isSurfaceReadyToShow(mainWindow)) { if (mIsRelaunchingAfterRequestedOrientationChanged) { return mLastShouldShowLetterboxUi; } Loading @@ -1441,13 +1441,6 @@ final class LetterboxUiController { return shouldShowLetterboxUi; } @VisibleForTesting boolean isSurfaceReadyToShow(WindowState mainWindow) { return mainWindow.isDrawn() // Regular case // Waiting for relayoutWindow to call preserveSurface || mainWindow.isDragResizeChanged(); } @VisibleForTesting boolean isSurfaceVisible(WindowState mainWindow) { return mainWindow.isOnScreen() && (mActivityRecord.isVisible() Loading
services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +0 −2 Original line number Diff line number Diff line Loading @@ -885,8 +885,6 @@ public class SizeCompatTests extends WindowTestsBase { assertEquals(window, mActivity.findMainWindow()); spyOn(mActivity.mLetterboxUiController); doReturn(true).when(mActivity.mLetterboxUiController) .isSurfaceReadyToShow(any()); doReturn(true).when(mActivity.mLetterboxUiController) .isSurfaceVisible(any()); Loading