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

Commit a9df21b5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix disappearing biometric prompt for the managed profile" into rvc-dev...

Merge "Fix disappearing biometric prompt for the managed profile" into rvc-dev am: 4d447026 am: e3e2ce74

Change-Id: I1bd4fa1d60bf9362541c7a2e8227c2f84ca940f1
parents ae8cdee1 e3e2ce74
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
    private int mUserId;
    private int mCredentialMode;
    private boolean mGoingToBackground;
    private boolean mWaitingForBiometricCallback;

    private Executor mExecutor = (runnable -> {
        mHandler.post(runnable);
@@ -116,6 +117,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
        @Override
        public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
            if (!mGoingToBackground) {
                mWaitingForBiometricCallback = false;
                if (errorCode == BiometricPrompt.BIOMETRIC_ERROR_USER_CANCELED
                        || errorCode == BiometricPrompt.BIOMETRIC_ERROR_CANCELED) {
                    finish();
@@ -123,11 +125,15 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
                    // All other errors go to some version of CC
                    showConfirmCredentials();
                }
            } else if (mWaitingForBiometricCallback) { // mGoingToBackground is true
                mWaitingForBiometricCallback = false;
                finish();
            }
        }

        @Override
        public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
            mWaitingForBiometricCallback = false;
            mTrustManager.setDeviceLockedForUser(mUserId, false);
            final boolean isStrongAuth = result.getAuthenticationType()
                    == BiometricPrompt.AUTHENTICATION_RESULT_TYPE_DEVICE_CREDENTIAL;
@@ -142,6 +148,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {

        @Override
        public void onAuthenticationFailed() {
            mWaitingForBiometricCallback = false;
            mDevicePolicyManager.reportFailedBiometricAttempt(mUserId);
        }

@@ -262,6 +269,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
            finish();
        } else if (launchedBiometric) {
            // Keep this activity alive until BiometricPrompt goes away
            mWaitingForBiometricCallback = true;
        } else {
            Log.d(TAG, "No pattern, password or PIN set.");
            setResult(Activity.RESULT_OK);
@@ -320,7 +328,9 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
        super.onPause();
        if (!isChangingConfigurations()) {
            mGoingToBackground = true;
            if (!mWaitingForBiometricCallback) {
                finish();
            }
        } else {
            mGoingToBackground = false;
        }