use of android.support.v4.os.CancellationSignal in project MTweaks-KernelAdiutorMOD by morogoku.
the class FingerprintUiHelper method startListening.
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);
}
}
use of android.support.v4.os.CancellationSignal in project Signal-Android by signalapp.
the class PassphrasePromptActivity method resumeScreenLock.
private void resumeScreenLock() {
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
assert keyguardManager != null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && !keyguardManager.isKeyguardSecure()) {
Log.w(TAG, "Keyguard not secure...");
handleAuthenticated();
return;
}
if (Build.VERSION.SDK_INT >= 16 && fingerprintManager.isHardwareDetected() && fingerprintManager.hasEnrolledFingerprints()) {
Log.w(TAG, "Listening for fingerprints...");
fingerprintCancellationSignal = new CancellationSignal();
fingerprintManager.authenticate(null, 0, fingerprintCancellationSignal, fingerprintListener, null);
} else if (Build.VERSION.SDK_INT >= 21) {
Log.w(TAG, "firing intent...");
Intent intent = keyguardManager.createConfirmDeviceCredentialIntent("Unlock Signal", "");
startActivityForResult(intent, 1);
} else {
Log.w(TAG, "Not compatible...");
handleAuthenticated();
}
}
use of android.support.v4.os.CancellationSignal in project MaxLock by Maxr1998.
the class FingerprintView method onWindowFocusChanged.
@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
super.onWindowFocusChanged(hasWindowFocus);
if (hasWindowFocus) {
FingerprintManagerCompat mFingerprintManager = FingerprintManagerCompat.from(getContext());
if (mFingerprintManager.isHardwareDetected() && mFingerprintManager.hasEnrolledFingerprints()) {
if (!mLockView.allowFingerprint()) {
handleFingerprintIndicator(R.drawable.lockscreen_fingerprint_fp_to_error_state_animation);
setOnClickListener(mNotAllowedToast);
return;
}
if (mCancelFingerprint.isCanceled()) {
mCancelFingerprint = new CancellationSignal();
}
mFingerprintManager.authenticate(null, 0, mCancelFingerprint, mFPAuthenticationCallback, null);
handleFingerprintIndicator(R.drawable.lockscreen_fingerprint_draw_on_animation);
} else {
setVisibility(GONE);
}
} else {
mCancelFingerprint.cancel();
}
}
use of android.support.v4.os.CancellationSignal in project SightRemote by TebbeUbben.
the class ConfirmationDialog method show.
@SuppressLint("NewApi")
public void show() {
prepareViews();
dialog = builder.show();
dialog.setOnDismissListener((dialogInterface -> onClose()));
dialog.setOnCancelListener((dialog -> onClose()));
if (useFingerprint())
getFingerprintManager().authenticate(null, cancellationSignal = new CancellationSignal(), 0, new FingerprintManager.AuthenticationCallback() {
@Override
public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) {
onConfirm();
}
@Override
public void onAuthenticationFailed() {
fingerprintIcon.getBackground().setColorFilter(ContextCompat.getColor(SightRemote.getInstance(), R.color.colorWrong), PorterDuff.Mode.MULTIPLY);
fingerprintText.setText(R.string.couldnt_recognize_fingerprint);
fingerprintText.setTextColor(ContextCompat.getColor(SightRemote.getInstance(), R.color.colorWrong));
}
}, null);
if (getBooleanPref(PREF_BOOLEAN_ENABLE_CONFIRMATION_CHALLENGES))
pin.requestFocus();
}
use of android.support.v4.os.CancellationSignal in project iosched by google.
the class CursorModelLoader method loadInBackground.
@Override
public D loadInBackground() {
synchronized (this) {
if (isLoadInBackgroundCanceled()) {
throw new OperationCanceledException();
}
mCancellationSignal = new CancellationSignal();
}
Cursor cursor = null;
try {
cursor = mCursorTransform.performQuery(this, mCancellationSignal);
if (cursor != null) {
try {
// Ensure the cursor window is filled.
cursor.getCount();
cursor.registerContentObserver(mObserver);
} catch (RuntimeException ex) {
cursor.close();
throw ex;
}
}
} finally {
synchronized (this) {
mCancellationSignal = null;
}
}
if (cursor != null) {
try {
return mCursorTransform.cursorToModel(this, cursor);
} finally {
cursor.close();
}
}
return null;
}
Aggregations