From 2a3a37edbce7e5d17a46c8314a2ed2d29c66d388 Mon Sep 17 00:00:00 2001 From: Varun Shah Date: Tue, 14 Mar 2023 21:58:30 +0000 Subject: [PATCH] Update metrics logging with new UIDT job fields. Bug: 262260570 Test: manual Change-Id: I6e2fbb74c6770c7dfa200e8ad131a3734760bf68 --- .../java/com/android/server/job/JobSchedulerService.java | 8 ++++++-- .../java/com/android/server/job/JobServiceContext.java | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java index 3cc67e7b56773..ceac922276c3b 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java @@ -1438,7 +1438,9 @@ public class JobSchedulerService extends com.android.server.SystemService /* isDeviceIdle */ false, /* hasConnectivityConstraintSatisfied */ false, /* hasContentTriggerConstraintSatisfied */ false, - 0); + 0, + jobStatus.getJob().isUserInitiated(), + /* isRunningAsUserInitiatedJob */ false); // If the job is immediately ready to run, then we can just immediately // put it in the pending list and try to schedule it. This is especially @@ -1857,7 +1859,9 @@ public class JobSchedulerService extends com.android.server.SystemService cancelled.isConstraintSatisfied(JobInfo.CONSTRAINT_FLAG_DEVICE_IDLE), cancelled.isConstraintSatisfied(JobStatus.CONSTRAINT_CONNECTIVITY), cancelled.isConstraintSatisfied(JobStatus.CONSTRAINT_CONTENT_TRIGGER), - 0); + 0, + cancelled.getJob().isUserInitiated(), + /* isRunningAsUserInitiatedJob */ false); } // If this is a replacement, bring in the new version of the job if (incomingJob != null) { diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java b/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java index e60ed4ade9b7f..4c339ac66160a 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java +++ b/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java @@ -462,7 +462,9 @@ public final class JobServiceContext implements ServiceConnection { job.isConstraintSatisfied(JobInfo.CONSTRAINT_FLAG_DEVICE_IDLE), job.isConstraintSatisfied(JobStatus.CONSTRAINT_CONNECTIVITY), job.isConstraintSatisfied(JobStatus.CONSTRAINT_CONTENT_TRIGGER), - mExecutionStartTimeElapsed - job.enqueueTime); + mExecutionStartTimeElapsed - job.enqueueTime, + job.getJob().isUserInitiated(), + job.shouldTreatAsUserInitiatedJob()); if (Trace.isTagEnabled(Trace.TRACE_TAG_SYSTEM_SERVER)) { // Use the context's ID to distinguish traces since there'll only be one job // running per context. @@ -1361,7 +1363,9 @@ public final class JobServiceContext implements ServiceConnection { completedJob.isConstraintSatisfied(JobInfo.CONSTRAINT_FLAG_DEVICE_IDLE), completedJob.isConstraintSatisfied(JobStatus.CONSTRAINT_CONNECTIVITY), completedJob.isConstraintSatisfied(JobStatus.CONSTRAINT_CONTENT_TRIGGER), - 0); + 0, + completedJob.getJob().isUserInitiated(), + completedJob.startedAsUserInitiatedJob); if (Trace.isTagEnabled(Trace.TRACE_TAG_SYSTEM_SERVER)) { Trace.asyncTraceForTrackEnd(Trace.TRACE_TAG_SYSTEM_SERVER, "JobScheduler", getId());