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

Commit a95e6b12 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Verify removal of task leash in TaskView" into main

parents ef98aa1f bf6b680c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -118,6 +118,11 @@ public class TaskViewTaskController implements ShellTaskOrganizer.TaskListener {
        mHideTaskWithSurface = hideTaskWithSurface;
    }

    @VisibleForTesting
    SurfaceControl getTaskLeash() {
        return mTaskLeash;
    }

    SurfaceControl getSurfaceControl() {
        return mSurfaceControl;
    }
+12 −0
Original line number Diff line number Diff line
@@ -433,10 +433,13 @@ public class TaskViewTest extends ShellTestCase {
        mTaskViewTransitions.prepareOpenAnimation(mTaskViewTaskController, true /* newTask */,
                new SurfaceControl.Transaction(), new SurfaceControl.Transaction(), mTaskInfo,
                mLeash, wct);
        final SurfaceControl taskLeash = mTaskViewTaskController.getTaskLeash();
        mTaskView.surfaceCreated(mock(SurfaceHolder.class));
        mTaskViewTaskController.prepareCloseAnimation();

        verify(mViewListener).onTaskRemovalStarted(eq(mTaskInfo.taskId));
        assertThat(mTaskViewTaskController.getTaskLeash()).isNull();
        assertThat(taskLeash.isValid()).isFalse();
    }

    @Test
@@ -586,6 +589,15 @@ public class TaskViewTest extends ShellTestCase {
        }
    }

    @Test
    public void testPrepareOpenAnimation_copiesLeash() {
        mTaskViewTransitions.prepareOpenAnimation(mTaskViewTaskController, true /* newTask */,
                new SurfaceControl.Transaction(), new SurfaceControl.Transaction(), mTaskInfo,
                mLeash, new WindowContainerTransaction());

        assertThat(mTaskViewTaskController.getTaskLeash()).isNotEqualTo(mLeash);
    }

    @Test
    public void testTaskViewPrepareOpenAnimationSetsBoundsAndVisibility() {
        assumeTrue(Transitions.ENABLE_SHELL_TRANSITIONS);