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

Commit b7f67abe authored by Alison Cichowlas's avatar Alison Cichowlas
Browse files

Use uptimeMillis instead of currentTimeMillis for interval calculation.

uptime is guaranteed monotonic; currentTime may go backwards in the event
of NTP updates or other wackiness.

Test: manual sanity check of logs; android.support.test.metricshelper.MetricsAssertsTest passes
Bug: 37538546, 18584861

Change-Id: I222b20be9d561e1184b11155fe44c574d90872a5
parent 0f876448
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ class ActivityMetricsLogger {
     */
    void notifyActivityLaunching() {
        if (!isAnyTransitionActive()) {
            mCurrentTransitionStartTime = System.currentTimeMillis();
            mCurrentTransitionStartTime = SystemClock.uptimeMillis();
        }
    }

@@ -299,7 +299,7 @@ class ActivityMetricsLogger {
    private int calculateCurrentDelay() {

        // Shouldn't take more than 25 days to launch an app, so int is fine here.
        return (int) (System.currentTimeMillis() - mCurrentTransitionStartTime);
        return (int) (SystemClock.uptimeMillis() - mCurrentTransitionStartTime);
    }

    private void logAppTransitionMultiEvents() {