Prevent set intent on non-leaf tasks
The root task was created with null intent, but the intent, resize mode and other information were updated from child tasks, which sets the split-screen-secondary root task to unresizeable. Bug: 170801863 Test: presubmit Change-Id: I57458c05c4c579d78894869c0590788d17912bc3
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user