Search in sources :

Example 91 with CancellationSignal

use of android.os.CancellationSignal in project OneUI-Design-Library by Yanndroid.

the class SeslImmersiveScrollBehavior method startAnimationControlRequest.

private void startAnimationControlRequest() {
    setWindowInsetsController();
    if (mCancellationSignal == null) {
        mCancellationSignal = new CancellationSignal();
    }
    if (mDecorViewInset.getDisplayCutout() != null) {
        mWindowInsetsController.hide(WindowInsetsCompat.Type.systemBars());
    }
    mWindowInsetsController.setSystemBarsBehavior(WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
    mWindowInsetsController.controlWindowInsetsAnimation(WindowInsetsCompat.Type.systemBars(), -1, null, mCancellationSignal, mWindowInsetsAnimationControlListener);
}
Also used : CancellationSignal(android.os.CancellationSignal)

Example 92 with CancellationSignal

use of android.os.CancellationSignal in project LibChecker-Rules-Bundle by zhaobozhen.

the class RuleDao_Impl method getAllRules.

@Override
public Object getAllRules(final Continuation<? super List<RuleEntity>> continuation) {
    final String _sql = "SELECT * from rules_table";
    final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
    final CancellationSignal _cancellationSignal = DBUtil.createCancellationSignal();
    return CoroutinesRoom.execute(__db, false, _cancellationSignal, new Callable<List<RuleEntity>>() {

        @Override
        public List<RuleEntity> call() throws Exception {
            final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
            try {
                final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "_id");
                final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
                final int _cursorIndexOfLabel = CursorUtil.getColumnIndexOrThrow(_cursor, "label");
                final int _cursorIndexOfType = CursorUtil.getColumnIndexOrThrow(_cursor, "type");
                final int _cursorIndexOfIconIndex = CursorUtil.getColumnIndexOrThrow(_cursor, "iconIndex");
                final int _cursorIndexOfIsRegexRule = CursorUtil.getColumnIndexOrThrow(_cursor, "isRegexRule");
                final int _cursorIndexOfRegexName = CursorUtil.getColumnIndexOrThrow(_cursor, "regexName");
                final List<RuleEntity> _result = new ArrayList<RuleEntity>(_cursor.getCount());
                while (_cursor.moveToNext()) {
                    final RuleEntity _item;
                    final int _tmpId;
                    _tmpId = _cursor.getInt(_cursorIndexOfId);
                    final String _tmpName;
                    if (_cursor.isNull(_cursorIndexOfName)) {
                        _tmpName = null;
                    } else {
                        _tmpName = _cursor.getString(_cursorIndexOfName);
                    }
                    final String _tmpLabel;
                    if (_cursor.isNull(_cursorIndexOfLabel)) {
                        _tmpLabel = null;
                    } else {
                        _tmpLabel = _cursor.getString(_cursorIndexOfLabel);
                    }
                    final int _tmpType;
                    _tmpType = _cursor.getInt(_cursorIndexOfType);
                    final int _tmpIconIndex;
                    _tmpIconIndex = _cursor.getInt(_cursorIndexOfIconIndex);
                    final boolean _tmpIsRegexRule;
                    final int _tmp;
                    _tmp = _cursor.getInt(_cursorIndexOfIsRegexRule);
                    _tmpIsRegexRule = _tmp != 0;
                    final String _tmpRegexName;
                    if (_cursor.isNull(_cursorIndexOfRegexName)) {
                        _tmpRegexName = null;
                    } else {
                        _tmpRegexName = _cursor.getString(_cursorIndexOfRegexName);
                    }
                    _item = new RuleEntity(_tmpId, _tmpName, _tmpLabel, _tmpType, _tmpIconIndex, _tmpIsRegexRule, _tmpRegexName);
                    _result.add(_item);
                }
                return _result;
            } finally {
                _cursor.close();
                _statement.release();
            }
        }
    }, continuation);
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) RoomSQLiteQuery(androidx.room.RoomSQLiteQuery) Cursor(android.database.Cursor) CancellationSignal(android.os.CancellationSignal)

Example 93 with CancellationSignal

use of android.os.CancellationSignal in project packages_apps_Settings by AICP.

the class BiometricEnrollSidecar method startEnrollment.

