Merge "Prevent set intent on non-leaf tasks" into sc-dev am: 5dc6029d31

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13406104

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I20d91fe3d750616ad93a80566671ef26b08b8842
This commit is contained in:
Louis Chang
2021-01-28 01:42:35 +00:00
committed by Automerger Merge Worker
2 changed files with 7 additions and 11 deletions

View File

@@ -307,6 +307,7 @@ message TaskProto {
optional bool animating_bounds = 26 [deprecated = true];
optional float minimize_amount = 27;
optional bool created_by_organizer = 28;
optional string affinity = 29;
}
/* represents ActivityRecordProto */

View File

@@ -124,6 +124,7 @@ import static com.android.server.wm.Task.ActivityState.RESUMED;
import static com.android.server.wm.Task.ActivityState.STARTED;
import static com.android.server.wm.Task.ActivityState.STOPPING;
import static com.android.server.wm.TaskProto.ACTIVITY_TYPE;
import static com.android.server.wm.TaskProto.AFFINITY;
import static com.android.server.wm.TaskProto.BOUNDS;
import static com.android.server.wm.TaskProto.CREATED_BY_ORGANIZER;
import static com.android.server.wm.TaskProto.DISPLAY_ID;
@@ -1244,27 +1245,20 @@ class Task extends WindowContainer<WindowContainer> {
mCallingFeatureId = r.launchedFromFeatureId;
setIntent(intent != null ? intent : r.intent, info != null ? info : r.info);
setLockTaskAuth(r);
final WindowContainer parent = getParent();
if (parent != null) {
final Task t = parent.asTask();
if (t != null) {
t.setIntent(r);
}
}
}
/** Sets the original intent, _without_ updating the calling uid or package. */
private void setIntent(Intent _intent, ActivityInfo info) {
final boolean isLeaf = isLeafTask();
if (!isLeafTask()) return;
if (intent == null) {
mNeverRelinquishIdentity =
(info.flags & FLAG_RELINQUISH_TASK_IDENTITY) == 0;
} else if (mNeverRelinquishIdentity && isLeaf) {
} else if (mNeverRelinquishIdentity) {
return;
}
affinity = isLeaf ? info.taskAffinity : null;
affinity = info.taskAffinity;
if (intent == null) {
// If this task already has an intent associated with it, don't set the root
// affinity -- we don't want it changing after initially set, but the initially
@@ -7809,6 +7803,7 @@ class Task extends WindowContainer<WindowContainer> {
}
proto.write(CREATED_BY_ORGANIZER, mCreatedByOrganizer);
proto.write(AFFINITY, affinity);
proto.end(token);
}