From 46b22adb71cbb0af876ad9de552a69eadfb9a39a Mon Sep 17 00:00:00 2001 From: Nick Chameyev Date: Wed, 31 May 2023 12:07:11 +0100 Subject: [PATCH] [Unfold animation] Merge change transitions into unfold transition Currently if we unfold a foldable device, first the display switch happens and then after some time Launcher adds a taskbar, which leads to an extra configuration change (and a CHANGE transition). This causes a problem that unfold animation gets stuck for some time if this second CHANGE transition starts during unfold animation. This CL fixes it by merging this extra transition into the unfold transition. Bug: 278064943 Test: unfold several times on launcher, app => check that it looks correct Change-Id: Id0fa208210e275042a84a40f6e823652314a306c --- .../wm/shell/unfold/UnfoldTransitionHandler.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/UnfoldTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/UnfoldTransitionHandler.java index bb0eba6a0fc75..c504f57216f34 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/UnfoldTransitionHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/UnfoldTransitionHandler.java @@ -173,6 +173,17 @@ public class UnfoldTransitionHandler implements TransitionHandler, UnfoldListene mTransition = null; } + @Override + public void mergeAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info, + @NonNull SurfaceControl.Transaction t, @NonNull IBinder mergeTarget, + @NonNull TransitionFinishCallback finishCallback) { + if (info.getType() == TRANSIT_CHANGE) { + // Apply changes happening during the unfold animation immediately + t.apply(); + finishCallback.onTransitionFinished(null, null); + } + } + @Nullable @Override public WindowContainerTransaction handleRequest(@NonNull IBinder transition,