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

Commit c259917d authored by Beverly's avatar Beverly
Browse files

Remove UDFPS hint animation

Used to be called when face auth failed or
after a timeout.

Fixes: 195565894
Test: manual
Change-Id: I0075153d9c1df1ba2dc57c5a1ba5d0c08dd6b643
parent 7de16da3
Loading
Loading
Loading
Loading
+0 −14
Original line number Original line Diff line number Diff line
@@ -23,7 +23,6 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.PorterDuffColorFilter;
@@ -68,8 +67,6 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
    private float mBurnInProgress;
    private float mBurnInProgress;
    private float mInterpolatedDarkAmount;
    private float mInterpolatedDarkAmount;


    private ValueAnimator mHintAnimator;

    public UdfpsKeyguardView(Context context, @Nullable AttributeSet attrs) {
    public UdfpsKeyguardView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        super(context, attrs);
        mFingerprintDrawable = new UdfpsFpDrawable(context);
        mFingerprintDrawable = new UdfpsFpDrawable(context);
@@ -94,9 +91,6 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
                new KeyPath("**"), LottieProperty.COLOR_FILTER,
                new KeyPath("**"), LottieProperty.COLOR_FILTER,
                frameInfo -> new PorterDuffColorFilter(mTextColorPrimary, PorterDuff.Mode.SRC_ATOP)
                frameInfo -> new PorterDuffColorFilter(mTextColorPrimary, PorterDuff.Mode.SRC_ATOP)
        );
        );

        mHintAnimator = ObjectAnimator.ofFloat(mLockScreenFp, "progress", 1f, 0f, 1f);
        mHintAnimator.setDuration(4000);
    }
    }


    @Override
    @Override
@@ -183,19 +177,11 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
    }
    }


    void onDozeAmountChanged(float linear, float eased) {
    void onDozeAmountChanged(float linear, float eased) {
        mHintAnimator.cancel();
        mInterpolatedDarkAmount = eased;
        mInterpolatedDarkAmount = eased;
        updateAlpha();
        updateAlpha();
        updateBurnInOffsets();
        updateBurnInOffsets();
    }
    }


    void animateHint() {
        if (!isShadeLocked() && !mUdfpsRequested && mAlpha == 255
                && mLockScreenFp.isVisibleToUser()) {
            mHintAnimator.start();
        }
    }

    /**
    /**
     * Animates in the bg protection circle behind the fp icon to highlight the icon.
     * Animates in the bg protection circle behind the fp icon to highlight the icon.
     */
     */
+0 −85
Original line number Original line Diff line number Diff line
@@ -20,14 +20,10 @@ import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;


import android.annotation.NonNull;
import android.annotation.NonNull;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.hardware.biometrics.BiometricSourceType;
import android.util.MathUtils;
import android.util.MathUtils;
import android.view.MotionEvent;
import android.view.MotionEvent;


import androidx.annotation.Nullable;

import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.R;
import com.android.systemui.R;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.keyguard.KeyguardViewMediator;
@@ -46,14 +42,8 @@ import java.io.PrintWriter;


/**
/**
 * Class that coordinates non-HBM animations during keyguard authentication.
 * Class that coordinates non-HBM animations during keyguard authentication.
 *
 * Highlights the udfps icon when:
 * - Face authentication has failed
 * - Face authentication has been run for > 2 seconds
 */
 */
