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

Commit be2bd817 authored by Winson Chung's avatar Winson Chung
Browse files

Add more context to Choreographer input callbacks



Bug: 330906135
Test: Take a perfetto trace with input and verify it shows tags

Change-Id: I28d87745b967d8f548a27c67a8b0d7469d337d42
Signed-off-by: default avatarWinson Chung <winsonc@google.com>
parent 04b951c1
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ public class BatchedInputEventReceiver extends InputEventReceiver {
    private Choreographer mChoreographer;
    private boolean mBatchingEnabled;
    private boolean mBatchedInputScheduled;
    private final String mTag;
    private final Handler mHandler;
    private final Runnable mConsumeBatchedInputEvents = new Runnable() {
        @Override
@@ -43,6 +44,7 @@ public class BatchedInputEventReceiver extends InputEventReceiver {
        super(inputChannel, looper);
        mChoreographer = choreographer;
        mBatchingEnabled = true;
        mTag = inputChannel.getName();
        traceBoolVariable("mBatchingEnabled", mBatchingEnabled);
        traceBoolVariable("mBatchedInputScheduled", mBatchedInputScheduled);
        mHandler = new Handler(looper);
@@ -123,7 +125,12 @@ public class BatchedInputEventReceiver extends InputEventReceiver {
    private final class BatchedInputRunnable implements Runnable {
        @Override
        public void run() {
            try {
                Trace.traceBegin(Trace.TRACE_TAG_INPUT, mTag);
                doConsumeBatchedInput(mChoreographer.getFrameTimeNanos());
            } finally {
                Trace.traceEnd(Trace.TRACE_TAG_INPUT);
            }
        }
    }
    private final BatchedInputRunnable mBatchedInputRunnable = new BatchedInputRunnable();
+12 −7
Original line number Diff line number Diff line
@@ -10166,6 +10166,8 @@ public final class ViewRootImpl implements ViewParent,
    final class ConsumeBatchedInputRunnable implements Runnable {
        @Override
        public void run() {
            Trace.traceBegin(TRACE_TAG_VIEW, mTag);
            try {
                mConsumeBatchedInputScheduled = false;
                if (doConsumeBatchedInput(mChoreographer.getFrameTimeNanos())) {
                    // If we consumed a batch here, we want to go ahead and schedule the
@@ -10174,6 +10176,9 @@ public final class ViewRootImpl implements ViewParent,
                    // things occurring in the process.
                    scheduleConsumeBatchedInput();
                }
            } finally {
                Trace.traceEnd(TRACE_TAG_VIEW);
            }
        }
    }
    final ConsumeBatchedInputRunnable mConsumedBatchedInputRunnable =