From e554b085acfe85e44601e2c5ad01961cdcd0cc0b Mon Sep 17 00:00:00 2001 From: Ming-Shin Lu Date: Mon, 15 May 2023 18:38:49 +0000 Subject: [PATCH] Fix divider not updated when moving split-tasks from fold -> unfold As starting unfold transition animation that the running split-tasks may not yet visible and the transition type could possible be TRSANSIT_TO_FRONT instead of TRANSIT_CHANGE depends on the user unfolding speed and the display power state, which leads to the SplitTaskUnfoldAnimator could not receive onTaskAppeared to update divider surface by wrong transition type and isApplicableTask check in UnfoldTransitionHandler. Ensure SplitTaskUnfoldAnimator receives onTaskAppeared when unfolding the device during starting unfold transition through UnfoldTransitionHandler#startAnimation with the right logic check. Fix: 278045290 Test: manual as following scenarios: A) Disable auto-rotate on folded screen 1. Enter split-screen on folded screen in portrait. 2. Unfolded the screen 3. Expect not seeing the divider gone. B) Enable auto-rotate on folded screen 1. enber split-screen on folded screen in landscape. 2. unfolded the screen. 3. Expect not seeing the divider being miss-placed on top or on left hand side. Change-Id: I08f737257f1cbc84f08ec4036ed561017b99f67a --- .../wm/shell/unfold/UnfoldTransitionHandler.java | 14 ++++++++++++-- .../unfold/animation/SplitTaskUnfoldAnimator.java | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) 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 5d7b62905d3b0..bb0eba6a0fc75 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 @@ -18,6 +18,8 @@ package com.android.wm.shell.unfold; import static android.view.WindowManager.TRANSIT_CHANGE; +import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_TRANSITIONS; + import android.os.IBinder; import android.view.SurfaceControl; import android.window.TransitionInfo; @@ -27,6 +29,7 @@ import android.window.WindowContainerTransaction; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.android.internal.protolog.common.ProtoLog; import com.android.wm.shell.common.TransactionPool; import com.android.wm.shell.sysui.ShellInit; import com.android.wm.shell.transition.Transitions; @@ -36,6 +39,7 @@ import com.android.wm.shell.unfold.ShellUnfoldProgressProvider.UnfoldListener; import com.android.wm.shell.unfold.animation.FullscreenUnfoldTaskAnimator; import com.android.wm.shell.unfold.animation.SplitTaskUnfoldAnimator; import com.android.wm.shell.unfold.animation.UnfoldTaskAnimator; +import com.android.wm.shell.util.TransitionUtil; import java.util.ArrayList; import java.util.List; @@ -105,8 +109,14 @@ public class UnfoldTransitionHandler implements TransitionHandler, UnfoldListene animator.clearTasks(); info.getChanges().forEach(change -> { - if (change.getTaskInfo() != null - && change.getMode() == TRANSIT_CHANGE + if (change.getTaskInfo() != null) { + ProtoLog.v(WM_SHELL_TRANSITIONS, + "startAnimation, check taskInfo: %s, mode: %s, isApplicableTask: %s", + change.getTaskInfo(), TransitionInfo.modeToString(change.getMode()), + animator.isApplicableTask(change.getTaskInfo())); + } + if (change.getTaskInfo() != null && (change.getMode() == TRANSIT_CHANGE + || TransitionUtil.isOpeningType(change.getMode())) && animator.isApplicableTask(change.getTaskInfo())) { animator.onTaskAppeared(change.getTaskInfo(), change.getLeash()); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/animation/SplitTaskUnfoldAnimator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/animation/SplitTaskUnfoldAnimator.java index 123bf3bfca2eb..a4cf149cc3b5c 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/animation/SplitTaskUnfoldAnimator.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/animation/SplitTaskUnfoldAnimator.java @@ -213,7 +213,7 @@ public class SplitTaskUnfoldAnimator implements UnfoldTaskAnimator, @Override public boolean isApplicableTask(TaskInfo taskInfo) { return taskInfo.hasParentTask() - && taskInfo.isVisible + && taskInfo.isRunning && taskInfo.realActivity != null // to filter out parents created by organizer && taskInfo.getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW; }