use of android.content.IntentSender in project android_packages_apps_Settings by crdroidandroid.
the class ChooseLockSettingsHelper method copyOptionalExtras.
private void copyOptionalExtras(Intent inIntent, Intent outIntent) {
IntentSender intentSender = inIntent.getParcelableExtra(Intent.EXTRA_INTENT);
if (intentSender != null) {
outIntent.putExtra(Intent.EXTRA_INTENT, intentSender);
}
int taskId = inIntent.getIntExtra(Intent.EXTRA_TASK_ID, -1);
if (taskId != -1) {
outIntent.putExtra(Intent.EXTRA_TASK_ID, taskId);
}
// TODO: Remove once that bug is fixed.
if (intentSender != null || taskId != -1) {
outIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
outIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
}
}
use of android.content.IntentSender in project android_packages_apps_Settings by crdroidandroid.
the class NotificationStation method formatPendingIntent.
private static String formatPendingIntent(PendingIntent pi) {
final StringBuilder sb = new StringBuilder();
final IntentSender is = pi.getIntentSender();
sb.append("Intent(pkg=").append(is.getCreatorPackage());
try {
final boolean isActivity = ActivityManager.getService().isIntentSenderAnActivity(is.getTarget());
if (isActivity)
sb.append(" (activity)");
} catch (RemoteException ex) {
}
sb.append(")");
return sb.toString();
}
use of android.content.IntentSender in project KeePassDX by Kunzisoft.
the class KeeAutofillService method onFillRequest.
@Override
public void onFillRequest(@NonNull FillRequest request, @NonNull CancellationSignal cancellationSignal, @NonNull FillCallback callback) {
List<FillContext> fillContexts = request.getFillContexts();
AssistStructure latestStructure = fillContexts.get(fillContexts.size() - 1).getStructure();
cancellationSignal.setOnCancelListener(() -> Log.e(TAG, "Cancel autofill not implemented in this sample."));
FillResponse.Builder responseBuilder = new FillResponse.Builder();
// Check user's settings for authenticating Responses and Datasets.
StructureParser.Result parseResult = new StructureParser(latestStructure).parse();
AutofillId[] autofillIds = parseResult.allAutofillIds();
if (!Arrays.asList(autofillIds).isEmpty()) {
// If the entire Autofill Response is authenticated, AuthActivity is used
// to generate Response.
IntentSender sender = AutoFillAuthActivity.getAuthIntentSenderForResponse(this);
RemoteViews presentation = new RemoteViews(getPackageName(), R.layout.autofill_service_unlock);
responseBuilder.setAuthentication(autofillIds, sender, presentation);
callback.onSuccess(responseBuilder.build());
}
}
use of android.content.IntentSender in project robolectric by robolectric.
the class ShadowActivityTest method getLastIntentSenderRequest.
@Test
public void getLastIntentSenderRequest() throws IntentSender.SendIntentException {
Activity activity = Robolectric.setupActivity(Activity.class);
int requestCode = 108;
Intent intent = new Intent("action");
Intent fillInIntent = new Intent();
PendingIntent pendingIntent = PendingIntent.getActivity(systemContext, requestCode, intent, 0);
Bundle options = new Bundle();
int flagsMask = 1;
int flagsValues = 2;
int extraFlags = 3;
IntentSender intentSender = pendingIntent.getIntentSender();
activity.startIntentSenderForResult(intentSender, requestCode, fillInIntent, flagsMask, flagsValues, extraFlags, options);
IntentSenderRequest lastIntentSenderRequest = shadowOf(activity).getLastIntentSenderRequest();
assertThat(lastIntentSenderRequest.intentSender).isEqualTo(intentSender);
assertThat(lastIntentSenderRequest.fillInIntent).isEqualTo(fillInIntent);
assertThat(lastIntentSenderRequest.requestCode).isEqualTo(requestCode);
assertThat(lastIntentSenderRequest.flagsMask).isEqualTo(flagsMask);
assertThat(lastIntentSenderRequest.flagsValues).isEqualTo(flagsValues);
assertThat(lastIntentSenderRequest.extraFlags).isEqualTo(extraFlags);
assertThat(lastIntentSenderRequest.options).isEqualTo(options);
}
use of android.content.IntentSender in project robolectric by robolectric.
the class ShadowActivityTest method startIntentSenderForResult_throwsException.
@Test
public void startIntentSenderForResult_throwsException() {
Activity activity = Robolectric.setupActivity(Activity.class);
shadowOf(activity).setThrowIntentSenderException(true);
IntentSender intentSender = PendingIntent.getActivity(systemContext, 0, new Intent("action"), 0).getIntentSender();
try {
activity.startIntentSenderForResult(intentSender, 0, null, 0, 0, 0);
fail("An IntentSender.SendIntentException should have been thrown");
} catch (IntentSender.SendIntentException e) {
// NOP
}
}
Aggregations