Package org.robolectric.shadows
Class ShadowFingerprintManager
java.lang.Object
org.robolectric.shadows.ShadowFingerprintManager
@Implements(android.hardware.fingerprint.FingerprintManager.class)
public class ShadowFingerprintManager
extends Object
Provides testing APIs for
FingerprintManager
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
authenticate
(FingerprintManager.CryptoObject crypto, CancellationSignal cancel, int flags, FingerprintManager.AuthenticationCallback callback, Handler handler) Success or failure can be simulated with a subsequent call toauthenticationSucceeds()
orauthenticationFails()
.void
Simulates a failed fingerprint authentication.void
Simulates a successful fingerprint authentication.protected FingerprintManager.AuthenticationResult
protected List<Fingerprint>
int
getFingerprintId
(int index) protected List<FingerprintSensorPropertiesInternal>
protected boolean
Returnsfalse
by default, or the value specified viasetHasEnrolledFingerprints(boolean)
.protected boolean
void
setDefaultFingerprints
(int num) Enrolls the given number of fingerprints, which will be returned ingetEnrolledFingerprints()
.void
setHasEnrolledFingerprints
(boolean hasEnrolledFingerprints) Deprecated.void
setIsHardwareDetected
(boolean isHardwareDetected) Sets the return value ofFingerprintManager.isHardwareDetected()
.
-
Field Details
-
pendingCryptoObject
-
-
Constructor Details
-
ShadowFingerprintManager
public ShadowFingerprintManager()
-
-
Method Details
-
authenticationSucceeds
public void authenticationSucceeds()Simulates a successful fingerprint authentication. An authentication request must have been issued withFingerprintManager.authenticate(CryptoObject, CancellationSignal, int, AuthenticationCallback, Handler)
and not cancelled. -
createAuthenticationResult
-
authenticationFails
public void authenticationFails()Simulates a failed fingerprint authentication. An authentication request must have been issued withFingerprintManager.authenticate(CryptoObject, CancellationSignal, int, AuthenticationCallback, Handler)
and not cancelled. -
authenticate
@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 toauthenticationSucceeds()
orauthenticationFails()
. -
setHasEnrolledFingerprints
Deprecated.usesetDefaultFingerprints(int)
instead.Sets the return value ofFingerprintManager.hasEnrolledFingerprints()
. -
hasEnrolledFingerprints
Returnsfalse
by default, or the value specified viasetHasEnrolledFingerprints(boolean)
. -
getEnrolledFingerprints
- Returns:
- lists of current fingerprint items, the list be set via
setDefaultFingerprints(int)
-
getFingerprintId
public int getFingerprintId(int index) - Returns:
- Returns the finger ID for the given index.
-
setDefaultFingerprints
public void setDefaultFingerprints(int num) Enrolls the given number of fingerprints, which will be returned ingetEnrolledFingerprints()
.- Parameters:
num
- the quantity of fingerprint item.
-
setIsHardwareDetected
public void setIsHardwareDetected(boolean isHardwareDetected) Sets the return value ofFingerprintManager.isHardwareDetected()
. -
isHardwareDetected
- Returns:
- false by default, or the value specified via
setIsHardwareDetected(boolean)
-
getSensorPropertiesInternal
@Implementation(minSdk=31) protected List<FingerprintSensorPropertiesInternal> getSensorPropertiesInternal()
-
setDefaultFingerprints(int)
instead.