From f20599b631f275b68a25309acfeca676e48330f2 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Wed, 14 Jul 2021 19:30:47 -0700 Subject: [PATCH] Show Task Surface if it will not be organized When trying to start an Activity in a new Task in an organzied TaskFragment, the Task is first created in TaskDisplayArea as a root Task, and then got reparented to the TaskFragment. As a result, Task#showSurfaceOnCreation() will return false, and there will not be other call to show its surface. Now, we show the Task surface if it can no longer be organized. Fix: 193681081 Test: manually test following the reproduce steps with sample app Change-Id: Ie3da5f1c789d25bcb828b3f1191867a346a508e8 --- services/core/java/com/android/server/wm/Task.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index d8681f6a0c9d9..89122f354139f 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -1208,6 +1208,12 @@ class Task extends TaskFragment { } if (newParent != null) { + // Surface of Task that will not be organized should be shown by default. + // See Task#showSurfaceOnCreation + if (!mCreatedByOrganizer && !canBeOrganized()) { + getSyncTransaction().show(mSurfaceControl); + } + // TODO: Ensure that this is actually necessary here // Notify the voice session if required if (voiceSession != null) {