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

Commit 906bde54 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Ensure BiometricDialogView dismiss animation is run

postOnAnimation requests the animation be started on the next frame. The
behavior is undefined if an animation is already running. Currently
if this happens, the second animation is never initiated.

Fixes: 138199986

Test: Modify BiometricPromptDemo to cancel authentication immediately after
      requesting authentication. BiometricDialogView isn't stuck anymore

Change-Id: Ia62dccc2d484d1eaca5587bffa4d3def89730533
parent f24ae8da
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -111,6 +111,9 @@ public abstract class BiometricDialogView extends LinearLayout {
    protected boolean mRequireConfirmation;
    private int mUserId; // used to determine if we should show work background

    private boolean mCompletedAnimatingIn;
    private boolean mPendingDismissDialog;

    protected abstract int getHintStringResourceId();
    protected abstract int getAuthenticatedAccessibilityResourceId();
    protected abstract int getIconDescriptionResourceId();
@@ -332,6 +335,7 @@ public abstract class BiometricDialogView extends LinearLayout {
            mDialog.setAlpha(1.0f);
            mDialog.setTranslationY(0);
            mLayout.setAlpha(1.0f);
            mCompletedAnimatingIn = true;
        } else {
            // Dim the background and slide the dialog up
            mDialog.setTranslationY(mAnimationTranslationOffset);
@@ -352,6 +356,12 @@ public abstract class BiometricDialogView extends LinearLayout {
    }

    public void startDismiss() {
        if (!mCompletedAnimatingIn) {
            Log.w(TAG, "startDismiss(): waiting for onDialogAnimatedIn");
            mPendingDismissDialog = true;
            return;
        }

        mAnimatingAway = true;

        // This is where final cleanup should occur.
@@ -499,6 +509,13 @@ public abstract class BiometricDialogView extends LinearLayout {
    }

    public void onDialogAnimatedIn() {
        mCompletedAnimatingIn = true;

        if (mPendingDismissDialog) {
            Log.d(TAG, "onDialogAnimatedIn(): mPendingDismissDialog=true, dismissing now");
            startDismiss();
            mPendingDismissDialog = false;
        }
    }

    public void restoreState(Bundle bundle) {
+1 −0
Original line number Diff line number Diff line
@@ -460,6 +460,7 @@ public class FaceDialogView extends BiometricDialogView {

    @Override
    public void onDialogAnimatedIn() {
        super.onDialogAnimatedIn();
        mDialogAnimatedIn = true;
        mIconController.startPulsing();
    }