Fixed
Status Update
Comments
su...@google.com <su...@google.com>
ap...@google.com <ap...@google.com> #2
In SystemJobService, it can expect null, and able to tolerance null from WorkManagerImpl.getInstance, due to auto-backup reason.
@Override
public void onCreate() {
super.onCreate();
mWorkManagerImpl = WorkManagerImpl.getInstance(getApplicationContext());
if (mWorkManagerImpl == null) {
// This can occur if...
// 1. The app is performing an auto-backup. Prior to O, JobScheduler could erroneously
// try to send commands to JobService in this state ( b/32180780 ). Since neither
// Application#onCreate nor ContentProviders have run, WorkManager won't be
// initialized. In this case, we should ignore all JobScheduler commands and tell it
// to retry.
But, current WorkManagerImpl.getInstance(Context context) implementation is that, it will never return null but throw IllegalStateException.
Isn't there's conflict among these 2 SystemJobService.onCreate logic, and WorkManagerImpl.getInstance logic?
@Override
public void onCreate() {
super.onCreate();
mWorkManagerImpl = WorkManagerImpl.getInstance(getApplicationContext());
if (mWorkManagerImpl == null) {
// This can occur if...
// 1. The app is performing an auto-backup. Prior to O, JobScheduler could erroneously
// try to send commands to JobService in this state (
// Application#onCreate nor ContentProviders have run, WorkManager won't be
// initialized. In this case, we should ignore all JobScheduler commands and tell it
// to retry.
But, current WorkManagerImpl.getInstance(Context context) implementation is that, it will never return null but throw IllegalStateException.
Isn't there's conflict among these 2 SystemJobService.onCreate logic, and WorkManagerImpl.getInstance logic?
Description
Version used: 1.0.0-beta02
Devices/Android versions reproduced on: Nexus 5X API 28 Emulator (28.1.3-5243232) and Samsung J5 phone with 8.1.0
Steps to reproduce:
- Run application, monitoring logcat
- Press Enqueue
- Toast will be displayed and the log should indicate the worker started, failed and requested a retry
- Monitor the logcat for a few minutes and observe that no worker has been retried
This is intermittent but happens 90% of the time. If the Worker does retry, hit Enqueue again and it will likely fail to retry the new worker.
Expected Behaviour:
The worker should be retried after 10 seconds and up to 5 times in total before failing.