diff options
| author | 2023-03-21 20:23:03 +0000 | |
|---|---|---|
| committer | 2023-03-21 20:23:03 +0000 | |
| commit | dcdc6fbc55bb7fca7dfc465560709c8435ca95d4 (patch) | |
| tree | a758b226cd08ca85b6d55381bc04214c2b0ef298 | |
| parent | c82fa1ff239b04b938db0aa64ec197cfdfdfe33b (diff) | |
| parent | 95e0af8c470732c5d25f11424817b217846438c6 (diff) | |
Merge "RESTRICT AUTOMERGE Show primary bouncer on TOUCH_OUTSIDE" into tm-qpr-dev
2 files changed, 22 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 2dc15d09afe2..71e2e405d071 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -1452,11 +1452,13 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public boolean onTouch(MotionEvent event) { boolean handledTouch = false; if (mAlternateBouncerInteractor.isVisibleState()) { - if (event.getAction() == MotionEvent.ACTION_DOWN) { + final boolean downThenUp = event.getActionMasked() == MotionEvent.ACTION_UP + && mAlternateBouncerReceivedDownTouch; + final boolean outsideTouch = event.getActionMasked() == MotionEvent.ACTION_OUTSIDE; + if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { mAlternateBouncerReceivedDownTouch = true; - } else if (event.getAction() == MotionEvent.ACTION_UP - && mAlternateBouncerInteractor.hasAlternateBouncerShownWithMinTime() - && mAlternateBouncerReceivedDownTouch) { + } else if ((downThenUp || outsideTouch) + && mAlternateBouncerInteractor.hasAlternateBouncerShownWithMinTime()) { showPrimaryBouncer(true); } handledTouch = true; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java index 61286a43217c..346b90c1bd88 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java @@ -786,4 +786,20 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { // THEN the alternateBouncer doesn't hide verify(mAlternateBouncerInteractor, never()).hide(); } + + @Test + public void testAlternateBouncerOnTouch_actionOutside_hidesAlternateBouncer() { + reset(mAlternateBouncerInteractor); + + // GIVEN the alternate bouncer has shown for a minimum amount of time + when(mAlternateBouncerInteractor.hasAlternateBouncerShownWithMinTime()).thenReturn(true); + when(mAlternateBouncerInteractor.isVisibleState()).thenReturn(true); + + // WHEN only ACTION_OUTSIDE touch event comes + mStatusBarKeyguardViewManager.onTouch( + MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_OUTSIDE, 0f, 0f, 0)); + + // THEN the alternateBouncer hides + verify(mAlternateBouncerInteractor).hide(); + } } |