From ac62fe4d8cfa6dd6bb13255e1d7b7c80a29707a3 Mon Sep 17 00:00:00 2001 From: Kweku Adams Date: Fri, 2 Nov 2018 18:47:42 -0700 Subject: [PATCH] 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 --- core/java/android/app/job/JobInfo.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/core/java/android/app/job/JobInfo.java b/core/java/android/app/job/JobInfo.java index 556ffa24368fb..a3c947614c902 100644 --- a/core/java/android/app/job/JobInfo.java +++ b/core/java/android/app/job/JobInfo.java @@ -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(