Package org.robolectric.shadows
Class ShadowFingerprintManager
java.lang.Object
org.robolectric.shadows.ShadowFingerprintManager
@Implements(value=android.hardware.fingerprint.FingerprintManager.class,
minSdk=23)
public class ShadowFingerprintManager
extends Object
Provides testing APIs for
FingerprintManager-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidauthenticate(FingerprintManager.CryptoObject crypto, CancellationSignal cancel, int flags, FingerprintManager.AuthenticationCallback callback, Handler handler) Success or failure can be simulated with a subsequent call toauthenticationSucceeds()orauthenticationFails().voidSimulates a failed fingerprint authentication.voidSimulates a successful fingerprint authentication.protected FingerprintManager.AuthenticationResultprotected List<Fingerprint>intgetFingerprintId(int index) protected List<FingerprintSensorPropertiesInternal>protected booleanReturnsfalseby default, or the value specified viasetHasEnrolledFingerprints(boolean).protected booleanvoidsetDefaultFingerprints(int num) Enrolls the given number of fingerprints, which will be returned ingetEnrolledFingerprints().voidsetHasEnrolledFingerprints(boolean hasEnrolledFingerprints) Deprecated.voidsetIsHardwareDetected(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 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
Returnsfalseby 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.