Status Update
Comments
ar...@gmail.com <ar...@gmail.com> #3
Is there an ETA for the next release?
ra...@google.com <ra...@google.com> #4
ar...@gmail.com <ar...@gmail.com> #5
Branch: androidx-master-dev
commit a1957df3709a06f4e6482fb0e4d39ded4f230a70
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Mon Jul 29 09:48:05 2019
Workaround NPE in PersistableBundle.getExtras().
Test: Existing unit tests pass. Ran integration test app.
Fixes:
Change-Id: I0b48e0009a7d83c343a3d26112b94c057470c281
M work/workmanager/src/main/java/androidx/work/impl/background/systemjob/SystemJobService.java
ra...@google.com <ra...@google.com>
ap...@google.com <ap...@google.com> #6
ap...@google.com <ap...@google.com> #7
Branch: androidx-master-dev
commit bc246c52633969268455ebc6efc217246a7438c3
Author: Rahul Ravikumar <tikurahul@gmail.com>
Date: Fri Sep 18 00:24:05 2020
[GH] Decouple clearing of Notifications from stopping of SystemForegroundService
* When WorkerWrapper resolves the `ListenableFuture`, it calls `stopForeground()` if the Workers lifecycle was bound to a Foreground service.
* `Processor` performs `stopForeground()` on the task executor thread. This in turn triggers a `stopForegroundService()` if there is no more pending foreground work.
* Meanwhile on the main thread, `SystemForegroundDispatcher`'s `onExecuted()` is responsible for tracking foreground
notifications that need to be removed. This is the race condition because this might happen _after_ `stopForeground()` is
completed.
* This change makes `onExecuted()` the owner of the lifcycle of all notifications - that way everything is consistent.
Test: Ran integraton tests.
Fixes:
This is an imported pull request from
Resolves #79
Github-Pr-Head-Sha: f2dff9f5b95fa5e3ef0b8ed9a0904ab931ab4225
GitOrigin-RevId: 6ffbe1d2e0b180c9d25044784679c60ffaab3931
Change-Id: I547306d40e0557d0b5376e9f733d0b92399c0974
M development/build_log_simplifier/messages.ignore
M work/workmanager/src/androidTest/java/androidx/work/impl/foreground/SystemForegroundDispatcherTest.kt
M work/workmanager/src/main/java/androidx/work/impl/foreground/SystemForegroundDispatcher.java
ar...@gmail.com <ar...@gmail.com> #8
Thanks for the fix! Is there a WorkManager snapshot I can check?
ra...@google.com <ra...@google.com> #9
ar...@gmail.com <ar...@gmail.com> #10
Unfortunately still happens using 6850853
and 2.5.0-SNAPSHOT
.
Logs when notification wasn’t hidden:
2020-09-21 08:43:11.098 17842-17842/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemjob.SystemJobService enabled
2020-09-21 08:43:11.099 17842-17842/com.sample D/WM-Schedulers: Created SystemJobScheduler and enabled SystemJobService
2020-09-21 08:43:11.112 17842-17864/com.sample D/WM-WorkManagerImpl: Unable to initialize multi-process support
java.lang.ClassNotFoundException: androidx.work.multiprocess.RemoteWorkManagerClient
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at java.lang.Class.forName(Class.java:379)
at androidx.work.impl.WorkManagerImpl.tryInitializeMultiProcessSupport(WorkManagerImpl.java:789)
at androidx.work.impl.WorkManagerImpl.getRemoteWorkManager(WorkManagerImpl.java:620)
at androidx.work.impl.utils.ForceStopRunnable.multiProcessChecks(ForceStopRunnable.java:215)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:85)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.work.multiprocess.RemoteWorkManagerClient" on path: DexPathList[[zip file "/data/app/~~pznhiTJaz8mu2OlB1YnkvQ==/com.sample-a0bfoO8aHcj3liE7R1MTLw==/base.apk"],nativeLibraryDirectories=[/data/app/~~pznhiTJaz8mu2OlB1YnkvQ==/com.sample-a0bfoO8aHcj3liE7R1MTLw==/lib/arm64, /system/lib64, /system_ext/lib64, /product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at java.lang.Class.forName(Class.java:379)
at androidx.work.impl.WorkManagerImpl.tryInitializeMultiProcessSupport(WorkManagerImpl.java:789)
at androidx.work.impl.WorkManagerImpl.getRemoteWorkManager(WorkManagerImpl.java:620)
at androidx.work.impl.utils.ForceStopRunnable.multiProcessChecks(ForceStopRunnable.java:215)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:85)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
2020-09-21 08:43:11.113 17842-17864/com.sample D/WM-ForceStopRunnable: Performing cleanup operations.
2020-09-21 08:43:11.160 17842-17868/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemalarm.RescheduleReceiver enabled
2020-09-21 08:43:11.175 17842-17868/com.sample D/WM-SystemJobScheduler: Scheduling work ID 4424568b-8425-4f4b-bfc9-07660a579b9d Job ID 7
2020-09-21 08:43:11.179 17842-17868/com.sample D/WM-GreedyScheduler: Starting work for 4424568b-8425-4f4b-bfc9-07660a579b9d
2020-09-21 08:43:11.186 17842-17870/com.sample D/WM-Processor: Processor: processing 4424568b-8425-4f4b-bfc9-07660a579b9d
2020-09-21 08:43:11.254 17842-17842/com.sample D/WM-WorkerWrapper: Starting work for com.sample.WorkApplication$ForegroundWorker
2020-09-21 08:43:11.273 17842-17842/com.sample D/WM-SystemJobService: onStartJob for 4424568b-8425-4f4b-bfc9-07660a579b9d
2020-09-21 08:43:11.274 17842-17869/com.sample D/WM-Processor: Work 4424568b-8425-4f4b-bfc9-07660a579b9d is already enqueued for processing
2020-09-21 08:43:11.276 17842-17869/com.sample I/WM-Processor: Moving WorkSpec (4424568b-8425-4f4b-bfc9-07660a579b9d) to the foreground
2020-09-21 08:43:11.295 17842-17873/com.sample D/WM-Foreground-Worker: I AM DONE!
2020-09-21 08:43:11.295 17842-17842/com.sample I/WM-SystemFgDispatcher: Started foreground service Intent { act=ACTION_START_FOREGROUND cmp=com.sample/androidx.work.impl.foreground.SystemForegroundService (has extras) }
2020-09-21 08:43:11.296 17842-17868/com.sample D/WM-WorkerWrapper: com.sample.WorkApplication$ForegroundWorker returned a Success {mOutputData=Data {}} result.
2020-09-21 08:43:11.298 17842-17868/com.sample I/WM-WorkerWrapper: Worker result SUCCESS for Work [ id=4424568b-8425-4f4b-bfc9-07660a579b9d, tags={ com.sample.WorkApplication$ForegroundWorker } ]
2020-09-21 08:43:11.301 17842-17868/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemalarm.RescheduleReceiver disabled
2020-09-21 08:43:11.301 17842-17842/com.sample D/WM-SystemFgDispatcher: Notifying with (id: 42, workSpecId: 4424568b-8425-4f4b-bfc9-07660a579b9d, notificationType: 0)
2020-09-21 08:43:11.305 17842-17842/com.sample D/WM-SystemFgDispatcher: Notifying with (id: 42, workSpecId: 4424568b-8425-4f4b-bfc9-07660a579b9d, notificationType: 0)
2020-09-21 08:43:11.309 17842-17842/com.sample I/WM-SystemFgDispatcher: Stopping foreground service
2020-09-21 08:43:11.309 17842-17868/com.sample D/WM-GreedyScheduler: Cancelling work ID 4424568b-8425-4f4b-bfc9-07660a579b9d
2020-09-21 08:43:11.309 17842-17842/com.sample D/WM-SystemFgService: All commands completed.
2020-09-21 08:43:11.312 17842-17842/com.sample D/WM-Processor: Processor 4424568b-8425-4f4b-bfc9-07660a579b9d executed; reschedule = false
2020-09-21 08:43:11.313 17842-17842/com.sample D/WM-SystemJobService: 4424568b-8425-4f4b-bfc9-07660a579b9d executed on JobScheduler
2020-09-21 08:43:11.313 17842-17842/com.sample D/WM-SystemFgDispatcher: Removing Notification (id: 42, workSpecId: 4424568b-8425-4f4b-bfc9-07660a579b9d ,notificationType: 0)
2020-09-21 08:43:11.315 17842-17842/com.sample D/WM-SystemJobService: onStopJob for 4424568b-8425-4f4b-bfc9-07660a579b9d
2020-09-21 08:43:11.320 17842-17868/com.sample D/WM-Processor: Processor stopping background work 4424568b-8425-4f4b-bfc9-07660a579b9d
2020-09-21 08:43:11.321 17842-17868/com.sample D/WM-Processor: WorkerWrapper could not be found for 4424568b-8425-4f4b-bfc9-07660a579b9d
2020-09-21 08:43:11.321 17842-17868/com.sample D/WM-StopWorkRunnable: StopWorkRunnable for 4424568b-8425-4f4b-bfc9-07660a579b9d; Processor.stopWork = false
2020-09-21 08:43:11.322 17842-17868/com.sample D/WM-Processor: Processor stopping background work 4424568b-8425-4f4b-bfc9-07660a579b9d
2020-09-21 08:43:11.322 17842-17868/com.sample D/WM-Processor: WorkerWrapper could not be found for 4424568b-8425-4f4b-bfc9-07660a579b9d
2020-09-21 08:43:11.322 17842-17868/com.sample D/WM-StopWorkRunnable: StopWorkRunnable for 4424568b-8425-4f4b-bfc9-07660a579b9d; Processor.stopWork = false
Corresponding diagnostics:
2020-09-21 08:47:19.149 17842-17842/com.sample D/WM-DiagnosticsRcvr: Requesting diagnostics
2020-09-21 08:47:19.161 17842-17864/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemalarm.RescheduleReceiver enabled
2020-09-21 08:47:19.178 17842-17864/com.sample D/WM-SystemJobScheduler: Scheduling work ID 81c3ccd7-43fa-411e-b319-00572086249b Job ID 8
2020-09-21 08:47:19.188 17842-17864/com.sample D/WM-GreedyScheduler: Starting work for 81c3ccd7-43fa-411e-b319-00572086249b
2020-09-21 08:47:19.192 17842-17870/com.sample D/WM-Processor: Processor: processing 81c3ccd7-43fa-411e-b319-00572086249b
2020-09-21 08:47:19.195 17842-17842/com.sample D/WM-SystemJobService: onStartJob for 81c3ccd7-43fa-411e-b319-00572086249b
2020-09-21 08:47:19.211 17842-17870/com.sample D/WM-Processor: Work 81c3ccd7-43fa-411e-b319-00572086249b is already enqueued for processing
2020-09-21 08:47:19.211 17842-17842/com.sample D/WM-WorkerWrapper: Starting work for androidx.work.impl.workers.DiagnosticsWorker
2020-09-21 08:47:19.224 17842-18039/com.sample I/WM-DiagnosticsWrkr: Recently completed work:
2020-09-21 08:47:19.231 17842-18039/com.sample I/WM-DiagnosticsWrkr: Id Class Name Job Id State Unique Name Tags
4424568b-8425-4f4b-bfc9-07660a579b9d com.sample.WorkApplication$ForegroundWorker null SUCCEEDED foreground-work com.sample.WorkApplication$ForegroundWorker
2020-09-21 08:47:19.231 17842-18039/com.sample I/WM-DiagnosticsWrkr: Running work:
2020-09-21 08:47:19.236 17842-18039/com.sample I/WM-DiagnosticsWrkr: Id Class Name Job Id State Unique Name Tags
81c3ccd7-43fa-411e-b319-00572086249b androidx.work.impl.workers.DiagnosticsWorker 8 RUNNING androidx.work.impl.workers.DiagnosticsWorker
2020-09-21 08:47:19.237 17842-17868/com.sample D/WM-WorkerWrapper: androidx.work.impl.workers.DiagnosticsWorker returned a Success {mOutputData=Data {}} result.
2020-09-21 08:47:19.240 17842-17868/com.sample I/WM-WorkerWrapper: Worker result SUCCESS for Work [ id=81c3ccd7-43fa-411e-b319-00572086249b, tags={ androidx.work.impl.workers.DiagnosticsWorker } ]
2020-09-21 08:47:19.246 17842-17868/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemalarm.RescheduleReceiver disabled
2020-09-21 08:47:19.248 17842-17842/com.sample D/WM-Processor: Processor 81c3ccd7-43fa-411e-b319-00572086249b executed; reschedule = false
2020-09-21 08:47:19.248 17842-17842/com.sample D/WM-SystemJobService: 81c3ccd7-43fa-411e-b319-00572086249b executed on JobScheduler
2020-09-21 08:47:19.272 17842-17868/com.sample D/WM-GreedyScheduler: Cancelling work ID 81c3ccd7-43fa-411e-b319-00572086249b
2020-09-21 08:47:19.279 17842-17868/com.sample D/WM-Processor: Processor stopping background work 81c3ccd7-43fa-411e-b319-00572086249b
2020-09-21 08:47:19.280 17842-17868/com.sample D/WM-Processor: WorkerWrapper could not be found for 81c3ccd7-43fa-411e-b319-00572086249b
2020-09-21 08:47:19.280 17842-17868/com.sample D/WM-StopWorkRunnable: StopWorkRunnable for 81c3ccd7-43fa-411e-b319-00572086249b; Processor.stopWork = false
Logs when notification was hidden (hides with 5 second timeout visually if this matters):
2020-09-21 08:48:14.677 18220-18220/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemjob.SystemJobService enabled
2020-09-21 08:48:14.677 18220-18220/com.sample D/WM-Schedulers: Created SystemJobScheduler and enabled SystemJobService
2020-09-21 08:48:14.686 18220-18242/com.sample D/WM-WorkManagerImpl: Unable to initialize multi-process support
java.lang.ClassNotFoundException: androidx.work.multiprocess.RemoteWorkManagerClient
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at java.lang.Class.forName(Class.java:379)
at androidx.work.impl.WorkManagerImpl.tryInitializeMultiProcessSupport(WorkManagerImpl.java:789)
at androidx.work.impl.WorkManagerImpl.getRemoteWorkManager(WorkManagerImpl.java:620)
at androidx.work.impl.utils.ForceStopRunnable.multiProcessChecks(ForceStopRunnable.java:215)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:85)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.work.multiprocess.RemoteWorkManagerClient" on path: DexPathList[[zip file "/data/app/~~pznhiTJaz8mu2OlB1YnkvQ==/com.sample-a0bfoO8aHcj3liE7R1MTLw==/base.apk"],nativeLibraryDirectories=[/data/app/~~pznhiTJaz8mu2OlB1YnkvQ==/com.sample-a0bfoO8aHcj3liE7R1MTLw==/lib/arm64, /system/lib64, /system_ext/lib64, /product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at java.lang.Class.forName(Class.java:379)
at androidx.work.impl.WorkManagerImpl.tryInitializeMultiProcessSupport(WorkManagerImpl.java:789)
at androidx.work.impl.WorkManagerImpl.getRemoteWorkManager(WorkManagerImpl.java:620)
at androidx.work.impl.utils.ForceStopRunnable.multiProcessChecks(ForceStopRunnable.java:215)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:85)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
2020-09-21 08:48:14.686 18220-18242/com.sample D/WM-ForceStopRunnable: Performing cleanup operations.
2020-09-21 08:48:14.729 18220-18246/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemalarm.RescheduleReceiver enabled
2020-09-21 08:48:14.739 18220-18246/com.sample D/WM-SystemJobScheduler: Scheduling work ID 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475 Job ID 10
2020-09-21 08:48:14.744 18220-18246/com.sample D/WM-GreedyScheduler: Starting work for 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475
2020-09-21 08:48:14.750 18220-18248/com.sample D/WM-Processor: Processor: processing 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475
2020-09-21 08:48:14.819 18220-18220/com.sample D/WM-WorkerWrapper: Starting work for com.sample.WorkApplication$ForegroundWorker
2020-09-21 08:48:14.838 18220-18220/com.sample D/WM-SystemJobService: onStartJob for 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475
2020-09-21 08:48:14.838 18220-18247/com.sample D/WM-Processor: Work 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475 is already enqueued for processing
2020-09-21 08:48:14.841 18220-18248/com.sample I/WM-Processor: Moving WorkSpec (2e0eb977-ff9b-4bf3-9c59-2b5c585ee475) to the foreground
2020-09-21 08:48:14.854 18220-18251/com.sample D/WM-Foreground-Worker: I AM DONE!
2020-09-21 08:48:14.855 18220-18242/com.sample D/WM-WorkerWrapper: com.sample.WorkApplication$ForegroundWorker returned a Success {mOutputData=Data {}} result.
2020-09-21 08:48:14.856 18220-18220/com.sample I/WM-SystemFgDispatcher: Started foreground service Intent { act=ACTION_START_FOREGROUND cmp=com.sample/androidx.work.impl.foreground.SystemForegroundService (has extras) }
2020-09-21 08:48:14.856 18220-18220/com.sample D/WM-SystemFgDispatcher: Notifying with (id: 42, workSpecId: 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475, notificationType: 0)
2020-09-21 08:48:14.858 18220-18242/com.sample I/WM-WorkerWrapper: Worker result SUCCESS for Work [ id=2e0eb977-ff9b-4bf3-9c59-2b5c585ee475, tags={ com.sample.WorkApplication$ForegroundWorker } ]
2020-09-21 08:48:14.858 18220-18220/com.sample D/WM-SystemFgDispatcher: Notifying with (id: 42, workSpecId: 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475, notificationType: 0)
2020-09-21 08:48:14.861 18220-18242/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemalarm.RescheduleReceiver disabled
2020-09-21 08:48:14.864 18220-18220/com.sample I/WM-SystemFgDispatcher: Stopping foreground service
2020-09-21 08:48:14.864 18220-18220/com.sample D/WM-SystemFgService: All commands completed.
2020-09-21 08:48:14.866 18220-18220/com.sample D/WM-Processor: Processor 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475 executed; reschedule = false
2020-09-21 08:48:14.866 18220-18220/com.sample D/WM-SystemJobService: 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475 executed on JobScheduler
2020-09-21 08:48:14.866 18220-18220/com.sample D/WM-SystemFgDispatcher: Removing Notification (id: 42, workSpecId: 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475 ,notificationType: 0)
2020-09-21 08:48:14.868 18220-18242/com.sample D/WM-GreedyScheduler: Cancelling work ID 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475
2020-09-21 08:48:14.872 18220-18220/com.sample D/WM-SystemJobService: onStopJob for 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475
2020-09-21 08:48:14.874 18220-18246/com.sample D/WM-Processor: Processor stopping background work 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475
2020-09-21 08:48:14.874 18220-18246/com.sample D/WM-Processor: WorkerWrapper could not be found for 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475
2020-09-21 08:48:14.875 18220-18246/com.sample D/WM-StopWorkRunnable: StopWorkRunnable for 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475; Processor.stopWork = false
2020-09-21 08:48:14.876 18220-18246/com.sample D/WM-Processor: Processor stopping background work 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475
2020-09-21 08:48:14.876 18220-18246/com.sample D/WM-Processor: WorkerWrapper could not be found for 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475
2020-09-21 08:48:14.876 18220-18246/com.sample D/WM-StopWorkRunnable: StopWorkRunnable for 2e0eb977-ff9b-4bf3-9c59-2b5c585ee475; Processor.stopWork = false
Corresponding diagnostics:
2020-09-21 08:48:56.601 18220-18220/com.sample D/WM-DiagnosticsRcvr: Requesting diagnostics
2020-09-21 08:48:56.610 18220-18242/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemalarm.RescheduleReceiver enabled
2020-09-21 08:48:56.627 18220-18242/com.sample D/WM-SystemJobScheduler: Scheduling work ID 1c7aaff0-5304-4645-b4a8-35c9511c3df3 Job ID 11
2020-09-21 08:48:56.635 18220-18242/com.sample D/WM-GreedyScheduler: Starting work for 1c7aaff0-5304-4645-b4a8-35c9511c3df3
2020-09-21 08:48:56.640 18220-18248/com.sample D/WM-Processor: Processor: processing 1c7aaff0-5304-4645-b4a8-35c9511c3df3
2020-09-21 08:48:56.649 18220-18220/com.sample D/WM-SystemJobService: onStartJob for 1c7aaff0-5304-4645-b4a8-35c9511c3df3
2020-09-21 08:48:56.657 18220-18220/com.sample D/WM-WorkerWrapper: Starting work for androidx.work.impl.workers.DiagnosticsWorker
2020-09-21 08:48:56.658 18220-18248/com.sample D/WM-Processor: Work 1c7aaff0-5304-4645-b4a8-35c9511c3df3 is already enqueued for processing
2020-09-21 08:48:56.668 18220-18280/com.sample I/WM-DiagnosticsWrkr: Recently completed work:
2020-09-21 08:48:56.676 18220-18280/com.sample I/WM-DiagnosticsWrkr: Id Class Name Job Id State Unique Name Tags
2e0eb977-ff9b-4bf3-9c59-2b5c585ee475 com.sample.WorkApplication$ForegroundWorker null SUCCEEDED foreground-work com.sample.WorkApplication$ForegroundWorker
81c3ccd7-43fa-411e-b319-00572086249b androidx.work.impl.workers.DiagnosticsWorker null SUCCEEDED androidx.work.impl.workers.DiagnosticsWorker
2020-09-21 08:48:56.677 18220-18280/com.sample I/WM-DiagnosticsWrkr: Running work:
2020-09-21 08:48:56.683 18220-18280/com.sample I/WM-DiagnosticsWrkr: Id Class Name Job Id State Unique Name Tags
1c7aaff0-5304-4645-b4a8-35c9511c3df3 androidx.work.impl.workers.DiagnosticsWorker 11 RUNNING androidx.work.impl.workers.DiagnosticsWorker
2020-09-21 08:48:56.684 18220-18246/com.sample D/WM-WorkerWrapper: androidx.work.impl.workers.DiagnosticsWorker returned a Success {mOutputData=Data {}} result.
2020-09-21 08:48:56.686 18220-18246/com.sample I/WM-WorkerWrapper: Worker result SUCCESS for Work [ id=1c7aaff0-5304-4645-b4a8-35c9511c3df3, tags={ androidx.work.impl.workers.DiagnosticsWorker } ]
2020-09-21 08:48:56.692 18220-18246/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemalarm.RescheduleReceiver disabled
2020-09-21 08:48:56.693 18220-18220/com.sample D/WM-Processor: Processor 1c7aaff0-5304-4645-b4a8-35c9511c3df3 executed; reschedule = false
2020-09-21 08:48:56.693 18220-18220/com.sample D/WM-SystemJobService: 1c7aaff0-5304-4645-b4a8-35c9511c3df3 executed on JobScheduler
2020-09-21 08:48:56.705 18220-18246/com.sample D/WM-GreedyScheduler: Cancelling work ID 1c7aaff0-5304-4645-b4a8-35c9511c3df3
2020-09-21 08:48:56.715 18220-18246/com.sample D/WM-Processor: Processor stopping background work 1c7aaff0-5304-4645-b4a8-35c9511c3df3
2020-09-21 08:48:56.715 18220-18246/com.sample D/WM-Processor: WorkerWrapper could not be found for 1c7aaff0-5304-4645-b4a8-35c9511c3df3
2020-09-21 08:48:56.716 18220-18246/com.sample D/WM-StopWorkRunnable: StopWorkRunnable for 1c7aaff0-5304-4645-b4a8-35c9511c3df3; Processor.stopWork = false
ra...@google.com <ra...@google.com> #11
Let me try and reproduce again. I was unable to reproduce this after I made the fix.
ra...@google.com <ra...@google.com> #12
I looked into this further, and it looks like there is a bug in the platform in Android 11. Will keep this bug updated as i have more information.
ar...@gmail.com <ar...@gmail.com> #13
Checked again with 6853689
and 2.5.0-SNAPSHOT
:
- Google Pixel 1 with Android 10. Notification is not even showing. Had to add a timeout before producing
Result.success()
to check that it’s even in place. - Google Pixel 3a with Android 11. 10% of tries the notification is not even showing. 85% it’s shown for 5 seconds or so and then hides. 5% it sticks forever. The "forever" outcome logs and diagnostics are below.
Logs:
2020-09-22 09:36:33.017 13711-13711/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemjob.SystemJobService enabled
2020-09-22 09:36:33.017 13711-13711/com.sample D/WM-Schedulers: Created SystemJobScheduler and enabled SystemJobService
2020-09-22 09:36:33.027 13711-13771/com.sample D/WM-WorkManagerImpl: Unable to initialize multi-process support
java.lang.ClassNotFoundException: androidx.work.multiprocess.RemoteWorkManagerClient
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at java.lang.Class.forName(Class.java:379)
at androidx.work.impl.WorkManagerImpl.tryInitializeMultiProcessSupport(WorkManagerImpl.java:789)
at androidx.work.impl.WorkManagerImpl.getRemoteWorkManager(WorkManagerImpl.java:620)
at androidx.work.impl.utils.ForceStopRunnable.multiProcessChecks(ForceStopRunnable.java:215)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:85)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.work.multiprocess.RemoteWorkManagerClient" on path: DexPathList[[zip file "/data/app/~~zyT1LboFg6KO8LnnXW0Bdw==/com.sample-mm1hod8ctb8bzuHrgG2QOw==/base.apk"],nativeLibraryDirectories=[/data/app/~~zyT1LboFg6KO8LnnXW0Bdw==/com.sample-mm1hod8ctb8bzuHrgG2QOw==/lib/arm64, /system/lib64, /system_ext/lib64, /product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at java.lang.Class.forName(Class.java:379)
at androidx.work.impl.WorkManagerImpl.tryInitializeMultiProcessSupport(WorkManagerImpl.java:789)
at androidx.work.impl.WorkManagerImpl.getRemoteWorkManager(WorkManagerImpl.java:620)
at androidx.work.impl.utils.ForceStopRunnable.multiProcessChecks(ForceStopRunnable.java:215)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:85)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
2020-09-22 09:36:33.029 13711-13771/com.sample D/WM-ForceStopRunnable: Performing cleanup operations.
2020-09-22 09:36:33.078 13711-13775/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemalarm.RescheduleReceiver enabled
2020-09-22 09:36:33.095 13711-13775/com.sample D/WM-SystemJobScheduler: Scheduling work ID ae315b30-745d-4669-bfe5-20feecac92ec Job ID 28
2020-09-22 09:36:33.105 13711-13775/com.sample D/WM-GreedyScheduler: Starting work for ae315b30-745d-4669-bfe5-20feecac92ec
2020-09-22 09:36:33.112 13711-13777/com.sample D/WM-Processor: Processor: processing ae315b30-745d-4669-bfe5-20feecac92ec
2020-09-22 09:36:33.176 13711-13711/com.sample D/WM-SystemJobService: onStartJob for ae315b30-745d-4669-bfe5-20feecac92ec
2020-09-22 09:36:33.177 13711-13776/com.sample D/WM-Processor: Work ae315b30-745d-4669-bfe5-20feecac92ec is already enqueued for processing
2020-09-22 09:36:33.177 13711-13711/com.sample D/WM-WorkerWrapper: Starting work for com.sample.WorkApplication$ForegroundWorker
2020-09-22 09:36:33.199 13711-13777/com.sample I/WM-Processor: Moving WorkSpec (ae315b30-745d-4669-bfe5-20feecac92ec) to the foreground
2020-09-22 09:36:33.220 13711-13780/com.sample D/WM-Foreground-Worker: I AM DONE!
2020-09-22 09:36:33.221 13711-13775/com.sample D/WM-WorkerWrapper: com.sample.WorkApplication$ForegroundWorker returned a Success {mOutputData=Data {}} result.
2020-09-22 09:36:33.222 13711-13775/com.sample I/WM-WorkerWrapper: Worker result SUCCESS for Work [ id=ae315b30-745d-4669-bfe5-20feecac92ec, tags={ com.sample.WorkApplication$ForegroundWorker } ]
2020-09-22 09:36:33.224 13711-13711/com.sample I/WM-SystemFgDispatcher: Started foreground service Intent { act=ACTION_START_FOREGROUND cmp=com.sample/androidx.work.impl.foreground.SystemForegroundService (has extras) }
2020-09-22 09:36:33.225 13711-13711/com.sample D/WM-SystemFgDispatcher: Notifying with (id: 42, workSpecId: ae315b30-745d-4669-bfe5-20feecac92ec, notificationType: 0)
2020-09-22 09:36:33.226 13711-13775/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemalarm.RescheduleReceiver disabled
2020-09-22 09:36:33.228 13711-13711/com.sample D/WM-SystemFgDispatcher: Notifying with (id: 42, workSpecId: ae315b30-745d-4669-bfe5-20feecac92ec, notificationType: 0)
2020-09-22 09:36:33.229 13711-13711/com.sample I/WM-SystemFgDispatcher: Stopping foreground service
2020-09-22 09:36:33.230 13711-13711/com.sample D/WM-SystemFgService: All commands completed.
2020-09-22 09:36:33.233 13711-13711/com.sample D/WM-Processor: Processor ae315b30-745d-4669-bfe5-20feecac92ec executed; reschedule = false
2020-09-22 09:36:33.234 13711-13711/com.sample D/WM-SystemJobService: ae315b30-745d-4669-bfe5-20feecac92ec executed on JobScheduler
2020-09-22 09:36:33.234 13711-13711/com.sample D/WM-SystemFgDispatcher: Removing Notification (id: 42, workSpecId: ae315b30-745d-4669-bfe5-20feecac92ec ,notificationType: 0)
2020-09-22 09:36:33.235 13711-13775/com.sample D/WM-GreedyScheduler: Cancelling work ID ae315b30-745d-4669-bfe5-20feecac92ec
2020-09-22 09:36:33.237 13711-13711/com.sample D/WM-SystemJobService: onStopJob for ae315b30-745d-4669-bfe5-20feecac92ec
2020-09-22 09:36:33.242 13711-13775/com.sample D/WM-Processor: Processor stopping background work ae315b30-745d-4669-bfe5-20feecac92ec
2020-09-22 09:36:33.242 13711-13775/com.sample D/WM-Processor: WorkerWrapper could not be found for ae315b30-745d-4669-bfe5-20feecac92ec
2020-09-22 09:36:33.242 13711-13775/com.sample D/WM-StopWorkRunnable: StopWorkRunnable for ae315b30-745d-4669-bfe5-20feecac92ec; Processor.stopWork = false
2020-09-22 09:36:33.244 13711-13775/com.sample D/WM-Processor: Processor stopping background work ae315b30-745d-4669-bfe5-20feecac92ec
2020-09-22 09:36:33.244 13711-13775/com.sample D/WM-Processor: WorkerWrapper could not be found for ae315b30-745d-4669-bfe5-20feecac92ec
2020-09-22 09:36:33.244 13711-13775/com.sample D/WM-StopWorkRunnable: StopWorkRunnable for ae315b30-745d-4669-bfe5-20feecac92ec; Processor.stopWork = false
Diagnostics:
2020-09-22 09:39:01.696 13711-13711/com.sample D/WM-DiagnosticsRcvr: Requesting diagnostics
2020-09-22 09:39:01.706 13711-13771/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemalarm.RescheduleReceiver enabled
2020-09-22 09:39:01.720 13711-13771/com.sample D/WM-SystemJobScheduler: Scheduling work ID 67418b7b-a714-4b56-9496-12e05f76b672 Job ID 29
2020-09-22 09:39:01.728 13711-13771/com.sample D/WM-GreedyScheduler: Starting work for 67418b7b-a714-4b56-9496-12e05f76b672
2020-09-22 09:39:01.733 13711-13776/com.sample D/WM-Processor: Processor: processing 67418b7b-a714-4b56-9496-12e05f76b672
2020-09-22 09:39:01.742 13711-13711/com.sample D/WM-SystemJobService: onStartJob for 67418b7b-a714-4b56-9496-12e05f76b672
2020-09-22 09:39:01.749 13711-13711/com.sample D/WM-WorkerWrapper: Starting work for androidx.work.impl.workers.DiagnosticsWorker
2020-09-22 09:39:01.751 13711-13777/com.sample D/WM-Processor: Work 67418b7b-a714-4b56-9496-12e05f76b672 is already enqueued for processing
2020-09-22 09:39:01.762 13711-13841/com.sample I/WM-DiagnosticsWrkr: Recently completed work:
2020-09-22 09:39:01.768 13711-13841/com.sample I/WM-DiagnosticsWrkr: Id Class Name Job Id State Unique Name Tags
ae315b30-745d-4669-bfe5-20feecac92ec com.sample.WorkApplication$ForegroundWorker null SUCCEEDED foreground-work com.sample.WorkApplication$ForegroundWorker
2020-09-22 09:39:01.768 13711-13841/com.sample I/WM-DiagnosticsWrkr: Running work:
2020-09-22 09:39:01.772 13711-13841/com.sample I/WM-DiagnosticsWrkr: Id Class Name Job Id State Unique Name Tags
67418b7b-a714-4b56-9496-12e05f76b672 androidx.work.impl.workers.DiagnosticsWorker 29 RUNNING androidx.work.impl.workers.DiagnosticsWorker
2020-09-22 09:39:01.773 13711-13776/com.sample D/WM-WorkerWrapper: androidx.work.impl.workers.DiagnosticsWorker returned a Success {mOutputData=Data {}} result.
2020-09-22 09:39:01.776 13711-13776/com.sample I/WM-WorkerWrapper: Worker result SUCCESS for Work [ id=67418b7b-a714-4b56-9496-12e05f76b672, tags={ androidx.work.impl.workers.DiagnosticsWorker } ]
2020-09-22 09:39:01.782 13711-13776/com.sample D/WM-PackageManagerHelper: androidx.work.impl.background.systemalarm.RescheduleReceiver disabled
2020-09-22 09:39:01.784 13711-13711/com.sample D/WM-Processor: Processor 67418b7b-a714-4b56-9496-12e05f76b672 executed; reschedule = false
2020-09-22 09:39:01.785 13711-13711/com.sample D/WM-SystemJobService: 67418b7b-a714-4b56-9496-12e05f76b672 executed on JobScheduler
2020-09-22 09:39:01.791 13711-13776/com.sample D/WM-GreedyScheduler: Cancelling work ID 67418b7b-a714-4b56-9496-12e05f76b672
2020-09-22 09:39:01.800 13711-13776/com.sample D/WM-Processor: Processor stopping background work 67418b7b-a714-4b56-9496-12e05f76b672
2020-09-22 09:39:01.801 13711-13776/com.sample D/WM-Processor: WorkerWrapper could not be found for 67418b7b-a714-4b56-9496-12e05f76b672
2020-09-22 09:39:01.801 13711-13776/com.sample D/WM-StopWorkRunnable: StopWorkRunnable for 67418b7b-a714-4b56-9496-12e05f76b672; Processor.stopWork = false
ra...@google.com <ra...@google.com> #14
That is correct, and in-line with what I am seeing. There a known bug in R that is being tracked which causes this to happen.
ar...@gmail.com <ar...@gmail.com> #15
Hey, do you have any news on this? Is there a reference to a platform issue? Should this issue be reopened? Is it possible to workaround the platform issue in WM? Is it possible to workaround the platform issue on the client side?
Sorry, a lot of questions but it would be nice to get rid of the issue on our side somehow.
ra...@google.com <ra...@google.com> #16
Sorry, the bug tracking the platform issue is internal.
This has not been fixed in the platform yet. There is a race condition in NotificationManager
's implementation. Unfortunately there are no known workarounds for this issue.
Will send out an update once the underlying bug is fixed.
ar...@gmail.com <ar...@gmail.com> #17
All right, thanks for the update!
Just a dumb idea: if we set a minimum work duration (to 3 seconds or so) on our side — will it help to mitigate the issue and avoid the race condition?
ra...@google.com <ra...@google.com> #18
It might alleviate your problem. There is still a race condition so it could still happen, but I am pretty sure it wont happen as often as it is now.
ar...@gmail.com <ar...@gmail.com> #19
Thanks again! We’ll check if it helps IRL.
Description
Don’t think the Android version matters here. The device might — we’ve observed that Google Pixel 4 (Android 10) does not suffer from this as often.
The sample application is attached. Steps to reproduce using it:
Logs captured using custom configuration (level is set to
DEBUG
):Fine behavior (notification is hidden eventually):
Diagnostics:
Issue behavior (notification is not hidden):
Diagnostics: