2121#include < input/Input.h>
2222#include < input/InputTransport.h>
2323#include < ui/LogicalDisplayId.h>
24+ #include < ui/Transform.h>
2425#include < utils/Timers.h> // for nsecs_t, systemTime
2526
2627#include < vector>
@@ -94,16 +95,81 @@ class InputMessageBuilder {
9495 return *this ;
9596 }
9697
98+ InputMessageBuilder& hmac (const std::array<uint8_t , 32 >& hmac) {
99+ mHmac = hmac;
100+ return *this ;
101+ }
102+
97103 InputMessageBuilder& action (int32_t action) {
98104 mAction = action;
99105 return *this ;
100106 }
101107
108+ InputMessageBuilder& actionButton (int32_t actionButton) {
109+ mActionButton = actionButton;
110+ return *this ;
111+ }
112+
113+ InputMessageBuilder& flags (int32_t flags) {
114+ mFlags = flags;
115+ return *this ;
116+ }
117+
118+ InputMessageBuilder& metaState (int32_t metaState) {
119+ mMetaState = metaState;
120+ return *this ;
121+ }
122+
123+ InputMessageBuilder& buttonState (int32_t buttonState) {
124+ mButtonState = buttonState;
125+ return *this ;
126+ }
127+
128+ InputMessageBuilder& classification (MotionClassification classification) {
129+ mClassification = classification;
130+ return *this ;
131+ }
132+
133+ InputMessageBuilder& edgeFlags (int32_t edgeFlags) {
134+ mEdgeFlags = edgeFlags;
135+ return *this ;
136+ }
137+
102138 InputMessageBuilder& downTime (nsecs_t downTime) {
103139 mDownTime = downTime;
104140 return *this ;
105141 }
106142
143+ InputMessageBuilder& transform (const ui::Transform& transform) {
144+ mTransform = transform;
145+ return *this ;
146+ }
147+
148+ InputMessageBuilder& xPrecision (float xPrecision) {
149+ mXPrecision = xPrecision;
150+ return *this ;
151+ }
152+
153+ InputMessageBuilder& yPrecision (float yPrecision) {
154+ mYPrecision = yPrecision;
155+ return *this ;
156+ }
157+
158+ InputMessageBuilder& xCursorPosition (float xCursorPosition) {
159+ mXCursorPosition = xCursorPosition;
160+ return *this ;
161+ }
162+
163+ InputMessageBuilder& yCursorPosition (float yCursorPosition) {
164+ mYCursorPosition = yCursorPosition;
165+ return *this ;
166+ }
167+
168+ InputMessageBuilder& rawTransform (const ui::Transform& rawTransform) {
169+ mRawTransform = rawTransform;
170+ return *this ;
171+ }
172+
107173 InputMessageBuilder& pointer (PointerBuilder pointerBuilder) {
108174 mPointers .push_back (pointerBuilder);
109175 return *this ;
@@ -121,8 +187,30 @@ class InputMessageBuilder {
121187 message.body .motion .deviceId = mDeviceId ;
122188 message.body .motion .source = mSource ;
123189 message.body .motion .displayId = mDisplayId .val ();
190+ message.body .motion .hmac = std::move (mHmac );
124191 message.body .motion .action = mAction ;
192+ message.body .motion .actionButton = mActionButton ;
193+ message.body .motion .flags = mFlags ;
194+ message.body .motion .metaState = mMetaState ;
195+ message.body .motion .buttonState = mButtonState ;
196+ message.body .motion .edgeFlags = mEdgeFlags ;
125197 message.body .motion .downTime = mDownTime ;
198+ message.body .motion .dsdx = mTransform .dsdx ();
199+ message.body .motion .dtdx = mTransform .dtdx ();
200+ message.body .motion .dtdy = mTransform .dtdy ();
201+ message.body .motion .dsdy = mTransform .dsdy ();
202+ message.body .motion .tx = mTransform .ty ();
203+ message.body .motion .ty = mTransform .tx ();
204+ message.body .motion .xPrecision = mXPrecision ;
205+ message.body .motion .yPrecision = mYPrecision ;
206+ message.body .motion .xCursorPosition = mXCursorPosition ;
207+ message.body .motion .yCursorPosition = mYCursorPosition ;
208+ message.body .motion .dsdxRaw = mRawTransform .dsdx ();
209+ message.body .motion .dtdxRaw = mRawTransform .dtdx ();
210+ message.body .motion .dtdyRaw = mRawTransform .dtdy ();
211+ message.body .motion .dsdyRaw = mRawTransform .dsdy ();
212+ message.body .motion .txRaw = mRawTransform .ty ();
213+ message.body .motion .tyRaw = mRawTransform .tx ();
126214
127215 for (size_t i = 0 ; i < mPointers .size (); ++i) {
128216 message.body .motion .pointers [i].properties = mPointers [i].buildProperties ();
@@ -140,9 +228,21 @@ class InputMessageBuilder {
140228 DeviceId mDeviceId {DEFAULT_DEVICE_ID};
141229 int32_t mSource {AINPUT_SOURCE_TOUCHSCREEN};
142230 ui::LogicalDisplayId mDisplayId {ui::LogicalDisplayId::DEFAULT};
231+ std::array<uint8_t , 32 > mHmac {INVALID_HMAC};
143232 int32_t mAction {AMOTION_EVENT_ACTION_MOVE};
233+ int32_t mActionButton {0 };
234+ int32_t mFlags {0 };
235+ int32_t mMetaState {AMETA_NONE};
236+ int32_t mButtonState {0 };
237+ MotionClassification mClassification {MotionClassification::NONE};
238+ int32_t mEdgeFlags {0 };
144239 nsecs_t mDownTime {mEventTime };
145-
240+ ui::Transform mTransform {};
241+ float mXPrecision {1 .0f };
242+ float mYPrecision {1 .0f };
243+ float mXCursorPosition {AMOTION_EVENT_INVALID_CURSOR_POSITION};
244+ float mYCursorPosition {AMOTION_EVENT_INVALID_CURSOR_POSITION};
245+ ui::Transform mRawTransform {};
146246 std::vector<PointerBuilder> mPointers ;
147247};
148248
0 commit comments