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

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

Merge "Revert "Flexiglass, Keyguard: mouse click on empty space should...

Merge "Revert "Flexiglass, Keyguard: mouse click on empty space should transition to bouncer"" into main
parents 53692005 0b281bc4
Loading
Loading
Loading
Loading
+10 −24
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.back.domain.interactor.BackActionInteractor
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor
import com.android.systemui.flags.DisableSceneContainer
import com.android.systemui.media.controls.util.MediaSessionLegacyHelperWrapper
import com.android.systemui.plugins.statusbar.StatusBarStateController
@@ -31,7 +30,6 @@ import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAsleepForTest
import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAwakeForTest
import com.android.systemui.power.domain.interactor.PowerInteractorFactory
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.ShadeController
import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager
@@ -70,7 +68,6 @@ class KeyguardKeyEventInteractorTest : SysuiTestCase() {
    @Mock private lateinit var mediaSessionLegacyHelperWrapper: MediaSessionLegacyHelperWrapper
    @Mock private lateinit var mediaSessionLegacyHelper: MediaSessionLegacyHelper
    @Mock private lateinit var backActionInteractor: BackActionInteractor
    @Mock private lateinit var deviceEntryInteractor: DeviceEntryInteractor

    private lateinit var underTest: KeyguardKeyEventInteractor

@@ -88,7 +85,6 @@ class KeyguardKeyEventInteractorTest : SysuiTestCase() {
                shadeController,
                mediaSessionLegacyHelperWrapper,
                backActionInteractor,
                deviceEntryInteractor,
                powerInteractor,
                kosmos.keyguardMediaKeyInteractor,
            )
@@ -274,36 +270,27 @@ class KeyguardKeyEventInteractorTest : SysuiTestCase() {
        // action down: does NOT collapse the shade
        val actionDownMenuKeyEvent = KeyEvent(KeyEvent.ACTION_DOWN, keycode)
        assertThat(underTest.dispatchKeyEvent(actionDownMenuKeyEvent)).isFalse()
        if (SceneContainerFlag.isEnabled) {
            verify(deviceEntryInteractor, never()).attemptDeviceEntry()
        } else {
        verify(statusBarKeyguardViewManager, never())
            .showPrimaryBouncer(
                any(),
                eq("KeyguardKeyEventInteractor#collapseShadeLockedOrShowPrimaryBouncer"),
            )
        }

        // action up: collapses the shade
        val actionUpMenuKeyEvent = KeyEvent(KeyEvent.ACTION_UP, keycode)
        assertThat(underTest.dispatchKeyEvent(actionUpMenuKeyEvent)).isTrue()
        if (SceneContainerFlag.isEnabled) {
            verify(deviceEntryInteractor).attemptDeviceEntry()
        } else {
        verify(statusBarKeyguardViewManager)
            .showPrimaryBouncer(
                eq(true),
                eq("KeyguardKeyEventInteractor#collapseShadeLockedOrShowPrimaryBouncer"),
            )
    }
    }

    private fun verifyActionsDoNothing(keycode: Int) {
        // action down: does nothing
        val actionDownMenuKeyEvent = KeyEvent(KeyEvent.ACTION_DOWN, keycode)
        assertThat(underTest.dispatchKeyEvent(actionDownMenuKeyEvent)).isFalse()
        verify(shadeController, never()).animateCollapseShadeForced()
        verify(deviceEntryInteractor, never()).attemptDeviceEntry()
        verify(statusBarKeyguardViewManager, never())
            .showPrimaryBouncer(
                any(),
@@ -314,7 +301,6 @@ class KeyguardKeyEventInteractorTest : SysuiTestCase() {
        val actionUpMenuKeyEvent = KeyEvent(KeyEvent.ACTION_UP, keycode)
        assertThat(underTest.dispatchKeyEvent(actionUpMenuKeyEvent)).isFalse()
        verify(shadeController, never()).animateCollapseShadeForced()
        verify(deviceEntryInteractor, never()).attemptDeviceEntry()
        verify(statusBarKeyguardViewManager, never())
            .showPrimaryBouncer(
                any(),
+1 −31
Original line number Diff line number Diff line
@@ -32,19 +32,14 @@ import com.android.systemui.Flags.FLAG_DOUBLE_TAP_TO_SLEEP
import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor
import com.android.systemui.deviceentry.shared.FaceAuthUiEvent
import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFaceAuthRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.kosmos.testScope
import com.android.systemui.power.domain.interactor.powerInteractor
import com.android.systemui.res.R
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.shared.model.Overlays
import com.android.systemui.shade.pulsingGestureListener
import com.android.systemui.statusbar.phone.statusBarKeyguardViewManager
import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper
import com.android.systemui.testKosmos
import com.android.systemui.util.mockito.mock
@@ -87,7 +82,6 @@ class KeyguardTouchHandlingInteractorTest : SysuiTestCase() {
    private val keyguardRepository = kosmos.fakeKeyguardRepository
    private val keyguardTransitionRepository = kosmos.fakeKeyguardTransitionRepository
    private val secureSettingsRepository = kosmos.userAwareSecureSettingsRepository
    private val sceneInteractor = kosmos.sceneInteractor

    @Mock private lateinit var powerManager: PowerManager

@@ -279,20 +273,15 @@ class KeyguardTouchHandlingInteractorTest : SysuiTestCase() {
        }

    @Test
    fun triggersFaceAuthWhenLockscreenIsClickedStaysOnKeyguard() =
    fun triggersFaceAuthWhenLockscreenIsClicked() =
        testScope.runTest {
            collectLastValue(underTest.isMenuVisible)
            val currentOverlays by collectLastValue(sceneInteractor.currentOverlays)
            runCurrent()
            kosmos.fakeDeviceEntryFaceAuthRepository.canRunFaceAuth.value = true

            assertThat(currentOverlays).doesNotContain(Overlays.Bouncer)

            underTest.onClick(100.0f, 100.0f)
            runCurrent()

            assertThat(currentOverlays).doesNotContain(Overlays.Bouncer)

            val runningAuthRequest =
                kosmos.fakeDeviceEntryFaceAuthRepository.runningAuthRequest.value
            assertThat(runningAuthRequest?.first)
@@ -300,22 +289,6 @@ class KeyguardTouchHandlingInteractorTest : SysuiTestCase() {
            assertThat(runningAuthRequest?.second).isEqualTo(true)
        }

    @Test
    fun switchesToBouncerWhenLockscreenIsClickedNoFaceAuth() =
        testScope.runTest {
            collectLastValue(underTest.isMenuVisible)
            val currentOverlays by collectLastValue(sceneInteractor.currentOverlays)
            runCurrent()
            kosmos.fakeDeviceEntryFaceAuthRepository.canRunFaceAuth.value = false

            assertThat(currentOverlays).doesNotContain(Overlays.Bouncer)

            underTest.onClick(100.0f, 100.0f)
            runCurrent()

            assertThat(currentOverlays).contains(Overlays.Bouncer)
        }

    @Test
    fun showMenu_leaveLockscreen_returnToLockscreen_menuNotVisible() =
        testScope.runTest {
@@ -462,11 +435,8 @@ class KeyguardTouchHandlingInteractorTest : SysuiTestCase() {
                logger = logger,
                broadcastDispatcher = fakeBroadcastDispatcher,
                accessibilityManager = kosmos.accessibilityManagerWrapper,
                statusBarKeyguardViewManager = kosmos.statusBarKeyguardViewManager,
                pulsingGestureListener = kosmos.pulsingGestureListener,
                faceAuthInteractor = kosmos.deviceEntryFaceAuthInteractor,
                deviceEntryInteractor = kosmos.deviceEntryInteractor,
                powerInteractor = kosmos.powerInteractor,
                secureSettingsRepository = secureSettingsRepository,
                powerManager = powerManager,
                systemClock = kosmos.fakeSystemClock,
+4 −10
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.media.AudioManager
import android.view.KeyEvent
import com.android.systemui.back.domain.interactor.BackActionInteractor
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor
import com.android.systemui.keyevent.domain.interactor.SysUIKeyEventHandler.Companion.handleAction
import com.android.systemui.media.controls.util.MediaSessionLegacyHelperWrapper
import com.android.systemui.plugins.ActivityStarter.OnDismissAction
@@ -45,7 +44,6 @@ constructor(
    private val shadeController: ShadeController,
    private val mediaSessionLegacyHelperWrapper: MediaSessionLegacyHelperWrapper,
    private val backActionInteractor: BackActionInteractor,
    private val deviceEntryInteractor: DeviceEntryInteractor,
    private val powerInteractor: PowerInteractor,
    private val keyguardMediaKeyInteractor: KeyguardMediaKeyInteractor,
) {
@@ -138,14 +136,10 @@ constructor(
                return true
            }
            StatusBarState.KEYGUARD -> {
                if (SceneContainerFlag.isEnabled) {
                    deviceEntryInteractor.attemptDeviceEntry()
                } else {
                statusBarKeyguardViewManager.showPrimaryBouncer(
                    true,
                    "KeyguardKeyEventInteractor#collapseShadeLockedOrShowPrimaryBouncer",
                )
                }
                return true
            }
        }
+1 −29
Original line number Diff line number Diff line
@@ -33,16 +33,12 @@ import com.android.systemui.broadcast.BroadcastDispatcher
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor
import com.android.systemui.keyguard.data.repository.KeyguardRepository
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.res.R
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.PulsingGestureListener
import com.android.systemui.shade.ShadeDisplayAware
import com.android.systemui.shared.settings.data.repository.SecureSettingsRepository
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager
import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper
import com.android.systemui.util.time.SystemClock
import javax.inject.Inject
@@ -73,11 +69,8 @@ constructor(
    private val logger: UiEventLogger,
    broadcastDispatcher: BroadcastDispatcher,
    private val accessibilityManager: AccessibilityManagerWrapper,
    private val statusBarKeyguardViewManager: StatusBarKeyguardViewManager,
    private val pulsingGestureListener: PulsingGestureListener,
    private val faceAuthInteractor: DeviceEntryFaceAuthInteractor,
    private val deviceEntryInteractor: DeviceEntryInteractor,
    private val powerInteractor: PowerInteractor,
    private val secureSettingsRepository: SecureSettingsRepository,
    private val powerManager: PowerManager,
    private val systemClock: SystemClock,
@@ -219,11 +212,7 @@ constructor(
    /** Notifies that the lockscreen has been clicked at position [x], [y]. */
    fun onClick(x: Float, y: Float) {
        pulsingGestureListener.onSingleTapUp(x, y)
        if (faceAuthInteractor.canFaceAuthRun()) {
        faceAuthInteractor.onNotificationPanelClicked()
        } else {
            attemptDeviceEntry()
        }
    }

    /** Notifies that the lockscreen has been double clicked. */
@@ -290,23 +279,6 @@ constructor(
            .toLong()
    }

    private fun attemptDeviceEntry() {
        if (isDeviceAwake()) {
            if (SceneContainerFlag.isEnabled) {
                deviceEntryInteractor.attemptDeviceEntry()
            } else {
                statusBarKeyguardViewManager.showPrimaryBouncer(
                    true,
                    "KeyguardTouchHandlingInteractor#attemptDeviceEntry",
                )
            }
        }
    }

    private fun isDeviceAwake(): Boolean {
        return powerInteractor.detailedWakefulness.value.isAwake()
    }

    enum class LogEvents(private val _id: Int) : UiEventLogger.UiEventEnum {
        @UiEvent(doc = "The lock screen was long-pressed and we showed the settings popup menu.")
        LOCK_SCREEN_LONG_PRESS_POPUP_SHOWN(1292),
+0 −6
Original line number Diff line number Diff line
@@ -22,13 +22,10 @@ import android.view.accessibility.accessibilityManagerWrapper
import com.android.internal.logging.uiEventLogger
import com.android.systemui.broadcast.broadcastDispatcher
import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor
import com.android.systemui.keyguard.data.repository.keyguardRepository
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.power.domain.interactor.powerInteractor
import com.android.systemui.shade.pulsingGestureListener
import com.android.systemui.statusbar.phone.statusBarKeyguardViewManager
import com.android.systemui.util.settings.data.repository.userAwareSecureSettingsRepository
import com.android.systemui.util.time.fakeSystemClock

@@ -42,11 +39,8 @@ val Kosmos.keyguardTouchHandlingInteractor by
            logger = uiEventLogger,
            broadcastDispatcher = broadcastDispatcher,
            accessibilityManager = accessibilityManagerWrapper,
            statusBarKeyguardViewManager = statusBarKeyguardViewManager,
            pulsingGestureListener = pulsingGestureListener,
            faceAuthInteractor = deviceEntryFaceAuthInteractor,
            powerInteractor = powerInteractor,
            deviceEntryInteractor = deviceEntryInteractor,
            secureSettingsRepository = userAwareSecureSettingsRepository,
            powerManager = powerManager,
            systemClock = fakeSystemClock,