From 265cdc3a689c05ccf11a0e3840beaba94bb425ae Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Tue, 20 Dec 2022 07:03:38 +0000 Subject: [PATCH] [ShellTransit] Reset alpha in buildFinishTransaction The alpha of a window container can be 0 after it play a fade-out app transition, (e.g. start/finish activity with overridePendingTransition) And since there doesn't have another animation layer like legacy transition do, that window will stay invisible because of alpha=0, unless somewhere trigger another animation with apply a new alpha on it. Also it won't able to receive touch event since the alpha is 0. To make it visible, always reset the alpha to 1 in buildFinishTransaction. Bug: 263439418 Test: manual, finish activity with an overridePendingTransition which apply fade-out animation for the entering one, the activity should be visible after animation finish. Change-Id: I5be555e33b76aa799e1f96b3ea340d365bad4c66 --- .../Shell/src/com/android/wm/shell/transition/Transitions.java | 2 -- services/core/java/com/android/server/wm/Transition.java | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java index b714d2e5e1e0e..39fe4559c88f0 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java @@ -370,8 +370,6 @@ public class Transitions implements RemoteCallable { // If this is a transferred starting window, we want it immediately visible. && (change.getFlags() & FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT) == 0) { t.setAlpha(leash, 0.f); - // fix alpha in finish transaction in case the animator itself no-ops. - finishT.setAlpha(leash, 1.f); } } else if (mode == TRANSIT_CLOSE || mode == TRANSIT_TO_BACK) { finishT.hide(leash); diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index c874747b0b5a2..c911b83a9a879 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -653,6 +653,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { t.setCornerRadius(targetLeash, 0); t.setShadowRadius(targetLeash, 0); t.setMatrix(targetLeash, 1, 0, 0, 1); + t.setAlpha(targetLeash, 1); // The bounds sent to the transition is always a real bounds. This means we lose // information about "null" bounds (inheriting from parent). Core will fix-up // non-organized window surface bounds; however, since Core can't touch organized