Merge "Log whenever face or fp enrollment state changes, and when trust usually managed state changes" into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2023-03-03 19:28:14 +00:00
committed by Android (Google) Code Review
2 changed files with 413 additions and 225 deletions

View File

@@ -676,7 +676,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
public void onTrustManagedChanged(boolean managed, int userId) { public void onTrustManagedChanged(boolean managed, int userId) {
Assert.isMainThread(); Assert.isMainThread();
mUserTrustIsManaged.put(userId, managed); mUserTrustIsManaged.put(userId, managed);
mUserTrustIsUsuallyManaged.put(userId, mTrustManager.isTrustUsuallyManaged(userId)); boolean trustUsuallyManaged = mTrustManager.isTrustUsuallyManaged(userId);
mLogger.logTrustUsuallyManagedUpdated(userId, mUserTrustIsUsuallyManaged.get(userId),
trustUsuallyManaged, "onTrustManagedChanged");
mUserTrustIsUsuallyManaged.put(userId, trustUsuallyManaged);
for (int i = 0; i < mCallbacks.size(); i++) { for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) { if (cb != null) {
@@ -2372,8 +2375,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
updateSecondaryLockscreenRequirement(user); updateSecondaryLockscreenRequirement(user);
List<UserInfo> allUsers = mUserManager.getUsers(); List<UserInfo> allUsers = mUserManager.getUsers();
for (UserInfo userInfo : allUsers) { for (UserInfo userInfo : allUsers) {
boolean trustUsuallyManaged = mTrustManager.isTrustUsuallyManaged(userInfo.id);
mLogger.logTrustUsuallyManagedUpdated(userInfo.id,
mUserTrustIsUsuallyManaged.get(userInfo.id),
trustUsuallyManaged, "init from constructor");
mUserTrustIsUsuallyManaged.put(userInfo.id, mUserTrustIsUsuallyManaged.put(userInfo.id,
mTrustManager.isTrustUsuallyManaged(userInfo.id)); trustUsuallyManaged);
} }
updateAirplaneModeState(); updateAirplaneModeState();
@@ -2413,10 +2420,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
} }
private void updateFaceEnrolled(int userId) { private void updateFaceEnrolled(int userId) {
mIsFaceEnrolled = whitelistIpcs( Boolean isFaceEnrolled = whitelistIpcs(
() -> mFaceManager != null && mFaceManager.isHardwareDetected() () -> mFaceManager != null && mFaceManager.isHardwareDetected()
&& mFaceManager.hasEnrolledTemplates(userId) && mFaceManager.hasEnrolledTemplates(userId)
&& mBiometricEnabledForUser.get(userId)); && mBiometricEnabledForUser.get(userId));
mIsFaceEnrolled = isFaceEnrolled;
mLogger.logFaceEnrolledUpdated(mIsFaceEnrolled, isFaceEnrolled);
} }
public boolean isFaceSupported() { public boolean isFaceSupported() {
@@ -3071,8 +3080,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
@VisibleForTesting @VisibleForTesting
boolean isUnlockWithFingerprintPossible(int userId) { boolean isUnlockWithFingerprintPossible(int userId) {
// TODO (b/242022358), make this rely on onEnrollmentChanged event and update it only once. // TODO (b/242022358), make this rely on onEnrollmentChanged event and update it only once.
mIsUnlockWithFingerprintPossible.put(userId, mFpm != null && mFpm.isHardwareDetected() boolean fpEnrolled = mFpm != null && mFpm.isHardwareDetected()
&& !isFingerprintDisabled(userId) && mFpm.hasEnrolledTemplates(userId)); && !isFingerprintDisabled(userId) && mFpm.hasEnrolledTemplates(userId);
mLogger.logFpEnrolledUpdated(userId,
mIsUnlockWithFingerprintPossible.getOrDefault(userId, false),
fpEnrolled);
mIsUnlockWithFingerprintPossible.put(userId, fpEnrolled);
return mIsUnlockWithFingerprintPossible.get(userId); return mIsUnlockWithFingerprintPossible.get(userId);
} }
@@ -3188,7 +3201,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
void handleUserSwitching(int userId, CountDownLatch latch) { void handleUserSwitching(int userId, CountDownLatch latch) {
Assert.isMainThread(); Assert.isMainThread();
clearBiometricRecognized(); clearBiometricRecognized();
mUserTrustIsUsuallyManaged.put(userId, mTrustManager.isTrustUsuallyManaged(userId)); boolean trustUsuallyManaged = mTrustManager.isTrustUsuallyManaged(userId);
mLogger.logTrustUsuallyManagedUpdated(userId, mUserTrustIsUsuallyManaged.get(userId),
trustUsuallyManaged, "userSwitching");
mUserTrustIsUsuallyManaged.put(userId, trustUsuallyManaged);
for (int i = 0; i < mCallbacks.size(); i++) { for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) { if (cb != null) {

View File

@@ -26,6 +26,7 @@ import com.android.keyguard.FaceAuthUiEvent
import com.android.keyguard.KeyguardListenModel import com.android.keyguard.KeyguardListenModel
import com.android.keyguard.KeyguardUpdateMonitorCallback import com.android.keyguard.KeyguardUpdateMonitorCallback
import com.android.keyguard.TrustGrantFlags import com.android.keyguard.TrustGrantFlags
import com.android.systemui.log.dagger.KeyguardUpdateMonitorLog
import com.android.systemui.plugins.log.LogBuffer import com.android.systemui.plugins.log.LogBuffer
import com.android.systemui.plugins.log.LogLevel import com.android.systemui.plugins.log.LogLevel
import com.android.systemui.plugins.log.LogLevel.DEBUG import com.android.systemui.plugins.log.LogLevel.DEBUG
@@ -33,18 +34,15 @@ import com.android.systemui.plugins.log.LogLevel.ERROR
import com.android.systemui.plugins.log.LogLevel.INFO import com.android.systemui.plugins.log.LogLevel.INFO
import com.android.systemui.plugins.log.LogLevel.VERBOSE import com.android.systemui.plugins.log.LogLevel.VERBOSE
import com.android.systemui.plugins.log.LogLevel.WARNING import com.android.systemui.plugins.log.LogLevel.WARNING
import com.android.systemui.log.dagger.KeyguardUpdateMonitorLog
import com.google.errorprone.annotations.CompileTimeConstant import com.google.errorprone.annotations.CompileTimeConstant
import javax.inject.Inject import javax.inject.Inject
private const val TAG = "KeyguardUpdateMonitorLog" private const val TAG = "KeyguardUpdateMonitorLog"
/** /** Helper class for logging for [com.android.keyguard.KeyguardUpdateMonitor] */
* Helper class for logging for [com.android.keyguard.KeyguardUpdateMonitor] class KeyguardUpdateMonitorLogger
*/ @Inject
class KeyguardUpdateMonitorLogger @Inject constructor( constructor(@KeyguardUpdateMonitorLog private val logBuffer: LogBuffer) {
@KeyguardUpdateMonitorLog private val logBuffer: LogBuffer
) {
fun d(@CompileTimeConstant msg: String) = log(msg, DEBUG) fun d(@CompileTimeConstant msg: String) = log(msg, DEBUG)
fun e(@CompileTimeConstant msg: String) = log(msg, ERROR) fun e(@CompileTimeConstant msg: String) = log(msg, ERROR)
@@ -56,15 +54,16 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
fun log(@CompileTimeConstant msg: String, level: LogLevel) = logBuffer.log(TAG, level, msg) fun log(@CompileTimeConstant msg: String, level: LogLevel) = logBuffer.log(TAG, level, msg)
fun logActiveUnlockTriggered(reason: String?) { fun logActiveUnlockTriggered(reason: String?) {
logBuffer.log("ActiveUnlock", DEBUG, logBuffer.log(
{ str1 = reason }, "ActiveUnlock",
{ "initiate active unlock triggerReason=$str1" }) DEBUG,
{ str1 = reason },
{ "initiate active unlock triggerReason=$str1" }
)
} }
fun logAuthInterruptDetected(active: Boolean) { fun logAuthInterruptDetected(active: Boolean) {
logBuffer.log(TAG, DEBUG, logBuffer.log(TAG, DEBUG, { bool1 = active }, { "onAuthInterruptDetected($bool1)" })
{ bool1 = active },
{ "onAuthInterruptDetected($bool1)" })
} }
fun logBroadcastReceived(action: String?) { fun logBroadcastReceived(action: String?) {
@@ -72,9 +71,12 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
} }
fun logDeviceProvisionedState(deviceProvisioned: Boolean) { fun logDeviceProvisionedState(deviceProvisioned: Boolean) {
logBuffer.log(TAG, DEBUG, logBuffer.log(
{ bool1 = deviceProvisioned }, TAG,
{ "DEVICE_PROVISIONED state = $bool1" }) DEBUG,
{ bool1 = deviceProvisioned },
{ "DEVICE_PROVISIONED state = $bool1" }
)
} }
fun logException(ex: Exception, @CompileTimeConstant logMsg: String) { fun logException(ex: Exception, @CompileTimeConstant logMsg: String) {
@@ -82,46 +84,56 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
} }
fun logFaceAcquired(acquireInfo: Int) { fun logFaceAcquired(acquireInfo: Int) {
logBuffer.log(TAG, DEBUG, logBuffer.log(TAG, DEBUG, { int1 = acquireInfo }, { "Face acquired acquireInfo=$int1" })
{ int1 = acquireInfo },
{ "Face acquired acquireInfo=$int1" })
} }
fun logFaceAuthDisabledForUser(userId: Int) { fun logFaceAuthDisabledForUser(userId: Int) {
logBuffer.log(TAG, DEBUG, logBuffer.log(
{ int1 = userId }, TAG,
{ "Face authentication disabled by DPM for userId: $int1" }) DEBUG,
{ int1 = userId },
{ "Face authentication disabled by DPM for userId: $int1" }
)
} }
fun logFaceAuthError(msgId: Int, originalErrMsg: String) { fun logFaceAuthError(msgId: Int, originalErrMsg: String) {
logBuffer.log(TAG, DEBUG, { logBuffer.log(
str1 = originalErrMsg TAG,
int1 = msgId DEBUG,
}, { "Face error received: $str1 msgId= $int1" }) {
str1 = originalErrMsg
int1 = msgId
},
{ "Face error received: $str1 msgId= $int1" }
)
} }
fun logFaceAuthForWrongUser(authUserId: Int) { fun logFaceAuthForWrongUser(authUserId: Int) {
logBuffer.log(TAG, DEBUG, logBuffer.log(
{ int1 = authUserId }, TAG,
{ "Face authenticated for wrong user: $int1" }) DEBUG,
{ int1 = authUserId },
{ "Face authenticated for wrong user: $int1" }
)
} }
fun logFaceAuthHelpMsg(msgId: Int, helpMsg: String?) { fun logFaceAuthHelpMsg(msgId: Int, helpMsg: String?) {
logBuffer.log(TAG, DEBUG, { logBuffer.log(
int1 = msgId TAG,
str1 = helpMsg DEBUG,
}, { "Face help received, msgId: $int1 msg: $str1" }) {
int1 = msgId
str1 = helpMsg
},
{ "Face help received, msgId: $int1 msg: $str1" }
)
} }
fun logFaceAuthRequested(reason: String?) { fun logFaceAuthRequested(reason: String?) {
logBuffer.log(TAG, DEBUG, { logBuffer.log(TAG, DEBUG, { str1 = reason }, { "requestFaceAuth() reason=$str1" })
str1 = reason
}, { "requestFaceAuth() reason=$str1" })
} }
fun logFaceAuthSuccess(userId: Int) { fun logFaceAuthSuccess(userId: Int) {
logBuffer.log(TAG, DEBUG, logBuffer.log(TAG, DEBUG, { int1 = userId }, { "Face auth succeeded for user $int1" })
{ int1 = userId },
{ "Face auth succeeded for user $int1" })
} }
fun logFaceLockoutReset(@LockoutMode mode: Int) { fun logFaceLockoutReset(@LockoutMode mode: Int) {
@@ -133,21 +145,30 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
} }
fun logFaceUnlockPossible(isFaceUnlockPossible: Boolean) { fun logFaceUnlockPossible(isFaceUnlockPossible: Boolean) {
logBuffer.log(TAG, DEBUG, logBuffer.log(
{ bool1 = isFaceUnlockPossible }, TAG,
{"isUnlockWithFacePossible: $bool1"}) DEBUG,
{ bool1 = isFaceUnlockPossible },
{ "isUnlockWithFacePossible: $bool1" }
)
} }
fun logFingerprintAuthForWrongUser(authUserId: Int) { fun logFingerprintAuthForWrongUser(authUserId: Int) {
logBuffer.log(TAG, DEBUG, logBuffer.log(
{ int1 = authUserId }, TAG,
{ "Fingerprint authenticated for wrong user: $int1" }) DEBUG,
{ int1 = authUserId },
{ "Fingerprint authenticated for wrong user: $int1" }
)
} }
fun logFingerprintDisabledForUser(userId: Int) { fun logFingerprintDisabledForUser(userId: Int) {
logBuffer.log(TAG, DEBUG, logBuffer.log(
{ int1 = userId }, TAG,
{ "Fingerprint disabled by DPM for userId: $int1" }) DEBUG,
{ int1 = userId },
{ "Fingerprint disabled by DPM for userId: $int1" }
)
} }
fun logFingerprintLockoutReset(@LockoutMode mode: Int) { fun logFingerprintLockoutReset(@LockoutMode mode: Int) {
@@ -155,16 +176,24 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
} }
fun logFingerprintRunningState(fingerprintRunningState: Int) { fun logFingerprintRunningState(fingerprintRunningState: Int) {
logBuffer.log(TAG, DEBUG, logBuffer.log(
{ int1 = fingerprintRunningState }, TAG,
{ "fingerprintRunningState: $int1" }) DEBUG,
{ int1 = fingerprintRunningState },
{ "fingerprintRunningState: $int1" }
)
} }
fun logFingerprintSuccess(userId: Int, isStrongBiometric: Boolean) { fun logFingerprintSuccess(userId: Int, isStrongBiometric: Boolean) {
logBuffer.log(TAG, DEBUG, { logBuffer.log(
int1 = userId TAG,
bool1 = isStrongBiometric DEBUG,
}, {"Fingerprint auth successful: userId: $int1, isStrongBiometric: $bool1"}) {
int1 = userId
bool1 = isStrongBiometric
},
{ "Fingerprint auth successful: userId: $int1, isStrongBiometric: $bool1" }
)
} }
fun logFaceDetected(userId: Int, isStrongBiometric: Boolean) { fun logFaceDetected(userId: Int, isStrongBiometric: Boolean) {
@@ -182,29 +211,42 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
} }
fun logFingerprintError(msgId: Int, originalErrMsg: String) { fun logFingerprintError(msgId: Int, originalErrMsg: String) {
logBuffer.log(TAG, DEBUG, { logBuffer.log(
str1 = originalErrMsg TAG,
int1 = msgId DEBUG,
}, { "Fingerprint error received: $str1 msgId= $int1" }) {
str1 = originalErrMsg
int1 = msgId
},
{ "Fingerprint error received: $str1 msgId= $int1" }
)
} }
fun logInvalidSubId(subId: Int) { fun logInvalidSubId(subId: Int) {
logBuffer.log(TAG, INFO, logBuffer.log(
{ int1 = subId }, TAG,
{ "Previously active sub id $int1 is now invalid, will remove" }) INFO,
{ int1 = subId },
{ "Previously active sub id $int1 is now invalid, will remove" }
)
} }
fun logPrimaryKeyguardBouncerChanged( fun logPrimaryKeyguardBouncerChanged(
primaryBouncerIsOrWillBeShowing: Boolean, primaryBouncerIsOrWillBeShowing: Boolean,
primaryBouncerFullyShown: Boolean primaryBouncerFullyShown: Boolean
) { ) {
logBuffer.log(TAG, DEBUG, { logBuffer.log(
bool1 = primaryBouncerIsOrWillBeShowing TAG,
bool2 = primaryBouncerFullyShown DEBUG,
}, { {
"handlePrimaryBouncerChanged " + bool1 = primaryBouncerIsOrWillBeShowing
bool2 = primaryBouncerFullyShown
},
{
"handlePrimaryBouncerChanged " +
"primaryBouncerIsOrWillBeShowing=$bool1 primaryBouncerFullyShown=$bool2" "primaryBouncerIsOrWillBeShowing=$bool1 primaryBouncerFullyShown=$bool2"
}) }
)
} }
fun logKeyguardListenerModel(model: KeyguardListenModel) { fun logKeyguardListenerModel(model: KeyguardListenModel) {
@@ -212,98 +254,134 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
} }
fun logKeyguardShowingChanged(showing: Boolean, occluded: Boolean, visible: Boolean) { fun logKeyguardShowingChanged(showing: Boolean, occluded: Boolean, visible: Boolean) {
logBuffer.log(TAG, DEBUG, { logBuffer.log(
bool1 = showing TAG,
bool2 = occluded DEBUG,
bool3 = visible {
}, { bool1 = showing
"keyguardShowingChanged(showing=$bool1 occluded=$bool2 visible=$bool3)" bool2 = occluded
}) bool3 = visible
},
{ "keyguardShowingChanged(showing=$bool1 occluded=$bool2 visible=$bool3)" }
)
} }
fun logMissingSupervisorAppError(userId: Int) { fun logMissingSupervisorAppError(userId: Int) {
logBuffer.log(TAG, ERROR, logBuffer.log(
{ int1 = userId }, TAG,
{ "No Profile Owner or Device Owner supervision app found for User $int1" }) ERROR,
{ int1 = userId },
{ "No Profile Owner or Device Owner supervision app found for User $int1" }
)
} }
fun logPhoneStateChanged(newState: String?) { fun logPhoneStateChanged(newState: String?) {
logBuffer.log(TAG, DEBUG, logBuffer.log(TAG, DEBUG, { str1 = newState }, { "handlePhoneStateChanged($str1)" })
{ str1 = newState },
{ "handlePhoneStateChanged($str1)" })
} }
fun logRegisterCallback(callback: KeyguardUpdateMonitorCallback?) { fun logRegisterCallback(callback: KeyguardUpdateMonitorCallback?) {
logBuffer.log(TAG, VERBOSE, logBuffer.log(TAG, VERBOSE, { str1 = "$callback" }, { "*** register callback for $str1" })
{ str1 = "$callback" },
{ "*** register callback for $str1" })
} }
fun logRetryingAfterFaceHwUnavailable(retryCount: Int) { fun logRetryingAfterFaceHwUnavailable(retryCount: Int) {
logBuffer.log(TAG, WARNING, logBuffer.log(
{ int1 = retryCount }, TAG,
{ "Retrying face after HW unavailable, attempt $int1" }) WARNING,
{ int1 = retryCount },
{ "Retrying face after HW unavailable, attempt $int1" }
)
} }
fun logRetryAfterFpErrorWithDelay(msgId: Int, errString: String?, delay: Int) { fun logRetryAfterFpErrorWithDelay(msgId: Int, errString: String?, delay: Int) {
logBuffer.log(TAG, DEBUG, { logBuffer.log(
int1 = msgId TAG,
int2 = delay DEBUG,
str1 = "$errString" {
}, { int1 = msgId
"Fingerprint scheduling retry auth after $int2 ms due to($int1) -> $str1" int2 = delay
}) str1 = "$errString"
},
{ "Fingerprint scheduling retry auth after $int2 ms due to($int1) -> $str1" }
)
} }
fun logRetryAfterFpHwUnavailable(retryCount: Int) { fun logRetryAfterFpHwUnavailable(retryCount: Int) {
logBuffer.log(TAG, WARNING, logBuffer.log(
{ int1 = retryCount }, TAG,
{ "Retrying fingerprint attempt: $int1" }) WARNING,
{ int1 = retryCount },
{ "Retrying fingerprint attempt: $int1" }
)
} }
fun logSendPrimaryBouncerChanged( fun logSendPrimaryBouncerChanged(
primaryBouncerIsOrWillBeShowing: Boolean, primaryBouncerIsOrWillBeShowing: Boolean,
primaryBouncerFullyShown: Boolean, primaryBouncerFullyShown: Boolean,
) { ) {
logBuffer.log(TAG, DEBUG, { logBuffer.log(
bool1 = primaryBouncerIsOrWillBeShowing TAG,
bool2 = primaryBouncerFullyShown DEBUG,
}, { {
"sendPrimaryBouncerChanged primaryBouncerIsOrWillBeShowing=$bool1 " + bool1 = primaryBouncerIsOrWillBeShowing
bool2 = primaryBouncerFullyShown
},
{
"sendPrimaryBouncerChanged primaryBouncerIsOrWillBeShowing=$bool1 " +
"primaryBouncerFullyShown=$bool2" "primaryBouncerFullyShown=$bool2"
}) }
)
} }
fun logServiceStateChange(subId: Int, serviceState: ServiceState?) { fun logServiceStateChange(subId: Int, serviceState: ServiceState?) {
logBuffer.log(TAG, DEBUG, { logBuffer.log(
int1 = subId TAG,
str1 = "$serviceState" DEBUG,
}, { "handleServiceStateChange(subId=$int1, serviceState=$str1)" }) {
int1 = subId
str1 = "$serviceState"
},
{ "handleServiceStateChange(subId=$int1, serviceState=$str1)" }
)
} }
fun logServiceStateIntent(action: String?, serviceState: ServiceState?, subId: Int) { fun logServiceStateIntent(action: String?, serviceState: ServiceState?, subId: Int) {
logBuffer.log(TAG, VERBOSE, { logBuffer.log(
str1 = action TAG,
str2 = "$serviceState" VERBOSE,
int1 = subId {
}, { "action $str1 serviceState=$str2 subId=$int1" }) str1 = action
str2 = "$serviceState"
int1 = subId
},
{ "action $str1 serviceState=$str2 subId=$int1" }
)
} }
fun logSimState(subId: Int, slotId: Int, state: Int) { fun logSimState(subId: Int, slotId: Int, state: Int) {
logBuffer.log(TAG, DEBUG, { logBuffer.log(
int1 = subId TAG,
int2 = slotId DEBUG,
long1 = state.toLong() {
}, { "handleSimStateChange(subId=$int1, slotId=$int2, state=$long1)" }) int1 = subId
int2 = slotId
long1 = state.toLong()
},
{ "handleSimStateChange(subId=$int1, slotId=$int2, state=$long1)" }
)
} }
fun logSimStateFromIntent(action: String?, extraSimState: String?, slotId: Int, subId: Int) { fun logSimStateFromIntent(action: String?, extraSimState: String?, slotId: Int, subId: Int) {
logBuffer.log(TAG, VERBOSE, { logBuffer.log(
str1 = action TAG,
str2 = extraSimState VERBOSE,
int1 = slotId {
int2 = subId str1 = action
}, { "action $str1 state: $str2 slotId: $int1 subid: $int2" }) str2 = extraSimState
int1 = slotId
int2 = subId
},
{ "action $str1 state: $str2 slotId: $int1 subid: $int2" }
)
} }
fun logSimUnlocked(subId: Int) { fun logSimUnlocked(subId: Int) {
@@ -311,78 +389,98 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
} }
fun logStartedListeningForFace(faceRunningState: Int, faceAuthUiEvent: FaceAuthUiEvent) { fun logStartedListeningForFace(faceRunningState: Int, faceAuthUiEvent: FaceAuthUiEvent) {
logBuffer.log(TAG, VERBOSE, { logBuffer.log(
int1 = faceRunningState TAG,
str1 = faceAuthUiEvent.reason VERBOSE,
str2 = faceAuthUiEvent.extraInfoToString() {
}, { "startListeningForFace(): $int1, reason: $str1 $str2" }) int1 = faceRunningState
str1 = faceAuthUiEvent.reason
str2 = faceAuthUiEvent.extraInfoToString()
},
{ "startListeningForFace(): $int1, reason: $str1 $str2" }
)
} }
fun logStartedListeningForFaceFromWakeUp(faceRunningState: Int, @WakeReason pmWakeReason: Int) { fun logStartedListeningForFaceFromWakeUp(faceRunningState: Int, @WakeReason pmWakeReason: Int) {
logBuffer.log(TAG, VERBOSE, { logBuffer.log(
int1 = faceRunningState TAG,
str1 = PowerManager.wakeReasonToString(pmWakeReason) VERBOSE,
}, { "startListeningForFace(): $int1, reason: wakeUp-$str1" }) {
int1 = faceRunningState
str1 = PowerManager.wakeReasonToString(pmWakeReason)
},
{ "startListeningForFace(): $int1, reason: wakeUp-$str1" }
)
} }
fun logStoppedListeningForFace(faceRunningState: Int, faceAuthReason: String) { fun logStoppedListeningForFace(faceRunningState: Int, faceAuthReason: String) {
logBuffer.log(TAG, VERBOSE, { logBuffer.log(
int1 = faceRunningState TAG,
str1 = faceAuthReason VERBOSE,
}, { "stopListeningForFace(): currentFaceRunningState: $int1, reason: $str1" }) {
int1 = faceRunningState
str1 = faceAuthReason
},
{ "stopListeningForFace(): currentFaceRunningState: $int1, reason: $str1" }
)
} }
fun logSubInfo(subInfo: SubscriptionInfo?) { fun logSubInfo(subInfo: SubscriptionInfo?) {
logBuffer.log(TAG, VERBOSE, logBuffer.log(TAG, VERBOSE, { str1 = "$subInfo" }, { "SubInfo:$str1" })
{ str1 = "$subInfo" },
{ "SubInfo:$str1" })
} }
fun logTimeFormatChanged(newTimeFormat: String?) { fun logTimeFormatChanged(newTimeFormat: String?) {
logBuffer.log(TAG, DEBUG, logBuffer.log(
{ str1 = newTimeFormat }, TAG,
{ "handleTimeFormatUpdate timeFormat=$str1" }) DEBUG,
{ str1 = newTimeFormat },
{ "handleTimeFormatUpdate timeFormat=$str1" }
)
} }
fun logUdfpsPointerDown(sensorId: Int) { fun logUdfpsPointerDown(sensorId: Int) {
logBuffer.log(TAG, DEBUG, logBuffer.log(TAG, DEBUG, { int1 = sensorId }, { "onUdfpsPointerDown, sensorId: $int1" })
{ int1 = sensorId },
{ "onUdfpsPointerDown, sensorId: $int1" })
} }
fun logUdfpsPointerUp(sensorId: Int) { fun logUdfpsPointerUp(sensorId: Int) {
logBuffer.log(TAG, DEBUG, logBuffer.log(TAG, DEBUG, { int1 = sensorId }, { "onUdfpsPointerUp, sensorId: $int1" })
{ int1 = sensorId },
{ "onUdfpsPointerUp, sensorId: $int1" })
} }
fun logUnexpectedFaceCancellationSignalState(faceRunningState: Int, unlockPossible: Boolean) { fun logUnexpectedFaceCancellationSignalState(faceRunningState: Int, unlockPossible: Boolean) {
logBuffer.log(TAG, ERROR, { logBuffer.log(
int1 = faceRunningState TAG,
bool1 = unlockPossible ERROR,
}, { {
"Cancellation signal is not null, high chance of bug in " + int1 = faceRunningState
"face auth lifecycle management. " + bool1 = unlockPossible
"Face state: $int1, unlockPossible: $bool1" },
}) {
"Cancellation signal is not null, high chance of bug in " +
"face auth lifecycle management. " +
"Face state: $int1, unlockPossible: $bool1"
}
)
} }
fun logUnexpectedFpCancellationSignalState( fun logUnexpectedFpCancellationSignalState(
fingerprintRunningState: Int, fingerprintRunningState: Int,
unlockPossible: Boolean unlockPossible: Boolean
) { ) {
logBuffer.log(TAG, ERROR, { logBuffer.log(
int1 = fingerprintRunningState TAG,
bool1 = unlockPossible ERROR,
}, { {
"Cancellation signal is not null, high chance of bug in " + int1 = fingerprintRunningState
"fp auth lifecycle management. FP state: $int1, unlockPossible: $bool1" bool1 = unlockPossible
}) },
{
"Cancellation signal is not null, high chance of bug in " +
"fp auth lifecycle management. FP state: $int1, unlockPossible: $bool1"
}
)
} }
fun logUnregisterCallback(callback: KeyguardUpdateMonitorCallback?) { fun logUnregisterCallback(callback: KeyguardUpdateMonitorCallback?) {
logBuffer.log(TAG, VERBOSE, logBuffer.log(TAG, VERBOSE, { str1 = "$callback" }, { "*** unregister callback for $str1" })
{ str1 = "$callback" },
{ "*** unregister callback for $str1" })
} }
fun logUserRequestedUnlock( fun logUserRequestedUnlock(
@@ -390,75 +488,149 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
reason: String?, reason: String?,
dismissKeyguard: Boolean dismissKeyguard: Boolean
) { ) {
logBuffer.log("ActiveUnlock", DEBUG, { logBuffer.log(
str1 = requestOrigin?.name "ActiveUnlock",
str2 = reason DEBUG,
bool1 = dismissKeyguard {
}, { "reportUserRequestedUnlock origin=$str1 reason=$str2 dismissKeyguard=$bool1" }) str1 = requestOrigin?.name
str2 = reason
bool1 = dismissKeyguard
},
{ "reportUserRequestedUnlock origin=$str1 reason=$str2 dismissKeyguard=$bool1" }
)
} }
fun logTrustGrantedWithFlags( fun logTrustGrantedWithFlags(
flags: Int, flags: Int,
newlyUnlocked: Boolean, newlyUnlocked: Boolean,
userId: Int, userId: Int,
message: String? message: String?
) { ) {
logBuffer.log(TAG, DEBUG, { logBuffer.log(
int1 = flags TAG,
bool1 = newlyUnlocked DEBUG,
int2 = userId {
str1 = message int1 = flags
}, { "trustGrantedWithFlags[user=$int2] newlyUnlocked=$bool1 " + bool1 = newlyUnlocked
"flags=${TrustGrantFlags(int1)} message=$str1" }) int2 = userId
str1 = message
},
{
"trustGrantedWithFlags[user=$int2] newlyUnlocked=$bool1 " +
"flags=${TrustGrantFlags(int1)} message=$str1"
}
)
} }
fun logTrustChanged( fun logTrustChanged(wasTrusted: Boolean, isNowTrusted: Boolean, userId: Int) {
wasTrusted: Boolean, logBuffer.log(
isNowTrusted: Boolean, TAG,
userId: Int DEBUG,
) { {
logBuffer.log(TAG, DEBUG, { bool1 = wasTrusted
bool1 = wasTrusted bool2 = isNowTrusted
bool2 = isNowTrusted int1 = userId
int1 = userId },
}, { "onTrustChanged[user=$int1] wasTrusted=$bool1 isNowTrusted=$bool2" }) { "onTrustChanged[user=$int1] wasTrusted=$bool1 isNowTrusted=$bool2" }
)
} }
fun logKeyguardStateUpdate( fun logKeyguardStateUpdate(
secure: Boolean, secure: Boolean,
canDismissLockScreen: Boolean, canDismissLockScreen: Boolean,
trusted: Boolean, trusted: Boolean,
trustManaged: Boolean trustManaged: Boolean
) { ) {
logBuffer.log("KeyguardState", DEBUG, { logBuffer.log(
bool1 = secure "KeyguardState",
bool2 = canDismissLockScreen DEBUG,
bool3 = trusted {
bool4 = trustManaged bool1 = secure
}, { "#update secure=$bool1 canDismissKeyguard=$bool2" + bool2 = canDismissLockScreen
" trusted=$bool3 trustManaged=$bool4" }) bool3 = trusted
bool4 = trustManaged
},
{
"#update secure=$bool1 canDismissKeyguard=$bool2" +
" trusted=$bool3 trustManaged=$bool4"
}
)
} }
fun logSkipUpdateFaceListeningOnWakeup(@WakeReason pmWakeReason: Int) { fun logSkipUpdateFaceListeningOnWakeup(@WakeReason pmWakeReason: Int) {
logBuffer.log(TAG, VERBOSE, { logBuffer.log(
str1 = PowerManager.wakeReasonToString(pmWakeReason) TAG,
}, { "Skip updating face listening state on wakeup from $str1"}) VERBOSE,
{ str1 = PowerManager.wakeReasonToString(pmWakeReason) },
{ "Skip updating face listening state on wakeup from $str1" }
)
} }
fun logTaskStackChangedForAssistant(assistantVisible: Boolean) { fun logTaskStackChangedForAssistant(assistantVisible: Boolean) {
logBuffer.log(TAG, VERBOSE, { logBuffer.log(
bool1 = assistantVisible TAG,
}, { VERBOSE,
"TaskStackChanged for ACTIVITY_TYPE_ASSISTANT, assistant visible: $bool1" { bool1 = assistantVisible },
}) { "TaskStackChanged for ACTIVITY_TYPE_ASSISTANT, assistant visible: $bool1" }
)
} }
fun logAssistantVisible(assistantVisible: Boolean) { fun logAssistantVisible(assistantVisible: Boolean) {
logBuffer.log(TAG, VERBOSE, { logBuffer.log(
bool1 = assistantVisible TAG,
}, { VERBOSE,
"Updating mAssistantVisible to new value: $bool1" { bool1 = assistantVisible },
}) { "Updating mAssistantVisible to new value: $bool1" }
)
}
fun logFaceEnrolledUpdated(oldValue: Boolean, newValue: Boolean) {
logBuffer.log(
TAG,
DEBUG,
{
bool1 = oldValue
bool2 = newValue
},
{ "Face enrolled state changed: old: $bool1, new: $bool2" }
)
}
fun logFpEnrolledUpdated(userId: Int, oldValue: Boolean, newValue: Boolean) {
logBuffer.log(
TAG,
DEBUG,
{
int1 = userId
bool1 = oldValue
bool2 = newValue
},
{ "Fp enrolled state changed for userId: $int1 old: $bool1, new: $bool2" }
)
}
fun logTrustUsuallyManagedUpdated(
userId: Int,
oldValue: Boolean,
newValue: Boolean,
context: String
) {
logBuffer.log(
TAG,
DEBUG,
{
int1 = userId
bool1 = oldValue
bool2 = newValue
str1 = context
},
{
"trustUsuallyManaged changed for " +
"userId: $int1 " +
"old: $bool1, " +
"new: $bool2 " +
"context: $context"
}
)
} }
} }