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

Commit 101edc0f authored by Matt Pietal's avatar Matt Pietal
Browse files

Process adb shell input keyevent 82 through dismiss

Previously, it would trigger a shade collapse, and eventually get
to keyguard to dismiss. Sending the request to keyguard follows
the path of every other dismiss request.

Bug: 371893850
Test: atest CtsWindowManagerDeviceKeyguard:android.server.wm.keyguard.KeyguardLockedTests
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:55017463035c83ebb968f7abc0ca900ac3601533)
Merged-In: I2c9a3ead9540ab473815e06d474d42978ff59cf6
Change-Id: I2c9a3ead9540ab473815e06d474d42978ff59cf6

NOTE FOR REVIEWERS - errors occurred while applying the patch.
PLEASE REVIEW CAREFULLY.
Errors:
Error applying patch in packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardKeyEventInteractorTest.kt: Cannot perform UNIFIED action on a non-existent file

Original patch:
 From 55017463 Mon Sep 17 00:00:00 2001
From: Matt Pietal <mpietal@google.com>
Date: Tue, 08 Oct 2024 20:13:14 +0000
Subject: [PATCH] Process adb shell input keyevent 82 through dismiss

Previously, it would trigger a shade collapse, and eventually get
to keyguard to dismiss. Sending the request to keyguard follows
the path of every other dismiss request.

Bug: 371893850
Test: atest CtsWindowManagerDeviceKeyguard:android.server.wm.keyguard.KeyguardLockedTests
Flag: EXEMPT bugfix
Change-Id: I2c9a3ead9540ab473815e06d474d42978ff59cf6
---
parent ec7676d1
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import com.android.systemui.back.domain.interactor.BackActionInteractor
import com.android.systemui.dagger.SysUISingleton
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
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.shade.ShadeController
@@ -105,7 +106,15 @@ constructor(
                (statusBarStateController.state != StatusBarState.SHADE) &&
                statusBarKeyguardViewManager.shouldDismissOnMenuPressed()
        if (shouldUnlockOnMenuPressed) {
            shadeController.animateCollapseShadeForced()
            statusBarKeyguardViewManager.dismissWithAction(
                object : OnDismissAction {
                    override fun onDismiss(): Boolean {
                        return false
                    }
                },
                null,
                false,
            )
            return true
        }
        return false
+8 −5
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import org.mockito.Mockito.clearInvocations
import org.mockito.Mockito.never
import org.mockito.Mockito.verify
import org.mockito.junit.MockitoJUnit
import org.mockito.kotlin.isNull

@ExperimentalCoroutinesApi
@SmallTest
@@ -96,7 +97,7 @@ class KeyguardKeyEventInteractorTest : SysuiTestCase() {
            .sendVolumeKeyEvent(
                eq(actionDownVolumeDownKeyEvent),
                eq(AudioManager.USE_DEFAULT_STREAM_TYPE),
                eq(true)
                eq(true),
            )

        assertThat(underTest.dispatchKeyEvent(actionDownVolumeUpKeyEvent)).isTrue()
@@ -104,7 +105,7 @@ class KeyguardKeyEventInteractorTest : SysuiTestCase() {
            .sendVolumeKeyEvent(
                eq(actionDownVolumeUpKeyEvent),
                eq(AudioManager.USE_DEFAULT_STREAM_TYPE),
                eq(true)
                eq(true),
            )
    }

@@ -117,7 +118,7 @@ class KeyguardKeyEventInteractorTest : SysuiTestCase() {
            .sendVolumeKeyEvent(
                eq(actionDownVolumeDownKeyEvent),
                eq(AudioManager.USE_DEFAULT_STREAM_TYPE),
                eq(true)
                eq(true),
            )

        assertThat(underTest.dispatchKeyEvent(actionDownVolumeUpKeyEvent)).isFalse()
@@ -125,7 +126,7 @@ class KeyguardKeyEventInteractorTest : SysuiTestCase() {
            .sendVolumeKeyEvent(
                eq(actionDownVolumeUpKeyEvent),
                eq(AudioManager.USE_DEFAULT_STREAM_TYPE),
                eq(true)
                eq(true),
            )
    }

@@ -135,7 +136,9 @@ class KeyguardKeyEventInteractorTest : SysuiTestCase() {
        whenever(statusBarStateController.state).thenReturn(StatusBarState.SHADE_LOCKED)
        whenever(statusBarKeyguardViewManager.shouldDismissOnMenuPressed()).thenReturn(true)

        verifyActionUpCollapsesTheShade(KeyEvent.KEYCODE_MENU)
        val actionUpMenuKeyEvent = KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MENU)
        assertThat(underTest.dispatchKeyEvent(actionUpMenuKeyEvent)).isTrue()
        verify(statusBarKeyguardViewManager).dismissWithAction(any(), isNull(), eq(false))
    }

    @Test