Tabnine Logo
CancellationSignal
Code IndexAdd Tabnine to your IDE (free)

How to use
CancellationSignal
in
androidx.core.os

Best Java code snippets using androidx.core.os.CancellationSignal (Showing top 20 results out of 315)

origin: uccmawei/FingerprintIdentify

@Override
protected void doIdentify() {
  try {
    mCancellationSignal = new CancellationSignal();
    mFingerprintManagerCompat.authenticate(null, 0, mCancellationSignal, new FingerprintManagerCompat.AuthenticationCallback() {
      @Override
origin: uccmawei/FingerprintIdentify

@Override
protected void doCancelIdentify() {
  try {
    if (mCancellationSignal != null) {
      mCancellationSignal.cancel();
    }
  } catch (Throwable e) {
    onCatchException(e);
  }
}
origin: uccmawei/FingerprintIdentify

@Override
public void authenticate(Context context, CryptoObject crypto, int flags, CancellationSignal cancel,
             AuthenticationCallback callback, Handler handler) {
  FingerprintManagerCompatApi23.authenticate(context, wrapCryptoObject(crypto), flags,
      cancel != null ? cancel.getCancellationSignalObject() : null, wrapCallback(callback), handler);
}
origin: requery/sqlite-android

private void attachCancellationSignal(CancellationSignal cancellationSignal) {
  if (cancellationSignal != null) {
    cancellationSignal.throwIfCanceled();
    mCancellationSignalAttachCount += 1;
    if (mCancellationSignalAttachCount == 1) {
      // Reset cancellation flag before executing the statement.
      nativeResetCancel(mConnectionPtr, true /*cancelable*/);
      // After this point, onCancel() may be called concurrently.
      cancellationSignal.setOnCancelListener(this);
    }
  }
}
origin: requery/sqlite-android

@SuppressLint("Assert")
private void detachCancellationSignal(CancellationSignal cancellationSignal) {
  if (cancellationSignal != null) {
    assert mCancellationSignalAttachCount > 0;
    mCancellationSignalAttachCount -= 1;
    if (mCancellationSignalAttachCount == 0) {
      // After this point, onCancel() cannot be called concurrently.
      cancellationSignal.setOnCancelListener(null);
      // Reset cancellation flag after executing the statement.
      nativeResetCancel(mConnectionPtr, false /*cancelable*/);
    }
  }
}
origin: requery/sqlite-android

private boolean yieldTransactionUnchecked(long sleepAfterYieldDelayMillis,
    CancellationSignal cancellationSignal) {
  if (cancellationSignal != null) {
    cancellationSignal.throwIfCanceled();
  }
  if (!mConnectionPool.shouldYieldConnection(mConnection, mConnectionFlags)) {
    return false;
  }
  final int transactionMode = mTransactionStack.mMode;
  final SQLiteTransactionListener listener = mTransactionStack.mListener;
  final int connectionFlags = mConnectionFlags;
  endTransactionUnchecked(cancellationSignal, true); // might throw
  if (sleepAfterYieldDelayMillis > 0) {
    try {
      Thread.sleep(sleepAfterYieldDelayMillis);
    } catch (InterruptedException ex) {
      // we have been interrupted, that's all we need to do
    }
  }
  beginTransactionUnchecked(transactionMode, listener, connectionFlags,
      cancellationSignal); // might throw
  return true;
}
origin: ajalt/reprint

  @Test
  public void unsubscribe_cancels() throws Exception {
    assertFalse(module.cancellationSignal.isCanceled());
    ts.dispose();
    assertTrue(module.cancellationSignal.isCanceled());
  }
}
origin: requery/sqlite-android

  cancellationSignal.throwIfCanceled();
cancellationSignal.setOnCancelListener(new CancellationSignal.OnCancelListener() {
  @Override
  public void onCancel() {
  cancellationSignal.setOnCancelListener(null);
origin: ajalt/reprint

cancellationSignal.setOnCancelListener(new CancellationSignal.OnCancelListener() {
  @Override
  public void onCancel() {
origin: requery/sqlite-android

cancellationSignal.throwIfCanceled();
origin: ajalt/reprint

  @Test
  public void unsubscribe_cancels() throws Exception {
    assertFalse(module.cancellationSignal.isCanceled());
    ts.unsubscribe();
    assertTrue(module.cancellationSignal.isCanceled());
  }
}
origin: morogoku/MTweaks-KernelAdiutorMOD

public void startListening(FingerprintManagerCompat.CryptoObject cryptoObject) {
  if (!mListening) {
    mListening = true;
    mCancellationSignal = new CancellationSignal();
    mSelfCancelled = false;
    mFingerprintManagerCompat
        .authenticate(cryptoObject, 0, mCancellationSignal, this, null);
    mSwirlView.setState(SwirlView.State.ON);
  }
}
origin: requery/sqlite-android

  @Override
  public void onCancel() {
    supportCancellationSignal.cancel();
  }
});
origin: ajalt/reprint

void authenticate(final CancellationSignal cancellationSignal,
             final AuthenticationListener listener,
             final Reprint.RestartPredicate restartPredicate,
             final int restartCount) throws SecurityException {
  final FingerprintManager fingerprintManager = fingerprintManager();
  if (fingerprintManager == null) {
    listener.onFailure(AuthenticationFailureReason.UNKNOWN, true,
        context.getString(R.string.fingerprint_error_hw_not_available), TAG, FINGERPRINT_ERROR_CANCELED);
    return;
  }
  final FingerprintManager.AuthenticationCallback callback =
      new AuthCallback(restartCount, restartPredicate, cancellationSignal, listener);
  // Why getCancellationSignalObject returns an Object is unexplained
  final android.os.CancellationSignal signalObject = cancellationSignal == null ? null :
      (android.os.CancellationSignal) cancellationSignal.getCancellationSignalObject();
  // Occasionally, an NPE will bubble up out of FingerprintManager.authenticate
  try {
    fingerprintManager.authenticate(null, signalObject, 0, callback, null);
  } catch (NullPointerException e) {
    logger.logException(e, "MarshmallowReprintModule: authenticate failed unexpectedly");
    listener.onFailure(AuthenticationFailureReason.UNKNOWN, true,
        context.getString(R.string.fingerprint_error_unable_to_process), TAG, FINGERPRINT_ERROR_CANCELED);
  }
}
origin: requery/sqlite-android

  CancellationSignal cancellationSignal) {
if (cancellationSignal != null) {
  cancellationSignal.throwIfCanceled();
origin: benoberkfell/android-fingerprint-demo

void beginAuthentication() {
  cancellationSignal = new CancellationSignal();
  FingerprintManagerCompat.AuthenticationCallback callback = new FingerprintManagerCompat.AuthenticationCallback() {
    @Override
    public void onAuthenticationError(int errMsgId, CharSequence errString) {
      super.onAuthenticationHelp(errMsgId, errString);
      if (!canceled) {
        fingerprintView.onError(errString.toString(), true);
      }
    }
    @Override
    public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
      super.onAuthenticationHelp(helpMsgId, helpString);
      if (!canceled) {
        fingerprintView.onError(helpString.toString(), false);
      }
    }
    @Override
    public void onAuthenticationSucceeded(FingerprintManagerCompat.AuthenticationResult result) {
      super.onAuthenticationSucceeded(result);
      fingerprintView.onSuccess(result.getCryptoObject());
    }
    @Override
    public void onAuthenticationFailed() {
      super.onAuthenticationFailed();
      fingerprintView.onError(R.string.fingerprint_not_recognized);
    }
  };
  fingerprintManager.authenticate(fingerprintView.cryptoObject(), 0, cancellationSignal, callback, null);
}
origin: morogoku/MTweaks-KernelAdiutorMOD

public void stopListening() {
  if (mCancellationSignal != null) {
    mSelfCancelled = true;
    mCancellationSignal.cancel();
    mCancellationSignal = null;
    mListening = false;
  }
}
origin: requery/sqlite-android

private void endTransactionUnchecked(CancellationSignal cancellationSignal, boolean yielding) {
  if (cancellationSignal != null) {
    cancellationSignal.throwIfCanceled();
origin: requery/sqlite-android

/**
 * Runs the provided SQL and returns a {@link Cursor} over the result set.
 *
 * @param supportQuery the SQL query. The SQL string must not be ; terminated
 * @param signal A signal to cancel the operation in progress, or null if none.
 * If the operation is canceled, then {@link OperationCanceledException} will be thrown
 * when the query is executed.
 * @return A {@link Cursor} object, which is positioned before the first entry. Note that
 * {@link Cursor}s are not synchronized, see the documentation for more details.
 */
@Override
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public Cursor query(SupportSQLiteQuery supportQuery, android.os.CancellationSignal signal) {
  final CancellationSignal supportCancellationSignal = new CancellationSignal();
  signal.setOnCancelListener(new android.os.CancellationSignal.OnCancelListener() {
    @Override
    public void onCancel() {
      supportCancellationSignal.cancel();
    }
  });
  return query(supportQuery, supportCancellationSignal);
}
origin: benoberkfell/android-fingerprint-demo

void cancel() {
  cancellationSignal.cancel();
  this.canceled = true;
}
androidx.core.osCancellationSignal

Most used methods

  • <init>
  • cancel
  • getCancellationSignalObject
  • setOnCancelListener
  • isCanceled
  • throwIfCanceled

Popular in Java

  • Running tasks concurrently on multiple threads
  • getApplicationContext (Context)
  • getContentResolver (Context)
  • getResourceAsStream (ClassLoader)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • JFrame (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now