Add debug logs for unlock ripple & sleep+auth interactions

Bug: 269557875, 270989070
Test: NA
Change-Id: I3938499d86025d136aedb7095f4041390163dc48
This commit is contained in:
Chandru S
2023-02-27 12:08:54 -08:00
parent aee5a4332a
commit 56cf6b5d48
7 changed files with 104 additions and 3 deletions

View File

@@ -867,7 +867,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
private void reportSuccessfulBiometricUnlock(boolean isStrongBiometric, int userId) {
mBackgroundExecutor.execute(
() -> mLockPatternUtils.reportSuccessfulBiometricUnlock(isStrongBiometric, userId));
() -> {
mLogger.logReportSuccessfulBiometricUnlock(isStrongBiometric, userId);
mLockPatternUtils.reportSuccessfulBiometricUnlock(isStrongBiometric, userId);
});
}
private void handleFingerprintAuthFailed() {
@@ -2504,11 +2507,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
// If this message exists, we should not authenticate again until this message is
// consumed by the handler
if (mHandler.hasMessages(MSG_BIOMETRIC_AUTHENTICATION_CONTINUE)) {
mLogger.logHandlerHasAuthContinueMsgs(action);
return;
}
// don't start running fingerprint until they're registered
if (!mAuthController.areAllFingerprintAuthenticatorsRegistered()) {
mLogger.d("All FP authenticators not registered, skipping FP listening state update");
return;
}
final boolean shouldListenForFingerprint = shouldListenForFingerprint(isUdfpsSupported());

View File

@@ -16,6 +16,7 @@
package com.android.keyguard.logging
import android.hardware.biometrics.BiometricSourceType
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.log.dagger.BiometricLog
import com.android.systemui.plugins.log.LogBuffer
@@ -157,6 +158,36 @@ class BiometricUnlockLogger @Inject constructor(@BiometricLog private val logBuf
}
)
}
fun deferringAuthenticationDueToSleep(
userId: Int,
biometricSourceType: BiometricSourceType,
alreadyPendingAuth: Boolean
) {
logBuffer.log(
TAG,
DEBUG,
{
int1 = userId
str1 = biometricSourceType.name
bool2 = alreadyPendingAuth
},
{
"onBiometricAuthenticated, deferring auth: userId: $int1, " +
"biometricSourceType: $str1, " +
"goingToSleep: true, " +
"mPendingAuthentication != null: $bool2"
}
)
}
fun finishedGoingToSleepWithPendingAuth() {
logBuffer.log(
TAG,
LogLevel.DEBUG,
"onFinishedGoingToSleep with pendingAuthenticated != null"
)
}
}
private fun wakeAndUnlockModeToString(mode: Int): String {

View File

@@ -16,6 +16,7 @@
package com.android.keyguard.logging
import com.android.systemui.biometrics.AuthRippleController
import com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController
import com.android.systemui.log.dagger.KeyguardLog
import com.android.systemui.plugins.log.LogBuffer
@@ -120,4 +121,29 @@ constructor(
"type=${KeyguardIndicationRotateTextViewController.indicationTypeToString(type)}"
}
}
fun notShowingUnlockRipple(keyguardNotShowing: Boolean, unlockNotAllowed: Boolean) {
buffer.log(
AuthRippleController.TAG,
LogLevel.DEBUG,
{
bool1 = keyguardNotShowing
bool2 = unlockNotAllowed
},
{ "Not showing unlock ripple: keyguardNotShowing: $bool1, unlockNotAllowed: $bool2" }
)
}
fun showingUnlockRippleAt(x: Int, y: Int, context: String) {
buffer.log(
AuthRippleController.TAG,
LogLevel.DEBUG,
{
int1 = x
int2 = y
str1 = context
},
{ "Showing unlock ripple with center (x, y): ($int1, $int2), context: $str1" }
)
}
}

View File

