diff options
| author | 2014-09-02 19:38:23 +0000 | |
|---|---|---|
| committer | 2014-09-02 19:38:25 +0000 | |
| commit | c8838dfbec12d17cdf89a03bd4512d13e93ae910 (patch) | |
| tree | 7cf749d20f7ef84a2071af2b18c33da298655d26 | |
| parent | 0fd79c955b3745648d5f326bc784ced1e1188935 (diff) | |
| parent | 962d535464eb79b11c346236f6889ad76a966e56 (diff) | |
Merge "Fix issue #17322903: Crash in systemUI while launching an app from recents tab" into lmp-dev
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityStackSupervisor.java | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 654513400e64..6bc1c9ce550e 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -1729,16 +1729,19 @@ public final class ActivityStackSupervisor implements DisplayListener { | (baseIntent.getFlags()&flagsOfInterest); intent.setFlags(launchFlags); inTask.setIntent(r); + addingToTask = true; - // If the task is not empty, then we are going to add the new activity on top - // of the task, so it can not be launching as a new task. + // If the task is not empty and the caller is asking to start it as the root + // of a new task, then we don't actually want to start this on the task. We + // will bring the task to the front, and possibly give it a new intent. } else if ((launchFlags & Intent.FLAG_ACTIVITY_NEW_TASK) != 0) { - ActivityOptions.abort(options); - throw new IllegalStateException("Caller has inTask " + inTask - + " but target is a new task"); + addingToTask = false; + + } else { + addingToTask = true; } + reuseTask = inTask; - addingToTask = true; } else { inTask = null; } @@ -1979,7 +1982,7 @@ public final class ActivityStackSupervisor implements DisplayListener { sourceRecord.task : null; // Should this be considered a new task? - if (r.resultTo == null && !addingToTask + if (r.resultTo == null && inTask == null && !addingToTask && (launchFlags & Intent.FLAG_ACTIVITY_NEW_TASK) != 0) { if (isLockTaskModeViolation(reuseTask)) { Slog.e(TAG, "Attempted Lock Task Mode violation r=" + r); @@ -2092,6 +2095,13 @@ public final class ActivityStackSupervisor implements DisplayListener { } } + if (!addingToTask) { + // We don't actually want to have this activity added to the task, so just + // stop here but still tell the caller that we consumed the intent. + ActivityOptions.abort(options); + return ActivityManager.START_TASK_TO_FRONT; + } + r.setTask(inTask, null); if (DEBUG_TASKS) Slog.v(TAG, "Starting new activity " + r + " in explicit task " + r.task); |