Home | History | Annotate | Download | only in shadows

Lines Matching defs:PendingIntent

3 import static android.app.PendingIntent.FLAG_CANCEL_CURRENT;
4 import static android.app.PendingIntent.FLAG_IMMUTABLE;
5 import static android.app.PendingIntent.FLAG_NO_CREATE;
6 import static android.app.PendingIntent.FLAG_ONE_SHOT;
7 import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
13 import android.app.PendingIntent;
14 import android.app.PendingIntent.CanceledException;
40 PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 99, intent, 100);
42 ShadowPendingIntent shadow = shadowOf(pendingIntent);
55 PendingIntent pendingIntent = PendingIntent.getActivity(context, 99, intent, 100);
57 ShadowPendingIntent shadow = shadowOf(pendingIntent);
70 PendingIntent pendingIntent = PendingIntent.getActivities(context, 99, intents, 100);
72 ShadowPendingIntent shadow = shadowOf(pendingIntent);
75 pendingIntent.send();
84 PendingIntent pendingIntent =
85 PendingIntent.getActivities(context, 99, intents, 100, Bundle.EMPTY);
87 ShadowPendingIntent shadow = shadowOf(pendingIntent);
90 pendingIntent.send();
99 PendingIntent pendingIntent = PendingIntent.getService(context, 99, intent, 100);
101 ShadowPendingIntent shadow = shadowOf(pendingIntent);
114 PendingIntent.getActivities(context, 99, null, 100);
115 fail("Expected NullPointerException when creating PendingIntent with null Intent[]");
124 PendingIntent.getActivities(context, 99, null, 100, Bundle.EMPTY);
125 fail("Expected NullPointerException when creating PendingIntent with null Intent[]");
135 PendingIntent pendingIntent = PendingIntent.getActivity(context, 99, intent, 100);
139 pendingIntent.send(otherContext, 0, fillIntent);
151 PendingIntent pendingIntent = PendingIntent.getActivities(context, 99, intents, 100);
156 pendingIntent.send(otherContext, 0, fillIntent);
174 PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, FLAG_IMMUTABLE);
178 pendingIntent.send(otherContext, 0, fillIntent);
189 PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
190 ShadowPendingIntent shadowPendingIntent = shadowOf(pendingIntent);
194 PendingIntent.getBroadcast(context, 0, intent, 0);
198 PendingIntent.getBroadcast(context, 0, intent, FLAG_UPDATE_CURRENT);
205 assertThat(PendingIntent.getActivity(context, 99, intent, FLAG_NO_CREATE)).isNull();
211 PendingIntent.getActivity(context, 99, intent, 0);
212 assertThat(PendingIntent.getActivity(context, 98, intent, FLAG_NO_CREATE)).isNull();
218 PendingIntent.getActivity(context, 99, intent, 100);
221 PendingIntent saved = PendingIntent.getActivity(context, 99, identical, FLAG_NO_CREATE);
229 PendingIntent.getActivity(context, 99, intent, 100);
232 PendingIntent saved = PendingIntent.getActivity(context, 99, updated, 0);
240 PendingIntent pendingIntent = PendingIntent.getActivities(context, 99, intents, FLAG_NO_CREATE);
241 assertThat(pendingIntent).isNull();
247 PendingIntent.getActivities(context, 99, intents, 0);
248 assertThat(PendingIntent.getActivities(context, 98, intents, FLAG_NO_CREATE)).isNull();
254 PendingIntent.getActivities(RuntimeEnvironment.application, 99, intents, 100);
257 PendingIntent saved =
258 PendingIntent.getActivities(context, 99, identicalIntents, FLAG_NO_CREATE);
266 PendingIntent.getActivities(RuntimeEnvironment.application, 99, intents, 100);
269 PendingIntent saved = PendingIntent.getActivities(context, 99, identicalIntents, 0);
277 PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 99, intent, FLAG_NO_CREATE);
278 assertThat(pendingIntent).isNull();
284 PendingIntent.getBroadcast(context, 99, intent, 0);
285 assertThat(PendingIntent.getBroadcast(context, 98, intent, FLAG_NO_CREATE)).isNull();
291 PendingIntent.getBroadcast(context, 99, intent, 100);
294 PendingIntent saved = PendingIntent.getBroadcast(context, 99, identical, FLAG_NO_CREATE);
302 PendingIntent.getBroadcast(context, 99, intent, 100);
305 PendingIntent saved = PendingIntent.getBroadcast(context, 99, identical, 0);
313 PendingIntent pendingIntent = PendingIntent.getService(context, 99, intent, FLAG_NO_CREATE);
314 assertThat(pendingIntent).isNull();
320 PendingIntent.getService(context, 99, intent, 0);
321 assertThat(PendingIntent.getService(context, 98, intent, FLAG_NO_CREATE)).isNull();
327 PendingIntent.getService(context, 99, intent, 100);
330 PendingIntent saved = PendingIntent.getService(context, 99, identical, FLAG_NO_CREATE);
338 PendingIntent.getService(context, 99, intent, 100);
341 PendingIntent saved = PendingIntent.getService(context, 99, identical, 0);
349 PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 99, intent, 100);
350 assertThat(pendingIntent).isNotNull();
352 pendingIntent.cancel();
353 assertThat(PendingIntent.getBroadcast(context, 99, intent, FLAG_NO_CREATE)).isNull();
359 PendingIntent pendingIntent = PendingIntent.getActivity(context, 99, intent, 100);
360 assertThat(pendingIntent).isNotNull();
362 pendingIntent.cancel();
363 assertThat(PendingIntent.getActivity(context, 99, intent, FLAG_NO_CREATE)).isNull();
369 PendingIntent pendingIntent = PendingIntent.getActivities(context, 99, intents, 100);
370 assertThat(pendingIntent).isNotNull();
372 pendingIntent.cancel();
373 assertThat(PendingIntent.getActivities(context, 99, intents, FLAG_NO_CREATE)).isNull();
379 PendingIntent pendingIntent = PendingIntent.getService(context, 99, intent, 100);
380 assertThat(pendingIntent).isNotNull();
382 pendingIntent.cancel();
383 assertThat(PendingIntent.getService(context, 99, intent, FLAG_NO_CREATE)).isNull();
389 PendingIntent canceled = PendingIntent.getService(context, 99, intent, 100);
392 // Cancel the existing PendingIntent and create a new one in its place.
393 PendingIntent current = PendingIntent.getService(context, 99, intent, FLAG_CANCEL_CURRENT);
399 // Sending the new PendingIntent should work as expected.
402 // Sending the canceled PendingIntent should produce a CanceledException.
405 fail("CanceledException expected when sending a canceled PendingIntent");
414 PendingIntent pendingIntent = PendingIntent
415 assertThat(shadowOf(pendingIntent).isCanceled()).isFalse();
417 pendingIntent.send();
418 assertThat(shadowOf(pendingIntent).isCanceled()).isTrue();
419 assertThat(PendingIntent.getService(context, 0, intent, FLAG_ONE_SHOT | FLAG_NO_CREATE))
426 PendingIntent oneShot = PendingIntent.getService(context, 0, intent, FLAG_ONE_SHOT);
427 PendingIntent notOneShot = PendingIntent.getService(context, 0, intent, FLAG_UPDATE_CURRENT);
434 PendingIntent immutable = PendingIntent.getService(context, 0, intent, FLAG_IMMUTABLE);
435 PendingIntent notImmutable = PendingIntent.getService(context, 0, intent, FLAG_UPDATE_CURRENT);
441 PendingIntent pendingIntent =
442 PendingIntent.getActivity(context, 99, new Intent("activity"), 100);
445 assertThat(PendingIntent.getActivity(context, 99, new Intent("activity"), FLAG_NO_CREATE))
446 .isSameAs(pendingIntent);
449 assertThat(PendingIntent.getActivity(context, 99, new Intent("activity2"), FLAG_NO_CREATE))
453 assertThat(PendingIntent.getActivity(context, 999, new Intent("activity"), FLAG_NO_CREATE))
457 assertThat(PendingIntent.getBroadcast(context, 99, new Intent("activity"), FLAG_NO_CREATE))
459 assertThat(PendingIntent.getService(context, 99, new Intent("activity"), FLAG_NO_CREATE))
466 PendingIntent pendingIntent = PendingIntent.getActivities(context, 99, intents, 100);
469 assertThat(PendingIntent.getActivities(context, 99, forward, FLAG_NO_CREATE))
470 .isSameAs(pendingIntent);
473 assertThat(PendingIntent.getActivities(context, 99, irrelevant, FLAG_NO_CREATE))
474 .isSameAs(pendingIntent);
477 assertThat(PendingIntent.getActivity(context, 99, single, FLAG_NO_CREATE))
478 .isSameAs(pendingIntent);
481 assertThat(PendingIntent.getActivities(context, 99, backward, FLAG_NO_CREATE)).isNull();
487 PendingIntent pendingIntent =
488 PendingIntent.getActivity(context, 99, new Intent("activity"), 100);
489 assertThat(pendingIntent.getCreatorPackage()).isEqualTo(context.getPackageName());
490 assertThat(pendingIntent.getTargetPackage()).isEqualTo(context.getPackageName());
497 PendingIntent pendingIntent =
498 PendingIntent.getActivity(context, 99, new Intent("activity"), 100);
499 shadowOf(pendingIntent).setCreatorPackage(fakePackage);
500 assertThat(pendingIntent.getCreatorPackage()).isEqualTo(fakePackage);
501 assertThat(pendingIntent.getTargetPackage()).isEqualTo(fakePackage);