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

Commit 54d66e38 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Add an unsupported split screen mode

This will allow us to avoid generating split drag zones until the
transition from bubble to split is implemented.

Flag: EXEMPT not wired
Bug: 393172431
Test: atest DragZoneFactoryTest
Change-Id: I5d4c1d07fc7926c01c86272d02acaab2a1410dde
parent 6e63524c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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"
+5 −1
Original line number Diff line number Diff line
@@ -322,6 +322,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(
@@ -379,6 +380,7 @@ class DragZoneFactory(
            }
        } else {
            when (splitScreenModeChecker.getSplitScreenMode()) {
                SplitScreenMode.UNSUPPORTED -> emptyList()
                SplitScreenMode.SPLIT_50_50,
                SplitScreenMode.NONE ->
                    listOf(
@@ -472,6 +474,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(
@@ -579,7 +582,8 @@ class DragZoneFactory(
            NONE,
            SPLIT_50_50,
            SPLIT_10_90,
            SPLIT_90_10
            SPLIT_90_10,
            UNSUPPORTED
        }

        fun getSplitScreenMode(): SplitScreenMode
+36 −3
Original line number Diff line number Diff line
@@ -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 }

@@ -283,7 +284,7 @@ class DragZoneFactoryTest {
    }

    @Test
    fun dragZonesForBubble_tablet_desktopModeDisabled() {
    fun dragZonesForBubble_desktopModeDisabled() {
        isDesktopWindowModeSupported = false
        dragZoneFactory =
            DragZoneFactory(
@@ -298,7 +299,7 @@ class DragZoneFactoryTest {
    }

    @Test
    fun dragZonesForExpandedView_tablet_desktopModeDisabled() {
    fun dragZonesForExpandedView_desktopModeDisabled() {
        isDesktopWindowModeSupported = false
        dragZoneFactory =
            DragZoneFactory(
@@ -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)
    }