summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-03-10 15:44:57 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-03-10 15:44:57 +0000
commitd9d727b959427998ea062df5bfe1d5871b76435d (patch)
treeaac9a634bf4348045e1d9b83c2c432813f1772f8
parentda2c3df4ce516b4943a7ee23fe5e6e1551957326 (diff)
parent48d8d370f3d1dac06719ca6a52bda5f45a1a533a (diff)
Merge "RESTRICT AUTOMERGE Create separated tasks for different apps from startActivities" into pi-dev
-rw-r--r--services/core/java/com/android/server/am/ActivityStartController.java21
1 files changed, 18 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStartController.java b/services/core/java/com/android/server/am/ActivityStartController.java
index c926503da27d..240f01d159a7 100644
--- a/services/core/java/com/android/server/am/ActivityStartController.java
+++ b/services/core/java/com/android/server/am/ActivityStartController.java
@@ -334,6 +334,9 @@ public class ActivityStartController {
} else {
callingPid = callingUid = -1;
}
+ boolean forceNewTask = false;
+ final int filterCallingUid = ActivityStarter.computeResolveFilterUid(
+ callingUid, realCallingUid, UserHandle.USER_NULL);
final long origId = Binder.clearCallingIdentity();
try {
synchronized (mService) {
@@ -353,11 +356,13 @@ public class ActivityStartController {
// Don't modify the client's object!
intent = new Intent(intent);
+ if (forceNewTask) {
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ }
// Collect information about the target of the Intent.
ActivityInfo aInfo = mSupervisor.resolveActivity(intent, resolvedTypes[i], 0,
- null, userId, ActivityStarter.computeResolveFilterUid(
- callingUid, realCallingUid, UserHandle.USER_NULL));
+ null, userId, filterCallingUid);
// TODO: New, check if this is correct
aInfo = mService.getActivityInfoForUser(aInfo, userId);
@@ -397,7 +402,17 @@ public class ActivityStartController {
return res;
}
- resultTo = outActivity[0] != null ? outActivity[0].appToken : null;
+ final ActivityRecord started = outActivity[0];
+ if (started != null && started.getUid() == filterCallingUid) {
+ // Only the started activity which has the same uid as the source caller can
+ // be the caller of next activity.
+ resultTo = started.appToken;
+ forceNewTask = false;
+ } else {
+ // Different apps not adjacent to the caller are forced to be new task.
+ resultTo = null;
+ forceNewTask = true;
+ }
}
}
} finally {