Avoid conflict surface reset on auto-enter-pip
This fix was introduced in ag/16150706 and recently got overridden with ag/18751998, UnfoldAnimationController#resetTask happens in between RecentsAnimationController cleanup and PipTaskOrganizer#onTaskAppeared may cause flicker at the end of auto-enter-pip transition. Fix it by intentionally ignore resetSurface if the task's pinned. Bug: 235737615 Test: auto enter pip repeatedly on foldable Test: atest WMShellUnitTests:UnfoldAnimationControllerTest Change-Id: I5de034f5c0d3f150dd77aadb97c0d2b3f9c64c15
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user