Loading libs/WindowManager/Shell/multivalentScreenshotTests/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryScreenshotTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ class DragZoneFactoryScreenshotTest(private val param: Param) { private val splitScreenModeName = when (splitScreenMode) { SplitScreenMode.UNSUPPORTED -> "_split_unsupported" SplitScreenMode.NONE -> "" SplitScreenMode.SPLIT_50_50 -> "_split_50_50" SplitScreenMode.SPLIT_10_90 -> "_split_10_90" Loading libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DragZoneFactory.kt +5 −1 Original line number Diff line number Diff line Loading @@ -303,6 +303,7 @@ class DragZoneFactory( val isVerticalSplit = deviceConfig.isSmallTablet == deviceConfig.isLandscape return if (isVerticalSplit) { when (splitScreenModeChecker.getSplitScreenMode()) { SplitScreenMode.UNSUPPORTED -> emptyList() SplitScreenMode.SPLIT_50_50, SplitScreenMode.NONE -> listOf( Loading Loading @@ -360,6 +361,7 @@ class DragZoneFactory( } } else { when (splitScreenModeChecker.getSplitScreenMode()) { SplitScreenMode.UNSUPPORTED -> emptyList() SplitScreenMode.SPLIT_50_50, SplitScreenMode.NONE -> listOf( Loading Loading @@ -453,6 +455,7 @@ class DragZoneFactory( // vertical split drag zones are aligned with the full screen drag zone width val splitZoneLeft = windowBounds.right / 2 - fullScreenDragZoneWidth / 2 when (splitScreenModeChecker.getSplitScreenMode()) { SplitScreenMode.UNSUPPORTED -> emptyList() SplitScreenMode.SPLIT_50_50, SplitScreenMode.NONE -> listOf( Loading Loading @@ -560,7 +563,8 @@ class DragZoneFactory( NONE, SPLIT_50_50, SPLIT_10_90, SPLIT_90_10 SPLIT_90_10, UNSUPPORTED } fun getSplitScreenMode(): SplitScreenMode Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryTest.kt +36 −3 Original line number Diff line number Diff line Loading @@ -53,7 +53,8 @@ class DragZoneFactoryTest { tabletPortrait.copy(windowBounds = Rect(0, 0, 800, 900), isSmallTablet = true) private val foldableLandscape = foldablePortrait.copy(windowBounds = Rect(0, 0, 900, 800), isLandscape = true) private val splitScreenModeChecker = SplitScreenModeChecker { SplitScreenMode.NONE } private var splitScreenMode = SplitScreenMode.NONE private val splitScreenModeChecker = SplitScreenModeChecker { splitScreenMode } private var isDesktopWindowModeSupported = true private val desktopWindowModeChecker = DesktopWindowModeChecker { isDesktopWindowModeSupported } Loading Loading @@ -283,7 +284,7 @@ class DragZoneFactoryTest { } @Test fun dragZonesForBubble_tablet_desktopModeDisabled() { fun dragZonesForBubble_desktopModeDisabled() { isDesktopWindowModeSupported = false dragZoneFactory = DragZoneFactory( Loading @@ -298,7 +299,7 @@ class DragZoneFactoryTest { } @Test fun dragZonesForExpandedView_tablet_desktopModeDisabled() { fun dragZonesForExpandedView_desktopModeDisabled() { isDesktopWindowModeSupported = false dragZoneFactory = DragZoneFactory( Loading @@ -314,6 +315,38 @@ class DragZoneFactoryTest { assertThat(dragZones.filterIsInstance<DragZone.DesktopWindow>()).isEmpty() } @Test fun dragZonesForBubble_splitScreenModeUnsupported() { splitScreenMode = SplitScreenMode.UNSUPPORTED dragZoneFactory = DragZoneFactory( context, foldableLandscape, splitScreenModeChecker, desktopWindowModeChecker ) val dragZones = dragZoneFactory.createSortedDragZones(DraggedObject.Bubble(BubbleBarLocation.LEFT)) assertThat(dragZones.filterIsInstance<DragZone.Split>()).isEmpty() } @Test fun dragZonesForExpandedView_splitScreenModeUnsupported() { splitScreenMode = SplitScreenMode.UNSUPPORTED dragZoneFactory = DragZoneFactory( context, foldableLandscape, splitScreenModeChecker, desktopWindowModeChecker ) val dragZones = dragZoneFactory.createSortedDragZones( DraggedObject.ExpandedView(BubbleBarLocation.LEFT) ) assertThat(dragZones.filterIsInstance<DragZone.Split>()).isEmpty() } private inline fun <reified T> verifyInstance(): DragZoneVerifier = { dragZone -> assertThat(dragZone).isInstanceOf(T::class.java) } Loading Loading
libs/WindowManager/Shell/multivalentScreenshotTests/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryScreenshotTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ class DragZoneFactoryScreenshotTest(private val param: Param) { private val splitScreenModeName = when (splitScreenMode) { SplitScreenMode.UNSUPPORTED -> "_split_unsupported" SplitScreenMode.NONE -> "" SplitScreenMode.SPLIT_50_50 -> "_split_50_50" SplitScreenMode.SPLIT_10_90 -> "_split_10_90" Loading
libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/DragZoneFactory.kt +5 −1 Original line number Diff line number Diff line Loading @@ -303,6 +303,7 @@ class DragZoneFactory( val isVerticalSplit = deviceConfig.isSmallTablet == deviceConfig.isLandscape return if (isVerticalSplit) { when (splitScreenModeChecker.getSplitScreenMode()) { SplitScreenMode.UNSUPPORTED -> emptyList() SplitScreenMode.SPLIT_50_50, SplitScreenMode.NONE -> listOf( Loading Loading @@ -360,6 +361,7 @@ class DragZoneFactory( } } else { when (splitScreenModeChecker.getSplitScreenMode()) { SplitScreenMode.UNSUPPORTED -> emptyList() SplitScreenMode.SPLIT_50_50, SplitScreenMode.NONE -> listOf( Loading Loading @@ -453,6 +455,7 @@ class DragZoneFactory( // vertical split drag zones are aligned with the full screen drag zone width val splitZoneLeft = windowBounds.right / 2 - fullScreenDragZoneWidth / 2 when (splitScreenModeChecker.getSplitScreenMode()) { SplitScreenMode.UNSUPPORTED -> emptyList() SplitScreenMode.SPLIT_50_50, SplitScreenMode.NONE -> listOf( Loading Loading @@ -560,7 +563,8 @@ class DragZoneFactory( NONE, SPLIT_50_50, SPLIT_10_90, SPLIT_90_10 SPLIT_90_10, UNSUPPORTED } fun getSplitScreenMode(): SplitScreenMode Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/shared/bubbles/DragZoneFactoryTest.kt +36 −3 Original line number Diff line number Diff line Loading @@ -53,7 +53,8 @@ class DragZoneFactoryTest { tabletPortrait.copy(windowBounds = Rect(0, 0, 800, 900), isSmallTablet = true) private val foldableLandscape = foldablePortrait.copy(windowBounds = Rect(0, 0, 900, 800), isLandscape = true) private val splitScreenModeChecker = SplitScreenModeChecker { SplitScreenMode.NONE } private var splitScreenMode = SplitScreenMode.NONE private val splitScreenModeChecker = SplitScreenModeChecker { splitScreenMode } private var isDesktopWindowModeSupported = true private val desktopWindowModeChecker = DesktopWindowModeChecker { isDesktopWindowModeSupported } Loading Loading @@ -283,7 +284,7 @@ class DragZoneFactoryTest { } @Test fun dragZonesForBubble_tablet_desktopModeDisabled() { fun dragZonesForBubble_desktopModeDisabled() { isDesktopWindowModeSupported = false dragZoneFactory = DragZoneFactory( Loading @@ -298,7 +299,7 @@ class DragZoneFactoryTest { } @Test fun dragZonesForExpandedView_tablet_desktopModeDisabled() { fun dragZonesForExpandedView_desktopModeDisabled() { isDesktopWindowModeSupported = false dragZoneFactory = DragZoneFactory( Loading @@ -314,6 +315,38 @@ class DragZoneFactoryTest { assertThat(dragZones.filterIsInstance<DragZone.DesktopWindow>()).isEmpty() } @Test fun dragZonesForBubble_splitScreenModeUnsupported() { splitScreenMode = SplitScreenMode.UNSUPPORTED dragZoneFactory = DragZoneFactory( context, foldableLandscape, splitScreenModeChecker, desktopWindowModeChecker ) val dragZones = dragZoneFactory.createSortedDragZones(DraggedObject.Bubble(BubbleBarLocation.LEFT)) assertThat(dragZones.filterIsInstance<DragZone.Split>()).isEmpty() } @Test fun dragZonesForExpandedView_splitScreenModeUnsupported() { splitScreenMode = SplitScreenMode.UNSUPPORTED dragZoneFactory = DragZoneFactory( context, foldableLandscape, splitScreenModeChecker, desktopWindowModeChecker ) val dragZones = dragZoneFactory.createSortedDragZones( DraggedObject.ExpandedView(BubbleBarLocation.LEFT) ) assertThat(dragZones.filterIsInstance<DragZone.Split>()).isEmpty() } private inline fun <reified T> verifyInstance(): DragZoneVerifier = { dragZone -> assertThat(dragZone).isInstanceOf(T::class.java) } Loading