Loading apex/jobscheduler/framework/java/android/app/job/JobParameters.java +4 −3 Original line number Diff line number Diff line Loading @@ -54,7 +54,8 @@ public class JobParameters implements Parcelable { * * @hide */ public static final int REASON_RESTRAINED = JobProtoEnums.STOP_REASON_RESTRAINED; // 6. public static final int REASON_RESTRICTED_BUCKET = JobProtoEnums.STOP_REASON_RESTRICTED_BUCKET; // 6. /** * All the stop reason codes. This should be regarded as an immutable array at runtime. Loading @@ -72,7 +73,7 @@ public class JobParameters implements Parcelable { REASON_TIMEOUT, REASON_DEVICE_IDLE, REASON_DEVICE_THERMAL, REASON_RESTRAINED, REASON_RESTRICTED_BUCKET, }; /** Loading @@ -88,7 +89,7 @@ public class JobParameters implements Parcelable { case REASON_TIMEOUT: return "timeout"; case REASON_DEVICE_IDLE: return "device_idle"; case REASON_DEVICE_THERMAL: return "thermal"; case REASON_RESTRAINED: return "restrained"; case REASON_RESTRICTED_BUCKET: return "restricted_bucket"; default: return "unknown:" + reasonCode; } } Loading apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +13 −3 Original line number Diff line number Diff line Loading @@ -1963,9 +1963,19 @@ public class JobSchedulerService extends com.android.server.SystemService continue; } if (!running.isReady()) { // If a restricted job doesn't have dynamic constraints satisfied, assume that's // the reason the job is being stopped, instead of because of other constraints // not being satisfied. if (running.getEffectiveStandbyBucket() == RESTRICTED_INDEX && !running.areDynamicConstraintsSatisfied()) { serviceContext.cancelExecutingJobLocked( JobParameters.REASON_RESTRICTED_BUCKET, "cancelled due to restricted bucket"); } else { serviceContext.cancelExecutingJobLocked( JobParameters.REASON_CONSTRAINTS_NOT_SATISFIED, "cancelled due to unsatisfied constraints"); } } else { final JobRestriction restriction = checkIfRestricted(running); if (restriction != null) { Loading apex/jobscheduler/service/java/com/android/server/job/controllers/JobStatus.java +5 −0 Original line number Diff line number Diff line Loading @@ -1293,6 +1293,11 @@ public final class JobStatus { CONSTRAINT_CHARGING | CONSTRAINT_BATTERY_NOT_LOW | CONSTRAINT_STORAGE_NOT_LOW | CONSTRAINT_TIMING_DELAY | CONSTRAINT_IDLE; /** Returns true whenever all dynamically set constraints are satisfied. */ public boolean areDynamicConstraintsSatisfied() { return mReadyDynamicSatisfied; } /** * @return Whether the constraints set on this job are satisfied. */ Loading core/proto/android/app/job/enums.proto +1 −1 Original line number Diff line number Diff line Loading @@ -34,5 +34,5 @@ enum StopReasonEnum { STOP_REASON_TIMEOUT = 3; STOP_REASON_DEVICE_IDLE = 4; STOP_REASON_DEVICE_THERMAL = 5; STOP_REASON_RESTRAINED = 6; STOP_REASON_RESTRICTED_BUCKET = 6; } Loading
apex/jobscheduler/framework/java/android/app/job/JobParameters.java +4 −3 Original line number Diff line number Diff line Loading @@ -54,7 +54,8 @@ public class JobParameters implements Parcelable { * * @hide */ public static final int REASON_RESTRAINED = JobProtoEnums.STOP_REASON_RESTRAINED; // 6. public static final int REASON_RESTRICTED_BUCKET = JobProtoEnums.STOP_REASON_RESTRICTED_BUCKET; // 6. /** * All the stop reason codes. This should be regarded as an immutable array at runtime. Loading @@ -72,7 +73,7 @@ public class JobParameters implements Parcelable { REASON_TIMEOUT, REASON_DEVICE_IDLE, REASON_DEVICE_THERMAL, REASON_RESTRAINED, REASON_RESTRICTED_BUCKET, }; /** Loading @@ -88,7 +89,7 @@ public class JobParameters implements Parcelable { case REASON_TIMEOUT: return "timeout"; case REASON_DEVICE_IDLE: return "device_idle"; case REASON_DEVICE_THERMAL: return "thermal"; case REASON_RESTRAINED: return "restrained"; case REASON_RESTRICTED_BUCKET: return "restricted_bucket"; default: return "unknown:" + reasonCode; } } Loading
apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +13 −3 Original line number Diff line number Diff line Loading @@ -1963,9 +1963,19 @@ public class JobSchedulerService extends com.android.server.SystemService continue; } if (!running.isReady()) { // If a restricted job doesn't have dynamic constraints satisfied, assume that's // the reason the job is being stopped, instead of because of other constraints // not being satisfied. if (running.getEffectiveStandbyBucket() == RESTRICTED_INDEX && !running.areDynamicConstraintsSatisfied()) { serviceContext.cancelExecutingJobLocked( JobParameters.REASON_RESTRICTED_BUCKET, "cancelled due to restricted bucket"); } else { serviceContext.cancelExecutingJobLocked( JobParameters.REASON_CONSTRAINTS_NOT_SATISFIED, "cancelled due to unsatisfied constraints"); } } else { final JobRestriction restriction = checkIfRestricted(running); if (restriction != null) { Loading
apex/jobscheduler/service/java/com/android/server/job/controllers/JobStatus.java +5 −0 Original line number Diff line number Diff line Loading @@ -1293,6 +1293,11 @@ public final class JobStatus { CONSTRAINT_CHARGING | CONSTRAINT_BATTERY_NOT_LOW | CONSTRAINT_STORAGE_NOT_LOW | CONSTRAINT_TIMING_DELAY | CONSTRAINT_IDLE; /** Returns true whenever all dynamically set constraints are satisfied. */ public boolean areDynamicConstraintsSatisfied() { return mReadyDynamicSatisfied; } /** * @return Whether the constraints set on this job are satisfied. */ Loading
core/proto/android/app/job/enums.proto +1 −1 Original line number Diff line number Diff line Loading @@ -34,5 +34,5 @@ enum StopReasonEnum { STOP_REASON_TIMEOUT = 3; STOP_REASON_DEVICE_IDLE = 4; STOP_REASON_DEVICE_THERMAL = 5; STOP_REASON_RESTRAINED = 6; STOP_REASON_RESTRICTED_BUCKET = 6; }