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

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

Merge "Move face and fingerprint error handling into separate methods." into...

Merge "Move face and fingerprint error handling into separate methods." into tm-qpr-dev am: dc72403d am: b355f9e7

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20370587



Change-Id: I8468d2eaaf3dedb51473c4863c2c9e09f22d52c4
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 18a1cb39 b355f9e7
Loading
Loading
Loading
Loading
+45 −48
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.app.admin.DevicePolicyResources.Strings.SystemUi.KEYGUARD_
import static android.app.admin.DevicePolicyResources.Strings.SystemUi.KEYGUARD_NAMED_MANAGEMENT_DISCLOSURE;
import static android.hardware.biometrics.BiometricFaceConstants.FACE_ACQUIRED_TOO_DARK;
import static android.hardware.biometrics.BiometricSourceType.FACE;
import static android.hardware.biometrics.BiometricSourceType.FINGERPRINT;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;

@@ -74,7 +75,6 @@ import androidx.annotation.Nullable;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.IBatteryStats;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.ViewClippingUtil;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.settingslib.Utils;
@@ -188,14 +188,7 @@ public class KeyguardIndicationController {
    private KeyguardUpdateMonitorCallback mUpdateMonitorCallback;

    private boolean mDozing;
    private final ViewClippingUtil.ClippingParameters mClippingParams =
            new ViewClippingUtil.ClippingParameters() {
                @Override
                public boolean shouldFinish(View view) {
                    return view == mIndicationArea;
                }
            };
    private ScreenLifecycle mScreenLifecycle;
    private final ScreenLifecycle mScreenLifecycle;
    private final ScreenLifecycle.Observer mScreenObserver =
            new ScreenLifecycle.Observer() {
        @Override
@@ -619,7 +612,6 @@ public class KeyguardIndicationController {
                                if (mFalsingManager.isFalseTap(LOW_PENALTY)) {
                                    return;
                                }
                                int currentUserId = getCurrentUser();
                                mDevicePolicyManager.logoutUser();
                            })
                            .build(),
@@ -676,7 +668,7 @@ public class KeyguardIndicationController {
                hideTransientIndication();
            }
            updateDeviceEntryIndication(false);
        } else if (!visible) {
        } else {
            // If we unlock and return to keyguard quickly, previous error should not be shown
            hideTransientIndication();
        }
