Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27c3f4c1 authored by Beverly's avatar Beverly
Browse files

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
parent 8c7cbddb
Loading
Loading
Loading
Loading
+23 −3
Original line number Diff line number Diff line
@@ -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();
                }

+22 −12
Original line number Diff line number Diff line
@@ -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