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

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

Merge "InputTracer: Ensure 0 coordinate values are traced" into main

parents c8631465 07446428
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -16,7 +16,9 @@

#include "AndroidInputEventProtoConverter.h"

#include <android/input.h>
#include <android-base/logging.h>
#include <input/Input.h>
#include <perfetto/trace/android/android_input_event.pbzero.h>

namespace android::inputdispatcher::trace {
@@ -67,6 +69,12 @@ void AndroidInputEventProtoConverter::toProtoMotionEvent(const TracedMotionEvent

        const auto& coords = event.pointerCoords[i];
        auto bits = BitSet64(coords.bits);
        if (isFromSource(event.source, AINPUT_SOURCE_CLASS_POINTER)) {
            // Always include the X and Y axes for pointer events, since the
            // bits will not be marked if the value is 0.
            bits.markBit(AMOTION_EVENT_AXIS_X);
            bits.markBit(AMOTION_EVENT_AXIS_Y);
        }
        for (int32_t axisIndex = 0; !bits.isEmpty(); axisIndex++) {
            const auto axis = bits.clearFirstMarkedBit();
            auto axisEntry = pointer->add_axis_value();