protected void startEnrollment() {
    mHandler.removeCallbacks(mTimeoutRunnable);
    mEnrollmentSteps = -1;
    mEnrollmentCancel = new CancellationSignal();
    mEnrolling = true;
}
Also used : CancellationSignal(android.os.CancellationSignal)

Example 94 with CancellationSignal

use of android.os.CancellationSignal in project packages_apps_Settings by AICP.

the class FingerprintAuthenticateSidecar method startAuthentication.

public void startAuthentication(int userId) {
    mCancellationSignal = new CancellationSignal();
    mFingerprintManager.authenticate(null, /* crypto */
    mCancellationSignal, mAuthenticationCallback, null, /* handler */
    userId);
}
Also used : CancellationSignal(android.os.CancellationSignal)

Example 95 with CancellationSignal

use of android.os.CancellationSignal in project packages_apps_Settings by AICP.

the class PrintJobSettingsActivityTest method viewPrintJobSettings.

@Test
@LargeTest
public void viewPrintJobSettings() throws Exception {
    UUID uuid = UUID.randomUUID();
    Object isWriteCalled = new Object();
    // Create adapter that is good enough to start a print preview
    PrintDocumentAdapter adapter = new PrintDocumentAdapter() {

        @Override
        public void onLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes, CancellationSignal cancellationSignal, LayoutResultCallback callback, Bundle extras) {
            callback.onLayoutFinished(new PrintDocumentInfo.Builder(uuid.toString()).build(), true);
        }

        @Override
        public void onWrite(PageRange[] pages, ParcelFileDescriptor destination, CancellationSignal cancellationSignal, WriteResultCallback callback) {
            synchronized (isWriteCalled) {
                isWriteCalled.notify();
            }
            callback.onWriteFailed(null);
        }
    };
    Activity activity = mActivityRule.getActivity();
    PrintManager pm = mActivityRule.getActivity().getSystemService(PrintManager.class);
    // Start printing
    PrintJob printJob = pm.print(uuid.toString(), adapter, null);
    // Wait until print preview is up
    synchronized (isWriteCalled) {
        isWriteCalled.wait();
    }
    // Start print job settings
    Intent intent = new Intent(android.provider.Settings.ACTION_PRINT_SETTINGS);
    intent.putExtra(EXTRA_PRINT_JOB_ID, printJob.getId().flattenToString());
    intent.setData(Uri.fromParts("printjob", printJob.getId().flattenToString(), null));
    activity.startActivity(intent);
    UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    UiObject2 printPrefTitle = uiDevice.wait(Until.findObject(By.text("Configuring " + uuid.toString())), 5000);
    assertNotNull(printPrefTitle);
    Log.i(LOG_TAG, "Found " + printPrefTitle.getText());
}
Also used : PrintJob(android.print.PrintJob) Bundle(android.os.Bundle) UiDevice(android.support.test.uiautomator.UiDevice) Activity(android.app.Activity) Intent(android.content.Intent) PrintAttributes(android.print.PrintAttributes) PrintManager(android.print.PrintManager) ParcelFileDescriptor(android.os.ParcelFileDescriptor) UUID(java.util.UUID) PrintDocumentAdapter(android.print.PrintDocumentAdapter) CancellationSignal(android.os.CancellationSignal) UiObject2(android.support.test.uiautomator.UiObject2) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) LargeTest(androidx.test.filters.LargeTest)

Aggregations

CancellationSignal (android.os.CancellationSignal)170 Cursor (android.database.Cursor)22 Test (org.junit.Test)21 BiometricPrompt (android.hardware.biometrics.BiometricPrompt)20 OperationCanceledException (android.os.OperationCanceledException)18 ParcelFileDescriptor (android.os.ParcelFileDescriptor)17 Handler (android.os.Handler)15 KeyguardManager (android.app.KeyguardManager)14 Intent (android.content.Intent)14 FingerprintManager (android.hardware.fingerprint.FingerprintManager)14 Bundle (android.os.Bundle)14 Activity (android.app.Activity)12 PrintAttributes (android.print.PrintAttributes)12 PrintDocumentAdapter (android.print.PrintDocumentAdapter)12 PrintJob (android.print.PrintJob)12 PrintManager (android.print.PrintManager)12 UiDevice (android.support.test.uiautomator.UiDevice)12 UiObject2 (android.support.test.uiautomator.UiObject2)12 LargeTest (androidx.test.filters.LargeTest)12 UUID (java.util.UUID)12