Status Update
Comments
su...@google.com <su...@google.com> #2
Triage notes: Assigning for a response.
dr...@gmail.com <dr...@gmail.com> #3
When updating the providers, startProvider()
is comparing the new scope produces with the previous scope produced, instead of the current parent scope, to determine if the content of the provider needs to change, ignoring if the parent changed. That has the effect of, if a provider provides a value that is identical to the parent value, the composer thinks that none of the the static composition locals changed and it doesn't need to force updates of the content of the provider.
The temporary work-around for this is to use a compositionLocalOf
instead. Using compositionLocalOf
is recommended for composition locals that can change and static should are not recommended for values that can change.
However, in the above example, LocalOtherValue
only changes once so using a staticCompositionLocal
is recommended as it avoids the overhead for tracking reads of a value that rarely changes, making this work-around temporary for LocalOtherValue
or similar locals.
Description
I know how to query the work queue and pick out enqueued work items as follows, but I'm just not sure how to tell what time each work item is scheduled to run:
WorkManager workManager = WorkManager.getInstance();
ListenableFuture<List<WorkInfo>> workInfos = workManager.getWorkInfosByTag("mywork");
try {
List<WorkInfo> workInfoList = workInfos.get();
for (WorkInfo workInfo : workInfoList) {
WorkInfo.State state = workInfo.getState();
if (state == WorkInfo.State.ENQUEUED) {
UUID workerId = workInfo.getId();
Log.d(TAG, "found enqueued work with id " + workerId);
// BUT HOW DO I TELL WHAT TIME THIS WORK IS SCHEDULED TO RUN?
}
}
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
Would be great to be able to query this information, such as what you can get via adb, e.g
PERIODIC: interval=+15m0s0ms flex=+15m0s0ms
Requires: charging=false deviceIdle=false
Earliest run time: 08:41
Latest run time: 23:41
BTW am loving WorkManager in general... it's brilliant to use compared to the mish-mash that was there before...!