Merge "Move BiometricUnlockController logs to LogBuffer" into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2022-11-21 22:20:36 +00:00
committed by Android (Google) Code Review
9 changed files with 278 additions and 41 deletions

View File

@@ -29,5 +29,4 @@ public class KeyguardConstants {
*/
public static final boolean DEBUG = Log.isLoggable("Keyguard", Log.DEBUG);
public static final boolean DEBUG_SIM_STATES = true;
public static final boolean DEBUG_BIOMETRIC_WAKELOCK = true;
}

View File

@@ -845,6 +845,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
+ " triggered while waiting for cancellation, removing watchdog");
mHandler.removeCallbacks(mFpCancelNotReceived);
}
mLogger.d("handleFingerprintAuthFailed");
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
@@ -974,6 +975,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
stopListeningForFace(FACE_AUTH_STOPPED_FP_LOCKED_OUT);
}
mLogger.logFingerprintError(msgId, errString);
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
@@ -3900,6 +3902,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
pw.println(" listening: actual=" + mFaceRunningState
+ " expected=(" + (shouldListenForFace() ? 1 : 0));
pw.println(" strongAuthFlags=" + Integer.toHexString(strongAuthFlags));
pw.println(" isNonStrongBiometricAllowedAfterIdleTimeout="
+ mStrongAuthTracker.isNonStrongBiometricAllowedAfterIdleTimeout(userId));
pw.println(" trustManaged=" + getUserTrustIsManaged(userId));
pw.println(" mFaceLockedOutPermanent=" + mFaceLockedOutPermanent);
pw.println(" enabledByUser=" + mBiometricEnabledForUser.get(userId));

View File

