Package org.robolectric.shadows
Class ShadowBiometricManager
java.lang.Object
org.robolectric.shadows.ShadowBiometricManager
@Implements(className="android.hardware.biometrics.BiometricManager",
minSdk=29,
isInAndroidSdk=false)
public class ShadowBiometricManager
extends Object
Provides testing APIs for
BiometricManager
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected int
protected int
canAuthenticate
(int authenticators) protected int
canAuthenticate
(int userId, int authenticators) protected long
getLastAuthenticationTime
(int authenticators) Gets the last authentication time set bysetLastAuthenticationTime(long)
.static void
reset()
void
setAuthenticatorType
(int type) Allow different resultcanAuthenticate(int)
, result will depend on the combination as described here For example, you can set the valueBiometricManager.Authenticators.BIOMETRIC_STRONG
to allowcanAuthenticate(int)
returnBiometricManager.BIOMETRIC_SUCCESS
when you passedBiometricManager.Authenticators.BIOMETRIC_WEAK
as parameter incanAuthenticate(int)
void
setCanAuthenticate
(boolean flag) Sets the valuetrue
to allowcanAuthenticate()
returnBiometricManager.BIOMETRIC_SUCCESS
If sets the value tofalse
, result will depend oninvalid reference
BiometricManager#hasBiometrics(Context)
void
setLastAuthenticationTime
(long time) Sets the last authentication time.
-
Field Details
-
biometricServiceConnected
protected static boolean biometricServiceConnected
-
-
Constructor Details
-
ShadowBiometricManager
public ShadowBiometricManager()
-
-
Method Details
-
reset
-
canAuthenticate
-
canAuthenticate
-
canAuthenticate
-
setCanAuthenticate
public void setCanAuthenticate(boolean flag) Sets the valuetrue
to allowcanAuthenticate()
returnBiometricManager.BIOMETRIC_SUCCESS
If sets the value tofalse
, result will depend oninvalid reference
BiometricManager#hasBiometrics(Context)
- Parameters:
flag
- to set can authenticate or not
-
setAuthenticatorType
public void setAuthenticatorType(int type) Allow different resultcanAuthenticate(int)
, result will depend on the combination as described here For example, you can set the valueBiometricManager.Authenticators.BIOMETRIC_STRONG
to allowcanAuthenticate(int)
returnBiometricManager.BIOMETRIC_SUCCESS
when you passedBiometricManager.Authenticators.BIOMETRIC_WEAK
as parameter incanAuthenticate(int)
- Parameters:
type
- to set the authenticatorType- See Also:
-
setLastAuthenticationTime
public void setLastAuthenticationTime(long time) Sets the last authentication time.- Parameters:
time
- the last authentication time orBiometricManager.BIOMETRIC_NO_AUTHENTICATION
-
getLastAuthenticationTime
Gets the last authentication time set bysetLastAuthenticationTime(long)
.
-