summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorCraig Mautner <cmautner@google.com>2014-05-27 16:37:45 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-27 16:37:45 +0000
commitc752919c7cd29b497918618cc9ebf56c18995a76 (patch)
tree72d60b45d55de4fac3ae0de59f9288d8494b2afe /services
parent5d0045835b0bfd456b9400be1cacdc8cb16d6cc7 (diff)
parentb539b3aafb2b0e55fc9578344eff35256fd5a94e (diff)
downloadframeworks_base-c752919c7cd29b497918618cc9ebf56c18995a76.zip
frameworks_base-c752919c7cd29b497918618cc9ebf56c18995a76.tar.gz
frameworks_base-c752919c7cd29b497918618cc9ebf56c18995a76.tar.bz2
Merge "Do not start tasks on ActivityViews unless explicit. DO NOT MERGE" into lmp-preview-dev
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 9133ce9..00dfec3 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -1212,8 +1212,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
requestCode = sourceRecord.requestCode;
sourceRecord.resultTo = null;
if (resultRecord != null) {
- resultRecord.removeResultsLocked(
- sourceRecord, resultWho, requestCode);
+ resultRecord.removeResultsLocked(sourceRecord, resultWho, requestCode);
}
if (sourceRecord.launchedFromUid == callingUid) {
// The new activity is being launched from the same uid as the previous
@@ -1385,7 +1384,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
return err;
}
- ActivityStack adjustStackFocus(ActivityRecord r) {
+ ActivityStack adjustStackFocus(ActivityRecord r, boolean newTask) {
final TaskRecord task = r.task;
if (r.isApplicationActivity() || (task != null && task.isApplicationTask())) {
if (task != null) {
@@ -1410,7 +1409,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
return container.mStack;
}
- if (mFocusedStack != mHomeStack) {
+ if (mFocusedStack != mHomeStack && (!newTask ||
+ mFocusedStack.mActivityContainer.isEligibleForNewTasks())) {
if (DEBUG_FOCUS || DEBUG_STACK) Slog.d(TAG,
"adjustStackFocus: Have a focused stack=" + mFocusedStack);
return mFocusedStack;
@@ -1807,7 +1807,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
Slog.e(TAG, "Attempted Lock Task Mode violation r=" + r);
return ActivityManager.START_RETURN_LOCK_TASK_MODE_VIOLATION;
}
- targetStack = adjustStackFocus(r);
+ newTask = true;
+ targetStack = adjustStackFocus(r, newTask);
targetStack.moveToFront();
if (reuseTask == null) {
r.setTask(targetStack.createTaskRecord(getNextTaskId(),
@@ -1824,7 +1825,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
} else {
r.setTask(reuseTask, reuseTask, true);
}
- newTask = true;
if (!movedHome) {
if ((launchFlags &
(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_TASK_ON_HOME))
@@ -1892,7 +1892,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
// This not being started from an existing activity, and not part
// of a new task... just put it in the top task, though these days
// this case should never happen.
- targetStack = adjustStackFocus(r);
+ targetStack = adjustStackFocus(r, newTask);
targetStack.moveToFront();
ActivityRecord prev = targetStack.topActivity();
r.setTask(prev != null ? prev.task
@@ -2319,7 +2319,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
final ActivityStack stack = stacks.get(stackNdx);
if (!r.isApplicationActivity() && !stack.isHomeStack()) {
- if (DEBUG_TASKS) Slog.d(TAG, "Skipping stack: " + stack);
+ if (DEBUG_TASKS) Slog.d(TAG, "Skipping stack: (home activity) " + stack);
+ continue;
+ }
+ if (!stack.mActivityContainer.isEligibleForNewTasks()) {
+ if (DEBUG_TASKS) Slog.d(TAG, "Skipping stack: (new task not allowed) " +
+ stack);
continue;
}
final ActivityRecord ar = stack.findTaskLocked(r);
@@ -3250,6 +3255,11 @@ public final class ActivityStackSupervisor implements DisplayListener {
void setDrawn() {
}
+ // You can always start a new task on a regular ActivityStack.
+ boolean isEligibleForNewTasks() {
+ return true;
+ }
+
@Override
public String toString() {
return mIdString + (mActivityDisplay == null ? "N" : "A");
@@ -3330,6 +3340,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
}
+ // Never start a new task on an ActivityView if it isn't explicitly specified.
+ @Override
+ boolean isEligibleForNewTasks() {
+ return false;
+ }
+
private void setSurfaceIfReady() {
if (DEBUG_STACK) Slog.v(TAG, "setSurfaceIfReady: mDrawn=" + mDrawn +
" mContainerState=" + mContainerState + " mSurface=" + mSurface);