From 27c3f4c1373bde4144ce09c8f6371709e35b1b3e Mon Sep 17 00:00:00 2001 From: Beverly Date: Thu, 18 Feb 2021 16:17:40 -0500 Subject: [PATCH] Don't show udfps disabled tap target after auth the circle used to briefly show after the user authenticated but now it won't Test: manual Bug: 172050991 Change-Id: I007d86531a359b8d6d06863db0586cf9b9c25d66 --- .../keyguard/DisabledUdfpsController.java | 26 ++++++++++++-- .../NotificationPanelViewController.java | 34 ++++++++++++------- 2 files changed, 45 insertions(+), 15 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/DisabledUdfpsController.java b/packages/SystemUI/src/com/android/keyguard/DisabledUdfpsController.java index f01b67b7b5c24..945c9c4994013 100644 --- a/packages/SystemUI/src/com/android/keyguard/DisabledUdfpsController.java +++ b/packages/SystemUI/src/com/android/keyguard/DisabledUdfpsController.java @@ -20,6 +20,7 @@ import static android.hardware.biometrics.BiometricSourceType.FINGERPRINT; import android.hardware.biometrics.BiometricSourceType; import android.view.View; +import android.view.ViewGroup; import androidx.annotation.NonNull; @@ -73,13 +74,15 @@ public class DisabledUdfpsController extends ViewController i @Override protected void onViewAttached() { - mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback); mIsBouncerShowing = mKeyguardViewController.isBouncerShowing(); - - mStatusBarStateController.addCallback(mStatusBarStateListener); mIsKeyguardShowing = mStatusBarStateController.getState() == StatusBarState.KEYGUARD; mIsDozing = mStatusBarStateController.isDozing(); + mRunningFPS = mKeyguardUpdateMonitor.isFingerprintDetectionRunning(); mAuthenticated = false; + updateButtonVisibility(); + + mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback); + mStatusBarStateController.addCallback(mStatusBarStateListener); } @Override @@ -88,6 +91,15 @@ public class DisabledUdfpsController extends ViewController i mStatusBarStateController.removeCallback(mStatusBarStateListener); } + /** + * Call when this controller is no longer needed. This will remove the view from its parent. + */ + public void destroy() { + if (mView != null && mView.getParent() != null) { + ((ViewGroup) mView.getParent()).removeView(mView); + } + } + private void updateButtonVisibility() { mShowButton = !mAuthenticated && !mIsDozing && mIsKeyguardShowing && !mIsBouncerShowing && !mRunningFPS; @@ -143,6 +155,14 @@ public class DisabledUdfpsController extends ViewController i public void onBiometricRunningStateChanged(boolean running, BiometricSourceType biometricSourceType) { mRunningFPS = running && biometricSourceType == FINGERPRINT; + mAuthenticated &= !mRunningFPS; + updateButtonVisibility(); + } + + @Override + public void onBiometricAuthenticated(int userId, + BiometricSourceType biometricSourceType, boolean isStrongBiometric) { + mAuthenticated = true; updateButtonVisibility(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index 2f9fa9e6ec419..d49f603f0fe61 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -281,18 +281,8 @@ public class NotificationPanelViewController extends PanelViewController { @Override public void onKeyguardVisibilityChanged(boolean showing) { - if (mDisabledUdfpsController == null - && mAuthController.getUdfpsRegion() != null - && mAuthController.isUdfpsEnrolled( - KeyguardUpdateMonitor.getCurrentUser())) { - mLayoutInflater.inflate(R.layout.disabled_udfps_view, mView); - mDisabledUdfpsController = new DisabledUdfpsController( - mView.findViewById(R.id.disabled_udfps_view), - mStatusBarStateController, - mUpdateMonitor, - mAuthController, - mStatusBarKeyguardViewManager); - mDisabledUdfpsController.init(); + if (showing) { + updateDisabledUdfpsController(); } } }; @@ -3582,6 +3572,25 @@ public class NotificationPanelViewController extends PanelViewController { } } + private void updateDisabledUdfpsController() { + final boolean udfpsEnrolled = mAuthController.getUdfpsRegion() != null + && mAuthController.isUdfpsEnrolled( + KeyguardUpdateMonitor.getCurrentUser()); + if (mDisabledUdfpsController == null && udfpsEnrolled) { + mLayoutInflater.inflate(R.layout.disabled_udfps_view, mView); + mDisabledUdfpsController = new DisabledUdfpsController( + mView.findViewById(R.id.disabled_udfps_view), + mStatusBarStateController, + mUpdateMonitor, + mAuthController, + mStatusBarKeyguardViewManager); + mDisabledUdfpsController.init(); + } else if (mDisabledUdfpsController != null && !udfpsEnrolled) { + mDisabledUdfpsController.destroy(); + mDisabledUdfpsController = null; + } + } + private class OnHeightChangedListener implements ExpandableView.OnHeightChangedListener { @Override public void onHeightChanged(ExpandableView view, boolean needsAnimation) { @@ -3997,6 +4006,7 @@ public class NotificationPanelViewController extends PanelViewController { FragmentHostManager.get(mView).addTagListener(QS.TAG, mFragmentListener); mStatusBarStateController.addCallback(mStatusBarStateListener); mConfigurationController.addCallback(mConfigurationListener); + updateDisabledUdfpsController(); mUpdateMonitor.registerCallback(mKeyguardUpdateCallback); // Theme might have changed between inflating this view and attaching it to the // window, so