Merge "Add debug logs for unlock ripple & sleep+auth interactions" into tm-qpr-dev

This commit is contained in:
Chandru S
2023-03-03 23:29:18 +00:00
committed by Android (Google) Code Review
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) { private void reportSuccessfulBiometricUnlock(boolean isStrongBiometric, int userId) {
mBackgroundExecutor.execute( mBackgroundExecutor.execute(
() -> mLockPatternUtils.reportSuccessfulBiometricUnlock(isStrongBiometric, userId)); () -> {
mLogger.logReportSuccessfulBiometricUnlock(isStrongBiometric, userId);
mLockPatternUtils.reportSuccessfulBiometricUnlock(isStrongBiometric, userId);
});
} }
private void handleFingerprintAuthFailed() { 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 // If this message exists, we should not authenticate again until this message is
// consumed by the handler // consumed by the handler
if (mHandler.hasMessages(MSG_BIOMETRIC_AUTHENTICATION_CONTINUE)) { if (mHandler.hasMessages(MSG_BIOMETRIC_AUTHENTICATION_CONTINUE)) {
mLogger.logHandlerHasAuthContinueMsgs(action);
return; return;
} }
// don't start running fingerprint until they're registered // don't start running fingerprint until they're registered
if (!mAuthController.areAllFingerprintAuthenticatorsRegistered()) { if (!mAuthController.areAllFingerprintAuthenticatorsRegistered()) {
mLogger.d("All FP authenticators not registered, skipping FP listening state update");
return; return;
} }
final boolean shouldListenForFingerprint = shouldListenForFingerprint(isUdfpsSupported()); final boolean shouldListenForFingerprint = shouldListenForFingerprint(isUdfpsSupported());

View File

@@ -16,6 +16,7 @@
package com.android.keyguard.logging package com.android.keyguard.logging
import android.hardware.biometrics.BiometricSourceType
import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.log.dagger.BiometricLog import com.android.systemui.log.dagger.BiometricLog
import com.android.systemui.plugins.log.LogBuffer 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 { private fun wakeAndUnlockModeToString(mode: Int): String {

View File

@@ -16,6 +16,7 @@
package com.android.keyguard.logging package com.android.keyguard.logging
import com.android.systemui.biometrics.AuthRippleController
import com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController import com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController
import com.android.systemui.log.dagger.KeyguardLog import com.android.systemui.log.dagger.KeyguardLog
import com.android.systemui.plugins.log.LogBuffer import com.android.systemui.plugins.log.LogBuffer
@@ -120,4 +121,29 @@ constructor(
"type=${KeyguardIndicationRotateTextViewController.indicationTypeToString(type)}" "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) { fun logFaceEnrolledUpdated(oldValue: Boolean, newValue: Boolean) {
logBuffer.log( logBuffer.log(
TAG, TAG,

View File

@@ -26,6 +26,7 @@ import android.hardware.biometrics.BiometricSourceType
import androidx.annotation.VisibleForTesting import androidx.annotation.VisibleForTesting
import com.android.keyguard.KeyguardUpdateMonitor import com.android.keyguard.KeyguardUpdateMonitor
import com.android.keyguard.KeyguardUpdateMonitorCallback import com.android.keyguard.KeyguardUpdateMonitorCallback
import com.android.keyguard.logging.KeyguardLogger
import com.android.settingslib.Utils import com.android.settingslib.Utils
import com.android.systemui.R import com.android.systemui.R
import com.android.systemui.animation.Interpolators import com.android.systemui.animation.Interpolators
@@ -74,6 +75,7 @@ class AuthRippleController @Inject constructor(
private val udfpsControllerProvider: Provider<UdfpsController>, private val udfpsControllerProvider: Provider<UdfpsController>,
private val statusBarStateController: StatusBarStateController, private val statusBarStateController: StatusBarStateController,
private val featureFlags: FeatureFlags, private val featureFlags: FeatureFlags,
private val logger: KeyguardLogger,
rippleView: AuthRippleView? rippleView: AuthRippleView?
) : ViewController<AuthRippleView>(rippleView), KeyguardStateController.Callback, ) : ViewController<AuthRippleView>(rippleView), KeyguardStateController.Callback,
WakefulnessLifecycle.Observer { WakefulnessLifecycle.Observer {
@@ -120,8 +122,11 @@ class AuthRippleController @Inject constructor(
} }
fun showUnlockRipple(biometricSourceType: BiometricSourceType) { fun showUnlockRipple(biometricSourceType: BiometricSourceType) {
if (!keyguardStateController.isShowing || val keyguardNotShowing = !keyguardStateController.isShowing
!keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(biometricSourceType)) { val unlockNotAllowed = !keyguardUpdateMonitor
.isUnlockingWithBiometricAllowed(biometricSourceType)
if (keyguardNotShowing || unlockNotAllowed) {
logger.notShowingUnlockRipple(keyguardNotShowing, unlockNotAllowed)
return return
} }
@@ -138,6 +143,7 @@ class AuthRippleController @Inject constructor(
Math.max(it.y, centralSurfaces.displayHeight.toInt() - it.y) Math.max(it.y, centralSurfaces.displayHeight.toInt() - it.y)
) )
) )
logger.showingUnlockRippleAt(it.x, it.y, "FP sensor radius: $udfpsRadius")
showUnlockedRipple() showUnlockedRipple()
} }
} else if (biometricSourceType == BiometricSourceType.FACE) { } else if (biometricSourceType == BiometricSourceType.FACE) {
@@ -155,6 +161,7 @@ class AuthRippleController @Inject constructor(
Math.max(it.y, centralSurfaces.displayHeight.toInt() - it.y) Math.max(it.y, centralSurfaces.displayHeight.toInt() - it.y)
) )
) )
logger.showingUnlockRippleAt(it.x, it.y, "Face unlock ripple")
showUnlockedRipple() showUnlockedRipple()
} }
} }
@@ -391,5 +398,6 @@ class AuthRippleController @Inject constructor(
companion object { companion object {
const val RIPPLE_ANIMATION_DURATION: Long = 1533 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) { boolean isStrongBiometric) {
Trace.beginSection("BiometricUnlockController#onBiometricAuthenticated"); Trace.beginSection("BiometricUnlockController#onBiometricAuthenticated");
if (mUpdateMonitor.isGoingToSleep()) { if (mUpdateMonitor.isGoingToSleep()) {
mLogger.deferringAuthenticationDueToSleep(userId,
biometricSourceType,
mPendingAuthenticated != null);
mPendingAuthenticated = new PendingAuthenticated(userId, biometricSourceType, mPendingAuthenticated = new PendingAuthenticated(userId, biometricSourceType,
isStrongBiometric); isStrongBiometric);
Trace.endSection(); Trace.endSection();
@@ -813,6 +816,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
public void onFinishedGoingToSleep() { public void onFinishedGoingToSleep() {
Trace.beginSection("BiometricUnlockController#onFinishedGoingToSleep"); Trace.beginSection("BiometricUnlockController#onFinishedGoingToSleep");
if (mPendingAuthenticated != null) { if (mPendingAuthenticated != null) {
mLogger.finishedGoingToSleepWithPendingAuth();
PendingAuthenticated pendingAuthenticated = mPendingAuthenticated; PendingAuthenticated pendingAuthenticated = mPendingAuthenticated;
// Post this to make sure it's executed after the device is fully locked. // Post this to make sure it's executed after the device is fully locked.
mHandler.post(() -> onBiometricAuthenticated(pendingAuthenticated.userId, 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.dx.mockito.inline.extended.ExtendedMockito.mockitoSession
import com.android.keyguard.KeyguardUpdateMonitor import com.android.keyguard.KeyguardUpdateMonitor
import com.android.keyguard.KeyguardUpdateMonitorCallback import com.android.keyguard.KeyguardUpdateMonitorCallback
import com.android.keyguard.logging.KeyguardLogger
import com.android.systemui.SysuiTestCase import com.android.systemui.SysuiTestCase
import com.android.systemui.dump.logcatLogBuffer
import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.FeatureFlags
import com.android.systemui.keyguard.WakefulnessLifecycle import com.android.systemui.keyguard.WakefulnessLifecycle
import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.plugins.statusbar.StatusBarStateController
@@ -109,6 +111,7 @@ class AuthRippleControllerTest : SysuiTestCase() {
udfpsControllerProvider, udfpsControllerProvider,
statusBarStateController, statusBarStateController,
featureFlags, featureFlags,
KeyguardLogger(logcatLogBuffer(AuthRippleController.TAG)),
rippleView rippleView
) )
controller.init() controller.init()