use of android.os.CancellationSignal in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BiometricFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
mBundle = getArguments();
final BiometricPrompt.Builder builder = new BiometricPrompt.Builder(getContext()).setTitle(mBundle.getString(BiometricPrompt.KEY_TITLE)).setUseDefaultTitle().setFromConfirmDeviceCredential().setSubtitle(mBundle.getString(BiometricPrompt.KEY_SUBTITLE)).setDescription(mBundle.getString(BiometricPrompt.KEY_DESCRIPTION)).setApplockPackage(mBundle.getString(BiometricPrompt.KEY_APPLOCK_PKG)).setConfirmationRequired(mBundle.getBoolean(BiometricPrompt.KEY_REQUIRE_CONFIRMATION, true));
final LockPatternUtils lockPatternUtils = FeatureFactory.getFactory(getContext()).getSecurityFeatureProvider().getLockPatternUtils(getContext());
switch(lockPatternUtils.getKeyguardStoredPasswordQuality(mUserId)) {
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
builder.setNegativeButton(getResources().getString(R.string.confirm_device_credential_pattern), mClientExecutor, mNegativeButtonListener);
break;
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
builder.setNegativeButton(getResources().getString(R.string.confirm_device_credential_pin), mClientExecutor, mNegativeButtonListener);
break;
case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC:
case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
case DevicePolicyManager.PASSWORD_QUALITY_MANAGED:
builder.setNegativeButton(getResources().getString(R.string.confirm_device_credential_password), mClientExecutor, mNegativeButtonListener);
break;
}
mBiometricPrompt = builder.build();
mCancellationSignal = new CancellationSignal();
// TODO: CC doesn't use crypto for now
mAuthenticating = true;
mBiometricPrompt.authenticateUser(mCancellationSignal, mClientExecutor, mAuthenticationCallback, mUserId, mCancelCallback);
}
use of android.os.CancellationSignal in project platform_frameworks_base by android.
the class RemoteViews method startTaskOnExecutor.
private CancellationSignal startTaskOnExecutor(AsyncApplyTask task, Executor executor) {
CancellationSignal cancelSignal = new CancellationSignal();
cancelSignal.setOnCancelListener(task);
task.executeOnExecutor(executor == null ? AsyncTask.THREAD_POOL_EXECUTOR : executor);
return cancelSignal;
}
use of android.os.CancellationSignal in project android_frameworks_base by ParanoidAndroid.
the class CursorLoader method loadInBackground.
/* Runs on a worker thread */
@Override
public Cursor loadInBackground() {
synchronized (this) {
if (isLoadInBackgroundCanceled()) {
throw new OperationCanceledException();
}
mCancellationSignal = new CancellationSignal();
}
try {
Cursor cursor = getContext().getContentResolver().query(mUri, mProjection, mSelection, mSelectionArgs, mSortOrder, mCancellationSignal);
if (cursor != null) {
try {
// Ensure the cursor window is filled.
cursor.getCount();
cursor.registerContentObserver(mObserver);
} catch (RuntimeException ex) {
cursor.close();
throw ex;
}
}
return cursor;
} finally {
synchronized (this) {
mCancellationSignal = null;
}
}
}
use of android.os.CancellationSignal in project platform_frameworks_base by android.
the class KeyguardUpdateMonitor method startListeningForFingerprint.
private void startListeningForFingerprint() {
if (mFingerprintRunningState == FINGERPRINT_STATE_CANCELLING) {
setFingerprintRunningState(FINGERPRINT_STATE_CANCELLING_RESTARTING);
return;
}
if (DEBUG)
Log.v(TAG, "startListeningForFingerprint()");
int userId = ActivityManager.getCurrentUser();
if (isUnlockWithFingerprintPossible(userId)) {
if (mFingerprintCancelSignal != null) {
mFingerprintCancelSignal.cancel();
}
mFingerprintCancelSignal = new CancellationSignal();
mFpm.authenticate(null, mFingerprintCancelSignal, 0, mAuthenticationCallback, null, userId);
setFingerprintRunningState(FINGERPRINT_STATE_RUNNING);
}
}
use of android.os.CancellationSignal in project android_frameworks_base by DirtyUnicorns.
the class CursorLoader method loadInBackground.
/* Runs on a worker thread */
@Override
public Cursor loadInBackground() {
synchronized (this) {
if (isLoadInBackgroundCanceled()) {
throw new OperationCanceledException();
}
mCancellationSignal = new CancellationSignal();
}
try {
Cursor cursor = getContext().getContentResolver().query(mUri, mProjection, mSelection, mSelectionArgs, mSortOrder, mCancellationSignal);
if (cursor != null) {
try {
// Ensure the cursor window is filled.
cursor.getCount();
cursor.registerContentObserver(mObserver);
} catch (RuntimeException ex) {
cursor.close();
throw ex;
}
}
return cursor;
} finally {
synchronized (this) {
mCancellationSignal = null;
}
}
}
Aggregations