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

Commit c1829f99 authored by Sergey Pinkevich's avatar Sergey Pinkevich Committed by Android (Google) Code Review
Browse files

Merge "Chrome tab tearing minimize animation" into main

parents 67b28ff3 9d406b44
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -3074,6 +3074,7 @@ class DesktopTasksController(
                    ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS
                pendingIntentLaunchFlags =
                    Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK
                splashScreenStyle = SPLASH_SCREEN_STYLE_ICON
            }
        if (windowingMode == WINDOWING_MODE_FULLSCREEN) {
            dragAndDropFullscreenCookie = Binder()
@@ -3082,7 +3083,12 @@ class DesktopTasksController(
        val wct = WindowContainerTransaction()
        wct.sendPendingIntent(launchIntent, null, opts.toBundle())
        if (windowingMode == WINDOWING_MODE_FREEFORM) {
            if (DesktopModeFlags.ENABLE_DESKTOP_TAB_TEARING_MINIMIZE_ANIMATION_BUGFIX.isTrue()) {
                // TODO b/376389593: Use a custom tab tearing transition/animation
                startLaunchTransition(TRANSIT_OPEN, wct, launchingTaskId = null)
            } else {
                desktopModeDragAndDropTransitionHandler.handleDropEvent(wct)
            }
        } else {
            transitions.startTransition(TRANSIT_OPEN, wct, null)
        }
+80 −6
Original line number Diff line number Diff line
@@ -5427,38 +5427,90 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
    }

    @Test
    fun onUnhandledDrag_newFreeformIntent() {
    @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_TAB_TEARING_MINIMIZE_ANIMATION_BUGFIX)
    fun onUnhandledDrag_newFreeformIntent_tabTearingAnimationBugfixFlagEnabled() {
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.TO_DESKTOP_INDICATOR,
            PointF(1200f, 700f),
            Rect(240, 700, 2160, 1900),
            tabTearingAnimationFlagEnabled = true,
        )
    }

    @Test
    fun onUnhandledDrag_newFreeformIntentSplitLeft() {
    @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_TAB_TEARING_MINIMIZE_ANIMATION_BUGFIX)
    fun onUnhandledDrag_newFreeformIntent_tabTearingAnimationBugfixFlagDisabled() {
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.TO_DESKTOP_INDICATOR,
            PointF(1200f, 700f),
            Rect(240, 700, 2160, 1900),
            tabTearingAnimationFlagEnabled = false,
        )
    }

    @Test
    @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_TAB_TEARING_MINIMIZE_ANIMATION_BUGFIX)
    fun onUnhandledDrag_newFreeformIntentSplitLeft_tabTearingAnimationBugfixFlagEnabled() {
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.TO_SPLIT_LEFT_INDICATOR,
            PointF(50f, 700f),
            Rect(0, 0, 500, 1000),
            tabTearingAnimationFlagEnabled = true,
        )
    }

    @Test
    @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_TAB_TEARING_MINIMIZE_ANIMATION_BUGFIX)
    fun onUnhandledDrag_newFreeformIntentSplitLeft_tabTearingAnimationBugfixFlagDisabled() {
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.TO_SPLIT_LEFT_INDICATOR,
            PointF(50f, 700f),
            Rect(0, 0, 500, 1000),
            tabTearingAnimationFlagEnabled = false,
        )
    }

    @Test
    fun onUnhandledDrag_newFreeformIntentSplitRight() {
    @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_TAB_TEARING_MINIMIZE_ANIMATION_BUGFIX)
    fun onUnhandledDrag_newFreeformIntentSplitRight_tabTearingAnimationBugfixFlagEnabled() {
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.TO_SPLIT_RIGHT_INDICATOR,
            PointF(2500f, 700f),
            Rect(500, 0, 1000, 1000),
            tabTearingAnimationFlagEnabled = true,
        )
    }

    @Test
    fun onUnhandledDrag_newFullscreenIntent() {
    @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_TAB_TEARING_MINIMIZE_ANIMATION_BUGFIX)
    fun onUnhandledDrag_newFreeformIntentSplitRight_tabTearingAnimationBugfixFlagDisabled() {
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.TO_SPLIT_RIGHT_INDICATOR,
            PointF(2500f, 700f),
            Rect(500, 0, 1000, 1000),
            tabTearingAnimationFlagEnabled = false,
        )
    }

    @Test
    @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_TAB_TEARING_MINIMIZE_ANIMATION_BUGFIX)
    fun onUnhandledDrag_newFullscreenIntent_tabTearingAnimationBugfixFlagEnabled() {
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.TO_FULLSCREEN_INDICATOR,
            PointF(1200f, 50f),
            Rect(),
            tabTearingAnimationFlagEnabled = true,
        )
    }

    @Test
    @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_TAB_TEARING_MINIMIZE_ANIMATION_BUGFIX)
    fun onUnhandledDrag_newFullscreenIntent_tabTearingAnimationBugfixFlagDisabled() {
        testOnUnhandledDrag(
            DesktopModeVisualIndicator.IndicatorType.TO_FULLSCREEN_INDICATOR,
            PointF(1200f, 50f),
            Rect(),
            tabTearingAnimationFlagEnabled = false,
        )
    }

@@ -5812,6 +5864,7 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        indicatorType: DesktopModeVisualIndicator.IndicatorType,
        inputCoordinate: PointF,
        expectedBounds: Rect,
        tabTearingAnimationFlagEnabled: Boolean,
    ) {
        setUpLandscapeDisplay()
        val task = setUpFreeformTask()
@@ -5842,6 +5895,16 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
                anyOrNull(),
                eq(DesktopModeVisualIndicator.DragStartState.DRAGGED_INTENT),
            )
        whenever(
                desktopMixedTransitionHandler.startLaunchTransition(
                    eq(TRANSIT_OPEN),
                    any(),
                    anyOrNull(),
                    anyOrNull(),
                    anyOrNull(),
                )
            )
            .thenReturn(Binder())

        spyController.onUnhandledDrag(
            mockPendingIntent,
@@ -5858,9 +5921,20 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
            verify(transitions).startTransition(any(), capture(arg), anyOrNull())
        } else {
            expectedWindowingMode = WINDOWING_MODE_FREEFORM
            if (tabTearingAnimationFlagEnabled) {
                verify(desktopMixedTransitionHandler)
                    .startLaunchTransition(
                        eq(TRANSIT_OPEN),
                        capture(arg),
                        anyOrNull(),
                        anyOrNull(),
                        anyOrNull(),
                    )
            } else {
                // All other launches use a special handler.
                verify(dragAndDropTransitionHandler).handleDropEvent(capture(arg))
            }
        }
        assertThat(
                ActivityOptions.fromBundle(arg.value.hierarchyOps[0].launchOptions)
                    .launchWindowingMode