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

Commit df9e9690 authored by Chris Tate's avatar Chris Tate Committed by Android (Google) Code Review
Browse files

Merge "Jobs now ignore standby bucketing while device is in parole"

parents 5fd1c97e a5a85bd4
Loading
Loading
Loading
Loading
+32 −21
Original line number Diff line number Diff line
@@ -184,6 +184,11 @@ public final class JobSchedulerService extends com.android.server.SystemService
     */
    boolean mReportedActive;

    /**
     * Are we currently in device-wide standby parole?
     */
    volatile boolean mInParole;

    /**
     * Current limit on the number of concurrent JobServiceContext entries we want to
     * keep actively running a job.
@@ -1720,7 +1725,9 @@ 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
        // an appropriate amount of time since the last invocation.  During device-
        // wide parole, standby bucketing is ignored.
        if (!mInParole) {
            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
@@ -1745,6 +1752,7 @@ public final class JobSchedulerService extends com.android.server.SystemService
                    }
                }
            }
        }

        // The expensive check last: validate that the defined package+service is
        // still present & viable.
@@ -2086,7 +2094,10 @@ public final class JobSchedulerService extends com.android.server.SystemService

        @Override
        public void onParoleStateChanged(boolean isParoleOn) {
            // Unused
            if (DEBUG_STANDBY) {
                Slog.i(TAG, "Global parole state now " + (isParoleOn ? "ON" : "OFF"));
            }
            mInParole = isParoleOn;
        }
    }