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

Commit 2b1b7d71 authored by Kean Mariotti's avatar Kean Mariotti
Browse files

Fix UI traces real-to-elapsed time offset

Fix: b/256819989
Test: collect traces with Winscope 2.0 and check that real timestamps are correct
Change-Id: Id3435f6f4c71b97f7504abf8623948e46cb85b54
parent 61a511a3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ class ImeTracingServerImpl extends ImeTracing {
    private void writeTracesToFilesLocked() {
        try {
            long timeOffsetNs =
                    TimeUnit.NANOSECONDS.convert(System.currentTimeMillis(), TimeUnit.NANOSECONDS)
                    TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis())
                    - SystemClock.elapsedRealtimeNanos();

            ProtoOutputStream clientsProto = new ProtoOutputStream();
+1 −2
Original line number Diff line number Diff line
@@ -2225,8 +2225,7 @@ final class AccessibilityController {
                ProtoOutputStream proto = new ProtoOutputStream();
                proto.write(MAGIC_NUMBER, MAGIC_NUMBER_VALUE);
                long timeOffsetNs =
                        TimeUnit.NANOSECONDS.convert(System.currentTimeMillis(),
                                                     TimeUnit.NANOSECONDS)
                        TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis())
                        - SystemClock.elapsedRealtimeNanos();
                proto.write(REAL_TO_ELAPSED_TIME_OFFSET_NANOS, timeOffsetNs);
                mBuffer.writeTraceToFile(mTraceFile, proto);
+1 −1
Original line number Diff line number Diff line
@@ -355,7 +355,7 @@ class WindowTracing {
            ProtoOutputStream proto = new ProtoOutputStream();
            proto.write(MAGIC_NUMBER, MAGIC_NUMBER_VALUE);
            long timeOffsetNs =
                    TimeUnit.NANOSECONDS.convert(System.currentTimeMillis(), TimeUnit.NANOSECONDS)
                    TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis())
                    - SystemClock.elapsedRealtimeNanos();
            proto.write(REAL_TO_ELAPSED_TIME_OFFSET_NANOS, timeOffsetNs);
            mBuffer.writeTraceToFile(mTraceFile, proto);