@Test public void testWriteToBundle_triggers() { Bundle b = writer.writeToBundle( initializeDefaultBuilder().setTrigger(Trigger.NOW).build(), new Bundle()); assertEquals("window_start", 0, b.getLong("window_start")); assertEquals("window_end", 1, b.getLong("window_end")); JobTrigger.ExecutionWindowTrigger t = Trigger.executionWindow(631, 978); b = writer.writeToBundle(initializeDefaultBuilder().setTrigger(t).build(), new Bundle()); assertEquals("window_start", t.getWindowStart(), b.getLong("window_start")); assertEquals("window_end", t.getWindowEnd(), b.getLong("window_end")); b = writer.writeToBundle( initializeDefaultBuilder().setRecurring(true).setTrigger(t).build(), new Bundle()); assertEquals("period", t.getWindowEnd(), b.getLong("period")); assertEquals("period_flex", t.getWindowEnd() - t.getWindowStart(), b.getLong("period_flex")); }
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);  }