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
Modifier and TypeFieldDescriptionprotected android.hardware.fingerprint.FingerprintManager.CryptoObject
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
authenticate
(android.hardware.fingerprint.FingerprintManager.CryptoObject crypto, CancellationSignal cancel, int flags, android.hardware.fingerprint.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 android.hardware.fingerprint.FingerprintManager.AuthenticationResult
protected List<android.hardware.fingerprint.Fingerprint>
int
getFingerprintId
(int index) protected List<android.hardware.fingerprint.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
protected android.hardware.fingerprint.FingerprintManager.CryptoObject 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
protected android.hardware.fingerprint.FingerprintManager.AuthenticationResult 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(android.hardware.fingerprint.FingerprintManager.CryptoObject crypto, CancellationSignal cancel, int flags, android.hardware.fingerprint.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
@HiddenApi @Implementation(minSdk=23) protected List<android.hardware.fingerprint.Fingerprint> 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<android.hardware.fingerprint.FingerprintSensorPropertiesInternal> getSensorPropertiesInternal()
-
setDefaultFingerprints(int)
instead.