Log the amount of time between authentication and error
Fixes: 135705310 Test: Checked logs Change-Id: I1d9b26befc30f233052504c7c74b17ea0a3d5671
This commit is contained in:
@@ -3282,6 +3282,8 @@ message BiometricErrorOccurred {
|
|||||||
optional int32 error_info_vendor = 7;
|
optional int32 error_info_vendor = 7;
|
||||||
// Dictates if this message should trigger additional debugging.
|
// Dictates if this message should trigger additional debugging.
|
||||||
optional bool debug = 8;
|
optional bool debug = 8;
|
||||||
|
// Time spent during the authentication attempt.
|
||||||
|
optional int64 latency_millis = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -170,6 +170,8 @@ public class BiometricService extends SystemService {
|
|||||||
// the authentication.
|
// the authentication.
|
||||||
byte[] mTokenEscrow;
|
byte[] mTokenEscrow;
|
||||||
|
|
||||||
|
// Timestamp when authentication started
|
||||||
|
private long mStartTimeMs;
|
||||||
// Timestamp when hardware authentication occurred
|
// Timestamp when hardware authentication occurred
|
||||||
private long mAuthenticatedTimeMs;
|
private long mAuthenticatedTimeMs;
|
||||||
|
|
||||||
@@ -1076,6 +1078,9 @@ public class BiometricService extends SystemService {
|
|||||||
latency,
|
latency,
|
||||||
Utils.isDebugEnabled(getContext(), mCurrentAuthSession.mUserId));
|
Utils.isDebugEnabled(getContext(), mCurrentAuthSession.mUserId));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
final long latency = System.currentTimeMillis() - mCurrentAuthSession.mStartTimeMs;
|
||||||
|
|
||||||
int error = reason == BiometricPrompt.DISMISSED_REASON_NEGATIVE
|
int error = reason == BiometricPrompt.DISMISSED_REASON_NEGATIVE
|
||||||
? BiometricConstants.BIOMETRIC_ERROR_NEGATIVE_BUTTON
|
? BiometricConstants.BIOMETRIC_ERROR_NEGATIVE_BUTTON
|
||||||
: reason == BiometricPrompt.DISMISSED_REASON_USER_CANCEL
|
: reason == BiometricPrompt.DISMISSED_REASON_USER_CANCEL
|
||||||
@@ -1087,7 +1092,8 @@ public class BiometricService extends SystemService {
|
|||||||
+ ", IsCrypto: " + mCurrentAuthSession.isCrypto()
|
+ ", IsCrypto: " + mCurrentAuthSession.isCrypto()
|
||||||
+ ", Action: " + BiometricsProtoEnums.ACTION_AUTHENTICATE
|
+ ", Action: " + BiometricsProtoEnums.ACTION_AUTHENTICATE
|
||||||
+ ", Client: " + BiometricsProtoEnums.CLIENT_BIOMETRIC_PROMPT
|
+ ", Client: " + BiometricsProtoEnums.CLIENT_BIOMETRIC_PROMPT
|
||||||
+ ", Error: " + error);
|
+ ", Error: " + error
|
||||||
|
+ ", Latency: " + latency);
|
||||||
}
|
}
|
||||||
// Auth canceled
|
// Auth canceled
|
||||||
StatsLog.write(StatsLog.BIOMETRIC_ERROR_OCCURRED,
|
StatsLog.write(StatsLog.BIOMETRIC_ERROR_OCCURRED,
|
||||||
@@ -1098,7 +1104,8 @@ public class BiometricService extends SystemService {
|
|||||||
BiometricsProtoEnums.CLIENT_BIOMETRIC_PROMPT,
|
BiometricsProtoEnums.CLIENT_BIOMETRIC_PROMPT,
|
||||||
error,
|
error,
|
||||||
0 /* vendorCode */,
|
0 /* vendorCode */,
|
||||||
Utils.isDebugEnabled(getContext(), mCurrentAuthSession.mUserId));
|
Utils.isDebugEnabled(getContext(), mCurrentAuthSession.mUserId),
|
||||||
|
latency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1422,6 +1429,9 @@ public class BiometricService extends SystemService {
|
|||||||
&& mCurrentAuthSession.mState == STATE_AUTH_PAUSED;
|
&& mCurrentAuthSession.mState == STATE_AUTH_PAUSED;
|
||||||
|
|
||||||
mCurrentAuthSession = mPendingAuthSession;
|
mCurrentAuthSession = mPendingAuthSession;
|
||||||
|
|
||||||
|
// Time starts when lower layers are ready to start the client.
|
||||||
|
mCurrentAuthSession.mStartTimeMs = System.currentTimeMillis();
|
||||||
mPendingAuthSession = null;
|
mPendingAuthSession = null;
|
||||||
|
|
||||||
mCurrentAuthSession.mState = STATE_AUTH_STARTED;
|
mCurrentAuthSession.mState = STATE_AUTH_STARTED;
|
||||||
|
|||||||
@@ -94,6 +94,10 @@ public abstract class LoggableMonitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected final void logOnError(Context context, int error, int vendorCode, int targetUserId) {
|
protected final void logOnError(Context context, int error, int vendorCode, int targetUserId) {
|
||||||
|
|
||||||
|
final long latency = mFirstAcquireTimeMs != 0
|
||||||
|
? (System.currentTimeMillis() - mFirstAcquireTimeMs) : -1;
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.v(TAG, "Error! Modality: " + statsModality()
|
Slog.v(TAG, "Error! Modality: " + statsModality()
|
||||||
+ ", User: " + targetUserId
|
+ ", User: " + targetUserId
|
||||||
@@ -101,7 +105,10 @@ public abstract class LoggableMonitor {
|
|||||||
+ ", Action: " + statsAction()
|
+ ", Action: " + statsAction()
|
||||||
+ ", Client: " + statsClient()
|
+ ", Client: " + statsClient()
|
||||||
+ ", Error: " + error
|
+ ", Error: " + error
|
||||||
+ ", VendorCode: " + vendorCode);
|
+ ", VendorCode: " + vendorCode
|
||||||
|
+ ", Latency: " + latency);
|
||||||
|
} else {
|
||||||
|
Slog.v(TAG, "Error latency: " + latency);
|
||||||
}
|
}
|
||||||
StatsLog.write(StatsLog.BIOMETRIC_ERROR_OCCURRED,
|
StatsLog.write(StatsLog.BIOMETRIC_ERROR_OCCURRED,
|
||||||
statsModality(),
|
statsModality(),
|
||||||
@@ -111,7 +118,8 @@ public abstract class LoggableMonitor {
|
|||||||
statsClient(),
|
statsClient(),
|
||||||
error,
|
error,
|
||||||
vendorCode,
|
vendorCode,
|
||||||
Utils.isDebugEnabled(context, targetUserId));
|
Utils.isDebugEnabled(context, targetUserId),
|
||||||
|
latency);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void logOnAuthenticated(Context context, boolean authenticated,
|
protected final void logOnAuthenticated(Context context, boolean authenticated,
|
||||||
|
|||||||
Reference in New Issue
Block a user