Merge "Avoid conflict surface reset on auto-enter-pip" into tm-qpr-dev am: d6579ac1b7

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18884005

Change-Id: I66a18d4eef38a2698cc645d5be42dc8f7feacff0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Hongwei Wang
2022-06-15 17:09:35 +00:00
committed by Automerger Merge Worker
2 changed files with 20 additions and 1 deletions

View File

@@ -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();

View File

@@ -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