diff options
| author | 2022-06-15 16:55:41 +0000 | |
|---|---|---|
| committer | 2022-06-15 16:55:41 +0000 | |
| commit | d6579ac1b7b3a43a59b4bda4fb35b80959e67d05 (patch) | |
| tree | 6fc7f15b4cf6bb04ce41036466eeb15220ca43d9 | |
| parent | 86d2469d1ee7e4252452cf2c0badb8e8b5cc1378 (diff) | |
| parent | 56dcce989345c89d7e6e9ee0438f53153260582d (diff) | |
Merge "Avoid conflict surface reset on auto-enter-pip" into tm-qpr-dev
2 files changed, 20 insertions, 1 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/UnfoldAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/UnfoldAnimationController.java index 530d47416665..05a024a0eb12 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/UnfoldAnimationController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/unfold/UnfoldAnimationController.java @@ -16,6 +16,8 @@ package com.android.wm.shell.unfold; +import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; + import android.annotation.NonNull; import android.app.ActivityManager.RunningTaskInfo; import android.app.TaskInfo; @@ -211,6 +213,10 @@ public class UnfoldAnimationController implements UnfoldListener { } private void resetTask(UnfoldTaskAnimator animator, TaskInfo taskInfo) { + if (taskInfo.getWindowingMode() == WINDOWING_MODE_PINNED) { + // PiP task has its own cleanup path, ignore surface reset to avoid conflict. + return; + } final SurfaceControl.Transaction transaction = mTransactionPool.acquire(); animator.resetSurface(taskInfo, transaction); transaction.apply(); diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/unfold/UnfoldAnimationControllerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/unfold/UnfoldAnimationControllerTest.java index 798208956180..46de60772766 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/unfold/UnfoldAnimationControllerTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/unfold/UnfoldAnimationControllerTest.java @@ -206,6 +206,19 @@ public class UnfoldAnimationControllerTest extends ShellTestCase { @Test public void testApplicableTaskDisappeared_resetsSurface() { + mTaskAnimator1.setTaskMatcher((info) -> info.getWindowingMode() == 0); + RunningTaskInfo taskInfo = new TestRunningTaskInfoBuilder() + .setWindowingMode(0).build(); + mUnfoldAnimationController.onTaskAppeared(taskInfo, mLeash); + assertThat(mTaskAnimator1.mResetTasks).doesNotContain(taskInfo.taskId); + + mUnfoldAnimationController.onTaskVanished(taskInfo); + + assertThat(mTaskAnimator1.mResetTasks).contains(taskInfo.taskId); + } + + @Test + public void testApplicablePinnedTaskDisappeared_doesNotResetSurface() { mTaskAnimator1.setTaskMatcher((info) -> info.getWindowingMode() == 2); RunningTaskInfo taskInfo = new TestRunningTaskInfoBuilder() .setWindowingMode(2).build(); @@ -214,7 +227,7 @@ public class UnfoldAnimationControllerTest extends ShellTestCase { mUnfoldAnimationController.onTaskVanished(taskInfo); - assertThat(mTaskAnimator1.mResetTasks).contains(taskInfo.taskId); + assertThat(mTaskAnimator1.mResetTasks).doesNotContain(taskInfo.taskId); } @Test |