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 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 with FingerprintManager.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 with FingerprintManager.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 to authenticationSucceeds() or authenticationFails().
    • setHasEnrolledFingerprints

      @Deprecated public void setHasEnrolledFingerprints(boolean hasEnrolledFingerprints)
      Deprecated.
      Sets the return value of FingerprintManager.hasEnrolledFingerprints().
    • hasEnrolledFingerprints

      @Implementation(minSdk=23) protected boolean hasEnrolledFingerprints()
      Returns false by default, or the value specified via setHasEnrolledFingerprints(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 in getEnrolledFingerprints().
      Parameters:
      num - the quantity of fingerprint item.
    • setIsHardwareDetected

      public void setIsHardwareDetected(boolean isHardwareDetected)
      Sets the return value of FingerprintManager.isHardwareDetected().
    • isHardwareDetected

      @Implementation(minSdk=23) protected boolean isHardwareDetected()
      Returns:
      false by default, or the value specified via setIsHardwareDetected(boolean)
    • getSensorPropertiesInternal

      @Implementation(minSdk=31) protected List<android.hardware.fingerprint.FingerprintSensorPropertiesInternal> getSensorPropertiesInternal()