use of android.os.CancellationSignal in project android_packages_apps_Settings by DirtyUnicorns.
the class FingerprintUiHelper method startListening.
public void startListening() {
if (mFingerprintManager != null && mFingerprintManager.isHardwareDetected() && mFingerprintManager.getEnrolledFingerprints(mUserId).size() > 0) {
mCancellationSignal = new CancellationSignal();
mFingerprintManager.setActiveUser(mUserId);
mFingerprintManager.authenticate(null, mCancellationSignal, 0, /* flags */
this, null, mUserId);
setFingerprintIconVisibility(true);
mIcon.setImageResource(R.drawable.ic_fingerprint);
}
}
use of android.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.os.CancellationSignal in project android-fingerprint-authentication by multidots.
the class FingerPrintAuthHelper method startAuth.
/**
* Start the finger print authentication by enabling the finger print sensor.
* Note: Use this function in the onResume() of the activity/fragment. Never forget to call {@link #stopAuth()}
* in onPause() of the activity/fragment.
*/
@TargetApi(Build.VERSION_CODES.M)
public void startAuth() {
if (isScanning)
stopAuth();
// check if the device supports the finger print hardware?
if (!checkFingerPrintAvailability(mContext))
return;
FingerprintManager fingerprintManager = (FingerprintManager) mContext.getSystemService(Context.FINGERPRINT_SERVICE);
FingerprintManager.CryptoObject cryptoObject = getCryptoObject();
if (cryptoObject == null) {
mCallback.onAuthFailed(AuthErrorCodes.NON_RECOVERABLE_ERROR, ERROR_FAILED_TO_INIT_CHIPPER);
} else {
mCancellationSignal = new CancellationSignal();
// noinspection MissingPermission
fingerprintManager.authenticate(cryptoObject, mCancellationSignal, 0, new FingerprintManager.AuthenticationCallback() {
@Override
public void onAuthenticationError(int errMsgId, CharSequence errString) {
mCallback.onAuthFailed(AuthErrorCodes.NON_RECOVERABLE_ERROR, errString.toString());
}
@Override
public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
mCallback.onAuthFailed(AuthErrorCodes.RECOVERABLE_ERROR, helpString.toString());
}
@Override
public void onAuthenticationFailed() {
mCallback.onAuthFailed(AuthErrorCodes.CANNOT_RECOGNIZE_ERROR, null);
}
@Override
public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) {
mCallback.onAuthSuccess(result.getCryptoObject());
}
}, null);
}
}
use of android.os.CancellationSignal in project platform_packages_apps_Settings by BlissRoms.
the class FingerprintEnrollSidecar method startEnrollment.
private void startEnrollment() {
mHandler.removeCallbacks(mTimeoutRunnable);
mEnrollmentSteps = -1;
mEnrollmentCancel = new CancellationSignal();
if (mUserId != UserHandle.USER_NULL) {
mFingerprintManager.setActiveUser(mUserId);
}
mFingerprintManager.enroll(mToken, mEnrollmentCancel, 0, /* flags */
mUserId, mEnrollmentCallback);
mEnrolling = true;
}
use of android.os.CancellationSignal in project QR-Code-Based-Attendance-System by ishan0445.
the class FingerprintHandler method startAuth.
public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
CancellationSignal cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
Aggregations