Merge "Add logging for AuthSession cancellation path" into sc-dev

This commit is contained in:
Kevin Chyn
2021-06-29 22:00:06 +00:00
committed by Android (Google) Code Review
6 changed files with 20 additions and 15 deletions

View File

@@ -366,10 +366,9 @@ public final class AuthSession implements IBinder.DeathRecipient {
// sending the final error callback to the application. // sending the final error callback to the application.
for (BiometricSensor sensor : mPreAuthInfo.eligibleSensors) { for (BiometricSensor sensor : mPreAuthInfo.eligibleSensors) {
try { try {
if (filter.apply(sensor)) { final boolean shouldCancel = filter.apply(sensor);
if (DEBUG) { Slog.d(TAG, "sensorId: " + sensor.id + ", shouldCancel: " + shouldCancel);
Slog.v(TAG, "Canceling sensor: " + sensor.id); if (shouldCancel) {
}
sensor.goToStateCancelling(mToken, mOpPackageName); sensor.goToStateCancelling(mToken, mOpPackageName);
} }
} catch (RemoteException e) { } catch (RemoteException e) {

View File

@@ -1369,11 +1369,11 @@ public class BiometricService extends SystemService {
/** /**
* handleAuthenticate() (above) which is called from BiometricPrompt determines which * handleAuthenticate() (above) which is called from BiometricPrompt determines which
* modality/modalities to start authenticating with. authenticateInternal() should only be * modality/modalities to start authenticating with. authenticateInternal() should only be
* used for: * used for preparing <Biometric>Services for authentication when BiometricPrompt#authenticate
* 1) Preparing <Biometric>Services for authentication when BiometricPrompt#authenticate is, * is invoked, shortly after which BiometricPrompt is shown and authentication starts.
* invoked, shortly after which BiometricPrompt is shown and authentication starts *
* 2) Preparing <Biometric>Services for authentication when BiometricPrompt is already shown * Note that this path is NOT invoked when the BiometricPrompt "Try again" button is pressed.
* and the user has pressed "try again" * In that case, see {@link #handleOnTryAgainPressed()}.
*/ */
private void authenticateInternal(IBinder token, long operationId, int userId, private void authenticateInternal(IBinder token, long operationId, int userId,
IBiometricServiceReceiver receiver, String opPackageName, PromptInfo promptInfo, IBiometricServiceReceiver receiver, String opPackageName, PromptInfo promptInfo,

View File

@@ -408,22 +408,22 @@ class PreAuthInfo {
public String toString() { public String toString() {
StringBuilder string = new StringBuilder( StringBuilder string = new StringBuilder(
"BiometricRequested: " + mBiometricRequested "BiometricRequested: " + mBiometricRequested
+ "\nStrengthRequested: " + mBiometricStrengthRequested + ", StrengthRequested: " + mBiometricStrengthRequested
+ "\nCredentialRequested: " + credentialRequested); + ", CredentialRequested: " + credentialRequested);
string.append("\nEligible:{"); string.append(", Eligible:{");
for (BiometricSensor sensor: eligibleSensors) { for (BiometricSensor sensor: eligibleSensors) {
string.append(sensor.id).append(" "); string.append(sensor.id).append(" ");
} }
string.append("}"); string.append("}");
string.append("\nIneligible:{"); string.append(", Ineligible:{");
for (Pair<BiometricSensor, Integer> ineligible : ineligibleSensors) { for (Pair<BiometricSensor, Integer> ineligible : ineligibleSensors) {
string.append(ineligible.first).append(":").append(ineligible.second).append(" "); string.append(ineligible.first).append(":").append(ineligible.second).append(" ");
} }
string.append("}"); string.append("}");
string.append("\nCredentialAvailable: ").append(credentialAvailable); string.append(", CredentialAvailable: ").append(credentialAvailable);
string.append("\n"); string.append(", ");
return string.toString(); return string.toString();
} }
} }

View File

@@ -579,6 +579,9 @@ public class BiometricScheduler {
final boolean isCorrectClient = isAuthenticationOrDetectionOperation(mCurrentOperation); final boolean isCorrectClient = isAuthenticationOrDetectionOperation(mCurrentOperation);
final boolean tokenMatches = mCurrentOperation.mClientMonitor.getToken() == token; final boolean tokenMatches = mCurrentOperation.mClientMonitor.getToken() == token;
Slog.d(getTag(), "cancelAuthenticationOrDetection, isCorrectClient: " + isCorrectClient
+ ", tokenMatches: " + tokenMatches);
if (isCorrectClient && tokenMatches) { if (isCorrectClient && tokenMatches) {
Slog.d(getTag(), "Cancelling: " + mCurrentOperation); Slog.d(getTag(), "Cancelling: " + mCurrentOperation);
cancelInternal(mCurrentOperation); cancelInternal(mCurrentOperation);

View File

@@ -498,6 +498,8 @@ public class FingerprintService extends SystemService {
Utils.checkPermission(getContext(), MANAGE_BIOMETRIC); Utils.checkPermission(getContext(), MANAGE_BIOMETRIC);
Slog.d(TAG, "cancelAuthenticationFromService, sensorId: " + sensorId);
final ServiceProvider provider = getProviderForSensor(sensorId); final ServiceProvider provider = getProviderForSensor(sensorId);
if (provider == null) { if (provider == null) {
Slog.w(TAG, "Null provider for cancelAuthenticationFromService"); Slog.w(TAG, "Null provider for cancelAuthenticationFromService");

View File

@@ -632,6 +632,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
@Override @Override
public void cancelAuthentication(int sensorId, @NonNull IBinder token) { public void cancelAuthentication(int sensorId, @NonNull IBinder token) {
Slog.d(TAG, "cancelAuthentication, sensorId: " + sensorId);
mHandler.post(() -> mScheduler.cancelAuthenticationOrDetection(token)); mHandler.post(() -> mScheduler.cancelAuthenticationOrDetection(token));
} }