Loading apex/jobscheduler/framework/java/android/app/job/JobInfo.java +15 −70 Original line number Diff line number Diff line Loading @@ -396,19 +396,12 @@ public class JobInfo implements Parcelable { */ public static final int FLAG_EXPEDITED = 1 << 4; /** * Whether it's a data transfer job or not. * * @hide */ public static final int FLAG_DATA_TRANSFER = 1 << 5; /** * Whether it's a user initiated job or not. * * @hide */ public static final int FLAG_USER_INITIATED = 1 << 6; public static final int FLAG_USER_INITIATED = 1 << 5; /** * @hide Loading Loading @@ -737,13 +730,6 @@ public class JobInfo implements Parcelable { return (flags & FLAG_EXPEDITED) != 0; } /** * @see JobInfo.Builder#setDataTransfer(boolean) */ public boolean isDataTransfer() { return (flags & FLAG_DATA_TRANSFER) != 0; } /** * @see JobInfo.Builder#setUserInitiated(boolean) */ Loading Loading @@ -1849,39 +1835,6 @@ public class JobInfo implements Parcelable { return this; } /** * Indicates that this job will be used to transfer data to or from a remote server. The * system could attempt to run a data transfer job longer than a regular job if the data * being transferred is potentially very large and can take a long time to complete. * * <p> * You must provide an estimate of the payload size via * {@link #setEstimatedNetworkBytes(long, long)} when scheduling the job or use * {@link JobService#updateEstimatedNetworkBytes(JobParameters, long, long)} or * {@link JobService#updateEstimatedNetworkBytes(JobParameters, JobWorkItem, long, long)} * shortly after the job starts. * * <p> * For user-initiated transfers that must be started immediately, call * {@link #setUserInitiated(boolean) setUserInitiated(true)}. Otherwise, the system may * defer the job to a more opportune time. * * <p> * If you want to perform more than one data transfer job, consider enqueuing multiple * {@link JobWorkItem JobWorkItems} along with {@link #setDataTransfer(boolean)}. * * @see JobInfo#isDataTransfer() */ @NonNull public Builder setDataTransfer(boolean dataTransfer) { if (dataTransfer) { mFlags |= FLAG_DATA_TRANSFER; } else { mFlags &= (~FLAG_DATA_TRANSFER); } return this; } /** * Indicates that this job is being scheduled to fulfill an explicit user request. * As such, user-initiated jobs can only be scheduled when the app is in the foreground Loading Loading @@ -1909,6 +1862,11 @@ public class JobInfo implements Parcelable { * {@link SecurityException}. * * <p> * In {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}, user-initiated jobs can only * be used for network data transfers. As such, they must specify a required network via * {@link #setRequiredNetwork(NetworkRequest)} or {@link #setRequiredNetworkType(int)}. * * <p> * These jobs will not be subject to quotas and will be started immediately once scheduled * if all constraints are met and the device system health allows for additional tasks. * Loading Loading @@ -2179,10 +2137,6 @@ public class JobInfo implements Parcelable { if (isPeriodic) { throw new IllegalArgumentException("An expedited job cannot be periodic"); } if ((flags & FLAG_DATA_TRANSFER) != 0) { throw new IllegalArgumentException( "An expedited job cannot also be a data transfer job"); } if (isUserInitiated) { throw new IllegalArgumentException("An expedited job cannot be user-initiated"); } Loading @@ -2202,24 +2156,6 @@ public class JobInfo implements Parcelable { } } if ((flags & FLAG_DATA_TRANSFER) != 0) { if (backoffPolicy == BACKOFF_POLICY_LINEAR) { throw new IllegalArgumentException( "A data transfer job cannot have a linear backoff policy."); } if (hasLateConstraint) { throw new IllegalArgumentException("A data transfer job cannot have a deadline"); } if ((flags & FLAG_PREFETCH) != 0) { throw new IllegalArgumentException( "A data transfer job cannot also be a prefetch job"); } if (networkRequest == null) { throw new IllegalArgumentException( "A data transfer job must specify a valid network type"); } } if (isUserInitiated) { if (hasEarlyConstraint) { throw new IllegalArgumentException("A user-initiated job cannot have a time delay"); Loading @@ -2245,6 +2181,15 @@ public class JobInfo implements Parcelable { throw new IllegalArgumentException( "Can't call addTriggerContentUri() on a user-initiated job"); } // UIDTs if (networkRequest == null) { throw new IllegalArgumentException( "A user-initaited data transfer job must specify a valid network type"); } if (backoffPolicy == BACKOFF_POLICY_LINEAR) { throw new IllegalArgumentException( "A user-initiated data transfer job cannot have a linear backoff policy."); } } } Loading apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +2 −47 Original line number Diff line number Diff line Loading @@ -478,8 +478,6 @@ public class JobSchedulerService extends com.android.server.SystemService case Constants.KEY_RUNTIME_FREE_QUOTA_MAX_LIMIT_MS: case Constants.KEY_RUNTIME_MIN_GUARANTEE_MS: case Constants.KEY_RUNTIME_MIN_EJ_GUARANTEE_MS: case Constants.KEY_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS: case Constants.KEY_RUNTIME_DATA_TRANSFER_LIMIT_MS: case Constants.KEY_RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS: case Constants.KEY_RUNTIME_USER_INITIATED_LIMIT_MS: case Constants.KEY_RUNTIME_MIN_USER_INITIATED_DATA_TRANSFER_GUARANTEE_BUFFER_FACTOR: Loading Loading @@ -574,10 +572,6 @@ public class JobSchedulerService extends com.android.server.SystemService "runtime_free_quota_max_limit_ms"; private static final String KEY_RUNTIME_MIN_GUARANTEE_MS = "runtime_min_guarantee_ms"; private static final String KEY_RUNTIME_MIN_EJ_GUARANTEE_MS = "runtime_min_ej_guarantee_ms"; private static final String KEY_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS = "runtime_min_data_transfer_guarantee_ms"; private static final String KEY_RUNTIME_DATA_TRANSFER_LIMIT_MS = "runtime_data_transfer_limit_ms"; private static final String KEY_RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS = "runtime_min_user_initiated_guarantee_ms"; private static final String KEY_RUNTIME_USER_INITIATED_LIMIT_MS = Loading Loading @@ -616,10 +610,6 @@ public class JobSchedulerService extends com.android.server.SystemService public static final long DEFAULT_RUNTIME_MIN_GUARANTEE_MS = 10 * MINUTE_IN_MILLIS; @VisibleForTesting public static final long DEFAULT_RUNTIME_MIN_EJ_GUARANTEE_MS = 3 * MINUTE_IN_MILLIS; public static final long DEFAULT_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS = DEFAULT_RUNTIME_MIN_GUARANTEE_MS; public static final long DEFAULT_RUNTIME_DATA_TRANSFER_LIMIT_MS = DEFAULT_RUNTIME_FREE_QUOTA_MAX_LIMIT_MS; public static final long DEFAULT_RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS = Math.max(10 * MINUTE_IN_MILLIS, DEFAULT_RUNTIME_MIN_GUARANTEE_MS); public static final long DEFAULT_RUNTIME_USER_INITIATED_LIMIT_MS = Loading Loading @@ -738,18 +728,6 @@ public class JobSchedulerService extends com.android.server.SystemService */ public long RUNTIME_MIN_EJ_GUARANTEE_MS = DEFAULT_RUNTIME_MIN_EJ_GUARANTEE_MS; /** * The minimum amount of time we try to guarantee normal data transfer jobs will run for. */ public long RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS = DEFAULT_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS; /** * The maximum amount of time we will let a normal data transfer job run for. This will only * apply if there are no other limits that apply to the specific data transfer job. */ public long RUNTIME_DATA_TRANSFER_LIMIT_MS = DEFAULT_RUNTIME_DATA_TRANSFER_LIMIT_MS; /** * The minimum amount of time we try to guarantee normal user-initiated jobs will run for. */ Loading Loading @@ -885,8 +863,6 @@ public class JobSchedulerService extends com.android.server.SystemService KEY_RUNTIME_FREE_QUOTA_MAX_LIMIT_MS, KEY_RUNTIME_MIN_GUARANTEE_MS, KEY_RUNTIME_MIN_EJ_GUARANTEE_MS, KEY_RUNTIME_MIN_USER_INITIATED_DATA_TRANSFER_GUARANTEE_BUFFER_FACTOR, KEY_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, KEY_RUNTIME_DATA_TRANSFER_LIMIT_MS, KEY_RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS, KEY_RUNTIME_USER_INITIATED_LIMIT_MS, KEY_RUNTIME_MIN_USER_INITIATED_DATA_TRANSFER_GUARANTEE_MS, Loading @@ -904,17 +880,6 @@ public class JobSchedulerService extends com.android.server.SystemService properties.getLong(KEY_RUNTIME_FREE_QUOTA_MAX_LIMIT_MS, DEFAULT_RUNTIME_FREE_QUOTA_MAX_LIMIT_MS)); // Make sure min runtime is at least as long as regular jobs. RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS = Math.max(RUNTIME_MIN_GUARANTEE_MS, properties.getLong( KEY_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, DEFAULT_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS)); // Max limit should be at least the min guarantee AND the free quota. RUNTIME_DATA_TRANSFER_LIMIT_MS = Math.max(RUNTIME_FREE_QUOTA_MAX_LIMIT_MS, Math.max(RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, properties.getLong( KEY_RUNTIME_DATA_TRANSFER_LIMIT_MS, DEFAULT_RUNTIME_DATA_TRANSFER_LIMIT_MS))); // Make sure min runtime is at least as long as regular jobs. RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS = Math.max(RUNTIME_MIN_GUARANTEE_MS, properties.getLong( KEY_RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS, Loading Loading @@ -993,10 +958,6 @@ public class JobSchedulerService extends com.android.server.SystemService pw.print(KEY_RUNTIME_MIN_EJ_GUARANTEE_MS, RUNTIME_MIN_EJ_GUARANTEE_MS).println(); pw.print(KEY_RUNTIME_FREE_QUOTA_MAX_LIMIT_MS, RUNTIME_FREE_QUOTA_MAX_LIMIT_MS) .println(); pw.print(KEY_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS).println(); pw.print(KEY_RUNTIME_DATA_TRANSFER_LIMIT_MS, RUNTIME_DATA_TRANSFER_LIMIT_MS).println(); pw.print(KEY_RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS, RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS).println(); pw.print(KEY_RUNTIME_USER_INITIATED_LIMIT_MS, Loading Loading @@ -3291,7 +3252,7 @@ public class JobSchedulerService extends com.android.server.SystemService if (job.shouldTreatAsUserInitiatedJob() && checkRunUserInitiatedJobsPermission( job.getSourceUid(), job.getSourcePackageName())) { if (job.getJob().isDataTransfer()) { if (job.getJob().getRequiredNetwork() != null) { // UI+DT final long estimatedTransferTimeMs = mConnectivityController.getEstimatedTransferTimeMs(job); if (estimatedTransferTimeMs == ConnectivityController.UNKNOWN_TIME) { Loading @@ -3308,9 +3269,6 @@ public class JobSchedulerService extends com.android.server.SystemService )); } return mConstants.RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS; } else if (job.getJob().isDataTransfer()) { // For now, don't increase a bg data transfer's minimum guarantee. return mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS; } else if (job.shouldTreatAsExpeditedJob()) { // Don't guarantee RESTRICTED jobs more than 5 minutes. return job.getEffectiveStandbyBucket() != RESTRICTED_INDEX Loading @@ -3328,7 +3286,7 @@ public class JobSchedulerService extends com.android.server.SystemService final boolean allowLongerJob = job.shouldTreatAsUserInitiatedJob() && checkRunUserInitiatedJobsPermission( job.getSourceUid(), job.getSourcePackageName()); if (job.getJob().isDataTransfer() && allowLongerJob) { // UI+DT if (job.getJob().getRequiredNetwork() != null && allowLongerJob) { // UI+DT return mConstants.RUNTIME_USER_INITIATED_DATA_TRANSFER_LIMIT_MS; } if (allowLongerJob) { // UI with LRJ permission Loading @@ -3337,9 +3295,6 @@ public class JobSchedulerService extends com.android.server.SystemService if (job.shouldTreatAsUserInitiatedJob()) { return mConstants.RUNTIME_FREE_QUOTA_MAX_LIMIT_MS; } if (job.getJob().isDataTransfer()) { return mConstants.RUNTIME_DATA_TRANSFER_LIMIT_MS; } return Math.min(mConstants.RUNTIME_FREE_QUOTA_MAX_LIMIT_MS, mConstants.USE_TARE_POLICY ? mTareController.getMaxJobExecutionTimeMsLocked(job) Loading core/api/current.txt +0 −2 Original line number Diff line number Diff line Loading @@ -8733,7 +8733,6 @@ package android.app.job { method public long getTriggerContentMaxDelay(); method public long getTriggerContentUpdateDelay(); method @Nullable public android.app.job.JobInfo.TriggerContentUri[] getTriggerContentUris(); method public boolean isDataTransfer(); method public boolean isExpedited(); method public boolean isImportantWhileForeground(); method public boolean isPeriodic(); Loading Loading @@ -8770,7 +8769,6 @@ package android.app.job { method public android.app.job.JobInfo build(); method public android.app.job.JobInfo.Builder setBackoffCriteria(long, int); method public android.app.job.JobInfo.Builder setClipData(@Nullable android.content.ClipData, int); method @NonNull public android.app.job.JobInfo.Builder setDataTransfer(boolean); method public android.app.job.JobInfo.Builder setEstimatedNetworkBytes(long, long); method @NonNull public android.app.job.JobInfo.Builder setExpedited(boolean); method public android.app.job.JobInfo.Builder setExtras(@NonNull android.os.PersistableBundle); services/tests/mockingservicestests/src/com/android/server/job/JobSchedulerServiceTest.java +7 −59 Original line number Diff line number Diff line Loading @@ -234,15 +234,9 @@ public class JobSchedulerServiceTest { createJobInfo(5).setPriority(JobInfo.PRIORITY_HIGH)); JobStatus jobDef = createJobStatus("testGetMinJobExecutionGuaranteeMs", createJobInfo(6)); JobStatus jobDT = createJobStatus("testGetMinJobExecutionGuaranteeMs", createJobInfo(7) .setDataTransfer(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)); JobStatus jobUI = createJobStatus("testGetMinJobExecutionGuaranteeMs", createJobInfo(8)); // TODO(255371817): add setUserInitiated(true) JobStatus jobUIDT = createJobStatus("testGetMinJobExecutionGuaranteeMs", // TODO(255371817): add setUserInitiated(true) createJobInfo(9) .setDataTransfer(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)); .setUserInitiated(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)); spyOn(ejMax); spyOn(ejHigh); Loading @@ -250,8 +244,6 @@ public class JobSchedulerServiceTest { spyOn(ejHighDowngraded); spyOn(jobHigh); spyOn(jobDef); spyOn(jobDT); spyOn(jobUI); spyOn(jobUIDT); when(ejMax.shouldTreatAsExpeditedJob()).thenReturn(true); Loading @@ -260,14 +252,11 @@ public class JobSchedulerServiceTest { when(ejHighDowngraded.shouldTreatAsExpeditedJob()).thenReturn(false); when(jobHigh.shouldTreatAsExpeditedJob()).thenReturn(false); when(jobDef.shouldTreatAsExpeditedJob()).thenReturn(false); when(jobUI.shouldTreatAsUserInitiatedJob()).thenReturn(true); when(jobUIDT.shouldTreatAsUserInitiatedJob()).thenReturn(true); ConnectivityController connectivityController = mService.getConnectivityController(); spyOn(connectivityController); mService.mConstants.RUNTIME_MIN_GUARANTEE_MS = 10 * MINUTE_IN_MILLIS; mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS = 15 * MINUTE_IN_MILLIS; mService.mConstants.RUNTIME_DATA_TRANSFER_LIMIT_MS = 60 * MINUTE_IN_MILLIS; mService.mConstants.RUNTIME_MIN_USER_INITIATED_DATA_TRANSFER_GUARANTEE_BUFFER_FACTOR = 1.5f; mService.mConstants.RUNTIME_MIN_USER_INITIATED_DATA_TRANSFER_GUARANTEE_MS = HOUR_IN_MILLIS; mService.mConstants.RUNTIME_USER_INITIATED_DATA_TRANSFER_LIMIT_MS = 6 * HOUR_IN_MILLIS; Loading @@ -284,37 +273,14 @@ public class JobSchedulerServiceTest { mService.getMinJobExecutionGuaranteeMs(jobHigh)); assertEquals(mService.mConstants.RUNTIME_MIN_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobDef)); grantRunUserInitiatedJobsPermission(false); // Without permission assertEquals(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobDT)); grantRunUserInitiatedJobsPermission(true); // With permission doReturn(ConnectivityController.UNKNOWN_TIME) .when(connectivityController).getEstimatedTransferTimeMs(any()); assertEquals(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobDT)); doReturn(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS / 2) .when(connectivityController).getEstimatedTransferTimeMs(any()); assertEquals(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobDT)); doReturn(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS * 2) .when(connectivityController).getEstimatedTransferTimeMs(any()); assertEquals(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobDT)); doReturn(mService.mConstants.RUNTIME_DATA_TRANSFER_LIMIT_MS * 2) .when(connectivityController).getEstimatedTransferTimeMs(any()); assertEquals(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobDT)); // UserInitiated grantRunUserInitiatedJobsPermission(false); // Permission isn't granted, so it should just be treated as a regular data transfer job. assertEquals(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobUIDT)); // Permission isn't granted, so it should just be treated as a regular job. assertEquals(mService.mConstants.RUNTIME_MIN_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobUI)); mService.getMinJobExecutionGuaranteeMs(jobUIDT)); grantRunUserInitiatedJobsPermission(true); // With permission assertEquals(mService.mConstants.RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobUI)); assertEquals(mService.mConstants.RUNTIME_MIN_USER_INITIATED_DATA_TRANSFER_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobUIDT)); doReturn(ConnectivityController.UNKNOWN_TIME) .when(connectivityController).getEstimatedTransferTimeMs(any()); assertEquals(mService.mConstants.RUNTIME_MIN_USER_INITIATED_DATA_TRANSFER_GUARANTEE_MS, Loading @@ -338,21 +304,10 @@ public class JobSchedulerServiceTest { @Test public void testGetMaxJobExecutionTimeMs() { JobStatus jobDT = createJobStatus("testGetMaxJobExecutionTimeMs", createJobInfo(7) .setDataTransfer(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)); JobStatus jobUI = createJobStatus("testGetMaxJobExecutionTimeMs", createJobInfo(9)); // TODO(255371817): add setUserInitiated(true) JobStatus jobUIDT = createJobStatus("testGetMaxJobExecutionTimeMs", // TODO(255371817): add setUserInitiated(true) createJobInfo(10) .setDataTransfer(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)); spyOn(jobDT); spyOn(jobUI); .setUserInitiated(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)); spyOn(jobUIDT); when(jobUI.shouldTreatAsUserInitiatedJob()).thenReturn(true); when(jobUIDT.shouldTreatAsUserInitiatedJob()).thenReturn(true); QuotaController quotaController = mService.getQuotaController(); Loading @@ -365,17 +320,9 @@ public class JobSchedulerServiceTest { .when(quotaController).getMaxJobExecutionTimeMsLocked(any()); grantRunUserInitiatedJobsPermission(true); assertEquals(mService.mConstants.RUNTIME_DATA_TRANSFER_LIMIT_MS, mService.getMaxJobExecutionTimeMs(jobDT)); assertEquals(mService.mConstants.RUNTIME_USER_INITIATED_LIMIT_MS, mService.getMaxJobExecutionTimeMs(jobUI)); assertEquals(mService.mConstants.RUNTIME_USER_INITIATED_DATA_TRANSFER_LIMIT_MS, mService.getMaxJobExecutionTimeMs(jobUIDT)); grantRunUserInitiatedJobsPermission(false); assertEquals(mService.mConstants.RUNTIME_DATA_TRANSFER_LIMIT_MS, mService.getMaxJobExecutionTimeMs(jobDT)); assertEquals(mService.mConstants.RUNTIME_FREE_QUOTA_MAX_LIMIT_MS, mService.getMaxJobExecutionTimeMs(jobUI)); assertEquals(mService.mConstants.RUNTIME_FREE_QUOTA_MAX_LIMIT_MS, mService.getMaxJobExecutionTimeMs(jobUIDT)); } Loading Loading @@ -478,7 +425,8 @@ public class JobSchedulerServiceTest { @Test public void testGetRescheduleJobForFailure_userStopped() { JobStatus uiJob = createJobStatus("testGetRescheduleJobForFailure", createJobInfo().setUserInitiated(true)); createJobInfo().setUserInitiated(true) .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)); JobStatus uvJob = createJobStatus("testGetRescheduleJobForFailure", createJobInfo()); spyOn(uvJob); doReturn(true).when(uvJob).isUserVisibleJob(); Loading services/tests/mockingservicestests/src/com/android/server/job/controllers/FlexibilityControllerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -619,7 +619,7 @@ public class FlexibilityControllerTest { @Test public void testExceptions_UserInitiated() { JobInfo.Builder jb = createJob(0); jb.setUserInitiated(true); jb.setUserInitiated(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY); JobStatus js = createJobStatus("testExceptions_UserInitiated", jb); assertFalse(js.hasFlexibilityConstraint()); } Loading Loading
apex/jobscheduler/framework/java/android/app/job/JobInfo.java +15 −70 Original line number Diff line number Diff line Loading @@ -396,19 +396,12 @@ public class JobInfo implements Parcelable { */ public static final int FLAG_EXPEDITED = 1 << 4; /** * Whether it's a data transfer job or not. * * @hide */ public static final int FLAG_DATA_TRANSFER = 1 << 5; /** * Whether it's a user initiated job or not. * * @hide */ public static final int FLAG_USER_INITIATED = 1 << 6; public static final int FLAG_USER_INITIATED = 1 << 5; /** * @hide Loading Loading @@ -737,13 +730,6 @@ public class JobInfo implements Parcelable { return (flags & FLAG_EXPEDITED) != 0; } /** * @see JobInfo.Builder#setDataTransfer(boolean) */ public boolean isDataTransfer() { return (flags & FLAG_DATA_TRANSFER) != 0; } /** * @see JobInfo.Builder#setUserInitiated(boolean) */ Loading Loading @@ -1849,39 +1835,6 @@ public class JobInfo implements Parcelable { return this; } /** * Indicates that this job will be used to transfer data to or from a remote server. The * system could attempt to run a data transfer job longer than a regular job if the data * being transferred is potentially very large and can take a long time to complete. * * <p> * You must provide an estimate of the payload size via * {@link #setEstimatedNetworkBytes(long, long)} when scheduling the job or use * {@link JobService#updateEstimatedNetworkBytes(JobParameters, long, long)} or * {@link JobService#updateEstimatedNetworkBytes(JobParameters, JobWorkItem, long, long)} * shortly after the job starts. * * <p> * For user-initiated transfers that must be started immediately, call * {@link #setUserInitiated(boolean) setUserInitiated(true)}. Otherwise, the system may * defer the job to a more opportune time. * * <p> * If you want to perform more than one data transfer job, consider enqueuing multiple * {@link JobWorkItem JobWorkItems} along with {@link #setDataTransfer(boolean)}. * * @see JobInfo#isDataTransfer() */ @NonNull public Builder setDataTransfer(boolean dataTransfer) { if (dataTransfer) { mFlags |= FLAG_DATA_TRANSFER; } else { mFlags &= (~FLAG_DATA_TRANSFER); } return this; } /** * Indicates that this job is being scheduled to fulfill an explicit user request. * As such, user-initiated jobs can only be scheduled when the app is in the foreground Loading Loading @@ -1909,6 +1862,11 @@ public class JobInfo implements Parcelable { * {@link SecurityException}. * * <p> * In {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}, user-initiated jobs can only * be used for network data transfers. As such, they must specify a required network via * {@link #setRequiredNetwork(NetworkRequest)} or {@link #setRequiredNetworkType(int)}. * * <p> * These jobs will not be subject to quotas and will be started immediately once scheduled * if all constraints are met and the device system health allows for additional tasks. * Loading Loading @@ -2179,10 +2137,6 @@ public class JobInfo implements Parcelable { if (isPeriodic) { throw new IllegalArgumentException("An expedited job cannot be periodic"); } if ((flags & FLAG_DATA_TRANSFER) != 0) { throw new IllegalArgumentException( "An expedited job cannot also be a data transfer job"); } if (isUserInitiated) { throw new IllegalArgumentException("An expedited job cannot be user-initiated"); } Loading @@ -2202,24 +2156,6 @@ public class JobInfo implements Parcelable { } } if ((flags & FLAG_DATA_TRANSFER) != 0) { if (backoffPolicy == BACKOFF_POLICY_LINEAR) { throw new IllegalArgumentException( "A data transfer job cannot have a linear backoff policy."); } if (hasLateConstraint) { throw new IllegalArgumentException("A data transfer job cannot have a deadline"); } if ((flags & FLAG_PREFETCH) != 0) { throw new IllegalArgumentException( "A data transfer job cannot also be a prefetch job"); } if (networkRequest == null) { throw new IllegalArgumentException( "A data transfer job must specify a valid network type"); } } if (isUserInitiated) { if (hasEarlyConstraint) { throw new IllegalArgumentException("A user-initiated job cannot have a time delay"); Loading @@ -2245,6 +2181,15 @@ public class JobInfo implements Parcelable { throw new IllegalArgumentException( "Can't call addTriggerContentUri() on a user-initiated job"); } // UIDTs if (networkRequest == null) { throw new IllegalArgumentException( "A user-initaited data transfer job must specify a valid network type"); } if (backoffPolicy == BACKOFF_POLICY_LINEAR) { throw new IllegalArgumentException( "A user-initiated data transfer job cannot have a linear backoff policy."); } } } Loading
apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +2 −47 Original line number Diff line number Diff line Loading @@ -478,8 +478,6 @@ public class JobSchedulerService extends com.android.server.SystemService case Constants.KEY_RUNTIME_FREE_QUOTA_MAX_LIMIT_MS: case Constants.KEY_RUNTIME_MIN_GUARANTEE_MS: case Constants.KEY_RUNTIME_MIN_EJ_GUARANTEE_MS: case Constants.KEY_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS: case Constants.KEY_RUNTIME_DATA_TRANSFER_LIMIT_MS: case Constants.KEY_RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS: case Constants.KEY_RUNTIME_USER_INITIATED_LIMIT_MS: case Constants.KEY_RUNTIME_MIN_USER_INITIATED_DATA_TRANSFER_GUARANTEE_BUFFER_FACTOR: Loading Loading @@ -574,10 +572,6 @@ public class JobSchedulerService extends com.android.server.SystemService "runtime_free_quota_max_limit_ms"; private static final String KEY_RUNTIME_MIN_GUARANTEE_MS = "runtime_min_guarantee_ms"; private static final String KEY_RUNTIME_MIN_EJ_GUARANTEE_MS = "runtime_min_ej_guarantee_ms"; private static final String KEY_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS = "runtime_min_data_transfer_guarantee_ms"; private static final String KEY_RUNTIME_DATA_TRANSFER_LIMIT_MS = "runtime_data_transfer_limit_ms"; private static final String KEY_RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS = "runtime_min_user_initiated_guarantee_ms"; private static final String KEY_RUNTIME_USER_INITIATED_LIMIT_MS = Loading Loading @@ -616,10 +610,6 @@ public class JobSchedulerService extends com.android.server.SystemService public static final long DEFAULT_RUNTIME_MIN_GUARANTEE_MS = 10 * MINUTE_IN_MILLIS; @VisibleForTesting public static final long DEFAULT_RUNTIME_MIN_EJ_GUARANTEE_MS = 3 * MINUTE_IN_MILLIS; public static final long DEFAULT_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS = DEFAULT_RUNTIME_MIN_GUARANTEE_MS; public static final long DEFAULT_RUNTIME_DATA_TRANSFER_LIMIT_MS = DEFAULT_RUNTIME_FREE_QUOTA_MAX_LIMIT_MS; public static final long DEFAULT_RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS = Math.max(10 * MINUTE_IN_MILLIS, DEFAULT_RUNTIME_MIN_GUARANTEE_MS); public static final long DEFAULT_RUNTIME_USER_INITIATED_LIMIT_MS = Loading Loading @@ -738,18 +728,6 @@ public class JobSchedulerService extends com.android.server.SystemService */ public long RUNTIME_MIN_EJ_GUARANTEE_MS = DEFAULT_RUNTIME_MIN_EJ_GUARANTEE_MS; /** * The minimum amount of time we try to guarantee normal data transfer jobs will run for. */ public long RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS = DEFAULT_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS; /** * The maximum amount of time we will let a normal data transfer job run for. This will only * apply if there are no other limits that apply to the specific data transfer job. */ public long RUNTIME_DATA_TRANSFER_LIMIT_MS = DEFAULT_RUNTIME_DATA_TRANSFER_LIMIT_MS; /** * The minimum amount of time we try to guarantee normal user-initiated jobs will run for. */ Loading Loading @@ -885,8 +863,6 @@ public class JobSchedulerService extends com.android.server.SystemService KEY_RUNTIME_FREE_QUOTA_MAX_LIMIT_MS, KEY_RUNTIME_MIN_GUARANTEE_MS, KEY_RUNTIME_MIN_EJ_GUARANTEE_MS, KEY_RUNTIME_MIN_USER_INITIATED_DATA_TRANSFER_GUARANTEE_BUFFER_FACTOR, KEY_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, KEY_RUNTIME_DATA_TRANSFER_LIMIT_MS, KEY_RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS, KEY_RUNTIME_USER_INITIATED_LIMIT_MS, KEY_RUNTIME_MIN_USER_INITIATED_DATA_TRANSFER_GUARANTEE_MS, Loading @@ -904,17 +880,6 @@ public class JobSchedulerService extends com.android.server.SystemService properties.getLong(KEY_RUNTIME_FREE_QUOTA_MAX_LIMIT_MS, DEFAULT_RUNTIME_FREE_QUOTA_MAX_LIMIT_MS)); // Make sure min runtime is at least as long as regular jobs. RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS = Math.max(RUNTIME_MIN_GUARANTEE_MS, properties.getLong( KEY_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, DEFAULT_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS)); // Max limit should be at least the min guarantee AND the free quota. RUNTIME_DATA_TRANSFER_LIMIT_MS = Math.max(RUNTIME_FREE_QUOTA_MAX_LIMIT_MS, Math.max(RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, properties.getLong( KEY_RUNTIME_DATA_TRANSFER_LIMIT_MS, DEFAULT_RUNTIME_DATA_TRANSFER_LIMIT_MS))); // Make sure min runtime is at least as long as regular jobs. RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS = Math.max(RUNTIME_MIN_GUARANTEE_MS, properties.getLong( KEY_RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS, Loading Loading @@ -993,10 +958,6 @@ public class JobSchedulerService extends com.android.server.SystemService pw.print(KEY_RUNTIME_MIN_EJ_GUARANTEE_MS, RUNTIME_MIN_EJ_GUARANTEE_MS).println(); pw.print(KEY_RUNTIME_FREE_QUOTA_MAX_LIMIT_MS, RUNTIME_FREE_QUOTA_MAX_LIMIT_MS) .println(); pw.print(KEY_RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS).println(); pw.print(KEY_RUNTIME_DATA_TRANSFER_LIMIT_MS, RUNTIME_DATA_TRANSFER_LIMIT_MS).println(); pw.print(KEY_RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS, RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS).println(); pw.print(KEY_RUNTIME_USER_INITIATED_LIMIT_MS, Loading Loading @@ -3291,7 +3252,7 @@ public class JobSchedulerService extends com.android.server.SystemService if (job.shouldTreatAsUserInitiatedJob() && checkRunUserInitiatedJobsPermission( job.getSourceUid(), job.getSourcePackageName())) { if (job.getJob().isDataTransfer()) { if (job.getJob().getRequiredNetwork() != null) { // UI+DT final long estimatedTransferTimeMs = mConnectivityController.getEstimatedTransferTimeMs(job); if (estimatedTransferTimeMs == ConnectivityController.UNKNOWN_TIME) { Loading @@ -3308,9 +3269,6 @@ public class JobSchedulerService extends com.android.server.SystemService )); } return mConstants.RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS; } else if (job.getJob().isDataTransfer()) { // For now, don't increase a bg data transfer's minimum guarantee. return mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS; } else if (job.shouldTreatAsExpeditedJob()) { // Don't guarantee RESTRICTED jobs more than 5 minutes. return job.getEffectiveStandbyBucket() != RESTRICTED_INDEX Loading @@ -3328,7 +3286,7 @@ public class JobSchedulerService extends com.android.server.SystemService final boolean allowLongerJob = job.shouldTreatAsUserInitiatedJob() && checkRunUserInitiatedJobsPermission( job.getSourceUid(), job.getSourcePackageName()); if (job.getJob().isDataTransfer() && allowLongerJob) { // UI+DT if (job.getJob().getRequiredNetwork() != null && allowLongerJob) { // UI+DT return mConstants.RUNTIME_USER_INITIATED_DATA_TRANSFER_LIMIT_MS; } if (allowLongerJob) { // UI with LRJ permission Loading @@ -3337,9 +3295,6 @@ public class JobSchedulerService extends com.android.server.SystemService if (job.shouldTreatAsUserInitiatedJob()) { return mConstants.RUNTIME_FREE_QUOTA_MAX_LIMIT_MS; } if (job.getJob().isDataTransfer()) { return mConstants.RUNTIME_DATA_TRANSFER_LIMIT_MS; } return Math.min(mConstants.RUNTIME_FREE_QUOTA_MAX_LIMIT_MS, mConstants.USE_TARE_POLICY ? mTareController.getMaxJobExecutionTimeMsLocked(job) Loading
core/api/current.txt +0 −2 Original line number Diff line number Diff line Loading @@ -8733,7 +8733,6 @@ package android.app.job { method public long getTriggerContentMaxDelay(); method public long getTriggerContentUpdateDelay(); method @Nullable public android.app.job.JobInfo.TriggerContentUri[] getTriggerContentUris(); method public boolean isDataTransfer(); method public boolean isExpedited(); method public boolean isImportantWhileForeground(); method public boolean isPeriodic(); Loading Loading @@ -8770,7 +8769,6 @@ package android.app.job { method public android.app.job.JobInfo build(); method public android.app.job.JobInfo.Builder setBackoffCriteria(long, int); method public android.app.job.JobInfo.Builder setClipData(@Nullable android.content.ClipData, int); method @NonNull public android.app.job.JobInfo.Builder setDataTransfer(boolean); method public android.app.job.JobInfo.Builder setEstimatedNetworkBytes(long, long); method @NonNull public android.app.job.JobInfo.Builder setExpedited(boolean); method public android.app.job.JobInfo.Builder setExtras(@NonNull android.os.PersistableBundle);
services/tests/mockingservicestests/src/com/android/server/job/JobSchedulerServiceTest.java +7 −59 Original line number Diff line number Diff line Loading @@ -234,15 +234,9 @@ public class JobSchedulerServiceTest { createJobInfo(5).setPriority(JobInfo.PRIORITY_HIGH)); JobStatus jobDef = createJobStatus("testGetMinJobExecutionGuaranteeMs", createJobInfo(6)); JobStatus jobDT = createJobStatus("testGetMinJobExecutionGuaranteeMs", createJobInfo(7) .setDataTransfer(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)); JobStatus jobUI = createJobStatus("testGetMinJobExecutionGuaranteeMs", createJobInfo(8)); // TODO(255371817): add setUserInitiated(true) JobStatus jobUIDT = createJobStatus("testGetMinJobExecutionGuaranteeMs", // TODO(255371817): add setUserInitiated(true) createJobInfo(9) .setDataTransfer(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)); .setUserInitiated(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)); spyOn(ejMax); spyOn(ejHigh); Loading @@ -250,8 +244,6 @@ public class JobSchedulerServiceTest { spyOn(ejHighDowngraded); spyOn(jobHigh); spyOn(jobDef); spyOn(jobDT); spyOn(jobUI); spyOn(jobUIDT); when(ejMax.shouldTreatAsExpeditedJob()).thenReturn(true); Loading @@ -260,14 +252,11 @@ public class JobSchedulerServiceTest { when(ejHighDowngraded.shouldTreatAsExpeditedJob()).thenReturn(false); when(jobHigh.shouldTreatAsExpeditedJob()).thenReturn(false); when(jobDef.shouldTreatAsExpeditedJob()).thenReturn(false); when(jobUI.shouldTreatAsUserInitiatedJob()).thenReturn(true); when(jobUIDT.shouldTreatAsUserInitiatedJob()).thenReturn(true); ConnectivityController connectivityController = mService.getConnectivityController(); spyOn(connectivityController); mService.mConstants.RUNTIME_MIN_GUARANTEE_MS = 10 * MINUTE_IN_MILLIS; mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS = 15 * MINUTE_IN_MILLIS; mService.mConstants.RUNTIME_DATA_TRANSFER_LIMIT_MS = 60 * MINUTE_IN_MILLIS; mService.mConstants.RUNTIME_MIN_USER_INITIATED_DATA_TRANSFER_GUARANTEE_BUFFER_FACTOR = 1.5f; mService.mConstants.RUNTIME_MIN_USER_INITIATED_DATA_TRANSFER_GUARANTEE_MS = HOUR_IN_MILLIS; mService.mConstants.RUNTIME_USER_INITIATED_DATA_TRANSFER_LIMIT_MS = 6 * HOUR_IN_MILLIS; Loading @@ -284,37 +273,14 @@ public class JobSchedulerServiceTest { mService.getMinJobExecutionGuaranteeMs(jobHigh)); assertEquals(mService.mConstants.RUNTIME_MIN_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobDef)); grantRunUserInitiatedJobsPermission(false); // Without permission assertEquals(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobDT)); grantRunUserInitiatedJobsPermission(true); // With permission doReturn(ConnectivityController.UNKNOWN_TIME) .when(connectivityController).getEstimatedTransferTimeMs(any()); assertEquals(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobDT)); doReturn(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS / 2) .when(connectivityController).getEstimatedTransferTimeMs(any()); assertEquals(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobDT)); doReturn(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS * 2) .when(connectivityController).getEstimatedTransferTimeMs(any()); assertEquals(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobDT)); doReturn(mService.mConstants.RUNTIME_DATA_TRANSFER_LIMIT_MS * 2) .when(connectivityController).getEstimatedTransferTimeMs(any()); assertEquals(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobDT)); // UserInitiated grantRunUserInitiatedJobsPermission(false); // Permission isn't granted, so it should just be treated as a regular data transfer job. assertEquals(mService.mConstants.RUNTIME_MIN_DATA_TRANSFER_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobUIDT)); // Permission isn't granted, so it should just be treated as a regular job. assertEquals(mService.mConstants.RUNTIME_MIN_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobUI)); mService.getMinJobExecutionGuaranteeMs(jobUIDT)); grantRunUserInitiatedJobsPermission(true); // With permission assertEquals(mService.mConstants.RUNTIME_MIN_USER_INITIATED_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobUI)); assertEquals(mService.mConstants.RUNTIME_MIN_USER_INITIATED_DATA_TRANSFER_GUARANTEE_MS, mService.getMinJobExecutionGuaranteeMs(jobUIDT)); doReturn(ConnectivityController.UNKNOWN_TIME) .when(connectivityController).getEstimatedTransferTimeMs(any()); assertEquals(mService.mConstants.RUNTIME_MIN_USER_INITIATED_DATA_TRANSFER_GUARANTEE_MS, Loading @@ -338,21 +304,10 @@ public class JobSchedulerServiceTest { @Test public void testGetMaxJobExecutionTimeMs() { JobStatus jobDT = createJobStatus("testGetMaxJobExecutionTimeMs", createJobInfo(7) .setDataTransfer(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)); JobStatus jobUI = createJobStatus("testGetMaxJobExecutionTimeMs", createJobInfo(9)); // TODO(255371817): add setUserInitiated(true) JobStatus jobUIDT = createJobStatus("testGetMaxJobExecutionTimeMs", // TODO(255371817): add setUserInitiated(true) createJobInfo(10) .setDataTransfer(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)); spyOn(jobDT); spyOn(jobUI); .setUserInitiated(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)); spyOn(jobUIDT); when(jobUI.shouldTreatAsUserInitiatedJob()).thenReturn(true); when(jobUIDT.shouldTreatAsUserInitiatedJob()).thenReturn(true); QuotaController quotaController = mService.getQuotaController(); Loading @@ -365,17 +320,9 @@ public class JobSchedulerServiceTest { .when(quotaController).getMaxJobExecutionTimeMsLocked(any()); grantRunUserInitiatedJobsPermission(true); assertEquals(mService.mConstants.RUNTIME_DATA_TRANSFER_LIMIT_MS, mService.getMaxJobExecutionTimeMs(jobDT)); assertEquals(mService.mConstants.RUNTIME_USER_INITIATED_LIMIT_MS, mService.getMaxJobExecutionTimeMs(jobUI)); assertEquals(mService.mConstants.RUNTIME_USER_INITIATED_DATA_TRANSFER_LIMIT_MS, mService.getMaxJobExecutionTimeMs(jobUIDT)); grantRunUserInitiatedJobsPermission(false); assertEquals(mService.mConstants.RUNTIME_DATA_TRANSFER_LIMIT_MS, mService.getMaxJobExecutionTimeMs(jobDT)); assertEquals(mService.mConstants.RUNTIME_FREE_QUOTA_MAX_LIMIT_MS, mService.getMaxJobExecutionTimeMs(jobUI)); assertEquals(mService.mConstants.RUNTIME_FREE_QUOTA_MAX_LIMIT_MS, mService.getMaxJobExecutionTimeMs(jobUIDT)); } Loading Loading @@ -478,7 +425,8 @@ public class JobSchedulerServiceTest { @Test public void testGetRescheduleJobForFailure_userStopped() { JobStatus uiJob = createJobStatus("testGetRescheduleJobForFailure", createJobInfo().setUserInitiated(true)); createJobInfo().setUserInitiated(true) .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)); JobStatus uvJob = createJobStatus("testGetRescheduleJobForFailure", createJobInfo()); spyOn(uvJob); doReturn(true).when(uvJob).isUserVisibleJob(); Loading
services/tests/mockingservicestests/src/com/android/server/job/controllers/FlexibilityControllerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -619,7 +619,7 @@ public class FlexibilityControllerTest { @Test public void testExceptions_UserInitiated() { JobInfo.Builder jb = createJob(0); jb.setUserInitiated(true); jb.setUserInitiated(true).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY); JobStatus js = createJobStatus("testExceptions_UserInitiated", jb); assertFalse(js.hasFlexibilityConstraint()); } Loading