Search code examples
androidandroid-workmanagerandroid-jobscheduler

Where I can find JobScheduler debug documentation


I have the following data from the debug:

 JOB #u0a231/5: a2826a0 com.abc.workmanagertest/androidx.work.impl.background.systemjob.SystemJobService
    u0a231 tag=*job*/com.abc.workmanagertest/androidx.work.impl.background.systemjob.SystemJobService
    Source: uid=u0a231 user=0 pkg=com.abc.workmanagertest
    JobInfo:
      Service: com.abc.workmanagertest/androidx.work.impl.background.systemjob.SystemJobService
      Flags: 2
      Requires: charging=false batteryNotLow=false deviceIdle=false
      Trigger content URIs:
        1 content://media/internal/video/media
        1 content://media/external/video/media
        1 content://media/internal/images/media
        1 content://media/external/images/media
      Trigger update delay: +1m0s0ms
      Trigger max delay: +10m0s0ms
      Extras: mParcelledData.dataSize=180
      Network type: NetworkRequest [ NONE id=0, [ Capabilities: NOT_METERED&INTERNET&NOT_RESTRICTED&TRUSTED&VALIDATED Uid: 10231 AdministratorUids: [] RequestorUid: -1 RequestorPackageName: null] ]
      Backoff: policy=1 initial=+30s0ms
    Required constraints: CONNECTIVITY CONTENT_TRIGGER [0x14000000]
    Dynamic constraints:
    Satisfied constraints: CONNECTIVITY CONTENT_TRIGGER DEVICE_NOT_DOZING BACKGROUND_NOT_RESTRICTED [0x16400000]
    Unsatisfied constraints: WITHIN_QUOTA [0x1000000]
    Tracking: CONNECTIVITY CONTENT QUOTA
    Implicit constraints:
      readyNotDozing: true
      readyNotRestrictedInBg: true
      readyDynamicSatisfied: false
    Network: 103
    Standby bucket: RARE
      Deferred since: -1h4m36s59ms
    Enqueue time: -1h4m36s59ms
    Run time: earliest=none, latest=none, original latest=none
    Restricted due to: none.
    Ready: false (job=false user=true !restricted=true !pending=true !active=true !backingup=true comp=true) 

As you see the problem for the job not being executed is: Unsatisfied constraints: WITHIN_QUOTA

Aren't there any docs with an explanation of what does this means?

I saw the following post, but it is just an opinion:

Unique periodic work stop executing after a while


Solution

  • You can specify constraints for Job as like setRequiresCharging. If constraints not met, Job can be stopped with onStopJob. e.g. The job in your dump requires CONNECTIVITY CONTENT_TRIGGER constraints.

    Unsatisfied constraints: WITHIN_QUOTA shows WITHIN_QUOTA implicit constraints unsatisfied for this job - can't run your job without quota. WITHIN_QUOTA is implicit constraints (added without explicit constraints setting, see this code).

    PTAL QuotaController documentation for more detail regards standby bucket quota.