Merge "Move synchronous generateChallenge to implementation-specific classes"

This commit is contained in:
Kevin Chyn
2020-10-03 00:04:12 +00:00
committed by Android (Google) Code Review
3 changed files with 16 additions and 11 deletions

View File

@@ -27,8 +27,6 @@ public abstract class GenerateChallengeClient<T> extends ClientMonitor<T> {
private static final String TAG = "GenerateChallengeClient";
protected long mChallenge;
public GenerateChallengeClient(@NonNull Context context, @NonNull LazyDaemon<T> lazyDaemon,
@NonNull IBinder token, @NonNull ClientMonitorCallbackConverter listener,
@NonNull String owner, int sensorId) {
@@ -51,12 +49,5 @@ public abstract class GenerateChallengeClient<T> extends ClientMonitor<T> {
super.start(callback);
startHalOperation();
try {
getListener().onChallengeGenerated(getSensorId(), mChallenge);
mCallback.onClientFinished(this, true /* success */);
} catch (RemoteException e) {
Slog.e(TAG, "Remote exception", e);
mCallback.onClientFinished(this, false /* success */);
}
}
}

View File

@@ -59,7 +59,14 @@ public class FaceGenerateChallengeClient extends GenerateChallengeClient<IBiomet
@Override
protected void startHalOperation() {
try {
mChallenge = getFreshDaemon().generateChallenge(CHALLENGE_TIMEOUT_SEC).value;
final long challenge = getFreshDaemon().generateChallenge(CHALLENGE_TIMEOUT_SEC).value;
try {
getListener().onChallengeGenerated(getSensorId(), challenge);
mCallback.onClientFinished(this, true /* success */);
} catch (RemoteException e) {
Slog.e(TAG, "Remote exception", e);
mCallback.onClientFinished(this, false /* success */);
}
} catch (RemoteException e) {
Slog.e(TAG, "generateChallenge failed", e);
}

View File

@@ -45,7 +45,14 @@ public class FingerprintGenerateChallengeClient
@Override
protected void startHalOperation() {
try {
mChallenge = getFreshDaemon().preEnroll();
final long challenge = getFreshDaemon().preEnroll();
try {
getListener().onChallengeGenerated(getSensorId(), challenge);
mCallback.onClientFinished(this, true /* success */);
} catch (RemoteException e) {
Slog.e(TAG, "Remote exception", e);
mCallback.onClientFinished(this, false /* success */);
}
} catch (RemoteException e) {
Slog.e(TAG, "preEnroll failed", e);
}