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

Commit d2cb311c authored by Chong Zhang's avatar Chong Zhang
Browse files

Call completeResumeLocked after activity is resume-relaunched

This is only needed when we're resuming an activity in
resumeTopActivityInnerLocked. If the activity is being resume-
relaunched elsewhere, we don't need to check this.

Also make sure RESUMED state is only set in ActivityStack#
setResumedActivityLocked.

Change-Id: If4be211f9ded7e5057257563ffc566cd4d65fb33
parent c60e962c
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -2962,8 +2962,6 @@ public final class ActivityManagerService extends ActivityManagerNative
     * {@link ActivityStack#setResumedActivityLocked} when an activity is resumed.
     */
    void setResumedActivityUncheckLocked(ActivityRecord r, String reason) {
        r.state = ActivityState.RESUMED;
        if (r.task.isApplicationTask()) {
            if (mCurAppTimeTracker != r.appTimeTracker) {
                // We are switching app tracking.  Complete the current one.
+7 −18
Original line number Diff line number Diff line
@@ -2122,6 +2122,7 @@ final class ActivityStack {
        // TODO: move mResumedActivity to stack supervisor,
        // there should only be 1 global copy of resumed activity.
        mResumedActivity = r;
        r.state = ActivityState.RESUMED;
        mService.setResumedActivityUncheckLocked(r, reason);
        r.task.touchActiveTime();
        mRecentTasks.addLocked(r.task);
@@ -2468,13 +2469,12 @@ final class ActivityStack {
                    // Do over!
                    mStackSupervisor.scheduleResumeTopActivities();
                }
                if (mStackSupervisor.reportResumedActivityLocked(next)) {
                    mNoAnimActivities.clear();
                    if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
                    return true;
                if (!next.visible || next.stopped) {
                    mWindowManager.setAppVisibility(next.appToken, true);
                }
                completeResumeLocked(next);
                if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
                return false;
                return true;
            }

            try {
@@ -4754,19 +4754,8 @@ final class ActivityStack {
            if (DEBUG_STATES) {
                Slog.d(TAG_STATES, "Resumed after relaunch " + r);
            }
            r.state = ActivityState.RESUMED;
            // Relaunch-resume could happen either when the app is already in the front,
            // or while it's being brought to front. In the latter case, it's marked RESUMED
            // but not yet visible (or stopped). We need to complete the resume here as the
            // code in resumeTopActivityInnerLocked to complete the resume might be skipped.
            if (!r.visible || r.stopped) {
                mWindowManager.setAppVisibility(r.appToken, true);
                setResumedActivityLocked(r, "relaunchActivityLocked");
                completeResumeLocked(r);
            } else {
            r.results = null;
            r.newIntents = null;
            }
            mService.showUnsupportedZoomDialogIfNeededLocked(r);
            mService.showAskCompatModeDialogLocked(r);
        } else {