diff options
| author | 2023-04-12 09:06:32 +0000 | |
|---|---|---|
| committer | 2023-04-12 09:19:35 +0000 | |
| commit | 9fac9e9dcb23e954907c867689825e61abf69cb4 (patch) | |
| tree | 3d961e4f833d254f76de5ea921d4069caa47ee63 | |
| parent | 6218576ef9b605de6462f68741d2610263c2c98a (diff) | |
Fix BP did not dismiss after swiping up the notification bar
AuthBiometricView doesn't use dismissWithoutCallback/dismissFromSystemServer
to close BP, so move disable operation to onDetachedFromWindow to avoid
AuthDialogPanelInteractionDetector work abnormally.
Bug: b/277841109
Test: atest AuthContainerTest
Change-Id: I1a699c7b8791fe0402f0d8da6bf6666385838e23
3 files changed, 9 insertions, 17 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java index e42f051bf3bb..517f94fbe938 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java @@ -637,6 +637,7 @@ public class AuthContainerView extends LinearLayout @Override public void onDetachedFromWindow() { + mPanelInteractionDetector.disable(); OnBackInvokedDispatcher dispatcher = findOnBackInvokedDispatcher(); if (dispatcher != null) { findOnBackInvokedDispatcher().unregisterOnBackInvokedCallback(mBackCallback); @@ -674,7 +675,6 @@ public class AuthContainerView extends LinearLayout @Override public void dismissWithoutCallback(boolean animate) { - mPanelInteractionDetector.disable(); if (animate) { animateAway(false /* sendReason */, 0 /* reason */); } else { @@ -685,7 +685,6 @@ public class AuthContainerView extends LinearLayout @Override public void dismissFromSystemServer() { - mPanelInteractionDetector.disable(); animateAway(false /* sendReason */, 0 /* reason */); } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt b/packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt index 6c62a3936910..b72801d3b5fe 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt @@ -30,6 +30,7 @@ constructor( @MainThread fun disable() { if (action != null) { + Log.i(TAG, "Disable dectector") action = null shadeExpansionStateManager.removeExpansionListener(this::onPanelExpansionChanged) } @@ -40,7 +41,7 @@ constructor( mainExecutor.execute { action?.let { if (event.tracking || (event.expanded && event.fraction > 0)) { - Log.v(TAG, "Detected panel interaction, event: $event") + Log.i(TAG, "Detected panel interaction, event: $event") it.onPanelInteraction.run() disable() } diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt index b4696e49e9aa..f914e758ecdb 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt @@ -170,24 +170,16 @@ class AuthContainerViewTest : SysuiTestCase() { } @Test - fun testFocusLossAfterRotating() { + fun testActionCancel_panelInteractionDetectorDisable() { val container = initializeFingerprintContainer() - waitForIdleSync() - - val requestID = authContainer?.requestId ?: 0L - - verify(callback).onDialogAnimatedIn(requestID) - container.onOrientationChanged() - container.onWindowFocusChanged(false) - waitForIdleSync() - - verify(callback, never()).onDismissed( - eq(AuthDialogCallback.DISMISSED_USER_CANCELED), - eq<ByteArray?>(null), /* credentialAttestation */ - eq(requestID) + container.mBiometricCallback.onAction( + AuthBiometricView.Callback.ACTION_USER_CANCELED ) + waitForIdleSync() + verify(panelInteractionDetector).disable() } + @Test fun testActionAuthenticated_sendsDismissedAuthenticated() { val container = initializeFingerprintContainer() |