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

Commit 61935548 authored by lbill's avatar lbill
Browse files

Remove onWindowFocusChange solution from FPS enrollment

Context:
The legacy architecture UdfpsEnrollView was shown by SysUI
which has higher z-order that encounter lots of overlap issue.
Besides, IPC impact the latency of show/hide enroll view in
legacy architecture.
We used to upload ag/19699461 to cancel enrollment due to
above limitation.

With the new architecture ag/20582186 the UdfpsEnrollView
migrate to Settings and controlled by Settings process.

And ag/21149538 config SETTINGS_SHOW_UDFPS_ENROLL_IN_SETTINGS flag
to ture by default.

It's the time to improve the enroll UX by removing cancel
signle when onWindowFocusChanged() invoked.

Bug: 262680438
Test: m RunSettingsRoboTests -j30 ROBOTEST_FILTER=FingerprintEnrollEnrollingTest
Test: manual Security Settings > Enroll fingerprint > enroll
      Swipe Notify Shade , Heads-up, Power menu interrupt should
      not stop the enroll flow.
Change-Id: I60d88d5edd80e6eed70e2fbf288357e949abcae3
parent c00fb2ef
Loading
Loading
Loading
Loading
+0 −23
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.settings.biometrics.fingerprint;

import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPRINT_ERROR_USER_CANCELED;
import static android.text.Layout.HYPHENATION_FREQUENCY_NONE;

import android.animation.Animator;
@@ -191,7 +190,6 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
    private boolean mRestoring;
    private Vibrator mVibrator;
    private boolean mIsSetupWizard;
    private boolean mIsOrientationChanged;
    @VisibleForTesting
    boolean mIsCanceled;
    private AccessibilityManager mAccessibilityManager;
@@ -224,25 +222,6 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
        return defaultDensity == currentDensity;
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        if (hasFocus || mIsCanceled) {
            return;
        }

        // By UX design, we should ensure seamless enrollment CUJ even though user rotate device.
        // Do NOT cancel enrollment progress after rotating, adding mIsOrientationChanged
        // to judge if the focus changed was triggered by rotation, current WMS has triple callbacks
        // (true > false > true), we need to reset mIsOrientationChanged when !hasFocus callback.
        // Side fps do not have to synchronize udfpsController overlay state, we should bypass sfps
        // from onWindowFocusChanged() as long press sfps power key will prompt dialog to users.
        if (!mIsOrientationChanged && !mCanAssumeSfps) {
            onCancelEnrollment(FINGERPRINT_ERROR_USER_CANCELED);
        } else {
            mIsOrientationChanged = false;
        }
    }

    @Override
    protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
        theme.applyStyle(R.style.SetupWizardPartnerResource, true);
@@ -493,7 +472,6 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
        mIsCanceled = savedInstanceState.getBoolean(KEY_STATE_CANCELED, false);
        mPreviousRotation = savedInstanceState.getInt(KEY_STATE_PREVIOUS_ROTATION,
                getDisplay().getRotation());
        mIsOrientationChanged = mPreviousRotation != getDisplay().getRotation();
    }

    @Override
@@ -537,7 +515,6 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
        // before showErrorDialog() to prevent that another error dialog is triggered again.
        mIsCanceled = true;
        FingerprintErrorDialog.showErrorDialog(this, errorMsgId, mCanAssumeUdfps);
        mIsOrientationChanged = false;
        cancelEnrollment();
        stopIconAnimation();
        stopListenOrientationEvent();
+1 −1
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ public class FingerprintEnrollEnrollingTest {
    }

    @Test
    public void fingerprintUdfpsOverlayEnrollment_loseFocus_shouldCancel() {
    public void fingerprintUdfpsOverlayEnrollment_loseFocus_shouldNotCancel() {
        initializeActivityFor(TYPE_UDFPS_OPTICAL);

        mActivity.onEnrollmentProgressChange(1, 1);