Skip to content

Commit 0744642

Browse files
committed
InputTracer: Ensure 0 coordinate values are traced
The axis bits in PointerCoords are not set when the value is 0, since that's the default value. Make sure the coordinate values are always traced for pointer events. Bug: 245989146 Change-Id: Ib9fc647f1d3166ae51b265c40e77018ad2682d23 Flag: EXEMPT tracing only Test: Presubmit
1 parent 94b29e5 commit 0744642

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)