@@ -17,7 +17,7 @@
package com.android.keyguard.logging
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.log.dagger.BiometricMessagesLog
import com.android.systemui.log.dagger.BiometricLog
import com.android.systemui.plugins.log.LogBuffer
import com.android.systemui.plugins.log.LogLevel.DEBUG
import javax.inject.Inject
@@ -26,7 +26,7 @@ import javax.inject.Inject
@SysUISingleton
class FaceMessageDeferralLogger
@Inject
constructor(@BiometricMessagesLog private val logBuffer: LogBuffer) :
constructor(@BiometricLog private val logBuffer: LogBuffer) :
BiometricMessageDeferralLogger(logBuffer, "FaceMessageDeferralLogger")
open class BiometricMessageDeferralLogger(

View File

@@ -0,0 +1,174 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.keyguard.logging
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.log.dagger.BiometricLog
import com.android.systemui.plugins.log.LogBuffer
import com.android.systemui.plugins.log.LogLevel
import com.android.systemui.plugins.log.LogLevel.DEBUG
import com.android.systemui.plugins.log.LogLevel.INFO
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_DISMISS_BOUNCER
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_NONE
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_ONLY_WAKE
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_SHOW_BOUNCER
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_UNLOCK_COLLAPSING
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK_FROM_DREAM
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING
import com.google.errorprone.annotations.CompileTimeConstant
import javax.inject.Inject
private const val TAG = "BiometricUnlockLogger"
/** Helper class for logging for [com.android.systemui.statusbar.phone.BiometricUnlockController] */
@SysUISingleton
class BiometricUnlockLogger @Inject constructor(@BiometricLog private val logBuffer: LogBuffer) {
fun i(@CompileTimeConstant msg: String) = log(msg, INFO)
fun d(@CompileTimeConstant msg: String) = log(msg, DEBUG)
fun log(@CompileTimeConstant msg: String, level: LogLevel) = logBuffer.log(TAG, level, msg)
fun logStartWakeAndUnlock(mode: Int) {
logBuffer.log(
TAG,
DEBUG,
{ int1 = mode },
{ "startWakeAndUnlock(${wakeAndUnlockModeToString(int1)})" }
)
}
fun logUdfpsAttemptThresholdMet(consecutiveFailedAttempts: Int) {
logBuffer.log(
TAG,
DEBUG,
{ int1 = consecutiveFailedAttempts },
{ "udfpsAttemptThresholdMet consecutiveFailedAttempts=$int1" }
)
}
fun logCalculateModeForFingerprintUnlockingAllowed(
deviceInteractive: Boolean,
keyguardShowing: Boolean,
deviceDreaming: Boolean
) {
logBuffer.log(
TAG,
DEBUG,
{
bool1 = deviceInteractive
bool2 = keyguardShowing
bool3 = deviceDreaming
},
{
"calculateModeForFingerprint unlockingAllowed=true" +
" deviceInteractive=$bool1 isKeyguardShowing=$bool2" +
" deviceDreaming=$bool3"
}
)
}
fun logCalculateModeForFingerprintUnlockingNotAllowed(
strongBiometric: Boolean,
strongAuthFlags: Int,
nonStrongBiometricAllowed: Boolean,
deviceInteractive: Boolean,
keyguardShowing: Boolean
) {
logBuffer.log(
TAG,
DEBUG,
{
int1 = strongAuthFlags
bool1 = strongBiometric
bool2 = nonStrongBiometricAllowed
bool3 = deviceInteractive
bool4 = keyguardShowing
},
{
"calculateModeForFingerprint unlockingAllowed=false" +
" strongBiometric=$bool1 strongAuthFlags=$int1" +
" nonStrongBiometricAllowed=$bool2" +
" deviceInteractive=$bool3 isKeyguardShowing=$bool4"
}
)
}
fun logCalculateModeForPassiveAuthUnlockingAllowed(
deviceInteractive: Boolean,
keyguardShowing: Boolean,
deviceDreaming: Boolean,
bypass: Boolean
) {
logBuffer.log(
TAG,
DEBUG,
{
bool1 = deviceInteractive
bool2 = keyguardShowing
bool3 = deviceDreaming
bool4 = bypass
},
{
"calculateModeForPassiveAuth unlockingAllowed=true" +
" deviceInteractive=$bool1 isKeyguardShowing=$bool2" +
" deviceDreaming=$bool3 bypass=$bool4"
}
)
}
fun logCalculateModeForPassiveAuthUnlockingNotAllowed(
strongBiometric: Boolean,
strongAuthFlags: Int,
nonStrongBiometricAllowed: Boolean,
deviceInteractive: Boolean,
keyguardShowing: Boolean,
bypass: Boolean
) {
logBuffer.log(
TAG,
DEBUG,
{
int1 = if (strongBiometric) 1 else 0
int2 = strongAuthFlags
bool1 = nonStrongBiometricAllowed
bool2 = deviceInteractive
bool3 = keyguardShowing
bool4 = bypass
},
{
"calculateModeForPassiveAuth unlockingAllowed=false" +
" strongBiometric=${int1 == 1}" +
" strongAuthFlags=$int2 nonStrongBiometricAllowed=$bool1" +
" deviceInteractive=$bool2 isKeyguardShowing=$bool3 bypass=$bool4"
}
)
}
}
private fun wakeAndUnlockModeToString(mode: Int): String {
return when (mode) {
MODE_NONE -> "MODE_NONE"
MODE_WAKE_AND_UNLOCK -> "MODE_WAKE_AND_UNLOCK"
MODE_WAKE_AND_UNLOCK_PULSING -> "MODE_WAKE_AND_UNLOCK_PULSING"
MODE_SHOW_BOUNCER -> "MODE_SHOW_BOUNCER"
MODE_ONLY_WAKE -> "MODE_ONLY_WAKE"
MODE_UNLOCK_COLLAPSING -> "MODE_UNLOCK_COLLAPSING"
MODE_WAKE_AND_UNLOCK_FROM_DREAM -> "MODE_WAKE_AND_UNLOCK_FROM_DREAM"
MODE_DISMISS_BOUNCER -> "MODE_DISMISS_BOUNCER"
else -> "UNKNOWN{$mode}"
}
}

View File

@@ -161,6 +161,13 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
}, {"Fingerprint auth successful: userId: $int1, isStrongBiometric: $bool1"})
}
fun logFingerprintError(msgId: Int, originalErrMsg: String) {
logBuffer.log(TAG, DEBUG, {
str1 = originalErrMsg
int1 = msgId
}, { "Fingerprint error received: $str1 msgId= $int1" })
}
fun logInvalidSubId(subId: Int) {
logBuffer.log(TAG, INFO,
{ int1 = subId },

View File

@@ -29,5 +29,5 @@ import javax.inject.Qualifier;
@Qualifier
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface BiometricMessagesLog {
public @interface BiometricLog {
}

View File

@@ -300,9 +300,9 @@ public class LogModule {
*/
@Provides
@SysUISingleton
@BiometricMessagesLog
public static LogBuffer provideBiometricMessagesLogBuffer(LogBufferFactory factory) {
return factory.create("BiometricMessagesLog", 150);
@BiometricLog
public static LogBuffer provideBiometricLogBuffer(LogBufferFactory factory) {
return factory.create("BiometricLog", 200);
}
/**

View File

@@ -29,7 +29,6 @@ import android.os.Handler;
import android.os.PowerManager;
import android.os.SystemClock;
import android.os.Trace;
import android.util.Log;
import androidx.annotation.Nullable;
@@ -41,10 +40,10 @@ import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.UiEventLoggerImpl;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.util.LatencyTracker;
import com.android.keyguard.KeyguardConstants;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.KeyguardViewController;
import com.android.keyguard.logging.BiometricUnlockLogger;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.biometrics.AuthController;
@@ -79,9 +78,6 @@ import javax.inject.Inject;
*/
@SysUISingleton
public class BiometricUnlockController extends KeyguardUpdateMonitorCallback implements Dumpable {
private static final String TAG = "BiometricUnlockCtrl";
private static final boolean DEBUG_BIO_WAKELOCK = KeyguardConstants.DEBUG_BIOMETRIC_WAKELOCK;
private static final long BIOMETRIC_WAKELOCK_TIMEOUT_MS = 15 * 1000;
private static final String BIOMETRIC_WAKE_LOCK_NAME = "wake-and-unlock:wakelock";
private static final UiEventLogger UI_EVENT_LOGGER = new UiEventLoggerImpl();
@@ -176,6 +172,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
private final StatusBarStateController mStatusBarStateController;
private final LatencyTracker mLatencyTracker;
private final VibratorHelper mVibratorHelper;
private final BiometricUnlockLogger mLogger;
private long mLastFpFailureUptimeMillis;
private int mNumConsecutiveFpFailures;
@@ -262,7 +259,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
private final ScreenOffAnimationController mScreenOffAnimationController;
@Inject
public BiometricUnlockController(DozeScrimController dozeScrimController,
public BiometricUnlockController(
DozeScrimController dozeScrimController,
KeyguardViewMediator keyguardViewMediator, ScrimController scrimController,
ShadeController shadeController,
NotificationShadeWindowController notificationShadeWindowController,
@@ -272,6 +270,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
KeyguardBypassController keyguardBypassController,
MetricsLogger metricsLogger, DumpManager dumpManager,
PowerManager powerManager,
BiometricUnlockLogger biometricUnlockLogger,
NotificationMediaManager notificationMediaManager,
WakefulnessLifecycle wakefulnessLifecycle,
ScreenLifecycle screenLifecycle,
@@ -308,6 +307,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
mSessionTracker = sessionTracker;
mScreenOffAnimationController = screenOffAnimationController;
mVibratorHelper = vibrator;
mLogger = biometricUnlockLogger;
dumpManager.registerDumpable(getClass().getName(), this);
}
@@ -329,9 +329,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
private final Runnable mReleaseBiometricWakeLockRunnable = new Runnable() {
@Override
public void run() {
if (DEBUG_BIO_WAKELOCK) {
Log.i(TAG, "biometric wakelock: TIMEOUT!!");
}
mLogger.i("biometric wakelock: TIMEOUT!!");
releaseBiometricWakeLock();
}
};
@@ -339,9 +337,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
private void releaseBiometricWakeLock() {
if (mWakeLock != null) {
mHandler.removeCallbacks(mReleaseBiometricWakeLockRunnable);
if (DEBUG_BIO_WAKELOCK) {
Log.i(TAG, "releasing biometric wakelock");
}
mLogger.i("releasing biometric wakelock");
mWakeLock.release();
mWakeLock = null;
}
@@ -372,9 +368,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
Trace.beginSection("acquiring wake-and-unlock");
mWakeLock.acquire();
Trace.endSection();
if (DEBUG_BIO_WAKELOCK) {
Log.i(TAG, "biometric acquired, grabbing biometric wakelock");
}
mLogger.i("biometric acquired, grabbing biometric wakelock");
mHandler.postDelayed(mReleaseBiometricWakeLockRunnable,
BIOMETRIC_WAKELOCK_TIMEOUT_MS);
}
@@ -411,7 +405,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
mKeyguardViewMediator.userActivity();
startWakeAndUnlock(biometricSourceType, isStrongBiometric);
} else {
Log.d(TAG, "onBiometricAuthenticated aborted by bypass controller");
mLogger.d("onBiometricAuthenticated aborted by bypass controller");
}
}
@@ -427,7 +421,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
}
public void startWakeAndUnlock(@WakeAndUnlockMode int mode) {
Log.v(TAG, "startWakeAndUnlock(" + mode + ")");
mLogger.logStartWakeAndUnlock(mode);
boolean wasDeviceInteractive = mUpdateMonitor.isDeviceInteractive();
mMode = mode;
mHasScreenTurnedOnSinceAuthenticating = false;
@@ -442,9 +436,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
// brightness changes due to display state transitions.
Runnable wakeUp = ()-> {
if (!wasDeviceInteractive || mUpdateMonitor.isDreaming()) {
if (DEBUG_BIO_WAKELOCK) {
Log.i(TAG, "bio wakelock: Authenticated, waking up...");
}
mLogger.i("bio wakelock: Authenticated, waking up...");
mPowerManager.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE,
"android.policy:BIOMETRIC");
}
@@ -537,13 +529,16 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
}
private @WakeAndUnlockMode int calculateModeForFingerprint(boolean isStrongBiometric) {
boolean unlockingAllowed =
final boolean unlockingAllowed =
mUpdateMonitor.isUnlockingWithBiometricAllowed(isStrongBiometric);
boolean deviceDreaming = mUpdateMonitor.isDreaming();
final boolean deviceInteractive = mUpdateMonitor.isDeviceInteractive();
final boolean keyguardShowing = mKeyguardStateController.isShowing();
final boolean deviceDreaming = mUpdateMonitor.isDreaming();
if (!mUpdateMonitor.isDeviceInteractive()) {
if (!mKeyguardStateController.isShowing()
&& !mScreenOffAnimationController.isKeyguardShowDelayed()) {
logCalculateModeForFingerprint(unlockingAllowed, deviceInteractive,
keyguardShowing, deviceDreaming, isStrongBiometric);
if (!deviceInteractive) {
if (!keyguardShowing && !mScreenOffAnimationController.isKeyguardShowDelayed()) {
if (mKeyguardStateController.isUnlocked()) {
return MODE_WAKE_AND_UNLOCK;
}
@@ -559,7 +554,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
if (unlockingAllowed && deviceDreaming) {
return MODE_WAKE_AND_UNLOCK_FROM_DREAM;
}
if (mKeyguardStateController.isShowing()) {
if (keyguardShowing) {
if (mKeyguardViewController.primaryBouncerIsOrWillBeShowing() && unlockingAllowed) {
return MODE_DISMISS_BOUNCER;
} else if (unlockingAllowed) {
@@ -571,14 +566,39 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
return MODE_NONE;
}
private void logCalculateModeForFingerprint(boolean unlockingAllowed, boolean deviceInteractive,
boolean keyguardShowing, boolean deviceDreaming, boolean strongBiometric) {
if (unlockingAllowed) {
mLogger.logCalculateModeForFingerprintUnlockingAllowed(deviceInteractive,
keyguardShowing, deviceDreaming);
} else {
// if unlocking isn't allowed, log more information about why unlocking may not
// have been allowed
final int strongAuthFlags = mUpdateMonitor.getStrongAuthTracker().getStrongAuthForUser(
KeyguardUpdateMonitor.getCurrentUser());
final boolean nonStrongBiometricAllowed =
mUpdateMonitor.getStrongAuthTracker()
.isNonStrongBiometricAllowedAfterIdleTimeout(
KeyguardUpdateMonitor.getCurrentUser());
mLogger.logCalculateModeForFingerprintUnlockingNotAllowed(strongBiometric,
strongAuthFlags, nonStrongBiometricAllowed, deviceInteractive, keyguardShowing);
}
}
private @WakeAndUnlockMode int calculateModeForPassiveAuth(boolean isStrongBiometric) {
boolean unlockingAllowed =
final boolean deviceInteractive = mUpdateMonitor.isDeviceInteractive();
final boolean isKeyguardShowing = mKeyguardStateController.isShowing();
final boolean unlockingAllowed =
mUpdateMonitor.isUnlockingWithBiometricAllowed(isStrongBiometric);
boolean deviceDreaming = mUpdateMonitor.isDreaming();
boolean bypass = mKeyguardBypassController.getBypassEnabled()
final boolean deviceDreaming = mUpdateMonitor.isDreaming();
final boolean bypass = mKeyguardBypassController.getBypassEnabled()
|| mAuthController.isUdfpsFingerDown();
if (!mUpdateMonitor.isDeviceInteractive()) {
if (!mKeyguardStateController.isShowing()) {
logCalculateModeForPassiveAuth(unlockingAllowed, deviceInteractive, isKeyguardShowing,
deviceDreaming, bypass, isStrongBiometric);
if (!deviceInteractive) {
if (!isKeyguardShowing) {
return bypass ? MODE_WAKE_AND_UNLOCK : MODE_ONLY_WAKE;
} else if (!unlockingAllowed) {
return bypass ? MODE_SHOW_BOUNCER : MODE_NONE;
@@ -602,11 +622,11 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
if (unlockingAllowed && mKeyguardStateController.isOccluded()) {
return MODE_UNLOCK_COLLAPSING;
}
if (mKeyguardStateController.isShowing()) {
if (isKeyguardShowing) {
if ((mKeyguardViewController.primaryBouncerIsOrWillBeShowing()
|| mKeyguardBypassController.getAltBouncerShowing()) && unlockingAllowed) {
return MODE_DISMISS_BOUNCER;
} else if (unlockingAllowed && (bypass || mAuthController.isUdfpsFingerDown())) {
} else if (unlockingAllowed && bypass) {
return MODE_UNLOCK_COLLAPSING;
} else {
return bypass ? MODE_SHOW_BOUNCER : MODE_NONE;
@@ -615,6 +635,28 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
return MODE_NONE;
}
private void logCalculateModeForPassiveAuth(boolean unlockingAllowed,
boolean deviceInteractive, boolean keyguardShowing, boolean deviceDreaming,
boolean bypass, boolean strongBiometric) {
if (unlockingAllowed) {
mLogger.logCalculateModeForPassiveAuthUnlockingAllowed(
deviceInteractive, keyguardShowing, deviceDreaming, bypass);
} else {
// if unlocking isn't allowed, log more information about why unlocking may not
// have been allowed
final int strongAuthFlags = mUpdateMonitor.getStrongAuthTracker().getStrongAuthForUser(
KeyguardUpdateMonitor.getCurrentUser());
final boolean nonStrongBiometricAllowed =
mUpdateMonitor.getStrongAuthTracker()
.isNonStrongBiometricAllowedAfterIdleTimeout(
KeyguardUpdateMonitor.getCurrentUser());
mLogger.logCalculateModeForPassiveAuthUnlockingNotAllowed(
strongBiometric, strongAuthFlags, nonStrongBiometricAllowed,
deviceInteractive, keyguardShowing, bypass);
}
}
@Override
public void onBiometricAuthFailed(BiometricSourceType biometricSourceType) {
mMetricsLogger.write(new LogMaker(MetricsEvent.BIOMETRIC_AUTH)
@@ -632,6 +674,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
if (!mVibratorHelper.hasVibrator()
&& (!mUpdateMonitor.isDeviceInteractive() || mUpdateMonitor.isDreaming())) {
mLogger.d("wakeup device on authentication failure (device doesn't have a vibrator)");
startWakeAndUnlock(MODE_ONLY_WAKE);
} else if (biometricSourceType == BiometricSourceType.FINGERPRINT
&& mUpdateMonitor.isUdfpsSupported()) {
@@ -644,6 +687,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
mLastFpFailureUptimeMillis = currUptimeMillis;
if (mNumConsecutiveFpFailures >= UDFPS_ATTEMPTS_BEFORE_SHOW_BOUNCER) {
mLogger.logUdfpsAttemptThresholdMet(mNumConsecutiveFpFailures);
startWakeAndUnlock(MODE_SHOW_BOUNCER);
UI_EVENT_LOGGER.log(BiometricUiEvent.BIOMETRIC_BOUNCER_SHOWN, getSessionId());
mNumConsecutiveFpFailures = 0;
@@ -674,6 +718,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
&& (msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT
|| msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT);
if (fingerprintLockout) {
mLogger.d("fingerprint locked out");
startWakeAndUnlock(MODE_SHOW_BOUNCER);
UI_EVENT_LOGGER.log(BiometricUiEvent.BIOMETRIC_BOUNCER_SHOWN, getSessionId());
}

View File

@@ -42,6 +42,7 @@ import android.testing.TestableResources;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.util.LatencyTracker;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.logging.BiometricUnlockLogger;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.dump.DumpManager;
@@ -78,6 +79,8 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
@Mock
private KeyguardUpdateMonitor mUpdateMonitor;
@Mock
private KeyguardUpdateMonitor.StrongAuthTracker mStrongAuthTracker;
@Mock
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
@Mock
private NotificationShadeWindowController mNotificationShadeWindowController;
@@ -119,6 +122,8 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
private ScreenOffAnimationController mScreenOffAnimationController;
@Mock
private VibratorHelper mVibratorHelper;
@Mock
private BiometricUnlockLogger mLogger;
private BiometricUnlockController mBiometricUnlockController;
@Before
@@ -138,12 +143,13 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
mKeyguardViewMediator, mScrimController, mShadeController,
mNotificationShadeWindowController, mKeyguardStateController, mHandler,
mUpdateMonitor, res.getResources(), mKeyguardBypassController,
mMetricsLogger, mDumpManager, mPowerManager,
mMetricsLogger, mDumpManager, mPowerManager, mLogger,
mNotificationMediaManager, mWakefulnessLifecycle, mScreenLifecycle,
mAuthController, mStatusBarStateController, mKeyguardUnlockAnimationController,
mSessionTracker, mLatencyTracker, mScreenOffAnimationController, mVibratorHelper);
mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager);
mBiometricUnlockController.addBiometricModeListener(mBiometricModeListener);
when(mUpdateMonitor.getStrongAuthTracker()).thenReturn(mStrongAuthTracker);
}
@Test
@@ -285,6 +291,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
@Test
public void onBiometricAuthenticated_whenFace_andBypass_encrypted_showPrimaryBouncer() {
reset(mUpdateMonitor);
when(mUpdateMonitor.getStrongAuthTracker()).thenReturn(mStrongAuthTracker);
when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true);
mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager);
@@ -322,6 +329,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
@Test
public void onBiometricAuthenticated_whenFace_noBypass_encrypted_doNothing() {
reset(mUpdateMonitor);
when(mUpdateMonitor.getStrongAuthTracker()).thenReturn(mStrongAuthTracker);
mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager);
when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(false);