use of android.os.CancellationSignal in project android_frameworks_base by ResurrectionRemix.
the class PrinterDiscoverySession method requestCustomPrinterIcon.
/**
* Request the custom icon for a printer.
*
* @param printerId The printer to icon belongs to.
* @see android.print.PrinterInfo.Builder#setHasCustomPrinterIcon()
*/
void requestCustomPrinterIcon(@NonNull PrinterId printerId) {
if (!mIsDestroyed && mObserver != null) {
CustomPrinterIconCallback callback = new CustomPrinterIconCallback(printerId, mObserver);
onRequestCustomPrinterIcon(printerId, new CancellationSignal(), callback);
}
}
use of android.os.CancellationSignal in project android_frameworks_base by ResurrectionRemix.
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 Resurrection_packages_apps_Settings by ResurrectionRemix.
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 android_frameworks_base by ResurrectionRemix.
the class MtpManagerTest method testEventObjectAdded.
public void testEventObjectAdded() throws Exception {
while (true) {
getInstrumentation().show("Please take a photo by using connected MTP device.");
final CancellationSignal signal = new CancellationSignal();
MtpEvent event = mManager.readEvent(mUsbDevice.getDeviceId(), signal);
if (event.getEventCode() != MtpConstants.EVENT_OBJECT_ADDED) {
continue;
}
assertTrue(event.getObjectHandle() != 0);
break;
}
}
use of android.os.CancellationSignal in project android_frameworks_base by ResurrectionRemix.
the class MtpManagerTest method testCancelEvent.
public void testCancelEvent() throws Exception {
final CancellationSignal signal = new CancellationSignal();
final FutureTask<Boolean> future = new FutureTask<Boolean>(new Callable<Boolean>() {
@Override
public Boolean call() throws IOException {
try {
while (true) {
mManager.readEvent(mUsbDevice.getDeviceId(), signal);
}
} catch (OperationCanceledException exception) {
return true;
}
}
});
final Thread thread = new Thread(future);
thread.start();
SystemClock.sleep(TIMEOUT_MS);
signal.cancel();
assertTrue(future.get(TIMEOUT_MS, TimeUnit.MILLISECONDS));
}
Aggregations