Loading services/core/java/com/android/server/job/JobSchedulerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -509,7 +509,7 @@ public class JobSchedulerService extends com.android.server.SystemService private static final float DEFAULT_CONN_CONGESTION_DELAY_FRAC = 0.5f; private static final float DEFAULT_CONN_PREFETCH_RELAX_FRAC = 0.5f; private static final boolean DEFAULT_USE_HEARTBEATS = false; private static final boolean DEFAULT_TIME_CONTROLLER_SKIP_NOT_READY_JOBS = false; private static final boolean DEFAULT_TIME_CONTROLLER_SKIP_NOT_READY_JOBS = true; private static final long DEFAULT_QUOTA_CONTROLLER_ALLOWED_TIME_PER_PERIOD_MS = 10 * 60 * 1000L; // 10 minutes private static final long DEFAULT_QUOTA_CONTROLLER_IN_QUOTA_BUFFER_MS = Loading services/core/java/com/android/server/job/controllers/JobStatus.java +45 −5 Original line number Diff line number Diff line Loading @@ -78,9 +78,9 @@ public final class JobStatus { static final int CONSTRAINT_DEADLINE = 1<<30; static final int CONSTRAINT_CONNECTIVITY = 1<<28; static final int CONSTRAINT_CONTENT_TRIGGER = 1<<26; static final int CONSTRAINT_DEVICE_NOT_DOZING = 1<<25; static final int CONSTRAINT_WITHIN_QUOTA = 1 << 24; static final int CONSTRAINT_BACKGROUND_NOT_RESTRICTED = 1<<22; static final int CONSTRAINT_DEVICE_NOT_DOZING = 1 << 25; // Implicit constraint static final int CONSTRAINT_WITHIN_QUOTA = 1 << 24; // Implicit constraint static final int CONSTRAINT_BACKGROUND_NOT_RESTRICTED = 1 << 22; // Implicit constraint /** * The constraints that we want to log to statsd. Loading Loading @@ -1044,8 +1044,48 @@ public final class JobStatus { * @return Whether or not this job would be ready to run if it had the specified constraint * granted, based on its requirements. */ public boolean wouldBeReadyWithConstraint(int constraint) { return isReady(mSatisfiedConstraintsOfInterest | constraint); boolean wouldBeReadyWithConstraint(int constraint) { boolean oldValue = false; int satisfied = mSatisfiedConstraintsOfInterest; switch (constraint) { case CONSTRAINT_BACKGROUND_NOT_RESTRICTED: oldValue = mReadyNotRestrictedInBg; mReadyNotRestrictedInBg = true; break; case CONSTRAINT_DEADLINE: oldValue = mReadyDeadlineSatisfied; mReadyDeadlineSatisfied = true; break; case CONSTRAINT_DEVICE_NOT_DOZING: oldValue = mReadyNotDozing; mReadyNotDozing = true; break; case CONSTRAINT_WITHIN_QUOTA: oldValue = mReadyWithinQuota; mReadyWithinQuota = true; break; default: satisfied |= constraint; break; } boolean toReturn = isReady(satisfied); switch (constraint) { case CONSTRAINT_BACKGROUND_NOT_RESTRICTED: mReadyNotRestrictedInBg = oldValue; break; case CONSTRAINT_DEADLINE: mReadyDeadlineSatisfied = oldValue; break; case CONSTRAINT_DEVICE_NOT_DOZING: mReadyNotDozing = oldValue; break; case CONSTRAINT_WITHIN_QUOTA: mReadyWithinQuota = oldValue; break; } return toReturn; } private boolean isReady(int satisfiedConstraints) { Loading services/tests/mockingservicestests/src/com/android/server/job/controllers/JobStatusTest.java +482 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
services/core/java/com/android/server/job/JobSchedulerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -509,7 +509,7 @@ public class JobSchedulerService extends com.android.server.SystemService private static final float DEFAULT_CONN_CONGESTION_DELAY_FRAC = 0.5f; private static final float DEFAULT_CONN_PREFETCH_RELAX_FRAC = 0.5f; private static final boolean DEFAULT_USE_HEARTBEATS = false; private static final boolean DEFAULT_TIME_CONTROLLER_SKIP_NOT_READY_JOBS = false; private static final boolean DEFAULT_TIME_CONTROLLER_SKIP_NOT_READY_JOBS = true; private static final long DEFAULT_QUOTA_CONTROLLER_ALLOWED_TIME_PER_PERIOD_MS = 10 * 60 * 1000L; // 10 minutes private static final long DEFAULT_QUOTA_CONTROLLER_IN_QUOTA_BUFFER_MS = Loading
services/core/java/com/android/server/job/controllers/JobStatus.java +45 −5 Original line number Diff line number Diff line Loading @@ -78,9 +78,9 @@ public final class JobStatus { static final int CONSTRAINT_DEADLINE = 1<<30; static final int CONSTRAINT_CONNECTIVITY = 1<<28; static final int CONSTRAINT_CONTENT_TRIGGER = 1<<26; static final int CONSTRAINT_DEVICE_NOT_DOZING = 1<<25; static final int CONSTRAINT_WITHIN_QUOTA = 1 << 24; static final int CONSTRAINT_BACKGROUND_NOT_RESTRICTED = 1<<22; static final int CONSTRAINT_DEVICE_NOT_DOZING = 1 << 25; // Implicit constraint static final int CONSTRAINT_WITHIN_QUOTA = 1 << 24; // Implicit constraint static final int CONSTRAINT_BACKGROUND_NOT_RESTRICTED = 1 << 22; // Implicit constraint /** * The constraints that we want to log to statsd. Loading Loading @@ -1044,8 +1044,48 @@ public final class JobStatus { * @return Whether or not this job would be ready to run if it had the specified constraint * granted, based on its requirements. */ public boolean wouldBeReadyWithConstraint(int constraint) { return isReady(mSatisfiedConstraintsOfInterest | constraint); boolean wouldBeReadyWithConstraint(int constraint) { boolean oldValue = false; int satisfied = mSatisfiedConstraintsOfInterest; switch (constraint) { case CONSTRAINT_BACKGROUND_NOT_RESTRICTED: oldValue = mReadyNotRestrictedInBg; mReadyNotRestrictedInBg = true; break; case CONSTRAINT_DEADLINE: oldValue = mReadyDeadlineSatisfied; mReadyDeadlineSatisfied = true; break; case CONSTRAINT_DEVICE_NOT_DOZING: oldValue = mReadyNotDozing; mReadyNotDozing = true; break; case CONSTRAINT_WITHIN_QUOTA: oldValue = mReadyWithinQuota; mReadyWithinQuota = true; break; default: satisfied |= constraint; break; } boolean toReturn = isReady(satisfied); switch (constraint) { case CONSTRAINT_BACKGROUND_NOT_RESTRICTED: mReadyNotRestrictedInBg = oldValue; break; case CONSTRAINT_DEADLINE: mReadyDeadlineSatisfied = oldValue; break; case CONSTRAINT_DEVICE_NOT_DOZING: mReadyNotDozing = oldValue; break; case CONSTRAINT_WITHIN_QUOTA: mReadyWithinQuota = oldValue; break; } return toReturn; } private boolean isReady(int satisfiedConstraints) { Loading
services/tests/mockingservicestests/src/com/android/server/job/controllers/JobStatusTest.java +482 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes