From 1267a8ffa5288244bf53c4a7979556423bc9c0d4 Mon Sep 17 00:00:00 2001 From: Ilya Matyukhin Date: Fri, 12 Nov 2021 15:17:39 -0800 Subject: Fix UDFPS not working when a HUN is showing We didn't want the UDFPS overlay to handle touches when a user pulls down the notification shade. We accomplished it by ignoring UDFPS touches if the notification shade is expanded. However, that had an undesired side effect. Apparently, the notification shade is considered expanded when a heads-up notification (HUN) is showing. Which means if a user receives a HUN during authentication, their touch will be ignored. This CL fixes the undesired behavior by also checking the expansion ratio. It appears that when a HUN is showing, the notification shade reports itself as expanded with the 0.0f expansion ratio. Bug: 203213357 Test: authenticate in BiometricPrompt with a HUN showing Change-Id: I597393b8f8bafda3b28e54237a44ba7517681869 --- .../com/android/systemui/biometrics/UdfpsAnimationView.java | 2 +- .../systemui/biometrics/UdfpsAnimationViewController.java | 12 +++++++----- .../systemui/biometrics/UdfpsKeyguardViewController.java | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationView.java index 1f11894de55e..e7f637421a4d 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationView.java @@ -111,7 +111,7 @@ abstract class UdfpsAnimationView extends FrameLayout { return (int) ((1 - percent) * 255); } - public void onExpansionChanged(float expansion, boolean expanded) { + public void onExpansionChanged(float expansion) { mAlpha = expansionToAlpha(expansion); updateAlpha(); } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.java index 94743407f03d..fb4616a832dc 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.java @@ -46,7 +46,7 @@ abstract class UdfpsAnimationViewController @NonNull final PanelExpansionStateManager mPanelExpansionStateManager; @NonNull final DumpManager mDumpManger; - boolean mNotificationShadeExpanded; + boolean mNotificationShadeVisible; protected UdfpsAnimationViewController( T view, @@ -85,7 +85,7 @@ abstract class UdfpsAnimationViewController @Override public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { - pw.println("mNotificationShadeExpanded=" + mNotificationShadeExpanded); + pw.println("mNotificationShadeVisible=" + mNotificationShadeVisible); pw.println("shouldPauseAuth()=" + shouldPauseAuth()); pw.println("isPauseAuth=" + mView.isPauseAuth()); } @@ -95,7 +95,7 @@ abstract class UdfpsAnimationViewController * authentication. */ boolean shouldPauseAuth() { - return mNotificationShadeExpanded; + return mNotificationShadeVisible; } /** @@ -182,8 +182,10 @@ abstract class UdfpsAnimationViewController @Override public void onPanelExpansionChanged( float fraction, boolean expanded, boolean tracking) { - mNotificationShadeExpanded = expanded; - mView.onExpansionChanged(fraction, expanded); + // Notification shade can be expanded but not visible (fraction: 0.0), for example + // when a heads-up notification (HUN) is showing. + mNotificationShadeVisible = expanded && fraction > 0f; + mView.onExpansionChanged(fraction); updatePauseAuth(); } }; diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java index d1ea45cac081..223eb78044c4 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java @@ -211,7 +211,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController