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);
}
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);
}
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;
}
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);
}
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());
}
Aggregations