@@ -584,6 +584,30 @@ constructor(@KeyguardUpdateMonitorLog private val logBuffer: LogBuffer) {
)
}
fun logReportSuccessfulBiometricUnlock(isStrongBiometric: Boolean, userId: Int) {
logBuffer.log(
TAG,
DEBUG,
{
bool1 = isStrongBiometric
int1 = userId
},
{ "reporting successful biometric unlock: isStrongBiometric: $bool1, userId: $int1" }
)
}
fun logHandlerHasAuthContinueMsgs(action: Int) {
logBuffer.log(
TAG,
DEBUG,
{ int1 = action },
{
"MSG_BIOMETRIC_AUTHENTICATION_CONTINUE already queued up, " +
"ignoring updating FP listening state to $int1"
}
)
}
fun logFaceEnrolledUpdated(oldValue: Boolean, newValue: Boolean) {
logBuffer.log(
TAG,

View File

@@ -26,6 +26,7 @@ import android.hardware.biometrics.BiometricSourceType
import androidx.annotation.VisibleForTesting
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.keyguard.KeyguardUpdateMonitorCallback
import com.android.keyguard.logging.KeyguardLogger
import com.android.settingslib.Utils
import com.android.systemui.R
import com.android.systemui.animation.Interpolators
@@ -74,6 +75,7 @@ class AuthRippleController @Inject constructor(
private val udfpsControllerProvider: Provider<UdfpsController>,
private val statusBarStateController: StatusBarStateController,
private val featureFlags: FeatureFlags,
private val logger: KeyguardLogger,
rippleView: AuthRippleView?
) : ViewController<AuthRippleView>(rippleView), KeyguardStateController.Callback,
WakefulnessLifecycle.Observer {
@@ -120,8 +122,11 @@ class AuthRippleController @Inject constructor(
}
fun showUnlockRipple(biometricSourceType: BiometricSourceType) {
if (!keyguardStateController.isShowing ||
!keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(biometricSourceType)) {
val keyguardNotShowing = !keyguardStateController.isShowing
val unlockNotAllowed = !keyguardUpdateMonitor
.isUnlockingWithBiometricAllowed(biometricSourceType)
if (keyguardNotShowing || unlockNotAllowed) {
logger.notShowingUnlockRipple(keyguardNotShowing, unlockNotAllowed)
return
}
@@ -138,6 +143,7 @@ class AuthRippleController @Inject constructor(
Math.max(it.y, centralSurfaces.displayHeight.toInt() - it.y)
)
)
logger.showingUnlockRippleAt(it.x, it.y, "FP sensor radius: $udfpsRadius")
showUnlockedRipple()
}
} else if (biometricSourceType == BiometricSourceType.FACE) {
@@ -155,6 +161,7 @@ class AuthRippleController @Inject constructor(
Math.max(it.y, centralSurfaces.displayHeight.toInt() - it.y)
)
)
logger.showingUnlockRippleAt(it.x, it.y, "Face unlock ripple")
showUnlockedRipple()
}
}
@@ -391,5 +398,6 @@ class AuthRippleController @Inject constructor(
companion object {
const val RIPPLE_ANIMATION_DURATION: Long = 1533
const val TAG = "AuthRippleController"
}
}

View File

@@ -398,6 +398,9 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
boolean isStrongBiometric) {
Trace.beginSection("BiometricUnlockController#onBiometricAuthenticated");
if (mUpdateMonitor.isGoingToSleep()) {
mLogger.deferringAuthenticationDueToSleep(userId,
biometricSourceType,
mPendingAuthenticated != null);
mPendingAuthenticated = new PendingAuthenticated(userId, biometricSourceType,
isStrongBiometric);
Trace.endSection();
@@ -813,6 +816,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
public void onFinishedGoingToSleep() {
Trace.beginSection("BiometricUnlockController#onFinishedGoingToSleep");
if (mPendingAuthenticated != null) {
mLogger.finishedGoingToSleepWithPendingAuth();
PendingAuthenticated pendingAuthenticated = mPendingAuthenticated;
// Post this to make sure it's executed after the device is fully locked.
mHandler.post(() -> onBiometricAuthenticated(pendingAuthenticated.userId,

View File

@@ -25,7 +25,9 @@ import androidx.test.filters.SmallTest
import com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.keyguard.KeyguardUpdateMonitorCallback
import com.android.keyguard.logging.KeyguardLogger
import com.android.systemui.SysuiTestCase
import com.android.systemui.dump.logcatLogBuffer
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.keyguard.WakefulnessLifecycle
import com.android.systemui.plugins.statusbar.StatusBarStateController
@@ -109,6 +111,7 @@ class AuthRippleControllerTest : SysuiTestCase() {
udfpsControllerProvider,
statusBarStateController,
featureFlags,
KeyguardLogger(logcatLogBuffer(AuthRippleController.TAG)),
rippleView
)
controller.init()