Allowing Jobs with no constraints.

Is JobScheduler a database now? Yes, yes it is.

The decision to now allow jobs with no constraints was made before
background restrictions were introduced. Now, with background restrictions,
it doesn't make as much as sense to have this policy.

Bug: 118636037
Test: Try to schedule a job with no constraints
Change-Id: Idfda95b415ae094a1ca5373f950b4a09c685b64f
This commit is contained in:
Kweku Adams
2018-11-02 18:47:42 -07:00
parent 9b882d88ee
commit ac62fe4d8c

View File

@@ -1534,13 +1534,6 @@ public class JobInfo implements Parcelable {
* @return The job object to hand to the JobScheduler. This object is immutable.
*/
public JobInfo build() {
// Allow jobs with no constraints - What am I, a database?
if (!mHasEarlyConstraint && !mHasLateConstraint && mConstraintFlags == 0 &&
mNetworkRequest == null &&
mTriggerContentUris == null) {
throw new IllegalArgumentException("You're trying to build a job with no " +
"constraints, this is not allowed.");
}
// Check that network estimates require network type
if ((mNetworkDownloadBytes > 0 || mNetworkUploadBytes > 0) && mNetworkRequest == null) {
throw new IllegalArgumentException(