Update job ids in Settings
Use constant integers instead of ids Bug: 77331929 Test: RunSettingsRoboTests Change-Id: Ic6def54aaae4a9ba025161340f1cee210cb2e87f
This commit is contained in:
@@ -18,9 +18,6 @@
|
||||
-->
|
||||
<resources>
|
||||
<item type="id" name="preference_highlighted" />
|
||||
<item type="id" name="job_anomaly_clean_up" />
|
||||
<item type="id" name="job_anomaly_config_update"/>
|
||||
<item type="id" name="job_anomaly_detection" />
|
||||
|
||||
<item type="id" name="lock_none" />
|
||||
<item type="id" name="lock_pin" />
|
||||
|
22
res/values/integers.xml
Normal file
22
res/values/integers.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2018 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Reserve all the job ids in settings -->
|
||||
<integer name="job_anomaly_clean_up">100</integer>
|
||||
<integer name="job_anomaly_config_update">101</integer>
|
||||
<integer name="job_anomaly_detection">102</integer>
|
||||
</resources>
|
@@ -42,7 +42,7 @@ public class AnomalyCleanupJobService extends JobService {
|
||||
|
||||
final ComponentName component = new ComponentName(context, AnomalyCleanupJobService.class);
|
||||
final JobInfo.Builder jobBuilder =
|
||||
new JobInfo.Builder(R.id.job_anomaly_clean_up, component)
|
||||
new JobInfo.Builder(R.integer.job_anomaly_clean_up, component)
|
||||
.setPeriodic(CLEAN_UP_FREQUENCY_MS)
|
||||
.setRequiresDeviceIdle(true)
|
||||
.setRequiresCharging(true);
|
||||
|
@@ -52,7 +52,7 @@ public class AnomalyConfigJobService extends JobService {
|
||||
|
||||
final ComponentName component = new ComponentName(context, AnomalyConfigJobService.class);
|
||||
final JobInfo.Builder jobBuilder =
|
||||
new JobInfo.Builder(R.id.job_anomaly_config_update, component)
|
||||
new JobInfo.Builder(R.integer.job_anomaly_config_update, component)
|
||||
.setPeriodic(CONFIG_UPDATE_FREQUENCY_MS)
|
||||
.setRequiresDeviceIdle(true)
|
||||
.setRequiresCharging(true);
|
||||
|
@@ -70,7 +70,7 @@ public class AnomalyDetectionJobService extends JobService {
|
||||
final ComponentName component = new ComponentName(context,
|
||||
AnomalyDetectionJobService.class);
|
||||
final JobInfo.Builder jobBuilder =
|
||||
new JobInfo.Builder(R.id.job_anomaly_detection, component)
|
||||
new JobInfo.Builder(R.integer.job_anomaly_detection, component)
|
||||
.setOverrideDeadline(MAX_DELAY_MS);
|
||||
|
||||
if (jobScheduler.enqueue(jobBuilder.build(), new JobWorkItem(intent))
|
||||
|
@@ -52,7 +52,7 @@ public class AnomalyCleanupJobServiceTest {
|
||||
List<JobInfo> pendingJobs = shadowJobScheduler.getAllPendingJobs();
|
||||
assertEquals(1, pendingJobs.size());
|
||||
JobInfo pendingJob = pendingJobs.get(0);
|
||||
assertThat(pendingJob.getId()).isEqualTo(R.id.job_anomaly_clean_up);
|
||||
assertThat(pendingJob.getId()).isEqualTo(R.integer.job_anomaly_clean_up);
|
||||
assertThat(pendingJob.getIntervalMillis()).isEqualTo(TimeUnit.DAYS.toMillis(1));
|
||||
assertThat(pendingJob.isRequireDeviceIdle()).isTrue();
|
||||
assertThat(pendingJob.isRequireCharging()).isTrue();
|
||||
|
@@ -79,7 +79,7 @@ public class AnomalyConfigJobServiceTest {
|
||||
List<JobInfo> pendingJobs = shadowJobScheduler.getAllPendingJobs();
|
||||
assertEquals(1, pendingJobs.size());
|
||||
JobInfo pendingJob = pendingJobs.get(0);
|
||||
assertThat(pendingJob.getId()).isEqualTo(R.id.job_anomaly_config_update);
|
||||
assertThat(pendingJob.getId()).isEqualTo(R.integer.job_anomaly_config_update);
|
||||
assertThat(pendingJob.getIntervalMillis()).isEqualTo(TimeUnit.DAYS.toMillis(1));
|
||||
assertThat(pendingJob.isRequireDeviceIdle()).isTrue();
|
||||
assertThat(pendingJob.isRequireCharging()).isTrue();
|
||||
|
@@ -113,7 +113,7 @@ public class AnomalyDetectionJobServiceTest {
|
||||
assertThat(pendingJobs).hasSize(1);
|
||||
|
||||
JobInfo pendingJob = pendingJobs.get(0);
|
||||
assertThat(pendingJob.getId()).isEqualTo(R.id.job_anomaly_detection);
|
||||
assertThat(pendingJob.getId()).isEqualTo(R.integer.job_anomaly_detection);
|
||||
assertThat(pendingJob.getMaxExecutionDelayMillis())
|
||||
.isEqualTo(TimeUnit.MINUTES.toMillis(30));
|
||||
}
|
||||
|
Reference in New Issue
Block a user