Merge "Use top activity for fixed rotation from snapshot starting window" into tm-dev am: d6ad543b7c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18924772

Change-Id: I1d1621dc2aa8cac0e9b34ceb66b65e4f607e07f0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Riddle Hsu
2022-06-21 15:03:36 +00:00
committed by Automerger Merge Worker
2 changed files with 12 additions and 5 deletions

View File

@@ -2462,8 +2462,16 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
if (!newTask && taskSwitch && processRunning && !activityCreated && task.intent != null if (!newTask && taskSwitch && processRunning && !activityCreated && task.intent != null
&& mActivityComponent.equals(task.intent.getComponent())) { && mActivityComponent.equals(task.intent.getComponent())) {
final ActivityRecord topAttached = task.getActivity(ActivityRecord::attachedToProcess); final ActivityRecord topAttached = task.getActivity(ActivityRecord::attachedToProcess);
if (topAttached != null && topAttached.isSnapshotCompatible(snapshot)) { if (topAttached != null) {
return STARTING_WINDOW_TYPE_SNAPSHOT; if (topAttached.isSnapshotCompatible(snapshot)
// This trampoline must be the same rotation.
&& mDisplayContent.getDisplayRotation().rotationForOrientation(mOrientation,
mDisplayContent.getRotation()) == snapshot.getRotation()) {
return STARTING_WINDOW_TYPE_SNAPSHOT;
}
// No usable snapshot. And a splash screen may also be weird because an existing
// activity may be shown right after the trampoline is finished.
return STARTING_WINDOW_TYPE_NONE;
} }
} }
final boolean isActivityHome = isActivityTypeHome(); final boolean isActivityHome = isActivityTypeHome();

View File

@@ -158,14 +158,13 @@ public class StartingSurfaceController {
+ topFullscreenActivity); + topFullscreenActivity);
return null; return null;
} }
if (topFullscreenActivity.getWindowConfiguration().getRotation() if (activity.mDisplayContent.getRotation() != taskSnapshot.getRotation()) {
!= taskSnapshot.getRotation()) {
// The snapshot should have been checked by ActivityRecord#isSnapshotCompatible // The snapshot should have been checked by ActivityRecord#isSnapshotCompatible
// that the activity will be updated to the same rotation as the snapshot. Since // that the activity will be updated to the same rotation as the snapshot. Since
// the transition is not started yet, fixed rotation transform needs to be applied // the transition is not started yet, fixed rotation transform needs to be applied
// earlier to make the snapshot show in a rotated container. // earlier to make the snapshot show in a rotated container.
activity.mDisplayContent.handleTopActivityLaunchingInDifferentOrientation( activity.mDisplayContent.handleTopActivityLaunchingInDifferentOrientation(
topFullscreenActivity, false /* checkOpening */); activity, false /* checkOpening */);
} }
mService.mAtmService.mTaskOrganizerController.addStartingWindow(task, mService.mAtmService.mTaskOrganizerController.addStartingWindow(task,
activity, 0 /* launchTheme */, taskSnapshot); activity, 0 /* launchTheme */, taskSnapshot);