From 353112c604ad7486d253b095a68ed9da9529d384 Mon Sep 17 00:00:00 2001 From: Bryce Lee Date: Thu, 23 Feb 2017 09:46:45 -0800 Subject: [PATCH] Clear associated task when starting activity in a new task. In the case that an activity is brought to the foreground with clear top, we will start it at the top of the source record's task. The current code sets the task to match the found activity, which will no longer be the case. This changelist cleans up this reference so that we do not try to reparent and instead just add the activity to the task. Change-Id: Ic7428548fa4972aa19bc9ba890c9edaf2ff31220 Fixes: 35318848 Test: manual by bug repo steps (consistently reproducible). --- services/core/java/com/android/server/am/ActivityStarter.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java index 83d43db20671b..e13d92409b005 100644 --- a/services/core/java/com/android/server/am/ActivityStarter.java +++ b/services/core/java/com/android/server/am/ActivityStarter.java @@ -1544,6 +1544,9 @@ class ActivityStarter { // running, and the caller has asked to clear the current task to have this // activity at the top. mAddingToTask = true; + + // We are no longer placing the activity in the task we previously thought we were. + mStartActivity.task = null; // Now pretend like this activity is being started by the top of its task, so it // is put in the right place. mSourceRecord = intentActivity;