blob: fbe8482ac4f195480ecdc2afad6c708ddaef6a9c [file] [log] [blame]
Siarhei Vishniakoud0784762019-11-01 15:33:48 -07001/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <benchmark/benchmark.h>
18
Siarhei Vishniakouf2652122021-03-05 21:39:46 +000019#include <android/os/IInputConstants.h>
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070020#include <binder/Binder.h>
chaviw3277faf2021-05-19 16:45:23 -050021#include <gui/constants.h>
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070022#include "../dispatcher/InputDispatcher.h"
23
Siarhei Vishniakou18050092021-09-01 13:32:49 -070024using android::base::Result;
chaviw3277faf2021-05-19 16:45:23 -050025using android::gui::WindowInfo;
26using android::gui::WindowInfoHandle;
Siarhei Vishniakouf2652122021-03-05 21:39:46 +000027using android::os::IInputConstants;
Siarhei Vishniakouae6229e2019-12-30 16:23:19 -080028using android::os::InputEventInjectionResult;
29using android::os::InputEventInjectionSync;
30
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070031namespace android::inputdispatcher {
32
Siarhei Vishniakouadeb6fa2023-05-26 09:11:06 -070033namespace {
34
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070035// An arbitrary device id.
Prabir Pradhan5735a322022-04-11 17:23:34 +000036constexpr int32_t DEVICE_ID = 1;
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070037
Prabir Pradhan5735a322022-04-11 17:23:34 +000038// The default pid and uid for windows created by the test.
39constexpr int32_t WINDOW_PID = 999;
40constexpr int32_t WINDOW_UID = 1001;
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070041
Siarhei Vishniakou097c3db2020-05-06 14:18:38 -070042static constexpr std::chrono::duration INJECT_EVENT_TIMEOUT = 5s;
43static constexpr std::chrono::nanoseconds DISPATCHING_TIMEOUT = 100ms;
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070044
45static nsecs_t now() {
46 return systemTime(SYSTEM_TIME_MONOTONIC);
47}
48
49// --- FakeInputDispatcherPolicy ---
50
51class FakeInputDispatcherPolicy : public InputDispatcherPolicyInterface {
52public:
Prabir Pradhana41d2442023-04-20 21:30:40 +000053 FakeInputDispatcherPolicy() = default;
54 virtual ~FakeInputDispatcherPolicy() = default;
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070055
56private:
Siarhei Vishniakouc1ae5562020-06-30 14:22:57 -050057 void notifyConfigurationChanged(nsecs_t) override {}
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070058
Siarhei Vishniakou234129c2020-10-22 22:28:12 -050059 void notifyNoFocusedWindowAnr(
60 const std::shared_ptr<InputApplicationHandle>& applicationHandle) override {
61 ALOGE("There is no focused window for %s", applicationHandle->getName().c_str());
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070062 }
63
Prabir Pradhanedd96402022-02-15 01:46:16 -080064 void notifyWindowUnresponsive(const sp<IBinder>& connectionToken, std::optional<int32_t> pid,
Siarhei Vishniakou3c63fa42020-12-15 02:59:54 +000065 const std::string& reason) override {
66 ALOGE("Window is not responding: %s", reason.c_str());
Siarhei Vishniakou234129c2020-10-22 22:28:12 -050067 }
68
Prabir Pradhanedd96402022-02-15 01:46:16 -080069 void notifyWindowResponsive(const sp<IBinder>& connectionToken,
70 std::optional<int32_t> pid) override {}
Siarhei Vishniakou234129c2020-10-22 22:28:12 -050071
Siarhei Vishniakouc1ae5562020-06-30 14:22:57 -050072 void notifyInputChannelBroken(const sp<IBinder>&) override {}
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070073
Siarhei Vishniakouc1ae5562020-06-30 14:22:57 -050074 void notifyFocusChanged(const sp<IBinder>&, const sp<IBinder>&) override {}
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070075
Chris Yef59a2f42020-10-16 12:55:26 -070076 void notifySensorEvent(int32_t deviceId, InputDeviceSensorType sensorType,
77 InputDeviceSensorAccuracy accuracy, nsecs_t timestamp,
78 const std::vector<float>& values) override {}
79
80 void notifySensorAccuracy(int32_t deviceId, InputDeviceSensorType sensorType,
81 InputDeviceSensorAccuracy accuracy) override {}
82
Chris Yefb552902021-02-03 17:18:37 -080083 void notifyVibratorState(int32_t deviceId, bool isOn) override {}
84
Prabir Pradhana41d2442023-04-20 21:30:40 +000085 InputDispatcherConfiguration getDispatcherConfiguration() override { return mConfig; }
86
87 bool filterInputEvent(const InputEvent& inputEvent, uint32_t policyFlags) override {
88 return true; // dispatch event normally
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070089 }
90
Prabir Pradhana41d2442023-04-20 21:30:40 +000091 void interceptKeyBeforeQueueing(const KeyEvent&, uint32_t&) override {}
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070092
Siarhei Vishniakouc1ae5562020-06-30 14:22:57 -050093 void interceptMotionBeforeQueueing(int32_t, nsecs_t, uint32_t&) override {}
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070094
Prabir Pradhana41d2442023-04-20 21:30:40 +000095 nsecs_t interceptKeyBeforeDispatching(const sp<IBinder>&, const KeyEvent&, uint32_t) override {
Siarhei Vishniakoud0784762019-11-01 15:33:48 -070096 return 0;
97 }
98
Prabir Pradhana41d2442023-04-20 21:30:40 +000099 std::optional<KeyEvent> dispatchUnhandledKey(const sp<IBinder>&, const KeyEvent&,
100 uint32_t) override {
101 return {};
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700102 }
103
Siarhei Vishniakouc1ae5562020-06-30 14:22:57 -0500104 void notifySwitch(nsecs_t, uint32_t, uint32_t, uint32_t) override {}
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700105
Sean Stoutb4e0a592021-02-23 07:34:53 -0800106 void pokeUserActivity(nsecs_t, int32_t, int32_t) override {}
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700107
Siarhei Vishniakouc1ae5562020-06-30 14:22:57 -0500108 void onPointerDownOutsideFocus(const sp<IBinder>& newToken) override {}
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700109
Prabir Pradhan5cc1a692021-08-06 14:01:18 +0000110 void setPointerCapture(const PointerCaptureRequest&) override {}
Prabir Pradhan99987712020-11-10 18:43:05 -0800111
arthurhungf452d0b2021-01-06 00:19:52 +0800112 void notifyDropWindow(const sp<IBinder>&, float x, float y) override {}
113
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700114 InputDispatcherConfiguration mConfig;
115};
116
117class FakeApplicationHandle : public InputApplicationHandle {
118public:
119 FakeApplicationHandle() {}
120 virtual ~FakeApplicationHandle() {}
121
122 virtual bool updateInfo() {
Siarhei Vishniakou70622952020-07-30 11:17:23 -0500123 mInfo.dispatchingTimeoutMillis =
124 std::chrono::duration_cast<std::chrono::milliseconds>(DISPATCHING_TIMEOUT).count();
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700125 return true;
126 }
127};
128
129class FakeInputReceiver {
130public:
131 void consumeEvent() {
Siarhei Vishniakoud549b252020-08-11 11:25:26 -0500132 uint32_t consumeSeq = 0;
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700133 InputEvent* event;
134
Siarhei Vishniakouadfd4fa2019-12-20 11:02:58 -0800135 std::chrono::time_point start = std::chrono::steady_clock::now();
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700136 status_t result = WOULD_BLOCK;
137 while (result == WOULD_BLOCK) {
Siarhei Vishniakouadfd4fa2019-12-20 11:02:58 -0800138 std::chrono::duration elapsed = std::chrono::steady_clock::now() - start;
139 if (elapsed > 10ms) {
140 ALOGE("Waited too long for consumer to produce an event, giving up");
141 break;
142 }
Harry Cutts33476232023-01-30 19:57:29 +0000143 result = mConsumer->consume(&mEventFactory, /*consumeBatches=*/true, -1, &consumeSeq,
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700144 &event);
145 }
146 if (result != OK) {
147 ALOGE("Received result = %d from consume()", result);
148 }
149 result = mConsumer->sendFinishedSignal(consumeSeq, true);
150 if (result != OK) {
151 ALOGE("Received result = %d from sendFinishedSignal", result);
152 }
153 }
154
155protected:
Siarhei Vishniakou18050092021-09-01 13:32:49 -0700156 explicit FakeInputReceiver(InputDispatcher& dispatcher, const std::string name) {
157 Result<std::unique_ptr<InputChannel>> channelResult = dispatcher.createInputChannel(name);
158 LOG_ALWAYS_FATAL_IF(!channelResult.ok());
159 mClientChannel = std::move(*channelResult);
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700160 mConsumer = std::make_unique<InputConsumer>(mClientChannel);
161 }
162
163 virtual ~FakeInputReceiver() {}
164
Garfield Tan15601662020-09-22 15:32:38 -0700165 std::shared_ptr<InputChannel> mClientChannel;
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700166 std::unique_ptr<InputConsumer> mConsumer;
167 PreallocatedInputEventFactory mEventFactory;
168};
169
chaviw3277faf2021-05-19 16:45:23 -0500170class FakeWindowHandle : public WindowInfoHandle, public FakeInputReceiver {
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700171public:
172 static const int32_t WIDTH = 200;
173 static const int32_t HEIGHT = 200;
174
Chris Yea209fde2020-07-22 13:54:51 -0700175 FakeWindowHandle(const std::shared_ptr<InputApplicationHandle>& inputApplicationHandle,
Siarhei Vishniakou18050092021-09-01 13:32:49 -0700176 InputDispatcher& dispatcher, const std::string name)
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700177 : FakeInputReceiver(dispatcher, name), mFrame(Rect(0, 0, WIDTH, HEIGHT)) {
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700178 inputApplicationHandle->updateInfo();
chaviw15fab6f2021-06-07 14:15:52 -0500179 updateInfo();
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700180 mInfo.applicationInfo = *inputApplicationHandle->getInfo();
181 }
182
chaviw15fab6f2021-06-07 14:15:52 -0500183 void updateInfo() {
Garfield Tan15601662020-09-22 15:32:38 -0700184 mInfo.token = mClientChannel->getConnectionToken();
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700185 mInfo.name = "FakeWindowHandle";
Siarhei Vishniakouc1ae5562020-06-30 14:22:57 -0500186 mInfo.dispatchingTimeout = DISPATCHING_TIMEOUT;
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700187 mInfo.frameLeft = mFrame.left;
188 mInfo.frameTop = mFrame.top;
189 mInfo.frameRight = mFrame.right;
190 mInfo.frameBottom = mFrame.bottom;
191 mInfo.globalScaleFactor = 1.0;
192 mInfo.touchableRegion.clear();
193 mInfo.addTouchableRegion(mFrame);
Prabir Pradhan5735a322022-04-11 17:23:34 +0000194 mInfo.ownerPid = WINDOW_PID;
195 mInfo.ownerUid = WINDOW_UID;
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700196 mInfo.displayId = ADISPLAY_ID_DEFAULT;
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700197 }
198
199protected:
200 Rect mFrame;
201};
202
203static MotionEvent generateMotionEvent() {
204 PointerProperties pointerProperties[1];
205 PointerCoords pointerCoords[1];
206
207 pointerProperties[0].clear();
208 pointerProperties[0].id = 0;
Siarhei Vishniakou6d73f832022-07-21 17:27:03 -0700209 pointerProperties[0].toolType = ToolType::FINGER;
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700210
211 pointerCoords[0].clear();
212 pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, 100);
213 pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, 100);
214
215 const nsecs_t currentTime = now();
216
chaviw9eaa22c2020-07-01 16:21:27 -0700217 ui::Transform identityTransform;
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700218 MotionEvent event;
Siarhei Vishniakouf2652122021-03-05 21:39:46 +0000219 event.initialize(IInputConstants::INVALID_INPUT_EVENT_ID, DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN,
Garfield Tanfbe732e2020-01-24 11:26:14 -0800220 ADISPLAY_ID_DEFAULT, INVALID_HMAC, AMOTION_EVENT_ACTION_DOWN,
221 /* actionButton */ 0, /* flags */ 0,
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700222 /* edgeFlags */ 0, AMETA_NONE, /* buttonState */ 0, MotionClassification::NONE,
chaviw9eaa22c2020-07-01 16:21:27 -0700223 identityTransform, /* xPrecision */ 0,
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700224 /* yPrecision */ 0, AMOTION_EVENT_INVALID_CURSOR_POSITION,
Prabir Pradhanb9b18502021-08-26 12:30:32 -0700225 AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, currentTime,
226 currentTime,
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700227 /*pointerCount*/ 1, pointerProperties, pointerCoords);
228 return event;
229}
230
231static NotifyMotionArgs generateMotionArgs() {
232 PointerProperties pointerProperties[1];
233 PointerCoords pointerCoords[1];
234
235 pointerProperties[0].clear();
236 pointerProperties[0].id = 0;
Siarhei Vishniakou6d73f832022-07-21 17:27:03 -0700237 pointerProperties[0].toolType = ToolType::FINGER;
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700238
239 pointerCoords[0].clear();
240 pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, 100);
241 pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, 100);
242
243 const nsecs_t currentTime = now();
244 // Define a valid motion event.
Siarhei Vishniakouf2652122021-03-05 21:39:46 +0000245 NotifyMotionArgs args(IInputConstants::INVALID_INPUT_EVENT_ID, currentTime, currentTime,
246 DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
247 POLICY_FLAG_PASS_TO_USER, AMOTION_EVENT_ACTION_DOWN,
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700248 /* actionButton */ 0, /* flags */ 0, AMETA_NONE, /* buttonState */ 0,
249 MotionClassification::NONE, AMOTION_EVENT_EDGE_FLAG_NONE, 1,
250 pointerProperties, pointerCoords,
251 /* xPrecision */ 0, /* yPrecision */ 0,
252 AMOTION_EVENT_INVALID_CURSOR_POSITION,
253 AMOTION_EVENT_INVALID_CURSOR_POSITION, currentTime, /* videoFrames */ {});
254
255 return args;
256}
257
258static void benchmarkNotifyMotion(benchmark::State& state) {
259 // Create dispatcher
Prabir Pradhana41d2442023-04-20 21:30:40 +0000260 FakeInputDispatcherPolicy fakePolicy;
Siarhei Vishniakou8c84b802022-03-23 15:48:41 -0700261 InputDispatcher dispatcher(fakePolicy);
262 dispatcher.setInputDispatchMode(/*enabled*/ true, /*frozen*/ false);
263 dispatcher.start();
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700264
265 // Create a window that will receive motion events
Chris Yea209fde2020-07-22 13:54:51 -0700266 std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
Siarhei Vishniakouaed7ad02022-08-03 15:04:33 -0700267 sp<FakeWindowHandle> window =
268 sp<FakeWindowHandle>::make(application, dispatcher, "Fake Window");
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700269
Siarhei Vishniakou8c84b802022-03-23 15:48:41 -0700270 dispatcher.setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700271
272 NotifyMotionArgs motionArgs = generateMotionArgs();
273
274 for (auto _ : state) {
275 // Send ACTION_DOWN
276 motionArgs.action = AMOTION_EVENT_ACTION_DOWN;
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700277 motionArgs.downTime = now();
278 motionArgs.eventTime = motionArgs.downTime;
Prabir Pradhan678438e2023-04-13 19:32:51 +0000279 dispatcher.notifyMotion(motionArgs);
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700280
281 // Send ACTION_UP
282 motionArgs.action = AMOTION_EVENT_ACTION_UP;
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700283 motionArgs.eventTime = now();
Prabir Pradhan678438e2023-04-13 19:32:51 +0000284 dispatcher.notifyMotion(motionArgs);
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700285
286 window->consumeEvent();
287 window->consumeEvent();
288 }
289
Siarhei Vishniakou8c84b802022-03-23 15:48:41 -0700290 dispatcher.stop();
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700291}
292
293static void benchmarkInjectMotion(benchmark::State& state) {
294 // Create dispatcher
Prabir Pradhana41d2442023-04-20 21:30:40 +0000295 FakeInputDispatcherPolicy fakePolicy;
Siarhei Vishniakou8c84b802022-03-23 15:48:41 -0700296 InputDispatcher dispatcher(fakePolicy);
297 dispatcher.setInputDispatchMode(/*enabled*/ true, /*frozen*/ false);
298 dispatcher.start();
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700299
300 // Create a window that will receive motion events
Chris Yea209fde2020-07-22 13:54:51 -0700301 std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
Siarhei Vishniakouaed7ad02022-08-03 15:04:33 -0700302 sp<FakeWindowHandle> window =
303 sp<FakeWindowHandle>::make(application, dispatcher, "Fake Window");
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700304
Siarhei Vishniakou8c84b802022-03-23 15:48:41 -0700305 dispatcher.setInputWindows({{ADISPLAY_ID_DEFAULT, {window}}});
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700306
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700307 for (auto _ : state) {
Siarhei Vishniakouadfd4fa2019-12-20 11:02:58 -0800308 MotionEvent event = generateMotionEvent();
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700309 // Send ACTION_DOWN
Harry Cutts33476232023-01-30 19:57:29 +0000310 dispatcher.injectInputEvent(&event, /*targetUid=*/{}, InputEventInjectionSync::NONE,
Prabir Pradhan5735a322022-04-11 17:23:34 +0000311 INJECT_EVENT_TIMEOUT,
Siarhei Vishniakou8c84b802022-03-23 15:48:41 -0700312 POLICY_FLAG_FILTERED | POLICY_FLAG_PASS_TO_USER);
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700313
314 // Send ACTION_UP
315 event.setAction(AMOTION_EVENT_ACTION_UP);
Harry Cutts33476232023-01-30 19:57:29 +0000316 dispatcher.injectInputEvent(&event, /*targetUid=*/{}, InputEventInjectionSync::NONE,
Prabir Pradhan5735a322022-04-11 17:23:34 +0000317 INJECT_EVENT_TIMEOUT,
Siarhei Vishniakou8c84b802022-03-23 15:48:41 -0700318 POLICY_FLAG_FILTERED | POLICY_FLAG_PASS_TO_USER);
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700319
320 window->consumeEvent();
321 window->consumeEvent();
322 }
323
Siarhei Vishniakou8c84b802022-03-23 15:48:41 -0700324 dispatcher.stop();
325}
326
327static void benchmarkOnWindowInfosChanged(benchmark::State& state) {
328 // Create dispatcher
Prabir Pradhana41d2442023-04-20 21:30:40 +0000329 FakeInputDispatcherPolicy fakePolicy;
Siarhei Vishniakou8c84b802022-03-23 15:48:41 -0700330 InputDispatcher dispatcher(fakePolicy);
331 dispatcher.setInputDispatchMode(/*enabled*/ true, /*frozen*/ false);
332 dispatcher.start();
333
334 // Create a window
335 std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
Siarhei Vishniakouaed7ad02022-08-03 15:04:33 -0700336 sp<FakeWindowHandle> window =
337 sp<FakeWindowHandle>::make(application, dispatcher, "Fake Window");
Siarhei Vishniakou8c84b802022-03-23 15:48:41 -0700338
339 std::vector<gui::WindowInfo> windowInfos{*window->getInfo()};
340 gui::DisplayInfo info;
341 info.displayId = window->getInfo()->displayId;
342 std::vector<gui::DisplayInfo> displayInfos{info};
343
344 for (auto _ : state) {
Patrick Williamsd828f302023-04-28 17:52:08 -0500345 dispatcher.onWindowInfosChanged(
346 {windowInfos, displayInfos, /*vsyncId=*/0, /*timestamp=*/0});
347 dispatcher.onWindowInfosChanged(
348 {/*windowInfos=*/{}, /*displayInfos=*/{}, /*vsyncId=*/{}, /*timestamp=*/0});
Siarhei Vishniakou8c84b802022-03-23 15:48:41 -0700349 }
350 dispatcher.stop();
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700351}
352
Siarhei Vishniakouadeb6fa2023-05-26 09:11:06 -0700353} // namespace
354
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700355BENCHMARK(benchmarkNotifyMotion);
356BENCHMARK(benchmarkInjectMotion);
Siarhei Vishniakou8c84b802022-03-23 15:48:41 -0700357BENCHMARK(benchmarkOnWindowInfosChanged);
Siarhei Vishniakoud0784762019-11-01 15:33:48 -0700358
359} // namespace android::inputdispatcher
360
361BENCHMARK_MAIN();