Fixed
Status Update
Comments
ra...@google.com <ra...@google.com>
ap...@google.com <ap...@google.com> #2
Yigit, do you have time to fix it?
reemission of the same liveData is racy
reemission of the same liveData is racy
dr...@gmail.com <dr...@gmail.com> #3
yea i'll take it.
ap...@google.com <ap...@google.com> #4
Thanks for the detailed analysis. This may not be an issue anymore since we've started using Main.immediate there but I' not sure; I'll try to create a test case.
Description
long interval = 900000; // 15 minutes
long flexInterval = (interval / 2);
workRequestBuilder = new PeriodicWorkRequest.Builder(MyWorker.class, interval, TimeUnit.MILLISECONDS, flexInterval, TimeUnit.MILLISECONDS);
When I enqueue this on my Android 7 device, the first periodic work does not fire immediately, but as expected only fires halfway through the interval, when the flex period starts.
But when this is enqueued on an Android 4 device (I'm using an Android 4.3 emulator but I noticed this first on a user's real Android 4.3 device), the first periodic work fires IMMEDIATELY.
Seems like flexInterval is not properly taken into account pre Android 5 (based on AlarmManager)??