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

Commit 2470c90a authored by Louis Chang's avatar Louis Chang
Browse files

Stop passing UserLeaving around

Activity#onUserLeaveHint() did not call on the split-secondary top
activity while starts home activity via gesture-nav in splits, so
the app did not enter pip.

Home task was moved to top and #resumeTop was called after the
recents animation finished. It was no-op since home activity was
already be resumed, but the TaskSupervisor#mUserLeaving was consumed
and was reset. The previous top activity was paused (made invisible)
later during activity visibilites update, without userLeaving hint
though.

This CL reset the TaskSupervisor#mUserLeaving when the requested
operation completed and stop passing the state over methods.


Bug: 176989982
Test: atest ActivityLifecycleLegacySplitScreenTests
Change-Id: Iaa6a7525d632a536f8a3faa6814a2a1b838e6830
parent 0d765236
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -2749,8 +2749,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

            if (ensureVisibility) {
                mDisplayContent.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */,
                        false /* preserveWindows */, true /* notifyClients */,
                        mTaskSupervisor.mUserLeaving);
                        false /* preserveWindows */, true /* notifyClients */);
            }
        }

@@ -4818,7 +4817,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        handleAlreadyVisible();
    }

    void makeInvisible(boolean userLeaving) {
    void makeInvisible() {
        if (!mVisibleRequested) {
            if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Already invisible: " + this);
            return;
@@ -4859,7 +4858,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                    // If the app is capable of entering PIP, we should try pausing it now
                    // so it can PIP correctly.
                    if (deferHidingClient) {
                        task.startPausingLocked(userLeaving, false /* uiSleeping */,
                        task.startPausingLocked(false /* uiSleeping */,
                                null /* resuming */, "makeInvisible");
                        break;
                    }
+1 −0
Original line number Diff line number Diff line
@@ -1588,6 +1588,7 @@ class ActivityStarter {
            Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
            startedActivityStack = handleStartResult(r, result);
            mService.continueWindowLayout();
            mSupervisor.mUserLeaving = false;

            // Transition housekeeping
            if (!ActivityManager.isStartResultSuccessful(result)) {
+1 −1
Original line number Diff line number Diff line
@@ -1940,7 +1940,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                } else {
                    stack.setWindowingMode(windowingMode);
                    stack.mDisplayContent.ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS,
                            true /* notifyClients */, mTaskSupervisor.mUserLeaving);
                            true /* notifyClients */);
                }
                return true;
            } finally {
+48 −43
Original line number Diff line number Diff line
@@ -1361,6 +1361,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
            return;
        }

        try {
            if ((flags & ActivityManager.MOVE_TASK_NO_USER_ACTION) == 0) {
                mUserLeaving = true;
            }
@@ -1407,7 +1408,11 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
                    "findTaskToMoveToFront: moved to front of stack=" + currentStack);

            handleNonResizableTaskIfNeeded(task, WINDOWING_MODE_UNDEFINED,
                mRootWindowContainer.getDefaultTaskDisplayArea(), currentStack, forceNonResizeable);
                    mRootWindowContainer.getDefaultTaskDisplayArea(), currentStack,
                    forceNonResizeable);
        } finally {
            mUserLeaving = false;
        }
    }

    private void moveHomeRootTaskToFrontIfNeeded(int flags, TaskDisplayArea taskDisplayArea,
@@ -2209,7 +2214,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
                        .notifyActivityDismissingDockedStack();
                taskDisplayArea.onSplitScreenModeDismissed(task);
                taskDisplayArea.mDisplayContent.ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS,
                        true /* notifyClients */, mUserLeaving);
                        true /* notifyClients */);
            }
            return;
        }
+2 −2
Original line number Diff line number Diff line
@@ -5524,7 +5524,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp


    void ensureActivitiesVisible(ActivityRecord starting, int configChanges,
            boolean preserveWindows, boolean notifyClients, boolean userLeaving) {
            boolean preserveWindows, boolean notifyClients) {
        if (mInEnsureActivitiesVisible) {
            // Don't do recursive work.
            return;
@@ -5534,7 +5534,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        try {
            forAllRootTasks(rootTask -> {
                rootTask.ensureActivitiesVisible(starting, configChanges, preserveWindows,
                        notifyClients, userLeaving);
                        notifyClients);
            });
        } finally {
            mAtmService.mTaskSupervisor.endActivityVisibilityUpdate();
Loading