Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a14bf150 authored by Hongwei Wang's avatar Hongwei Wang Committed by Automerger Merge Worker
Browse files

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

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

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



Change-Id: I1ad2fe8055d0c323ee0264ceee2af6a2bb3eafb2
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b86d866b 444f2993
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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();
+14 −1
Original line number Diff line number Diff line
@@ -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