Search in sources :

Example 46 with CancellationSignal

use of android.os.CancellationSignal in project android_frameworks_base by crdroidandroid.

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 47 with CancellationSignal

use of android.os.CancellationSignal in project android_frameworks_base by crdroidandroid.

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)

Aggregations

CancellationSignal (android.os.CancellationSignal)47 OperationCanceledException (android.os.OperationCanceledException)17 Cursor (android.database.Cursor)12 RemoteException (android.os.RemoteException)10 FileNotFoundException (java.io.FileNotFoundException)10 IOException (java.io.IOException)10 ContentProviderClient (android.content.ContentProviderClient)6 ContentResolver (android.content.ContentResolver)5 AssetFileDescriptor (android.content.res.AssetFileDescriptor)5 MtpEvent (android.mtp.MtpEvent)5 Uri (android.net.Uri)5 ParcelFileDescriptor (android.os.ParcelFileDescriptor)5 InputStream (java.io.InputStream)5 FutureTask (java.util.concurrent.FutureTask)5 Test (org.junit.Test)3 ContentProviderOperation (android.content.ContentProviderOperation)1 ContentValues (android.content.ContentValues)1 Fingerprint (android.hardware.fingerprint.Fingerprint)1 FingerprintManager (android.hardware.fingerprint.FingerprintManager)1 Bundle (android.os.Bundle)1