JobCoder { JobInvocation decodeIntentBundle(@NonNull Bundle bundle) { if (bundle == null) { Log.e(TAG, "Unexpected null Bundle provided"); return null; } Bundle taskExtras = bundle.getBundle(GooglePlayJobWriter.REQUEST_PARAM_EXTRAS); if (taskExtras == null) { return null; } JobInvocation.Builder builder = decode(taskExtras); List<Uri> triggeredContentUris = bundle.getParcelableArrayList(BundleProtocol.PACKED_PARAM_TRIGGERED_URIS); if (triggeredContentUris != null) { builder.setTriggerReason(new TriggerReason(triggeredContentUris)); } return builder.build(); } JobCoder(String prefix); @Nullable JobInvocation.Builder decode(@NonNull Bundle providedBundle);  }
@Test public void decodeIntentBundle() { Bundle bundle = new Bundle(); ContentUriTrigger uriTrigger = getContentUriTrigger(); Bundle encode = encodeContentUriJob(uriTrigger, coder); bundle.putBundle(GooglePlayJobWriter.REQUEST_PARAM_EXTRAS, encode); ArrayList<Uri> uris = new ArrayList<>(); uris.add(ContactsContract.AUTHORITY_URI); uris.add(Media.EXTERNAL_CONTENT_URI); bundle.putParcelableArrayList(BundleProtocol.PACKED_PARAM_TRIGGERED_URIS, uris); JobInvocation jobInvocation = coder.decodeIntentBundle(bundle); assertEquals(uris, jobInvocation.getTriggerReason().getTriggeredContentUris()); assertEquals("TAG", jobInvocation.getTag()); assertEquals(uriTrigger.getUris(), ((ContentUriTrigger) jobInvocation.getTrigger()).getUris()); assertEquals(TestJobService.class.getName(), jobInvocation.getService()); assertEquals( RetryStrategy.DEFAULT_EXPONENTIAL.getPolicy(), jobInvocation.getRetryStrategy().getPolicy()); }