Fixed
Status Update
Comments
ra...@google.com <ra...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 6dc75802c57ce519ea6a5ad328368c743147f1a5
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Tue Feb 12 15:41:35 2019
Emulate flex time for AlarmManager implementation.
Test: Added unit tests
Fixes: b/124274584
Ran integraton tests on API 22.
Change-Id: I197f193dc2fb24b260cb5baf095b8d2bb028931f
M work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/MainActivity.java
M work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/ToastWorker.java
M work/integration-tests/testapp/src/main/res/layout/activity_main.xml
M work/integration-tests/testapp/src/main/res/values/strings.xml
M work/workmanager/src/androidTest/java/androidx/work/WorkSpecTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/WorkerWrapperTest.java
M work/workmanager/src/main/java/androidx/work/impl/WorkerWrapper.java
M work/workmanager/src/main/java/androidx/work/impl/model/WorkSpec.java
https://android-review.googlesource.com/903194
https://goto.google.com/android-sha1/6dc75802c57ce519ea6a5ad328368c743147f1a5
Branch: androidx-master-dev
commit 6dc75802c57ce519ea6a5ad328368c743147f1a5
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Tue Feb 12 15:41:35 2019
Emulate flex time for AlarmManager implementation.
Test: Added unit tests
Fixes:
Ran integraton tests on API 22.
Change-Id: I197f193dc2fb24b260cb5baf095b8d2bb028931f
M work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/MainActivity.java
M work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/ToastWorker.java
M work/integration-tests/testapp/src/main/res/layout/activity_main.xml
M work/integration-tests/testapp/src/main/res/values/strings.xml
M work/workmanager/src/androidTest/java/androidx/work/WorkSpecTest.java
M work/workmanager/src/androidTest/java/androidx/work/impl/WorkerWrapperTest.java
M work/workmanager/src/main/java/androidx/work/impl/WorkerWrapper.java
M work/workmanager/src/main/java/androidx/work/impl/model/WorkSpec.java
dr...@gmail.com <dr...@gmail.com> #3
Many thanks!
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 38beac9b36d050b7415332c39bbbcb9d253efa3a
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Wed Feb 13 11:16:38 2019
Align emulation of flex time with JobScheduler.
Test: Updated unit tests. Ran integration tests.
I/WM-ToastWorker(11424): Run time [Periodic work]: Wed Feb 13 11:16:03 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work with Flex]: Wed Feb 13 11:20:58 PST 2019 (scheduled at the same time as the one above)
I/WM-ToastWorker(11424): Run time [Periodic work]: Wed Feb 13 11:31:03 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work with Flex]: Wed Feb 13 11:35:58 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work]: Wed Feb 13 11:46:03 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work with Flex]: Wed Feb 13 11:50:58 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work]: Wed Feb 13 12:01:03 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work with Flex]: Wed Feb 13 12:05:58 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work]: Wed Feb 13 12:16:03 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work with Flex]: Wed Feb 13 12:20:59 PST 2019
Fixes: b/124274584
Change-Id: Ic0d2f97a6b53caa16bfd71da3b30fb40be9e68a4
M work/workmanager/src/androidTest/java/androidx/work/WorkSpecTest.java
M work/workmanager/src/main/java/androidx/work/impl/model/WorkSpec.java
https://android-review.googlesource.com/904373
https://goto.google.com/android-sha1/38beac9b36d050b7415332c39bbbcb9d253efa3a
Branch: androidx-master-dev
commit 38beac9b36d050b7415332c39bbbcb9d253efa3a
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Wed Feb 13 11:16:38 2019
Align emulation of flex time with JobScheduler.
Test: Updated unit tests. Ran integration tests.
I/WM-ToastWorker(11424): Run time [Periodic work]: Wed Feb 13 11:16:03 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work with Flex]: Wed Feb 13 11:20:58 PST 2019 (scheduled at the same time as the one above)
I/WM-ToastWorker(11424): Run time [Periodic work]: Wed Feb 13 11:31:03 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work with Flex]: Wed Feb 13 11:35:58 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work]: Wed Feb 13 11:46:03 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work with Flex]: Wed Feb 13 11:50:58 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work]: Wed Feb 13 12:01:03 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work with Flex]: Wed Feb 13 12:05:58 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work]: Wed Feb 13 12:16:03 PST 2019
I/WM-ToastWorker(11424): Run time [Periodic work with Flex]: Wed Feb 13 12:20:59 PST 2019
Fixes:
Change-Id: Ic0d2f97a6b53caa16bfd71da3b30fb40be9e68a4
M work/workmanager/src/androidTest/java/androidx/work/WorkSpecTest.java
M work/workmanager/src/main/java/androidx/work/impl/model/WorkSpec.java
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)??