From 74d6d5fde950e6cd239cfe61bc954853bf45851b Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Tue, 20 Jul 2021 15:05:20 -0700 Subject: [PATCH] make non-organized tasks visible when their activity is made visible This is necessary in a few cases (CTS) where a task is NOT organized but had its visibility changed within its direct parent. An example of this is if an alternate home leaf-task HB is started atop the normal home leaf-task HA: these are both in the Home root-task HR, so there will be a transition containing HA and HB where HA surface is hidden. If a standard task SA is launched on top, then HB finishes, no transition will happen since neither home is visible. When SA finishes, the transition contains HR rather than HA. Since home leaf-tasks are NOT organized, HA won't be in the transition and thus its surface wouldn't be shown. Just show is safe here since all other properties will have already been reset by the original hiding-transition's finishTransaction (we can't show in the finishTransaction because by then the activity doesn't hide until surface placement). Bug: 194112093 Test: atest SplashscreenTests Change-Id: I885d688b3f505d33e04d9c2e4857928ada1c4fb0 --- .../com/android/server/wm/Transition.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index 1ac16664244fa..c4130a8b83374 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -437,6 +437,25 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe final ActivityRecord ar = mParticipants.valueAt(i).asActivityRecord(); if (ar == null || !ar.mVisibleRequested) continue; transaction.show(ar.getSurfaceControl()); + + // Also manually show any non-reported parents. This is necessary in a few cases + // where a task is NOT organized but had its visibility changed within its direct + // parent. An example of this is if an alternate home leaf-task HB is started atop the + // normal home leaf-task HA: these are both in the Home root-task HR, so there will be a + // transition containing HA and HB where HA surface is hidden. If a standard task SA is + // launched on top, then HB finishes, no transition will happen since neither home is + // visible. When SA finishes, the transition contains HR rather than HA. Since home + // leaf-tasks are NOT organized, HA won't be in the transition and thus its surface + // wouldn't be shown. Just show is safe here since all other properties will have + // already been reset by the original hiding-transition's finishTransaction (we can't + // show in the finishTransaction because by then the activity doesn't hide until + // surface placement). + for (WindowContainer p = ar.getParent(); p != null && !mTargets.contains(p); + p = p.getParent()) { + if (p.getSurfaceControl() != null) { + transaction.show(p.getSurfaceControl()); + } + } } mStartTransaction = transaction;