diff options
| author | 2024-10-16 16:01:35 +0000 | |
|---|---|---|
| committer | 2024-10-16 16:09:02 +0000 | |
| commit | 101edc0f518ab4682aba42fac84ba618b6707c7a (patch) | |
| tree | 387d6eaa1fcaeb210f0c200684cada0be97f63b3 | |
| parent | ec7676d1f550dae58c62827e4a197d4ef21ca440 (diff) | |
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 55017463035c83ebb968f7abc0ca900ac3601533 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
---
2 files changed, 18 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardKeyEventInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardKeyEventInteractor.kt index 65b42e657e75..fcf486b5696b 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardKeyEventInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardKeyEventInteractor.kt @@ -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 diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardKeyEventInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardKeyEventInteractorTest.kt index 13f30f560cdf..945e44afa455 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardKeyEventInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardKeyEventInteractorTest.kt @@ -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 |