Merge "Add missing parameters to notifyAcquired and notifyError"

This commit is contained in:
Kevin Chyn
2020-10-20 21:32:39 +00:00
committed by Android (Google) Code Review
6 changed files with 70 additions and 12 deletions

View File

@@ -688,8 +688,8 @@ package android.hardware.biometrics {
method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void cleanupInternalState(int);
method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void close();
method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void finishEnroll(int);
method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void notifyAcquired(int);
method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void notifyError(int);
method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void notifyAcquired(int, int);
method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void notifyError(int, int);
method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void rejectAuthentication(int);
method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void startEnroll(int);
}

View File

@@ -172,8 +172,7 @@ public interface BiometricConstants {
BIOMETRIC_ERROR_NEGATIVE_BUTTON,
BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL,
BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED,
BIOMETRIC_PAUSED_REJECTED,
BIOMETRIC_ERROR_VENDOR_BASE})
BIOMETRIC_PAUSED_REJECTED})
@Retention(RetentionPolicy.SOURCE)
@interface Errors {}
@@ -181,6 +180,19 @@ public interface BiometricConstants {
// Image acquisition messages.
//
/**
* @hide
*/
@IntDef({BIOMETRIC_ACQUIRED_GOOD,
BIOMETRIC_ACQUIRED_PARTIAL,
BIOMETRIC_ACQUIRED_INSUFFICIENT,
BIOMETRIC_ACQUIRED_IMAGER_DIRTY,
BIOMETRIC_ACQUIRED_TOO_SLOW,
BIOMETRIC_ACQUIRED_TOO_FAST,
BIOMETRIC_ACQUIRED_VENDOR})
@Retention(RetentionPolicy.SOURCE)
@interface Acquired {}
/**
* The image acquired was good.
*/

View File

@@ -16,11 +16,15 @@
package android.hardware.biometrics;
import android.annotation.IntDef;
import android.app.KeyguardManager;
import android.compat.annotation.UnsupportedAppUsage;
import android.hardware.biometrics.BiometricManager.Authenticators;
import android.hardware.fingerprint.FingerprintManager;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Interface containing all of the fingerprint-specific constants.
*
@@ -35,6 +39,27 @@ public interface BiometricFingerprintConstants {
// removal. Must agree with the list in fingerprint.h
//
/**
* @hide
*/
@IntDef({FINGERPRINT_ERROR_HW_UNAVAILABLE,
FINGERPRINT_ERROR_UNABLE_TO_PROCESS,
FINGERPRINT_ERROR_TIMEOUT,
FINGERPRINT_ERROR_NO_SPACE,
FINGERPRINT_ERROR_CANCELED,
FINGERPRINT_ERROR_UNABLE_TO_REMOVE,
FINGERPRINT_ERROR_LOCKOUT,
FINGERPRINT_ERROR_VENDOR,
FINGERPRINT_ERROR_LOCKOUT_PERMANENT,
FINGERPRINT_ERROR_USER_CANCELED,
FINGERPRINT_ERROR_NO_FINGERPRINTS,
FINGERPRINT_ERROR_HW_NOT_PRESENT,
FINGERPRINT_ERROR_NEGATIVE_BUTTON,
BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL,
BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED})
@Retention(RetentionPolicy.SOURCE)
@interface FingerprintError {}
/**
* The hardware is unavailable. Try again later.
*/
@@ -149,6 +174,20 @@ public interface BiometricFingerprintConstants {
// Image acquisition messages. Must agree with those in fingerprint.h
//
/**
* @hide
*/
@IntDef({FINGERPRINT_ACQUIRED_GOOD,
FINGERPRINT_ACQUIRED_PARTIAL,
FINGERPRINT_ACQUIRED_INSUFFICIENT,
FINGERPRINT_ACQUIRED_IMAGER_DIRTY,
FINGERPRINT_ACQUIRED_TOO_SLOW,
FINGERPRINT_ACQUIRED_TOO_FAST,
FINGERPRINT_ACQUIRED_VENDOR,
FINGERPRINT_ACQUIRED_START})
@Retention(RetentionPolicy.SOURCE)
@interface FingerprintAcquired {}
/**
* The image acquired was good.
*/

View File

@@ -22,6 +22,7 @@ import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.TestApi;
import android.content.Context;
import android.hardware.fingerprint.FingerprintManager;
import android.os.RemoteException;
import android.util.ArraySet;
@@ -128,11 +129,14 @@ public class BiometricTestSession implements AutoCloseable {
* Simulates an acquired message from the HAL.
*
* @param userId User that this command applies to.
* @param acquireInfo See
* {@link BiometricPrompt.AuthenticationCallback#onAuthenticationAcquired(int)} and
* {@link FingerprintManager.AuthenticationCallback#onAuthenticationAcquired(int)}
*/
@RequiresPermission(TEST_BIOMETRIC)
public void notifyAcquired(int userId) {
public void notifyAcquired(int userId, int acquireInfo) {
try {
mTestSession.notifyAcquired(userId);
mTestSession.notifyAcquired(userId, acquireInfo);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -142,11 +146,14 @@ public class BiometricTestSession implements AutoCloseable {
* Simulates an error message from the HAL.
*
* @param userId User that this command applies to.
* @param errorCode See
* {@link BiometricPrompt.AuthenticationCallback#onAuthenticationError(int, CharSequence)} and
* {@link FingerprintManager.AuthenticationCallback#onAuthenticationError(int, CharSequence)}
*/
@RequiresPermission(TEST_BIOMETRIC)
public void notifyError(int userId) {
public void notifyError(int userId, int errorCode) {
try {
mTestSession.notifyError(userId);
mTestSession.notifyError(userId, errorCode);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}

View File

@@ -42,10 +42,10 @@ interface ITestSession {
void rejectAuthentication(int userId);
// Simulates an acquired message from the HAL.
void notifyAcquired(int userId);
void notifyAcquired(int userId, int acquireInfo);
// Simulates an error message from the HAL.
void notifyError(int userId);
void notifyError(int userId, int errorCode);
// Matches the framework's cached enrollments against the HAL's enrollments. Any enrollment
// that isn't known by both sides are deleted. This should generally be used when the test

View File

@@ -127,12 +127,12 @@ public class FingerprintService extends SystemService {
}
@Override
public void notifyAcquired(int userId) {
public void notifyAcquired(int userId, int acquireInfo) {
Utils.checkPermission(getContext(), TEST_BIOMETRIC);
}
@Override
public void notifyError(int userId) {
public void notifyError(int userId, int errorCode) {
Utils.checkPermission(getContext(), TEST_BIOMETRIC);
}