Fixed
Status Update
Comments
ra...@google.com <ra...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 19b15188d2c730d65e6a1e24e5df26bcfd1bffa7
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Tue Apr 30 17:27:38 2019
Add a delegating WorkerFactory which can delegate to other WorkerFactories.
Test: Added unit tests.
Fixes: b/131435993
Change-Id: Id55dfca1ea4461b2bf2d7da2356c6cce9af22507
M work/workmanager/api/2.1.0-alpha01.txt
M work/workmanager/api/current.txt
M work/workmanager/build.gradle
A work/workmanager/src/androidTest/java/androidx/work/DelegatingWorkerFactoryTest.kt
A work/workmanager/src/main/java/androidx/work/DelegatingWorkerFactory.java
M work/workmanager/src/main/java/androidx/work/WorkerFactory.java
https://android-review.googlesource.com/954186
https://goto.google.com/android-sha1/19b15188d2c730d65e6a1e24e5df26bcfd1bffa7
Branch: androidx-master-dev
commit 19b15188d2c730d65e6a1e24e5df26bcfd1bffa7
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Tue Apr 30 17:27:38 2019
Add a delegating WorkerFactory which can delegate to other WorkerFactories.
Test: Added unit tests.
Fixes:
Change-Id: Id55dfca1ea4461b2bf2d7da2356c6cce9af22507
M work/workmanager/api/2.1.0-alpha01.txt
M work/workmanager/api/current.txt
M work/workmanager/build.gradle
A work/workmanager/src/androidTest/java/androidx/work/DelegatingWorkerFactoryTest.kt
A work/workmanager/src/main/java/androidx/work/DelegatingWorkerFactory.java
M work/workmanager/src/main/java/androidx/work/WorkerFactory.java
ca...@careem.com <ca...@careem.com> #3
So if I understand this correctly, this enables us to add more worker factory at runtime?
ra...@google.com <ra...@google.com> #4
This enables the use-case where a library that uses WorkManager uses a different WorkerFactory. So an application could add the library provided WorkerFactory to the list of delegates.
Description
I have created a Worker and a test class running it, but the doWork method is not called.
I have tried to debug the issue and the work is not executed as the constructor of `TestWorkManagerImpl` creates a list of Schedulers with one `null` Scheduler. due to this the Schedulers.schedule method throws a null pointer exception.
Here is the stacktrace from the exception:
androidx.work.impl.Schedulers.schedule(Schedulers.java:91)
androidx.work.impl.utils.EnqueueRunnable.scheduleWorkInBackground(EnqueueRunnable.java:131)
androidx.work.impl.utils.EnqueueRunnable.run(EnqueueRunnable.java:92)
androidx.work.testing.TestWorkManagerImpl$1.executeOnBackgroundThread(TestWorkManagerImpl.java:63)
androidx.work.impl.WorkContinuationImpl.enqueue(WorkContinuationImpl.java:185)
androidx.work.impl.WorkManagerImpl.enqueue(WorkManagerImpl.java:305)
androidx.work.WorkManager.enqueue(WorkManager.java:180)
com.example.carlo.myapplication.testWorker() <--- where WorkManager.getInstance().enqueue(request) is called
I have also created a project with one failing test.
I am using WorkManager 1.0.0-beta01
Please let me know if you need more information