Skip to content

Commit b1e8c9f

Browse files
Treehugger RobotAndroid (Google) Code Review
authored andcommitted
Merge "InputTracer: Ensure 0 coordinate values are traced" into main
2 parents c863146 + 0744642 commit b1e8c9f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

services/inputflinger/dispatcher/trace/AndroidInputEventProtoConverter.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
#include "AndroidInputEventProtoConverter.h"
1818

19+
#include <android/input.h>
1920
#include <android-base/logging.h>
21+
#include <input/Input.h>
2022
#include <perfetto/trace/android/android_input_event.pbzero.h>
2123

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

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

0 commit comments

Comments
 (0)