diff options
2 files changed, 87 insertions, 7 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt index 8cf7cbd26d39..cfeae91673e6 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt @@ -3084,6 +3084,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() @@ -3092,7 +3093,12 @@ class DesktopTasksController( val wct = WindowContainerTransaction() wct.sendPendingIntent(launchIntent, null, opts.toBundle()) if (windowingMode == WINDOWING_MODE_FREEFORM) { - desktopModeDragAndDropTransitionHandler.handleDropEvent(wct) + 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) } diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt index bffbb99bf13b..0cf87dffbdce 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt @@ -5384,38 +5384,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 + @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_newFreeformIntentSplitRight() { + @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 - fun onUnhandledDrag_newFullscreenIntent() { + @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, ) } @@ -5769,6 +5821,7 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() indicatorType: DesktopModeVisualIndicator.IndicatorType, inputCoordinate: PointF, expectedBounds: Rect, + tabTearingAnimationFlagEnabled: Boolean, ) { setUpLandscapeDisplay() val task = setUpFreeformTask() @@ -5799,6 +5852,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, @@ -5815,8 +5878,19 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() verify(transitions).startTransition(any(), capture(arg), anyOrNull()) } else { expectedWindowingMode = WINDOWING_MODE_FREEFORM - // All other launches use a special handler. - verify(dragAndDropTransitionHandler).handleDropEvent(capture(arg)) + 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) |