@Implements(value=android.hardware.fingerprint.FingerprintManager.class) public class ShadowFingerprintManager extends Object
Provides testing APIs for FingerprintManager
Constructor and Description |
---|
ShadowFingerprintManager() |
Modifier and Type | Method and Description |
---|---|
protected void |
authenticate(FingerprintManager.CryptoObject crypto,
CancellationSignal cancel,
int flags,
FingerprintManager.AuthenticationCallback callback,
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 List<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(FingerprintManager.CryptoObject crypto, CancellationSignal cancel, int flags, FingerprintManager.AuthenticationCallback callback, 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 List<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)