android / codelab-android-workmanager

Apache License 2.0
549 stars 239 forks source link

Oppo Realme1 Job Schduler Min interval for Periodic Work is 1 hr #59

Closed indiascope closed 6 years ago

indiascope commented 6 years ago

Hi,

Currently I am using WorkManager 1.0.0-alpha05. I set periodic Work Request using below code. When interval is below 1 hr then In Oppo Realme (Android Version - 8.1.0 , ColorOSVersion V5.0 ) job execute at 1 hr. When interval greater than 1 hr job execute at exact time . when interval is smaller than 1 hr then job execute at 1 hr.

Please let me know any log or information required

Code For Schdule Periodic Job:

        `PeriodicWorkRequest uploadWork = new PeriodicWorkRequest.
                Builder(LocationUpdatesJobService.class ,interval, TimeUnit.MILLISECONDS)
                .addTag(Constants.Location.TAG_BACKGROUND_LOCATION_PERIODIC)
                .setConstraints(constraints).build();
            WorkManager.getInstance().enqueueUniquePeriodicWork(
                    Constants.Location.TAG_BACKGROUND_LOCATION_PERIODIC,
                    ExistingPeriodicWorkPolicy.REPLACE, uploadWork);`

in all other device Periodic Work request interval is proper. In Oppo Realme 1 work execute at 1 hr.

Oppo Realme 1: Interval 15 Min

I debug Job Schduler using below command: adb shell dumpsys jobscheduler

Log:

 JOB #u0a249/18: cc2fc59 com.cygneto.field_sales/androidx.work.impl.background.systemjob.SystemJobService
    u0a249 tag=*job*/com.cygneto.field_sales/androidx.work.impl.background.systemjob.SystemJobService
    Source: uid=u0a249 user=0 pkg=com.cygneto.field_sales
    JobInfo:
      Service: com.cygneto.field_sales/androidx.work.impl.background.systemjob.SystemJobService
      PERIODIC: interval=+1h0m0s0ms flex=+21m0s0ms
      Requires: charging=false batteryNotLow=false deviceIdle=false
Extras: mParcelledData.dataSize=180
      Backoff: policy=1 initial=+30s0ms
      Has early constraint
      Has late constraint
    Required constraints: TIMING_DELAY DEADLINE
    Satisfied constraints: APP_NOT_IDLE DEVICE_NOT_DOZING
    Unsatisfied constraints: TIMING_DELAY DEADLINE
    Doze whitelisted: true
    Tracking: TIME
    Enqueue time: -9m4s617ms
    Run time: earliest=+29m55s383ms, latest=+50m55s383ms
    Ready: false (job=false user=true !pending=true !active=true !backingup=true comp=true)

Oppo Realme 1: Interval 1hr 10 Min

Log:

JobInfo:
      Service: com.cygneto.field_sales/androidx.work.impl.background.systemjob.SystemJobService
      PERIODIC: interval=+1h10m0s0ms flex=+1h10m0s0ms
      Requires: charging=false batteryNotLow=false deviceIdle=false
      Extras: mParcelledData.dataSize=180
      Doze whitelisted: true
    Tracking: TIME
    Enqueue time: -4m19s846ms
    Run time: earliest=+1h5m39s833ms, latest=+2h15m39s833ms
    Last successful run: 2018-07-25 17:01:23
    Ready: false (job=false user=true !pending=true !active=true !backingup=true comp=true)

Other Device :

Log : JobInfo:

Service: com.cygneto.field_sales/androidx.work.impl.background.systemjob.SystemJobService
      PERIODIC: interval=+15m0s0ms flex=+15m0s0ms
      Requires: charging=false batteryNotLow=false deviceIdle=false
    Tracking: TIME
    Enqueue time: -29s237ms
    Run time: earliest=+14m30s690ms, latest=+29m30s690ms
    Last successful run: 2018-07-25 17:29:19
    Ready: false (job=false user=true !pending=true !active=true !backingup=true comp=true)

I also try Using different library. I found same behavior in Job Scheduler and Android-Job. job period length is 15 min but execute at 1 hr but when i try using firebase job dispatcher job execute at correct 15 min interval time.

i debug Job Scheduler and Android-Job using below command: adb shell dumpsys jobscheduler

Job Scheduler:

Interval : 15 Min Output : 1 hr:

Log:

JOB #u0a266/1: a0dd846 com.jobscheduler_periodic/com.periodic.JobSchedulerService
    u0a266 tag=*job*/com.jobscheduler_periodic/com.periodic.JobSchedulerService
    Source: uid=u0a266 user=0 pkg=com.jobscheduler_periodic
    JobInfo:
      Service: com.jobscheduler_periodic/com.periodic.JobSchedulerService
      PERIODIC: interval=+1h0m0s0ms flex=+15m0s0ms

Android-Job:

Interval : 15 Min Output : 1 hr:

Log:

JOB #u0a266/3: 10c0d65 com.jobscheduler_periodic/com.evernote.android.job.v21.PlatformJobService
    u0a266 tag=*job*/com.jobscheduler_periodic/com.evernote.android.job.v21.PlatformJobService
    Source: uid=u0a266 user=0 pkg=com.jobscheduler_periodic
    JobInfo:
      Service: com.jobscheduler_periodic/com.evernote.android.job.v21.PlatformJobService
      PERIODIC: interval=+1h0m0s0ms flex=+5m0s0ms

Firebase Job Dispatcher:

I debug firebase job Dispatcher using below command: adb shell "dumpsys activity service GcmService | grep com.jobscheduler_periodic"

Interval : 15 Min Output : 15 min

Log:

u0|com.jobscheduler_periodic: 1
    (scheduled) com.jobscheduler_periodic/com.firebase.jobdispatcher.GooglePlayReceiver{u=0 tag="MyJobService" trigger=window{s
tart=720s,end=900s,earliest=46s,latest=226s} requirements=[NET_CONNECTED,CHARGING] attributes=[RECURRING] scheduled=-673s last_
run=N/A jid=N/A status=PENDING retries=0 client_lib=FIREBASE_JOB_DISPATCHER-1}
pfmaggi commented 6 years ago

Thanks for reporting this. I'm closing this issue because this forum is for issues with the codelab.

If you think that this is a problem of the WorkManager library, please open a bug on the WorkManager public issue tracker: https://issuetracker.google.com/issues/new?component=409906&template=1094197

Please reopen if you still think this is an issue with the codelab.