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

Commit 59dad4ea authored by Bryce Lee's avatar Bryce Lee
Browse files

Persist TaskRecord before calling performClearTaskLocked.

A recent change persisted this record with a member variable that
could be cleared as a result of performClearTasklocked. This
changelist resolves this by using a local variable to store the
reference until after the method call.

Change-Id: I6d5d42e06afdbf6e8ff960fcfae71c80abd891f4
Fixes: 36001400
Test: adb shell am instrument -w -e class com.google.android.setupwizard.tests.activity.SetupWizardExitActivityTest com.google.android.setupwizard.tests.activity com.google.android.setupwizard.tests.activity/.SetupWizardTestRunner
parent 70c8e868
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -1562,9 +1562,14 @@ class ActivityStarter {
            // activity. Well that should not be too hard...
            // Note: we must persist the {@link TaskRecord} first as intentActivity could be
            // removed from calling performClearTaskLocked (For example, if it is being brought out
            // of history or if it is finished immediately), thus disassociating the task.
            mReuseTask = intentActivity.task;
            mReuseTask.performClearTaskLocked();
            // of history or if it is finished immediately), thus disassociating the task. Also note
            // that mReuseTask is reset as a result of {@link TaskRecord#performClearTaskLocked}
            // launching another activity.
            // TODO(b/36119896):  We shouldn't trigger activity launches in this path since we are
            // already launching one.
            final TaskRecord task = intentActivity.task;
            task.performClearTaskLocked();
            mReuseTask = task;
            mReuseTask.setIntent(mStartActivity);

            // When we clear the task - focus will be adjusted, which will bring another task