From a75330fa8a9482ca0b44bbc214a4790aa81e282e Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Fri, 27 Aug 2021 09:54:19 +0800 Subject: [PATCH] Fix task missing after dropped an app in PIP to enter stage split When dropping an app in PIP to enter stage split, the existing PIP task will be reparented to the side stage root before PipController be notified of the activity restart attempt, which result to the pinned task didn't dismiss properly in wm-shell. This patch leaves pinned task reparenting operations to task organizer to make sure PipController in wm-shell can dismiss the pinned task properly with on activity restart attempt callback. Bug: 195727079 Test: Put Maps app in PIP, drag and drop the Maps icon to enter split, observed Maps expands to fullscreen and won't be put to background unexpectedly. Change-Id: I8d8e4c0e86e4fc732d70d4a3d8e2c10701bc88d1 --- .../core/java/com/android/server/wm/ActivityStarter.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java index c721c248710e4..2c6486ca6301c 100644 --- a/services/core/java/com/android/server/wm/ActivityStarter.java +++ b/services/core/java/com/android/server/wm/ActivityStarter.java @@ -30,6 +30,7 @@ import static android.app.ActivityManager.START_RETURN_LOCK_TASK_MODE_VIOLATION; import static android.app.ActivityManager.START_SUCCESS; import static android.app.ActivityManager.START_TASK_TO_FRONT; import static android.app.ActivityTaskManager.INVALID_TASK_ID; +import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY; import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; @@ -2698,7 +2699,11 @@ class ActivityStarter { mStartActivity.appTimeTracker, DEFER_RESUME, "bringingFoundTaskToFront"); mMovedToFront = !wasTopOfVisibleRootTask; - } else { + } else if (intentActivity.getWindowingMode() != WINDOWING_MODE_PINNED) { + // Leaves reparenting pinned task operations to task organizer to make sure it + // dismisses pinned task properly. + // TODO(b/199997762): Consider leaving all reparent operation of organized tasks + // to task organizer. intentTask.reparent(mTargetRootTask, ON_TOP, REPARENT_MOVE_ROOT_TASK_TO_FRONT, ANIMATE, DEFER_RESUME, "reparentToTargetRootTask"); mMovedToFront = true;