Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc6ca23b authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Finish fixed rotation of transient launch with corner cases

Case 1:
Right before finishing recents transition, a display change transition
starts to collect, then if the recent activity is using fixed rotation,
hasAnimatingFixedRotationTransition() will return true because the
inTransition() also includes activity from display. That causes the
fixed rotation not to complete for finishing recents transition.

Case 2:
Launch a landscape app from portrait home. Before the opening
animation is finished, use gesture navigation to swipe up from bottom
and drag back to the bottom. So the transient-hide root task and its
activities are still visible at the end state. Because only root task
is collected, its activities still need to add into participants so the
transition finish callback can receive the activity record to complete
the fixed rotation and continue the display rotation.

Fix: 296780012
Test: atest DisplayContentTests# \
      testFinishFixedRotationNoAppTransitioningTask

Change-Id: I55d4dbc2da5f97e41a8fff9aac189edcf48f68e5
parent 5918648b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1127,6 +1127,9 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
                        // though, notify the controller to prevent degenerate cases.
                        if (!r.isVisibleRequested()) {
                            mController.mValidateCommitVis.add(r);
                        } else {
                            // Make sure onAppTransitionFinished can be notified.
                            mParticipants.add(r);
                        }
                        return;
                    }
+2 −1
Original line number Diff line number Diff line
@@ -519,7 +519,8 @@ class WindowToken extends WindowContainer<WindowState> {
        for (int i = mFixedRotationTransformState.mAssociatedTokens.size() - 1; i >= 0; i--) {
            final ActivityRecord r =
                    mFixedRotationTransformState.mAssociatedTokens.get(i).asActivityRecord();
            if (r != null && r.isInTransition()) {
            // Only care about the transition at Activity/Task level.
            if (r != null && r.inTransitionSelfOrParent() && !r.mDisplayContent.inTransition()) {
                return true;
            }
        }
+5 −2
Original line number Diff line number Diff line
@@ -1703,14 +1703,17 @@ public class DisplayContentTests extends WindowTestsBase {
        final Task task = app.getTask();
        final ActivityRecord app2 = new ActivityBuilder(mWm.mAtmService).setTask(task).build();
        mDisplayContent.setFixedRotationLaunchingApp(app2, (mDisplayContent.getRotation() + 1) % 4);
        doReturn(true).when(app).isInTransition();
        doReturn(true).when(app).inTransitionSelfOrParent();
        // If the task contains a transition, this should be no-op.
        mDisplayContent.mFixedRotationTransitionListener.onAppTransitionFinishedLocked(app.token);

        assertTrue(app2.hasFixedRotationTransform());
        assertTrue(mDisplayContent.hasTopFixedRotationLaunchingApp());

        doReturn(false).when(app).isInTransition();
        // The display should be unlikely to be in transition, but if it happens, the fixed
        // rotation should proceed to finish because the activity/task level transition is finished.
        doReturn(true).when(mDisplayContent).inTransition();
        doReturn(false).when(app).inTransitionSelfOrParent();
        // Although this notifies app instead of app2 that uses the fixed rotation, app2 should
        // still finish the transform because there is no more transition event.
        mDisplayContent.mFixedRotationTransitionListener.onAppTransitionFinishedLocked(app.token);