From fffe0f3c4031ca4fa04c63cc0026247c586d9d4e Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Mon, 26 Jun 2023 17:08:58 -0700 Subject: [PATCH] Don't commit invisible on a collecting transient-launch task The visibleAtTransitionEnd mechanism can't be used for transient-launch; however, we need to avoid the same problem that it prevents (premutarely committing invisible on a window that was not hidden by the current transition but instead a later one). This CL adds a heuristic for the transient-launch case that serves a similar purpose. Bug: 280907903 Test: inject a sleep during finish to ensure that you can launch an app before finishing swipe-to-home. Then swipe to home and open another app immediately. Change-Id: I8b3374040c60068d08905b5d2c604b7c250afccf --- .../core/java/com/android/server/wm/Transition.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index b7ef5bbf13bd3..738869b84474c 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -1093,6 +1093,16 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { final Task task = ar.getTask(); if (task == null) continue; boolean visibleAtTransitionEnd = mVisibleAtTransitionEndTokens.contains(ar); + // visibleAtTransitionEnd is used to guard against pre-maturely committing + // invisible on a window which is actually hidden by a later transition and not this + // one. However, for a transient launch, we can't use this mechanism because the + // visibility is determined at finish. Instead, use a different heuristic: don't + // commit invisible if the window is already in a later transition. That later + // transition will then handle the commit. + if (isTransientLaunch(ar) && !ar.isVisibleRequested() + && mController.inCollectingTransition(ar)) { + visibleAtTransitionEnd = true; + } // We need both the expected visibility AND current requested-visibility to be // false. If it is expected-visible but not currently visible, it means that // another animation is queued-up to animate this to invisibility, so we can't