From b347ffad418fa39a79ea2bda1131abe6db8d4e57 Mon Sep 17 00:00:00 2001 From: Kweku Adams Date: Wed, 3 May 2023 20:39:58 +0000 Subject: [PATCH] Fix cumulative execution calculation. The base timestamp wasn't being reset when the job started, so the duration was always being perceived as starting from boot time. Setting the base timestamp as the job start time fixes the cumulative execution tracking. Bug: 280653695 Test: N/A Change-Id: I8fdcde54c21bc53cfdb41c78ba4f19d7b45cc50b --- .../service/java/com/android/server/job/JobServiceContext.java | 1 + 1 file changed, 1 insertion(+) 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 f95df4471c29a..3fbb337fcc0df 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java +++ b/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java @@ -350,6 +350,7 @@ public final class JobServiceContext implements ServiceConnection { job.shouldTreatAsUserInitiatedJob(), triggeredUris, triggeredAuthorities, passedNetwork); mExecutionStartTimeElapsed = sElapsedRealtimeClock.millis(); + mLastExecutionDurationStampTimeElapsed = mExecutionStartTimeElapsed; mMinExecutionGuaranteeMillis = mService.getMinJobExecutionGuaranteeMs(job); mMaxExecutionTimeMillis = Math.max(mService.getMaxJobExecutionTimeMs(job), mMinExecutionGuaranteeMillis);