Fixed
Status Update
Comments
su...@google.com <su...@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
ch...@gmail.com <ch...@gmail.com> #3
So if I understand this correctly, this enables us to add more worker factory at runtime?
[Deleted User] <[Deleted User]> #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.
ro...@gmail.com <ro...@gmail.com> #5
You should add your libraries at startup, not at some point after your app and WorkManager have been initialized.
su...@google.com <su...@google.com> #6
Reopening so I can just rename it to WorkResult.
ch...@instacart.com <ch...@instacart.com> #8
Thanks Sumir!
Description
Version used: 1.0.0-alpha12
After upgrading to alpha12, all of my Workers written in Kotlin (and CoroutineWorkers, FWIW), complain about the 'Result' return value with an error that says: "One type argument expected for class Result<out T>"
It appears that the Kotlin standard library contains a public inline Result class already:
The Kotlin Result class is automatically available in every file, so Android Studio (3.2.1) doesn't offer to import the androidx.work.Result class, causing the error since it assumes you want to use the already available kotlin Result.
There were two workarounds, neither very friendly:
1) Use the fully qualified androidx.work.Result
2) Manually adding the androidx.work.Result import statement
Note that:
- Using the fully qualified name, then using the Android Studio option to add import did not work
- Removing the doWork method entirely and using Android Studio's quick fix to implement the method did add an import to androidx.work.Result, so new classes would avoid running into this issue.