From c5aaf99df5656fde68a4aaf2801fe30b0f5e44ae Mon Sep 17 00:00:00 2001 From: Jeff Chang Date: Fri, 27 May 2022 11:58:11 +0800 Subject: [PATCH] [RESTRICT AUTOMERGE]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 unresizable. This CL is back porting from f666e494af to prevent setting the split-screen-secondary root task to unresizable. Bug: 230435065 Bug: 185810717 Test: atest IntentTests atest ActivityStarterTests atest TaskRecordTests atest testSplitscreenPortraitAppOrientationRequests Change-Id: I856d66371ac121f681958a7129527f18a5357d0f --- services/core/java/com/android/server/wm/Task.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 3d86747e15688..4b4e936c73c1d 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -961,27 +961,20 @@ class Task extends WindowContainer { mCallingPackage = r.launchedFromPackage; mCallingFeatureId = r.launchedFromFeatureId; setIntent(intent != null ? intent : r.intent, info != null ? info : r.info); - final WindowContainer parent = getParent(); - if (parent != null) { - final Task t = parent.asTask(); - if (t != null) { - t.setIntent(r); - } - } } setLockTaskAuth(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