Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f8d0358 authored by Varun Shah's avatar Varun Shah
Browse files

Ensure total runtime for time-limited FGS is in uptime base.

Bug: 330399444
Test: atest CtsFgsTimeoutTestCases
Change-Id: I71edd971bb3dbf7eef83ba030103c4de90ee8be9
parent 1d9fb990
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -683,6 +683,7 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN
        private long mLastFgsStartTime;
        @UptimeMillisLong
        private long mTimeLimitExceededAt = Long.MIN_VALUE;
        @UptimeMillisLong
        private long mTotalRuntime = 0;

        TimeLimitedFgsInfo(@UptimeMillisLong long startTime) {
@@ -705,9 +706,10 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN
        }

        public void updateTotalRuntime() {
            mTotalRuntime += SystemClock.elapsedRealtime() - mLastFgsStartTime;
            mTotalRuntime += SystemClock.uptimeMillis() - mLastFgsStartTime;
        }

        @UptimeMillisLong
        public long getTotalRuntime() {
            return mTotalRuntime;
        }