public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<UdfpsKeyguardView> {
public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<UdfpsKeyguardView> {
    private static final long AFTER_FACE_AUTH_HINT_DELAY = 2000;

    @NonNull private final StatusBarKeyguardViewManager mKeyguardViewManager;
    @NonNull private final StatusBarKeyguardViewManager mKeyguardViewManager;
    @NonNull private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
    @NonNull private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
    @NonNull private final DelayableExecutor mExecutor;
    @NonNull private final DelayableExecutor mExecutor;
@@ -62,12 +52,10 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
    @NonNull private final ConfigurationController mConfigurationController;
    @NonNull private final ConfigurationController mConfigurationController;
    @NonNull private final UdfpsController mUdfpsController;
    @NonNull private final UdfpsController mUdfpsController;


    @Nullable private Runnable mCancelDelayedHintRunnable;
    private boolean mShowingUdfpsBouncer;
    private boolean mShowingUdfpsBouncer;
    private boolean mUdfpsRequested;
    private boolean mUdfpsRequested;
    private boolean mQsExpanded;
    private boolean mQsExpanded;
    private boolean mFaceDetectRunning;
    private boolean mFaceDetectRunning;
    private boolean mHintShown;
    private int mStatusBarState;
    private int mStatusBarState;
    private float mTransitionToFullShadeProgress;
    private float mTransitionToFullShadeProgress;
    private float mLastDozeAmount;
    private float mLastDozeAmount;
@@ -110,10 +98,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
    @Override
    @Override
    protected void onViewAttached() {
    protected void onViewAttached() {
        super.onViewAttached();
        super.onViewAttached();
        mHintShown = false;
        mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback);
        updateFaceDetectRunning(mKeyguardUpdateMonitor.isFaceDetectionRunning());

        final float dozeAmount = mStatusBarStateController.getDozeAmount();
        final float dozeAmount = mStatusBarStateController.getDozeAmount();
        mLastDozeAmount = dozeAmount;
        mLastDozeAmount = dozeAmount;
        mStateListener.onDozeAmountChanged(dozeAmount, dozeAmount);
        mStateListener.onDozeAmountChanged(dozeAmount, dozeAmount);
@@ -136,7 +120,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
    @Override
    @Override
    protected void onViewDetached() {
    protected void onViewDetached() {
        super.onViewDetached();
        super.onViewDetached();
        mKeyguardUpdateMonitor.removeCallback(mKeyguardUpdateMonitorCallback);
        mFaceDetectRunning = false;
        mFaceDetectRunning = false;


        mStatusBarStateController.removeCallback(mStateListener);
        mStatusBarStateController.removeCallback(mStateListener);
@@ -146,11 +129,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        if (mLockScreenShadeTransitionController.getUdfpsKeyguardViewController() == this) {
        if (mLockScreenShadeTransitionController.getUdfpsKeyguardViewController() == this) {
            mLockScreenShadeTransitionController.setUdfpsKeyguardViewController(null);
            mLockScreenShadeTransitionController.setUdfpsKeyguardViewController(null);
        }
        }

        if (mCancelDelayedHintRunnable != null) {
            mCancelDelayedHintRunnable.run();
            mCancelDelayedHintRunnable = null;
        }
    }
    }


    @Override
    @Override
@@ -249,36 +227,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        }
        }
    }
    }


    private void cancelDelayedHint() {
        if (mCancelDelayedHintRunnable != null) {
            mCancelDelayedHintRunnable.run();
            mCancelDelayedHintRunnable = null;
        }
    }

    private void updateFaceDetectRunning(boolean running) {
        if (mFaceDetectRunning == running) {
            return;
        }

        // show udfps hint a few seconds after face auth started running
        if (!mFaceDetectRunning && running && !mHintShown && mCancelDelayedHintRunnable == null) {
            // Face detect started running, show udfps hint after a delay
            mCancelDelayedHintRunnable = mExecutor.executeDelayed(() -> showHint(false),
                    AFTER_FACE_AUTH_HINT_DELAY);
        }

        mFaceDetectRunning = running;
    }

    private void showHint(boolean forceShow) {
        cancelDelayedHint();
        if (!mHintShown || forceShow) {
            mHintShown = true;
            mView.animateHint();
        }
    }

    /**
    /**
     * Set the progress we're currently transitioning to the full shade. 0.0f means we're not
     * Set the progress we're currently transitioning to the full shade. 0.0f means we're not
     * transitioning yet, while 1.0f means we've fully dragged down.
     * transitioning yet, while 1.0f means we've fully dragged down.
@@ -318,39 +266,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        }
        }
    };
    };


    private final KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback =
            new KeyguardUpdateMonitorCallback() {
                public void onBiometricRunningStateChanged(boolean running,
                        BiometricSourceType biometricSourceType) {
                    if (biometricSourceType == BiometricSourceType.FACE) {
                        updateFaceDetectRunning(running);
                    }
                }

                public void onBiometricAuthFailed(BiometricSourceType biometricSourceType) {
                    if (biometricSourceType == BiometricSourceType.FACE) {
                        // show udfps hint when face auth fails
                        showHint(true);
                    }
                }

                public void onBiometricError(int msgId, String errString,
                        BiometricSourceType biometricSourceType) {
                    if (biometricSourceType == BiometricSourceType.FACE) {
                        // show udfps hint when face auth fails
                        showHint(true);
                    }
                }

                public void onBiometricAuthenticated(int userId,
                        BiometricSourceType biometricSourceType, boolean isStrongBiometric) {
                    if (biometricSourceType == BiometricSourceType.FACE) {
                        // cancel delayed hint if face auth succeeded
                        cancelDelayedHint();
                    }
                }
            };

    private final StatusBarKeyguardViewManager.AlternateAuthInterceptor mAlternateAuthInterceptor =
    private final StatusBarKeyguardViewManager.AlternateAuthInterceptor mAlternateAuthInterceptor =
            new StatusBarKeyguardViewManager.AlternateAuthInterceptor() {
            new StatusBarKeyguardViewManager.AlternateAuthInterceptor() {
                @Override
                @Override