summaryrefslogtreecommitdiffstats
path: root/services/core/java/com/android/server/am
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2014-08-29 16:27:40 -0700
committerDianne Hackborn <hackbod@google.com>2014-08-29 16:27:40 -0700
commit962d535464eb79b11c346236f6889ad76a966e56 (patch)
treec858909cc79c4ee1631b2f04f0a8f86262c2e884 /services/core/java/com/android/server/am
parent78358b17885cfb99f359f54c11565c0c3a998928 (diff)
downloadframeworks_base-962d535464eb79b11c346236f6889ad76a966e56.zip
frameworks_base-962d535464eb79b11c346236f6889ad76a966e56.tar.gz
frameworks_base-962d535464eb79b11c346236f6889ad76a966e56.tar.bz2
Fix issue #17322903: Crash in systemUI while launching an app from recents tab
We now do sane things when adding a NEW_TASK to a task that already has activities in it. Change-Id: I965d6d44f9523e6199b1d90293f61ae5b8c352a4
Diffstat (limited to 'services/core/java/com/android/server/am')
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java24
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 1d2f7a9..5a95ef8 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);