/** * Return an {@link Observable} that will continue to emit events as long as the fingerprint * sensor is active. * * @see Reprint#authenticate(AuthenticationListener) */ public static Observable<AuthenticationResult> authenticate() { return authenticate(RestartPredicates.defaultPredicate()); }
/** * Return an {@link Flowable} that will continue to emit events as long as the fingerprint * sensor is active. * * @see Reprint#authenticate(AuthenticationListener) */ public static Flowable<AuthenticationResult> authenticate() { return authenticate(RestartPredicates.defaultPredicate()); }
/** * Start a fingerprint authentication request. * <p/> * Equivalent to calling {@link #authenticate(AuthenticationListener, RestartPredicate)} with * {@link RestartPredicates#defaultPredicate()} * * @param listener The listener that will be notified of authentication events. */ public static void authenticate(AuthenticationListener listener) { authenticate(listener, RestartPredicates.defaultPredicate()); }
@Test public void defaultPredicate_passesUnlimitedNonFatal() throws Exception { Reprint.RestartPredicate predicate = RestartPredicates.defaultPredicate(); assertTrue(predicate.invoke(AUTHENTICATION_FAILED, 0)); assertTrue(predicate.invoke(AUTHENTICATION_FAILED, 1)); assertTrue(predicate.invoke(AUTHENTICATION_FAILED, 2)); assertTrue(predicate.invoke(AUTHENTICATION_FAILED, 3)); assertTrue(predicate.invoke(AUTHENTICATION_FAILED, 4)); assertTrue(predicate.invoke(AUTHENTICATION_FAILED, 5)); }
@Test public void defaultPredicate_passesLimitedTimeout() throws Exception { Reprint.RestartPredicate predicate = RestartPredicates.defaultPredicate(); assertTrue(predicate.invoke(TIMEOUT, 0)); assertTrue(predicate.invoke(TIMEOUT, 1)); assertTrue(predicate.invoke(TIMEOUT, 2)); assertTrue(predicate.invoke(TIMEOUT, 3)); assertTrue(predicate.invoke(TIMEOUT, 4)); assertFalse(predicate.invoke(TIMEOUT, 5)); }
@Test public void defaultPredicate_passesMixedAuthFailureAndTimeout() throws Exception { Reprint.RestartPredicate predicate = RestartPredicates.defaultPredicate(); assertTrue(predicate.invoke(AUTHENTICATION_FAILED, 0)); assertTrue(predicate.invoke(TIMEOUT, 1)); assertTrue(predicate.invoke(AUTHENTICATION_FAILED, 2)); assertTrue(predicate.invoke(TIMEOUT, 3)); assertTrue(predicate.invoke(TIMEOUT, 4)); assertTrue(predicate.invoke(TIMEOUT, 5)); assertTrue(predicate.invoke(TIMEOUT, 6)); assertFalse(predicate.invoke(TIMEOUT, 7)); }