diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/DisabledUdfpsController.java')
| -rw-r--r-- | packages/SystemUI/src/com/android/keyguard/DisabledUdfpsController.java | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/DisabledUdfpsController.java b/packages/SystemUI/src/com/android/keyguard/DisabledUdfpsController.java index f01b67b7b5c2..945c9c499401 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<DisabledUdfpsView> 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<DisabledUdfpsView> 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<DisabledUdfpsView> 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(); } |
