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 Details

    • biometricServiceConnected

      protected static boolean biometricServiceConnected
  • Constructor Details

    • ShadowBiometricManager

      public ShadowBiometricManager()
  • Method Details

    • reset

      @Resetter public static void reset()
    • canAuthenticate

      @Implementation protected int canAuthenticate()
    • canAuthenticate

      @Implementation(minSdk=30) protected int canAuthenticate(int authenticators)
    • canAuthenticate

      @Implementation(minSdk=30) protected int canAuthenticate(int userId, int authenticators)
    • setCanAuthenticate

      public void setCanAuthenticate(boolean flag)
      Sets the value true to allow canAuthenticate() return BIOMETRIC_SUCCESS If sets the value to false, result will depend on BiometricManager#hasBiometrics(Context context)
      Parameters:
      flag - to set can authenticate or not
    • setAuthenticatorType

      public void setAuthenticatorType(int type)
      Allow different result canAuthenticate(int), result will depend on the combination as described here For example, you can set the value BiometricManager.Authenticators.BIOMETRIC_STRONG to allow canAuthenticate(int) return BiometricManager.BIOMETRIC_SUCCESS when you passed BiometricManager.Authenticators.BIOMETRIC_WEAK as parameter in canAuthenticate(int)
      Parameters:
      type - to set the authenticatorType
      See Also: