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

Commit f77b0177 authored by Ale Nijamkin's avatar Ale Nijamkin
Browse files

[flexiglass] Don't expand other dual shade when swiping in this one

Bug was that swiping down, on the other half of an overlay would expand
the other overlay. This was because the user actions were bound to the
left/right half. Instead, they should be bound to the right/left half of
the top edge.

Fix: 402375503
Test: verified manually by swiping down from the status bar or from the
middle, on either side (left/right) in both gone and lockscreen with or
without either overlay being expanded
Flag: com.android.systemui.scene_container

Change-Id: I6a08f49817a69fba52707a23c3fe3fa48cee63a1
parent e4dd14c7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ class NotificationsShadeOverlayActionsViewModelTest : SysuiTestCase() {
            underTest.activateIn(this)

            val action =
                (actions?.get(Swipe.Down(fromSource = SceneContainerArea.EndHalf))
                (actions?.get(Swipe.Down(fromSource = SceneContainerArea.TopEdgeEndHalf))
                    as? ReplaceByOverlay)
            assertThat(action?.overlay).isEqualTo(Overlays.QuickSettingsShade)
        }
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ class QuickSettingsShadeOverlayActionsViewModelTest : SysuiTestCase() {
            underTest.activateIn(this)

            val action =
                (actions?.get(Swipe.Down(fromSource = SceneContainerArea.StartHalf))
                (actions?.get(Swipe.Down(fromSource = SceneContainerArea.TopEdgeStartHalf))
                    as? ReplaceByOverlay)
            assertThat(action?.overlay).isEqualTo(Overlays.NotificationsShade)
        }
+19 −5
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ import com.android.systemui.scene.ui.viewmodel.SceneContainerArea.Resolved.LeftE
import com.android.systemui.scene.ui.viewmodel.SceneContainerArea.Resolved.LeftHalf
import com.android.systemui.scene.ui.viewmodel.SceneContainerArea.Resolved.RightEdge
import com.android.systemui.scene.ui.viewmodel.SceneContainerArea.Resolved.RightHalf
import com.android.systemui.scene.ui.viewmodel.SceneContainerArea.Resolved.TopEdgeLeftHalf
import com.android.systemui.scene.ui.viewmodel.SceneContainerArea.Resolved.TopEdgeRightHalf
import com.android.systemui.scene.ui.viewmodel.SceneContainerArea.StartEdge
import com.android.systemui.scene.ui.viewmodel.SceneContainerArea.StartHalf
import com.google.common.truth.Truth.assertThat
@@ -55,9 +57,9 @@ class SceneContainerSwipeDetectorTest : SysuiTestCase() {
    }

    @Test
    fun source_swipeVerticallyOnTopLeft_detectsLeftHalf() {
    fun source_swipeVerticallyOnTopLeft_detectsTopEdgeLeftHalf() {
        val detectedEdge = swipeVerticallyFrom(x = 1, y = edgeSize - 1)
        assertThat(detectedEdge).isEqualTo(LeftHalf)
        assertThat(detectedEdge).isEqualTo(TopEdgeLeftHalf)
    }

    @Test
@@ -69,7 +71,7 @@ class SceneContainerSwipeDetectorTest : SysuiTestCase() {
    @Test
    fun source_swipeVerticallyOnTopRight_detectsRightHalf() {
        val detectedEdge = swipeVerticallyFrom(x = screenWidth - 1, y = edgeSize - 1)
        assertThat(detectedEdge).isEqualTo(RightHalf)
        assertThat(detectedEdge).isEqualTo(TopEdgeRightHalf)
    }

    @Test
@@ -79,14 +81,26 @@ class SceneContainerSwipeDetectorTest : SysuiTestCase() {
    }

    @Test
    fun source_swipeVerticallyToLeftOfSplit_detectsLeftHalf() {
    fun source_swipeVerticallyOnTopEdge_ToLeftOfSplit_detectsTopEdgeLeftHalf() {
        val detectedEdge = swipeVerticallyFrom(x = (screenWidth / 2) - 1, y = edgeSize - 1)
        assertThat(detectedEdge).isEqualTo(TopEdgeLeftHalf)
    }

    @Test
    fun source_swipeVerticallyBelowTopEdge_ToLeftOfSplit_detectsLeftHalf() {
        val detectedEdge = swipeVerticallyFrom(x = (screenWidth / 2) - 1, y = edgeSize + 1)
        assertThat(detectedEdge).isEqualTo(LeftHalf)
    }

    @Test
    fun source_swipeVerticallyToRightOfSplit_detectsRightHalf() {
    fun source_swipeVerticallyOnTopEdge_toRightOfSplit_detectsTopEdgeRightHalf() {
        val detectedEdge = swipeVerticallyFrom(x = (screenWidth / 2) + 1, y = edgeSize - 1)
        assertThat(detectedEdge).isEqualTo(TopEdgeRightHalf)
    }

    @Test
    fun source_swipeVerticallyBelowTopEdge_toRightOfSplit_detectsRightHalf() {
        val detectedEdge = swipeVerticallyFrom(x = (screenWidth / 2) + 1, y = edgeSize + 1)
        assertThat(detectedEdge).isEqualTo(RightHalf)
    }

+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ class NotificationsShadeOverlayActionsViewModel @AssistedInject constructor() :
            mapOf(
                Swipe.Up to HideOverlay(Overlays.NotificationsShade),
                Back to HideOverlay(Overlays.NotificationsShade),
                Swipe.Down(fromSource = SceneContainerArea.EndHalf) to
                Swipe.Down(fromSource = SceneContainerArea.TopEdgeEndHalf) to
                    ReplaceByOverlay(Overlays.QuickSettingsShade),
            )
        )
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ constructor(private val editModeViewModel: EditModeViewModel) : UserActionsViewM
                        put(Back, HideOverlay(Overlays.QuickSettingsShade))
                    }
                    put(
                        Swipe.Down(fromSource = SceneContainerArea.StartHalf),
                        Swipe.Down(fromSource = SceneContainerArea.TopEdgeStartHalf),
                        ReplaceByOverlay(Overlays.NotificationsShade),
                    )
                }
Loading