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

Commit 362449af authored by Craig Mautner's avatar Craig Mautner
Browse files

Do not delete stack if empty task is being reused.

If a task is being cleared due to Intent flags and that clearing
was causing the last activity in the last task on a stack to be
deleted, then we were deleting the stack. Immediately after
this we were refilling the task with the same activity but the
stack had already been deleted.

This fix preserves the task and stack when it is only being
cleared for the new activity.

Fixes bug 15611901.

Change-Id: I7bcfa826d0852d9c640daa73fe1324b89471fecd
parent 4d30b1e6
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -64,6 +64,10 @@ final class TaskRecord extends ThumbnailHolder {
     * Display.DEFAULT_DISPLAY. */
    boolean mOnTopOfHome = false;

    // Used in the unique case where we are clearing the task in order to reuse it. In that case we
    // do not want to delete the stack when the task goes empty.
    boolean mReuseTask = false;

    TaskRecord(int _taskId, ActivityInfo info, Intent _intent) {
        taskId = _taskId;
        affinity = info.taskAffinity;
@@ -219,7 +223,7 @@ final class TaskRecord extends ThumbnailHolder {
            // Was previously in list.
            numFullscreen--;
        }
        return mActivities.size() == 0;
        return mActivities.size() == 0 && !mReuseTask;
    }

    /**
@@ -244,7 +248,9 @@ final class TaskRecord extends ThumbnailHolder {
     * Completely remove all activities associated with an existing task.
     */
    final void performClearTaskLocked() {
        mReuseTask = true;
        performClearTaskAtIndexLocked(0);
        mReuseTask = false;
    }

    /**