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

Commit 9c5b677c authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Request starting window first when moving task with shell transition

Both binder calls (add-starting-window, request-transition) from core
to shell will post to wmshell.main thread. And because starting window
controller will post to its wmshell.splashscreen thread, if starting
window is scheduled earlier, these 2 operations can run in parallel.

This aligns the same order as startActivity.

Bug: 235323163
Test: adb shell setprop persist.wm.debug.shell_transit 1; reboot
      Launch app from recents.
Change-Id: Ibcefb4c446217f8a3bdc2e20bfbfce8029d6981b
parent f017558a
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -2179,14 +2179,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                    : null;
            mTaskSupervisor.findTaskToMoveToFront(task, flags, realOptions, "moveTaskToFront",
                    false /* forceNonResizable */);

            final ActivityRecord topActivity = task.getTopNonFinishingActivity();
            if (topActivity != null) {

                // We are reshowing a task, use a starting window to hide the initial draw delay
                // so the transition can start earlier.
                topActivity.showStartingWindow(true /* taskSwitch */);
            }
        } finally {
            Binder.restoreCallingIdentity(origId);
        }
+15 −4
Original line number Diff line number Diff line
@@ -1434,10 +1434,10 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
                mUserLeaving = true;
            }

            task.mTransitionController.requestTransitionIfNeeded(TRANSIT_TO_FRONT,
                    0 /* flags */, task, task /* readyGroupRef */,
                    options != null ? options.getRemoteTransition() : null,
                    null /* displayChange */);
            final Transition newTransition = task.mTransitionController.isShellTransitionsEnabled()
                    ? task.mTransitionController.isCollecting() ? null
                    : task.mTransitionController.createTransition(TRANSIT_TO_FRONT) : null;
            task.mTransitionController.collect(task);
            reason = reason + " findTaskToMoveToFront";
            boolean reparented = false;
            if (task.isResizeable() && canUseActivityOptionsLaunchBounds(options)) {
@@ -1480,6 +1480,17 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
            handleNonResizableTaskIfNeeded(task, WINDOWING_MODE_UNDEFINED,
                    mRootWindowContainer.getDefaultTaskDisplayArea(), currentRootTask,
                    forceNonResizeable);
            if (r != null) {
                // Use a starting window to reduce the transition latency for reshowing the task.
                // Note that with shell transition, this should be executed before requesting
                // transition to avoid delaying the starting window.
                r.showStartingWindow(true /* taskSwitch */);
            }
            if (newTransition != null) {
                task.mTransitionController.requestStartTransition(newTransition, task,
                        options != null ? options.getRemoteTransition() : null,
                        null /* displayChange */);
            }
        } finally {
            mUserLeaving = false;
        }