• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/base


Commit MetaInfo

Revisãoa952197bd161ac0e03abc6acb5f48e4ec2a56e9d (tree)
Hora2020-03-31 05:56:09
AutorRiddle Hsu <riddlehsu@goog...>
CommiterAnis Assi

Mensagem de Log

RESTRICT AUTOMERGE Create separated tasks for different apps from startActivities

Assume there are 2 applications A, B with different uids.
There are 4 activities A1, A2, B1, B2 with default task
affinity and launch mode.

After A1 called startActivities(B1, A2, B2):

Original : Task(A1, B1, A2, B2)
This Change: Task(A1, B1), Task(A2, B2)

In other words, the source caller cannot launch its activity
above the activity of other application in the same task, and
it can still launch activity of other application in its task.

Bug: 145669109
Test: run cts --test android.server.cts.StartActivityTests \

-m CtsServicesHostTestCases

Change-Id: I97bd875146a52f62b8fe82235487ccefb2955e8e
(cherry picked from commit 973ecc619c0bb87a03481774ea9e86d2924601e4)

Mudança Sumário

Diff

--- a/services/core/java/com/android/server/am/ActivityStarter.java
+++ b/services/core/java/com/android/server/am/ActivityStarter.java
@@ -940,6 +940,8 @@ class ActivityStarter {
940940 } else {
941941 callingPid = callingUid = -1;
942942 }
943+ boolean forceNewTask = false;
944+ final int filterCallingUid = callingUid >= 0 ? callingUid : realCallingUid;
943945 final long origId = Binder.clearCallingIdentity();
944946 try {
945947 synchronized (mService) {
@@ -959,6 +961,9 @@ class ActivityStarter {
959961
960962 // Don't modify the client's object!
961963 intent = new Intent(intent);
964+ if (forceNewTask) {
965+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
966+ }
962967
963968 // Collect information about the target of the Intent.
964969 ActivityInfo aInfo = mSupervisor.resolveActivity(intent, resolvedTypes[i], 0,
@@ -984,7 +989,17 @@ class ActivityStarter {
984989 return res;
985990 }
986991
987- resultTo = outActivity[0] != null ? outActivity[0].appToken : null;
992+ final ActivityRecord started = outActivity[0];
993+ if (started != null && started.getUid() == filterCallingUid) {
994+ // Only the started activity which has the same uid as the source caller can
995+ // be the caller of next activity.
996+ resultTo = started.appToken;
997+ forceNewTask = false;
998+ } else {
999+ // Different apps not adjacent to the caller are forced to be new task.
1000+ resultTo = null;
1001+ forceNewTask = true;
1002+ }
9881003 }
9891004 }
9901005 } finally {