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

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

Avoid collecting transient activity in next transition

The moveFocusableActivityToTop always collects the activity
even if there is no order change. If the next transition is
started to collect, the transient activity may be a participant
that makes inTransition() return true to disturb some conditions.

In normal case, RecentsTransitionHandler already calls setFocusedTask
to make sure the transient activity is on top with focus. So at
finishTransition, assume it should already on top then only need to
set focus if it was not focused.

Bug: 276707493
Test: Swipe auto-pip from fullscreen landscape to portrait.
      PiP should not disappear.
Change-Id: I1cd2859279d6760189fda7060c5e194ce3a1e060
parent ebba1751
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -907,6 +907,8 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            final WindowContainer<?> participant = mParticipants.valueAt(i);
            final ActivityRecord ar = participant.asActivityRecord();
            if (ar != null) {
                final Task task = ar.getTask();
                if (task == null) continue;
                boolean visibleAtTransitionEnd = mVisibleAtTransitionEndTokens.contains(ar);
                // We need both the expected visibility AND current requested-visibility to be
                // false. If it is expected-visible but not currently visible, it means that
@@ -925,9 +927,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
                    if (commitVisibility) {
                        ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS,
                                "  Commit activity becoming invisible: %s", ar);
                        final Task task = ar.getTask();
                        if (task != null && !task.isVisibleRequested()
                                && mTransientLaunches != null) {
                        if (mTransientLaunches != null && !task.isVisibleRequested()) {
                            // If transition is transient, then snapshots are taken at end of
                            // transition.
                            mController.mSnapshotController.mTaskSnapshotController
@@ -952,8 +952,9 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {

                    // Since transient launches don't automatically take focus, make sure we
                    // synchronize focus since we committed to the launch.
                    if (ar.isTopRunningActivity()) {
                        ar.moveFocusableActivityToTop("transitionFinished");
                    if (!task.isFocused() && ar.isTopRunningActivity()) {
                        mController.mAtm.setLastResumedActivityUncheckLocked(ar,
                                "transitionFinished");
                    }
                }
                continue;