public class FingerprintManager extends Object
Use Context.getSystemService(java.lang.String)
with argument Context.FINGERPRINT_SERVICE
to get
an instance of this class.
Modifier and Type | Class and Description |
---|---|
static class |
FingerprintManager.AuthenticationCallback
Callback structure provided to
authenticate(CryptoObject,
CancellationSignal, int, AuthenticationCallback, Handler) . |
static class |
FingerprintManager.AuthenticationResult
Container for callback data from
authenticate(CryptoObject,
CancellationSignal, int, AuthenticationCallback, Handler) . |
static class |
FingerprintManager.CryptoObject
A wrapper class for the crypto objects supported by FingerprintManager.
|
static class |
FingerprintManager.EnrollmentCallback
Callback structure provided to {@link FingerprintManager#enroll(long, EnrollmentCallback,
CancellationSignal, int).
|
static class |
FingerprintManager.LockoutResetCallback |
static class |
FingerprintManager.RemovalCallback
Callback structure provided to {@link FingerprintManager#remove(int).
|
Modifier and Type | Field and Description |
---|---|
static int |
FINGERPRINT_ACQUIRED_GOOD
The image acquired was good.
|
static int |
FINGERPRINT_ACQUIRED_IMAGER_DIRTY
The fingerprint image was too noisy due to suspected or detected dirt on the sensor.
|
static int |
FINGERPRINT_ACQUIRED_INSUFFICIENT
The fingerprint image was too noisy to process due to a detected condition (i.e. dry skin) or
a possibly dirty sensor (See
FINGERPRINT_ACQUIRED_IMAGER_DIRTY ). |
static int |
FINGERPRINT_ACQUIRED_PARTIAL
Only a partial fingerprint image was detected.
|
static int |
FINGERPRINT_ACQUIRED_TOO_FAST
The fingerprint image was incomplete due to quick motion.
|
static int |
FINGERPRINT_ACQUIRED_TOO_SLOW
The fingerprint image was unreadable due to lack of motion.
|
static int |
FINGERPRINT_ACQUIRED_VENDOR_BASE
Hardware vendors may extend this list if there are conditions that do not fall under one of
the above categories.
|
static int |
FINGERPRINT_ERROR_CANCELED
The operation was canceled because the fingerprint sensor is unavailable.
|
static int |
FINGERPRINT_ERROR_HW_UNAVAILABLE
The hardware is unavailable.
|
static int |
FINGERPRINT_ERROR_LOCKOUT
The operation was canceled because the API is locked out due to too many attempts.
|
static int |
FINGERPRINT_ERROR_NO_SPACE
Error state returned for operations like enrollment; the operation cannot be completed
because there's not enough storage remaining to complete the operation.
|
static int |
FINGERPRINT_ERROR_TIMEOUT
Error state returned when the current request has been running too long.
|
static int |
FINGERPRINT_ERROR_UNABLE_TO_PROCESS
Error state returned when the sensor was unable to process the current image.
|
static int |
FINGERPRINT_ERROR_UNABLE_TO_REMOVE
The
FingerprintManager#remove(Fingerprint, RemovalCallback) call failed. |
static int |
FINGERPRINT_ERROR_VENDOR_BASE
Hardware vendors may extend this list if there are conditions that do not fall under one of
the above categories.
|
Constructor and Description |
---|
FingerprintManager(Context context,
IFingerprintService service) |
Modifier and Type | Method and Description |
---|---|
void |
addLockoutResetCallback(FingerprintManager.LockoutResetCallback callback) |
void |
authenticate(FingerprintManager.CryptoObject crypto,
CancellationSignal cancel,
int flags,
FingerprintManager.AuthenticationCallback callback,
Handler handler)
Request authentication of a crypto object.
|
void |
authenticate(FingerprintManager.CryptoObject crypto,
CancellationSignal cancel,
int flags,
FingerprintManager.AuthenticationCallback callback,
Handler handler,
int userId)
Per-user version
|
void |
enroll(byte[] token,
CancellationSignal cancel,
int flags,
int userId,
FingerprintManager.EnrollmentCallback callback)
Request fingerprint enrollment.
|
long |
getAuthenticatorId()
Retrieves the authenticator token for binding keys to the lifecycle
of the current set of fingerprints.
|
List<Fingerprint> |
getEnrolledFingerprints()
Obtain the list of enrolled fingerprints templates.
|
List<Fingerprint> |
getEnrolledFingerprints(int userId)
Obtain the list of enrolled fingerprints templates.
|
boolean |
hasEnrolledFingerprints()
Determine if there is at least one fingerprint enrolled.
|
boolean |
hasEnrolledFingerprints(int userId) |
boolean |
isHardwareDetected()
Determine if fingerprint hardware is present and functional.
|
int |
postEnroll()
Finishes enrollment and cancels the current auth token.
|
long |
preEnroll()
Requests a pre-enrollment auth token to tie enrollment to the confirmation of
existing device credentials (e.g. pin/pattern/password).
|
void |
remove(Fingerprint fp,
int userId,
FingerprintManager.RemovalCallback callback)
Remove given fingerprint template from fingerprint hardware and/or protected storage.
|
void |
rename(int fpId,
int userId,
String newName)
Renames the given fingerprint template
|
void |
resetTimeout(byte[] token)
Reset the lockout timer when asked to do so by keyguard.
|
void |
setActiveUser(int userId)
Sets the active user.
|
public static final int FINGERPRINT_ERROR_HW_UNAVAILABLE
public static final int FINGERPRINT_ERROR_UNABLE_TO_PROCESS
public static final int FINGERPRINT_ERROR_TIMEOUT
public static final int FINGERPRINT_ERROR_NO_SPACE
public static final int FINGERPRINT_ERROR_CANCELED
public static final int FINGERPRINT_ERROR_UNABLE_TO_REMOVE
FingerprintManager#remove(Fingerprint, RemovalCallback)
call failed. Typically
this will happen when the provided fingerprint id was incorrect.public static final int FINGERPRINT_ERROR_LOCKOUT
public static final int FINGERPRINT_ERROR_VENDOR_BASE
public static final int FINGERPRINT_ACQUIRED_GOOD
public static final int FINGERPRINT_ACQUIRED_PARTIAL
public static final int FINGERPRINT_ACQUIRED_INSUFFICIENT
FINGERPRINT_ACQUIRED_IMAGER_DIRTY
).public static final int FINGERPRINT_ACQUIRED_IMAGER_DIRTY
FINGERPRINT_ACQUIRED_INSUFFICIENT
or actual detection of dirt on the sensor
(stuck pixels, swaths, etc.). The user is expected to take action to clean the sensor
when this is returned.public static final int FINGERPRINT_ACQUIRED_TOO_SLOW
public static final int FINGERPRINT_ACQUIRED_TOO_FAST
public static final int FINGERPRINT_ACQUIRED_VENDOR_BASE
public FingerprintManager(Context context, IFingerprintService service)
public void authenticate(FingerprintManager.CryptoObject crypto, CancellationSignal cancel, int flags, FingerprintManager.AuthenticationCallback callback, Handler handler)
FingerprintManager.AuthenticationCallback.onAuthenticationError(int, CharSequence)
or
AuthenticationCallback#onAuthenticationSucceeded(AuthenticationResult)
is called, at
which point the object is no longer valid. The operation can be canceled by using the
provided cancel object.crypto
- object associated with the call or null if none required.cancel
- an object that can be used to cancel authenticationflags
- optional flags; should be 0callback
- an object to receive authentication eventshandler
- an optional handler to handle callback eventsIllegalArgumentException
- if the crypto operation is not supported or is not backed
by Android Keystore
facility.IllegalStateException
- if the crypto primitive is not initialized.public void authenticate(FingerprintManager.CryptoObject crypto, CancellationSignal cancel, int flags, FingerprintManager.AuthenticationCallback callback, Handler handler, int userId)
public void enroll(byte[] token, CancellationSignal cancel, int flags, int userId, FingerprintManager.EnrollmentCallback callback)
FingerprintManager.EnrollmentCallback
object. It terminates when
FingerprintManager.EnrollmentCallback.onEnrollmentError(int, CharSequence)
or
{@link EnrollmentCallback#onEnrollmentProgress(int) is called with remaining == 0, at
which point the object is no longer valid. The operation can be canceled by using the
provided cancel object.token
- a unique token provided by a recent creation or verification of device
credentials (e.g. pin, pattern or password).cancel
- an object that can be used to cancel enrollmentflags
- optional flagsuserId
- the user to whom this fingerprint will belong tocallback
- an object to receive enrollment eventspublic long preEnroll()
public int postEnroll()
public void setActiveUser(int userId)
userId
- public void remove(Fingerprint fp, int userId, FingerprintManager.RemovalCallback callback)
fp
- the fingerprint item to removeuserId
- the user who this fingerprint belongs tocallback
- an optional callback to verify that fingerprint templates have been
successfully removed. May be null of no callback is required.public void rename(int fpId, int userId, String newName)
fpId
- the fingerprint iduserId
- the user who this fingerprint belongs tonewName
- the new namepublic List<Fingerprint> getEnrolledFingerprints(int userId)
public List<Fingerprint> getEnrolledFingerprints()
public boolean hasEnrolledFingerprints()
public boolean hasEnrolledFingerprints(int userId)
public boolean isHardwareDetected()
public long getAuthenticatorId()
public void resetTimeout(byte[] token)
token
- an opaque token returned by password confirmation.public void addLockoutResetCallback(FingerprintManager.LockoutResetCallback callback)