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

Commit d4f54878 authored by Nicolo' Mazzucato's avatar Nicolo' Mazzucato Committed by Nicolò Mazzucato
Browse files

Report instant event from CUJ UI thread once started

This will allow to accurately determine which UI thread a CUJ is associated to, and deprecate hardcoded lists.

See aosp/3191152 for metric changes.

Bug: 337803466
Test: Recorded perfetto trace and used with aosp/3187162
Flag: None - logging
Change-Id: Ia771c5f5b246037edfc91d7dae75e82a4ac330cb
parent 4232c17d
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -317,6 +317,7 @@ public class FrameTracker implements HardwareRendererObserver.OnFrameMetricsAvai
        Trace.asyncTraceForTrackBegin(Trace.TRACE_TAG_APP, name, name, (int) mBeginVsyncId);
        markEvent("FT#beginVsync", mBeginVsyncId);
        markEvent("FT#layerId", mSurfaceControl.getLayerId());
        markCujUiThread();
        mJankDataListenerRegistration =
                mSurfaceControlWrapper.addJankStatsListener(this, mSurfaceControl);
        if (!mSurfaceOnly) {
@@ -433,6 +434,13 @@ public class FrameTracker implements HardwareRendererObserver.OnFrameMetricsAvai
        }
    }

    private void markCujUiThread() {
        if (Trace.isTagEnabled(Trace.TRACE_TAG_APP)) {
            // This is being called from the CUJ ui thread.
            Trace.instant(Trace.TRACE_TAG_APP, mConfig.getSessionName() + "#UIThread");
        }
    }

    private void notifyCujEvent(String action, @Reasons int reason) {
        if (mListener == null) return;
        mListener.onCujEvents(this, action, reason);