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

Commit 43732320 authored by Craig Mautner's avatar Craig Mautner Committed by Android (Google) Code Review
Browse files

Merge "Extend clearing of mLastPausedActivity."

parents 445b5f46 0f922749
Loading
Loading
Loading
Loading
+19 −11
Original line number Diff line number Diff line
@@ -176,6 +176,13 @@ final class ActivityStack {
     */
    ActivityRecord mLastPausedActivity = null;

    /**
     * Activities that specify No History must be removed once the user navigates away from them.
     * If the device goes to sleep with such an activity in the paused state then we save it here
     * and finish it later if another activity replaces it on wakeup.
     */
    ActivityRecord mLastNoHistoryActivity = null;

    /**
     * Current activity that is resumed, or null if there is none.
     */
@@ -710,6 +717,8 @@ final class ActivityStack {
        mResumedActivity = null;
        mPausingActivity = prev;
        mLastPausedActivity = prev;
        mLastNoHistoryActivity = (prev.intent.getFlags() & Intent.FLAG_ACTIVITY_NO_HISTORY) != 0
                || (prev.info.flags & ActivityInfo.FLAG_NO_HISTORY) != 0 ? prev : null;
        prev.state = ActivityState.PAUSING;
        prev.task.touchActiveTime();
        clearLaunchTime(prev);
@@ -732,10 +741,12 @@ final class ActivityStack {
                Slog.w(TAG, "Exception thrown during pause", e);
                mPausingActivity = null;
                mLastPausedActivity = null;
                mLastNoHistoryActivity = null;
            }
        } else {
            mPausingActivity = null;
            mLastPausedActivity = null;
            mLastNoHistoryActivity = null;
        }

        // If we are not going to sleep, we want to ensure the device is
@@ -1333,16 +1344,13 @@ final class ActivityStack {
        // If the most recent activity was noHistory but was only stopped rather
        // than stopped+finished because the device went to sleep, we need to make
        // sure to finish it as we're making a new activity topmost.
        final ActivityRecord last = mLastPausedActivity;
        if (mService.mSleeping && last != null && !last.finishing) {
            if ((last.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_HISTORY) != 0
                    || (last.info.flags&ActivityInfo.FLAG_NO_HISTORY) != 0) {
                if (DEBUG_STATES) {
                    Slog.d(TAG, "no-history finish of " + last + " on new resume");
                }
                requestFinishActivityLocked(last.appToken, Activity.RESULT_CANCELED, null,
                        "no-history", false);
            }
        if (mService.mSleeping && mLastNoHistoryActivity != null &&
                !mLastNoHistoryActivity.finishing) {
            if (DEBUG_STATES) Slog.d(TAG, "no-history finish of " + mLastNoHistoryActivity +
                    " on new resume");
            requestFinishActivityLocked(mLastNoHistoryActivity.appToken, Activity.RESULT_CANCELED,
                    null, "no-history", false);
            mLastNoHistoryActivity = null;
        }

        if (prev != null && prev != next) {
@@ -2949,7 +2957,6 @@ final class ActivityStack {

        mWindowManager.moveTaskToTop(tr.taskId);

        mLastPausedActivity = null;
        mStackSupervisor.resumeTopActivitiesLocked();
        EventLog.writeEvent(EventLogTags.AM_TASK_TO_FRONT, tr.userId, tr.taskId);

@@ -3368,6 +3375,7 @@ final class ActivityStack {
        }
        if (mLastPausedActivity != null && mLastPausedActivity.app == app) {
            mLastPausedActivity = null;
            mLastNoHistoryActivity = null;
        }
        final ActivityRecord top = topRunningActivityLocked(null);
        final boolean launchHomeTaskNext =
+8 −0
Original line number Diff line number Diff line
@@ -1398,6 +1398,7 @@ public final class ActivityStackSupervisor {
                        r.task = intentActivity.task;
                    }
                    targetStack = intentActivity.task.stack;
                    targetStack.mLastPausedActivity = null;
                    moveHomeStack(targetStack.isHomeStack());
                    if (intentActivity.task.intent == null) {
                        // This task was started because of movement of
@@ -1575,6 +1576,7 @@ public final class ActivityStackSupervisor {
                                    top.task);
                            // For paranoia, make sure we have correctly
                            // resumed the top activity.
                            topStack.mLastPausedActivity = null;
                            if (doResume) {
                                setLaunchHomeTaskNextFlag(sourceRecord, null, topStack);
                                resumeTopActivitiesLocked();
@@ -1653,6 +1655,7 @@ public final class ActivityStackSupervisor {
                    top.deliverNewIntentLocked(callingUid, r.intent);
                    // For paranoia, make sure we have correctly
                    // resumed the top activity.
                    targetStack.mLastPausedActivity = null;
                    if (doResume) {
                        setLaunchHomeTaskNextFlag(sourceRecord, null, targetStack);
                        targetStack.resumeTopActivityLocked(null);
@@ -1675,6 +1678,7 @@ public final class ActivityStackSupervisor {
                    ActivityStack.logStartActivity(EventLogTags.AM_NEW_INTENT, r, task);
                    top.updateOptionsLocked(options);
                    top.deliverNewIntentLocked(callingUid, r.intent);
                    targetStack.mLastPausedActivity = null;
                    if (doResume) {
                        setLaunchHomeTaskNextFlag(sourceRecord, null, targetStack);
                        targetStack.resumeTopActivityLocked(null);
@@ -1714,6 +1718,7 @@ public final class ActivityStackSupervisor {
        }
        ActivityStack.logStartActivity(EventLogTags.AM_CREATE_ACTIVITY, r, r.task);
        setLaunchHomeTaskNextFlag(sourceRecord, r, targetStack);
        targetStack.mLastPausedActivity = null;
        targetStack.startActivityLocked(r, newTask, doResume, keepCurTransition, options);
        mService.setFocusedActivityLocked(r);
        return ActivityManager.START_SUCCESS;
@@ -2390,7 +2395,10 @@ public final class ActivityStackSupervisor {
                        "    mLastPausedActivity: ");
                if (pr) {
                    printed = true;
                    needSep = true;
                }
                printed |= printThisActivity(pw, stack.mLastNoHistoryActivity, dumpPackage,
                        needSep, "    mLastNoHistoryActivity: ");
            }
            needSep = printed;
        }