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

Commit cc6143da authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ignore custom glanceable hub touch on lockscreen" into main

parents 60b4de2c d965a6ef
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -37,9 +37,11 @@ import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.compose.theme.PlatformTheme
import com.android.internal.annotations.VisibleForTesting
import com.android.systemui.Flags
import com.android.systemui.Flags.communalHubOnMobile
import com.android.systemui.ambient.touch.TouchMonitor
import com.android.systemui.ambient.touch.dagger.AmbientTouchComponent
import com.android.systemui.communal.dagger.Communal
@@ -70,7 +72,6 @@ import java.util.function.Consumer
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import com.android.app.tracing.coroutines.launchTraced as launch

/**
 * Controller that's responsible for the glanceable hub container view and its touch handling.
@@ -513,14 +514,19 @@ constructor(
        val touchOnUmo = keyguardMediaController.isWithinMediaViewBounds(ev.x.toInt(), ev.y.toInt())
        val touchOnSmartspace =
            lockscreenSmartspaceController.isWithinSmartspaceBounds(ev.x.toInt(), ev.y.toInt())
        if (!hubShowing && (touchOnNotifications || touchOnUmo || touchOnSmartspace)) {
        val glanceableHubV2 = communalHubOnMobile()
        if (
            !hubShowing &&
                (touchOnNotifications || touchOnUmo || touchOnSmartspace || glanceableHubV2)
        ) {
            logger.d({
                "Lockscreen touch ignored: touchOnNotifications: $bool1, touchOnUmo: $bool2, " +
                    "touchOnSmartspace: $bool3"
                    "touchOnSmartspace: $bool3, glanceableHubV2: $bool4"
            }) {
                bool1 = touchOnNotifications
                bool2 = touchOnUmo
                bool3 = touchOnSmartspace
                bool4 = glanceableHubV2
            }
            return false
        }
+16 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import androidx.lifecycle.LifecycleOwner
import androidx.test.filters.SmallTest
import com.android.compose.animation.scene.SceneKey
import com.android.systemui.Flags
import com.android.systemui.Flags.FLAG_COMMUNAL_HUB_ON_MOBILE
import com.android.systemui.Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX
import com.android.systemui.SysuiTestCase
import com.android.systemui.ambient.touch.TouchHandler
@@ -630,6 +631,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() {
            }
        }

    @DisableFlags(FLAG_COMMUNAL_HUB_ON_MOBILE)
    @Test
    fun onTouchEvent_shadeInteracting_movesNotDispatched() =
        with(kosmos) {
@@ -686,6 +688,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() {
            }
        }

    @DisableFlags(FLAG_COMMUNAL_HUB_ON_MOBILE)
    @Test
    fun onTouchEvent_bouncerInteracting_movesNotDispatched() =
        with(kosmos) {
@@ -718,6 +721,19 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() {
            }
        }

    @EnableFlags(FLAG_COMMUNAL_HUB_ON_MOBILE)
    @Test
    fun onTouchEvent_onLockscreenAndGlanceableHubV2_touchIgnored() =
        with(kosmos) {
            testScope.runTest {
                // On lockscreen.
                goToScene(CommunalScenes.Blank)

                assertThat(underTest.onTouchEvent(DOWN_EVENT)).isFalse()
                verify(containerView, never()).onTouchEvent(DOWN_EVENT)
            }
        }

    @Test
    fun disposeView_destroysTouchMonitor() {
        clearInvocations(touchMonitor)