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

Commit 177be536 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Don't call 'getShortDescription' when tracing is not enabled" into main

parents d01f5610 ab77bd97
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -290,9 +290,15 @@ public abstract class InputEventReceiver {
    @SuppressWarnings("unused")
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    private void dispatchInputEvent(int seq, InputEvent event) {
        Trace.traceBegin(Trace.TRACE_TAG_INPUT, "dispatchInputEvent " + getShortDescription(event));
        if (Trace.isTagEnabled(Trace.TRACE_TAG_INPUT)) {
            // This 'if' block is an optimization - without it, 'getShortDescription' will be
            // called unconditionally, which is expensive.
            Trace.traceBegin(Trace.TRACE_TAG_INPUT,
                    "dispatchInputEvent " + getShortDescription(event));
        }
        mSeqMap.put(event.getSequenceNumber(), seq);
        onInputEvent(event);
        // If tracing is not enabled, `traceEnd` is a no-op (so we don't need to guard it with 'if')
        Trace.traceEnd(Trace.TRACE_TAG_INPUT);
    }