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

Commit 8a5106c2 authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Log initial state after enabling WM tracing

Currently the traces are logged only if a transaction is commited. The
initial trace should be logged when starting the trace, as it is useful
for debugging

Test: Flash a device. Start WM tracing. Don't use the device. Stop WM
tracing. Open the trace in Winscope, it should have 1 entry

Fixes: 127545789
Change-Id: I3b9e96b8177cc206761bddc94add1f7ac2869446
parent f61de8f4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ class WindowTracing {
            mBuffer.resetBuffer();
            mEnabled = mEnabledLockFree = true;
        }
        log("trace.enable");
    }

    void stopTrace(@Nullable PrintWriter pw) {
+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentat

import static com.android.dx.mockito.inline.extended.ExtendedMockito.doAnswer;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.times;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verifyZeroInteractions;

@@ -124,7 +125,7 @@ public class WindowTracingTest {
    public void trace_dumpsWindowManagerState_whenTracing() throws Exception {
        mWindowTracing.startTrace(mock(PrintWriter.class));
        mWindowTracing.logState("where");
        verify(mWmMock).writeToProtoLocked(any(), eq(WindowTraceLogLevel.TRIM));
        verify(mWmMock, times(2)).writeToProtoLocked(any(), eq(WindowTraceLogLevel.TRIM));
    }

    @Test