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

Commit 4ac678f2 authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Don't show udfps disabled tap target after auth" into sc-dev

parents 5611e4d8 27c3f4c1
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();
                    }
                }
    };
@@ -3561,6 +3551,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) {
@@ -3980,6 +3989,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