@Implements(value=android.hardware.fingerprint.FingerprintManager.class) public class ShadowFingerprintManager extends java.lang.Object
Provides testing APIs for FingerprintManager
Constructor and Description |
---|
ShadowFingerprintManager() |
Modifier and Type | Method and Description |
---|---|
protected void |
authenticate(android.hardware.fingerprint.FingerprintManager.CryptoObject crypto,
android.os.CancellationSignal cancel,
int flags,
android.hardware.fingerprint.FingerprintManager.AuthenticationCallback callback,
android.os.Handler handler)
Success or failure can be simulated with a subsequent call to
authenticationSucceeds() or authenticationFails() . |
void |
authenticationFails()
Simulates a failed fingerprint authentication.
|
void |
authenticationSucceeds()
Simulates a successful fingerprint authentication.
|
protected java.util.List<android.hardware.fingerprint.Fingerprint> |
getEnrolledFingerprints() |
int |
getFingerprintId(int index) |
protected boolean |
hasEnrolledFingerprints()
Returns
false by default, or the value specified via setHasEnrolledFingerprints(boolean) . |
protected boolean |
isHardwareDetected() |
void |
setDefaultFingerprints(int num)
Enrolls the given number of fingerprints, which will be returned in
getEnrolledFingerprints() . |
void |
setHasEnrolledFingerprints(boolean hasEnrolledFingerprints)
Deprecated.
use
setDefaultFingerprints(int) instead. |
void |
setIsHardwareDetected(boolean isHardwareDetected)
Sets the return value of
FingerprintManager.isHardwareDetected() . |
public void authenticationSucceeds()
Simulates a successful fingerprint authentication. An authentication request must have been issued with FingerprintManager.authenticate(CryptoObject, CancellationSignal, int, AuthenticationCallback, Handler)
and not cancelled.
public void authenticationFails()
Simulates a failed fingerprint authentication. An authentication request must have been issued with FingerprintManager.authenticate(CryptoObject, CancellationSignal, int, AuthenticationCallback, Handler)
and not cancelled.
@Implementation(minSdk=23) protected void authenticate(android.hardware.fingerprint.FingerprintManager.CryptoObject crypto, android.os.CancellationSignal cancel, int flags, android.hardware.fingerprint.FingerprintManager.AuthenticationCallback callback, android.os.Handler handler)
Success or failure can be simulated with a subsequent call to authenticationSucceeds()
or authenticationFails()
.
@Deprecated public void setHasEnrolledFingerprints(boolean hasEnrolledFingerprints)
setDefaultFingerprints(int)
instead.Sets the return value of FingerprintManager.hasEnrolledFingerprints()
.
@Implementation(minSdk=23) protected boolean hasEnrolledFingerprints()
Returns false
by default, or the value specified via setHasEnrolledFingerprints(boolean)
.
@HiddenApi @Implementation(minSdk=23) protected java.util.List<android.hardware.fingerprint.Fingerprint> getEnrolledFingerprints()
setDefaultFingerprints(int)
public int getFingerprintId(int index)
public void setDefaultFingerprints(int num)
Enrolls the given number of fingerprints, which will be returned in getEnrolledFingerprints()
.
num
- the quantity of fingerprint item.public void setIsHardwareDetected(boolean isHardwareDetected)
Sets the return value of FingerprintManager.isHardwareDetected()
.
@Implementation(minSdk=23) protected boolean isHardwareDetected()
false
by default, or the value specified via setIsHardwareDetected(boolean)