Search in sources :

Example 1 with CancellationSignal

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);
    }
}
Also used : CancellationSignal(android.os.CancellationSignal)

Example 2 with CancellationSignal

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);
    }
}
Also used : CancellationSignal(android.os.CancellationSignal) Fingerprint(android.hardware.fingerprint.Fingerprint)

Example 3 with CancellationSignal

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;
}
Also used : CancellationSignal(android.os.CancellationSignal)

Example 4 with CancellationSignal

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;
    }
}
Also used : CancellationSignal(android.os.CancellationSignal) MtpEvent(android.mtp.MtpEvent)

Example 5 with CancellationSignal

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));
}
Also used : FutureTask(java.util.concurrent.FutureTask) OperationCanceledException(android.os.OperationCanceledException) IOException(java.io.IOException) CancellationSignal(android.os.CancellationSignal)

Aggregations

CancellationSignal (android.os.CancellationSignal)79 OperationCanceledException (android.os.OperationCanceledException)18 Cursor (android.database.Cursor)13 FileNotFoundException (java.io.FileNotFoundException)11 IOException (java.io.IOException)11 RemoteException (android.os.RemoteException)10 FingerprintManager (android.hardware.fingerprint.FingerprintManager)8 ContentProviderClient (android.content.ContentProviderClient)7 ContentResolver (android.content.ContentResolver)6 Uri (android.net.Uri)6 ParcelFileDescriptor (android.os.ParcelFileDescriptor)6 AssetFileDescriptor (android.content.res.AssetFileDescriptor)5 MtpEvent (android.mtp.MtpEvent)5 InputStream (java.io.InputStream)5 FutureTask (java.util.concurrent.FutureTask)4 Test (org.junit.Test)4 KeyguardManager (android.app.KeyguardManager)2 BiometricPrompt (android.hardware.biometrics.BiometricPrompt)2 Bundle (android.os.Bundle)2 Handler (android.os.Handler)2