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

This commit is contained in:
Hongwei Wang
2022-06-15 16:55:41 +00:00
committed by Android (Google) Code Review
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