Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit faa39248 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Age jobs into runnability even in infrequent buckets"

parents a5db7602 0c4d768b
Loading
Loading
Loading
Loading
+20 −7
Original line number Diff line number Diff line
@@ -1721,7 +1721,14 @@ public final class JobSchedulerService extends com.android.server.SystemService

        // If the app is in a non-active standby bucket, make sure we've waited
        // an appropriate amount of time since the last invocation
        if (mHeartbeat < mNextBucketHeartbeat[job.getStandbyBucket()]) {
        final int bucket = job.getStandbyBucket();
        if (mHeartbeat < mNextBucketHeartbeat[bucket]) {
            // Only skip this job if it's still waiting for the end of its (initial) nominal
            // bucket interval.  Once it's waited that long, we let it go ahead and clear.
            // The final (NEVER) bucket is special; we never age those apps' jobs into
            // runnability.
            if (bucket >= mConstants.STANDBY_BEATS.length
                    || (mHeartbeat < job.getBaseHeartbeat() + mConstants.STANDBY_BEATS[bucket])) {
                // TODO: log/trace that we're deferring the job due to bucketing if we hit this
                if (job.getWhenStandbyDeferred() == 0) {
                    if (DEBUG_STANDBY) {
@@ -1731,6 +1738,12 @@ public final class JobSchedulerService extends com.android.server.SystemService
                    job.setWhenStandbyDeferred(sElapsedRealtimeClock.millis());
                }
                return false;
            } else {
                if (DEBUG_STANDBY) {
                    Slog.v(TAG, "Bucket deferred job aged into runnability at "
                            + mHeartbeat + " : " + job);
                }
            }
        }

        // The expensive check last: validate that the defined package+service is