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

Commit 41969e1d authored by wilsonshih's avatar wilsonshih Committed by Wei Sheng Shih
Browse files

Prepare close transition before adjust focusable task.

There will adjust task layer when finish the last activity in a task,
to preventing the layer change transaction being applied by pending
transaction, prepare close transition before adjust focusable task.

Flag: EXEMPT bugfix
Bug: 379854272
Test: launch several tasks in desktop mode, close a task and verify the
task layer won't change before transition ready.

Change-Id: I510e9588fbc2009ae6e61f3c78d537b7fdd26425
parent 6d657891
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -3667,16 +3667,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

            pauseKeyDispatchingLocked();

            // We are finishing the top focused activity and its task has nothing to be focused so
            // the next focusable task should be focused.
            if (mayAdjustTop && task.topRunningActivity(true /* focusableOnly */)
                    == null) {
                task.adjustFocusToNextFocusableTask("finish-top", false /* allowFocusSelf */,
                            shouldAdjustGlobalFocus);
            }

            finishActivityResults(resultCode, resultData, resultGrants);

            final boolean endTask = task.getTopNonFinishingActivity() == null
                    && !task.isClearingToReuseTask();
            final WindowContainer<?> trigger = endTask ? task : this;
@@ -3687,6 +3677,16 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            if (transition != null) {
                transition.collectClose(trigger);
            }
            // We are finishing the top focused activity and its task has nothing to be focused so
            // the next focusable task should be focused.
            if (mayAdjustTop && task.topRunningActivity(true /* focusableOnly */)
                    == null) {
                task.adjustFocusToNextFocusableTask("finish-top", false /* allowFocusSelf */,
                            shouldAdjustGlobalFocus);
            }

            finishActivityResults(resultCode, resultData, resultGrants);

            if (isState(RESUMED)) {
                if (endTask) {
                    mAtmService.getTaskChangeNotificationController().notifyTaskRemovalStarted(