Add charging requirement for scheduled job.

Previously, the job to compute APEX and module hashes are scheduled
to be run when device is idle. However, that alone causes an idle
power issue.

We are thus adding a requirement for this job to be run when the
device is charging.

Bug: 229137737
Test: Manual

Change-Id: I6a86aac249541854948968e21dfbc5617cb59970
This commit is contained in:
Billy Lau
2022-04-14 12:38:26 -07:00
parent d73ce7e277
commit 599801303f

View File

@@ -441,6 +441,7 @@ public class BinaryTransparencyService extends SystemService {
final JobInfo jobInfo = new JobInfo.Builder(COMPUTE_APEX_MODULE_SHA256_JOB_ID,
new ComponentName(context, UpdateMeasurementsJobService.class))
.setRequiresDeviceIdle(true)
.setRequiresCharging(true)
.build();
if (jobScheduler.schedule(jobInfo) != JobScheduler.RESULT_SUCCESS) {
Slog.e(TAG, "Failed to schedule job to update binary measurements.");