@@ -1078,11 +1070,8 @@ public class KeyguardIndicationController {
            final boolean isCoExFaceAcquisitionMessage =
                    faceAuthSoftError && isUnlockWithFingerprintPossible;
            if (isCoExFaceAcquisitionMessage && !mCoExFaceAcquisitionMsgIdsToShow.contains(msgId)) {
                if (DEBUG) {
                    Log.d(TAG, "skip showing msgId=" + msgId + " helpString=" + helpString
                debugLog("skip showing msgId=" + msgId + " helpString=" + helpString
                        + ", due to co-ex logic");
                }
                return;
            } else if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
                mStatusBarKeyguardViewManager.setKeyguardMessage(helpString,
                        mInitialTextColorState);
@@ -1122,23 +1111,23 @@ public class KeyguardIndicationController {
        @Override
        public void onBiometricError(int msgId, String errString,
                BiometricSourceType biometricSourceType) {
            CharSequence deferredFaceMessage = null;
            if (biometricSourceType == FACE) {
                if (msgId == BiometricFaceConstants.FACE_ERROR_TIMEOUT) {
                    deferredFaceMessage = mFaceAcquiredMessageDeferral.getDeferredMessage();
                    if (DEBUG) {
                        Log.d(TAG, "showDeferredFaceMessage msgId=" + deferredFaceMessage);
                onFaceAuthError(msgId, errString);
            } else if (biometricSourceType == FINGERPRINT) {
                onFingerprintAuthError(msgId, errString);
            }
        }
                mFaceAcquiredMessageDeferral.reset();
            }

            if (shouldSuppressBiometricError(msgId, biometricSourceType, mKeyguardUpdateMonitor)) {
                if (DEBUG) {
                    Log.d(TAG, "suppressingBiometricError msgId=" + msgId
                            + " source=" + biometricSourceType);
        private void onFaceAuthError(int msgId, String errString) {
            CharSequence deferredFaceMessage = null;
            if (msgId == BiometricFaceConstants.FACE_ERROR_TIMEOUT) {
                deferredFaceMessage = mFaceAcquiredMessageDeferral.getDeferredMessage();
                debugLog("showDeferredFaceMessage msgId=" + deferredFaceMessage);
            }
            } else if (biometricSourceType == FACE && msgId == FaceManager.FACE_ERROR_TIMEOUT) {
            mFaceAcquiredMessageDeferral.reset();
            if (shouldSuppressFaceError(msgId, mKeyguardUpdateMonitor)) {
                debugLog("suppressingFaceError msgId=" + msgId + " errString= " + errString);
            } else if (msgId == FaceManager.FACE_ERROR_TIMEOUT) {
                // Co-ex: show deferred message OR nothing
                if (mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible(
                        KeyguardUpdateMonitor.getCurrentUser())) {
@@ -1153,9 +1142,7 @@ public class KeyguardIndicationController {
                    }

                    // otherwise, don't show any message
                    if (DEBUG) {
                        Log.d(TAG, "skip showing FACE_ERROR_TIMEOUT due to co-ex logic");
                    }
                    debugLog("skip showing FACE_ERROR_TIMEOUT due to co-ex logic");
                    return;
                }

@@ -1170,24 +1157,18 @@ public class KeyguardIndicationController {
                    // suggest swiping up to unlock (try face auth again or swipe up to bouncer)
                    showActionToUnlock();
                }
            } else if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
                mStatusBarKeyguardViewManager.setKeyguardMessage(errString, mInitialTextColorState);
            } else if (mScreenLifecycle.getScreenState() == SCREEN_ON) {
                showBiometricMessage(errString);
            } else {
                mBiometricErrorMessageToShowOnScreenOn = errString;
                handleGenericBiometricError(errString);
            }
        }

        private boolean shouldSuppressBiometricError(int msgId,
                BiometricSourceType biometricSourceType, KeyguardUpdateMonitor updateMonitor) {
            if (biometricSourceType == BiometricSourceType.FINGERPRINT) {
                return shouldSuppressFingerprintError(msgId, updateMonitor);
            }
            if (biometricSourceType == FACE) {
                return shouldSuppressFaceError(msgId, updateMonitor);
        private void onFingerprintAuthError(int msgId, String errString) {
            if (shouldSuppressFingerprintError(msgId, mKeyguardUpdateMonitor)) {
                debugLog("suppressingFingerprintError msgId=" + msgId
                        + " errString= " + errString);
            } else {
                handleGenericBiometricError(errString);
            }
            return false;
        }

        private boolean shouldSuppressFingerprintError(int msgId,
@@ -1286,7 +1267,23 @@ public class KeyguardIndicationController {
        }
    }

    private StatusBarStateController.StateListener mStatusBarStateListener =
    private void debugLog(String logMsg) {
        if (DEBUG) {
            Log.d(TAG, logMsg);
        }
    }

    private void handleGenericBiometricError(String errString) {
        if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
            mStatusBarKeyguardViewManager.setKeyguardMessage(errString, mInitialTextColorState);
        } else if (mScreenLifecycle.getScreenState() == SCREEN_ON) {
            showBiometricMessage(errString);
        } else {
            mBiometricErrorMessageToShowOnScreenOn = errString;
        }
    }

    private final StatusBarStateController.StateListener mStatusBarStateListener =
            new StatusBarStateController.StateListener() {
        @Override
        public void onStateChanged(int newState) {
@@ -1307,7 +1304,7 @@ public class KeyguardIndicationController {
        }
    };

    private KeyguardStateController.Callback mKeyguardStateCallback =
    private final KeyguardStateController.Callback mKeyguardStateCallback =
            new KeyguardStateController.Callback() {
        @Override
        public void onUnlockedChanged() {