@Test public void testWriteToBundle_contentUriTrigger() { ObservedUri observedUri = new ObservedUri(ContactsContract.AUTHORITY_URI, Flags.FLAG_NOTIFY_FOR_DESCENDANTS); ContentUriTrigger contentUriTrigger = Trigger.contentUriTrigger(Arrays.asList(observedUri)); Bundle bundle = writer.writeToBundle( initializeDefaultBuilder().setTrigger(contentUriTrigger).build(), new Bundle()); Uri[] uris = (Uri[]) bundle.getParcelableArray(BundleProtocol.PACKED_PARAM_CONTENT_URI_ARRAY); int[] flags = bundle.getIntArray(BundleProtocol.PACKED_PARAM_CONTENT_URI_FLAGS_ARRAY); assertTrue("Array size", uris.length == flags.length && flags.length == 1); assertEquals( BundleProtocol.PACKED_PARAM_CONTENT_URI_ARRAY, ContactsContract.AUTHORITY_URI, uris[0]); assertEquals( BundleProtocol.PACKED_PARAM_CONTENT_URI_FLAGS_ARRAY, Flags.FLAG_NOTIFY_FOR_DESCENDANTS, flags[0]); }
public Bundle writeToBundle(JobParameters job, Bundle b) { b.putString(REQUEST_PARAM_TAG, job.getTag()); b.putBoolean(REQUEST_PARAM_UPDATE_CURRENT, job.shouldReplaceCurrent()); boolean persisted = job.getLifetime() == Lifetime.FOREVER; b.putBoolean(REQUEST_PARAM_PERSISTED, persisted); b.putString(REQUEST_PARAM_SERVICE, GooglePlayReceiver.class.getName()); writeTriggerToBundle(job, b); writeConstraintsToBundle(job, b); writeRetryStrategyToBundle(job, b); Bundle userExtras = job.getExtras(); if (userExtras == null) { userExtras = new Bundle(); } b.putBundle(REQUEST_PARAM_EXTRAS, jobCoder.encode(job, userExtras)); return b; }
GooglePlayJobWriter { public Bundle writeToBundle(JobParameters job, Bundle b) { b.putString(REQUEST_PARAM_TAG, job.getTag()); b.putBoolean(REQUEST_PARAM_UPDATE_CURRENT, job.shouldReplaceCurrent()); boolean persisted = job.getLifetime() == Lifetime.FOREVER; b.putBoolean(REQUEST_PARAM_PERSISTED, persisted); b.putString(REQUEST_PARAM_SERVICE, GooglePlayReceiver.class.getName()); writeTriggerToBundle(job, b); writeConstraintsToBundle(job, b); writeRetryStrategyToBundle(job, b); Bundle userExtras = job.getExtras(); if (userExtras == null) { userExtras = new Bundle(); } b.putBundle(REQUEST_PARAM_EXTRAS, jobCoder.encode(job, userExtras)); return b; } }
GooglePlayJobWriter { public Bundle writeToBundle(JobParameters job, Bundle b) { b.putString(REQUEST_PARAM_TAG, job.getTag()); b.putBoolean(REQUEST_PARAM_UPDATE_CURRENT, job.shouldReplaceCurrent()); boolean persisted = job.getLifetime() == Lifetime.FOREVER; b.putBoolean(REQUEST_PARAM_PERSISTED, persisted); b.putString(REQUEST_PARAM_SERVICE, GooglePlayReceiver.class.getName()); writeTriggerToBundle(job, b); writeConstraintsToBundle(job, b); writeRetryStrategyToBundle(job, b); Bundle userExtras = job.getExtras(); if (userExtras == null) { userExtras = new Bundle(); } b.putBundle(REQUEST_PARAM_EXTRAS, jobCoder.encode(job, userExtras)); return b; }  }
GooglePlayJobWriter { public Bundle writeToBundle(JobParameters job, Bundle b) { b.putString(REQUEST_PARAM_TAG, job.getTag()); b.putBoolean(REQUEST_PARAM_UPDATE_CURRENT, job.shouldReplaceCurrent()); boolean persisted = job.getLifetime() == Lifetime.FOREVER; b.putBoolean(REQUEST_PARAM_PERSISTED, persisted); b.putString(REQUEST_PARAM_SERVICE, GooglePlayReceiver.class.getName()); writeTriggerToBundle(job, b); writeConstraintsToBundle(job, b); writeRetryStrategyToBundle(job, b); Bundle userExtras = job.getExtras(); if (userExtras == null) { userExtras = new Bundle(); } b.putBundle(REQUEST_PARAM_EXTRAS, jobCoder.encode(job, userExtras)); return b; }  Bundle writeToBundle(JobParameters job, Bundle b); }
GooglePlayJobWriter { public Bundle writeToBundle(JobParameters job, Bundle b) { b.putString(REQUEST_PARAM_TAG, job.getTag()); b.putBoolean(REQUEST_PARAM_UPDATE_CURRENT, job.shouldReplaceCurrent()); boolean persisted = job.getLifetime() == Lifetime.FOREVER; b.putBoolean(REQUEST_PARAM_PERSISTED, persisted); b.putString(REQUEST_PARAM_SERVICE, GooglePlayReceiver.class.getName()); writeTriggerToBundle(job, b); writeConstraintsToBundle(job, b); writeRetryStrategyToBundle(job, b); Bundle userExtras = job.getExtras(); if (userExtras == null) { userExtras = new Bundle(); } b.putBundle(REQUEST_PARAM_EXTRAS, jobCoder.encode(job, userExtras)); return b; }  Bundle writeToBundle(JobParameters job, Bundle b);  }