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

Commit b67fa45c authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Fix issue #258640: Automatic propagation of FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET

Make sure, if an activity is started with clear task when reset, if that
activity is finished in the middle of a stack that the behavior is retained
by propagating it to the next activity.

Change-Id: Ie31b8f968558b0e64e0ef7efa55950a722c6afa5
parent 8a878dde
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -4078,11 +4078,20 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
                System.identityHashCode(r),
                r.task.taskId, r.shortComponentName, reason);
        r.task.numActivities--;
        if (r.frontOfTask && index < (mHistory.size()-1)) {
        if (index < (mHistory.size()-1)) {
            HistoryRecord next = (HistoryRecord)mHistory.get(index+1);
            if (next.task == r.task) {
                if (r.frontOfTask) {
                    // The next activity is now the front of the task.
                    next.frontOfTask = true;
                }
                if ((r.intent.getFlags()&Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) != 0) {
                    // If the caller asked that this activity (and all above it)
                    // be cleared when the task is reset, don't lose that information,
                    // but propagate it up to the next activity.
                    next.intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
                }
            }
        }
        r.pauseKeyDispatchingLocked();