xref: /aosp_15_r20/frameworks/native/services/inputflinger/tests/InterfaceMocks.h (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1*38e8c45fSAndroid Build Coastguard Worker /*
2*38e8c45fSAndroid Build Coastguard Worker  * Copyright 2023 The Android Open Source Project
3*38e8c45fSAndroid Build Coastguard Worker  *
4*38e8c45fSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*38e8c45fSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*38e8c45fSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*38e8c45fSAndroid Build Coastguard Worker  *
8*38e8c45fSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*38e8c45fSAndroid Build Coastguard Worker  *
10*38e8c45fSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*38e8c45fSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*38e8c45fSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*38e8c45fSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*38e8c45fSAndroid Build Coastguard Worker  * limitations under the License.
15*38e8c45fSAndroid Build Coastguard Worker  */
16*38e8c45fSAndroid Build Coastguard Worker 
17*38e8c45fSAndroid Build Coastguard Worker #pragma once
18*38e8c45fSAndroid Build Coastguard Worker 
19*38e8c45fSAndroid Build Coastguard Worker #include <cstdint>
20*38e8c45fSAndroid Build Coastguard Worker #include <list>
21*38e8c45fSAndroid Build Coastguard Worker #include <memory>
22*38e8c45fSAndroid Build Coastguard Worker #include <optional>
23*38e8c45fSAndroid Build Coastguard Worker #include <string>
24*38e8c45fSAndroid Build Coastguard Worker #include <unordered_map>
25*38e8c45fSAndroid Build Coastguard Worker #include <utility>
26*38e8c45fSAndroid Build Coastguard Worker #include <vector>
27*38e8c45fSAndroid Build Coastguard Worker 
28*38e8c45fSAndroid Build Coastguard Worker #include <EventHub.h>
29*38e8c45fSAndroid Build Coastguard Worker #include <InputDevice.h>
30*38e8c45fSAndroid Build Coastguard Worker #include <InputReaderBase.h>
31*38e8c45fSAndroid Build Coastguard Worker #include <InputReaderContext.h>
32*38e8c45fSAndroid Build Coastguard Worker #include <NotifyArgs.h>
33*38e8c45fSAndroid Build Coastguard Worker #include <PointerChoreographerPolicyInterface.h>
34*38e8c45fSAndroid Build Coastguard Worker #include <StylusState.h>
35*38e8c45fSAndroid Build Coastguard Worker #include <VibrationElement.h>
36*38e8c45fSAndroid Build Coastguard Worker #include <android-base/logging.h>
37*38e8c45fSAndroid Build Coastguard Worker #include <android-base/result.h>
38*38e8c45fSAndroid Build Coastguard Worker #include <gmock/gmock.h>
39*38e8c45fSAndroid Build Coastguard Worker #include <input/InputDevice.h>
40*38e8c45fSAndroid Build Coastguard Worker #include <input/KeyCharacterMap.h>
41*38e8c45fSAndroid Build Coastguard Worker #include <input/KeyLayoutMap.h>
42*38e8c45fSAndroid Build Coastguard Worker #include <input/KeyboardClassifier.h>
43*38e8c45fSAndroid Build Coastguard Worker #include <input/PropertyMap.h>
44*38e8c45fSAndroid Build Coastguard Worker #include <input/TouchVideoFrame.h>
45*38e8c45fSAndroid Build Coastguard Worker #include <input/VirtualKeyMap.h>
46*38e8c45fSAndroid Build Coastguard Worker #include <utils/Errors.h>
47*38e8c45fSAndroid Build Coastguard Worker #include <utils/Timers.h>
48*38e8c45fSAndroid Build Coastguard Worker 
49*38e8c45fSAndroid Build Coastguard Worker namespace android {
50*38e8c45fSAndroid Build Coastguard Worker 
51*38e8c45fSAndroid Build Coastguard Worker class MockInputReaderContext : public InputReaderContext {
52*38e8c45fSAndroid Build Coastguard Worker public:
53*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, updateGlobalMetaState, (), (override));
54*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(int32_t, getGlobalMetaState, (), (override));
55*38e8c45fSAndroid Build Coastguard Worker 
56*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, disableVirtualKeysUntil, (nsecs_t time), (override));
57*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, shouldDropVirtualKey, (nsecs_t now, int32_t keyCode, int32_t scanCode),
58*38e8c45fSAndroid Build Coastguard Worker                 (override));
59*38e8c45fSAndroid Build Coastguard Worker 
60*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, requestTimeoutAtTime, (nsecs_t when), (override));
bumpGeneration()61*38e8c45fSAndroid Build Coastguard Worker     int32_t bumpGeneration() override { return ++mGeneration; }
62*38e8c45fSAndroid Build Coastguard Worker 
63*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, getExternalStylusDevices, (std::vector<InputDeviceInfo>& outDevices),
64*38e8c45fSAndroid Build Coastguard Worker                 (override));
65*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::list<NotifyArgs>, dispatchExternalStylusState, (const StylusState& outState),
66*38e8c45fSAndroid Build Coastguard Worker                 (override));
67*38e8c45fSAndroid Build Coastguard Worker 
68*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(InputReaderPolicyInterface*, getPolicy, (), (override));
69*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(EventHubInterface*, getEventHub, (), (override));
70*38e8c45fSAndroid Build Coastguard Worker 
getNextId()71*38e8c45fSAndroid Build Coastguard Worker     int32_t getNextId() override { return 1; };
72*38e8c45fSAndroid Build Coastguard Worker 
73*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, updateLedMetaState, (int32_t metaState), (override));
74*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(int32_t, getLedMetaState, (), (override));
75*38e8c45fSAndroid Build Coastguard Worker 
76*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, setPreventingTouchpadTaps, (bool prevent), (override));
77*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, isPreventingTouchpadTaps, (), (override));
78*38e8c45fSAndroid Build Coastguard Worker 
79*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, setLastKeyDownTimestamp, (nsecs_t when));
80*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(nsecs_t, getLastKeyDownTimestamp, ());
81*38e8c45fSAndroid Build Coastguard Worker 
getKeyboardClassifier()82*38e8c45fSAndroid Build Coastguard Worker     KeyboardClassifier& getKeyboardClassifier() override { return *mClassifier; };
83*38e8c45fSAndroid Build Coastguard Worker 
84*38e8c45fSAndroid Build Coastguard Worker private:
85*38e8c45fSAndroid Build Coastguard Worker     int32_t mGeneration = 0;
86*38e8c45fSAndroid Build Coastguard Worker     std::unique_ptr<KeyboardClassifier> mClassifier = std::make_unique<KeyboardClassifier>();
87*38e8c45fSAndroid Build Coastguard Worker };
88*38e8c45fSAndroid Build Coastguard Worker 
89*38e8c45fSAndroid Build Coastguard Worker class MockEventHubInterface : public EventHubInterface {
90*38e8c45fSAndroid Build Coastguard Worker public:
91*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(ftl::Flags<InputDeviceClass>, getDeviceClasses, (int32_t deviceId), (const));
92*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(InputDeviceIdentifier, getDeviceIdentifier, (int32_t deviceId), (const));
93*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(int32_t, getDeviceControllerNumber, (int32_t deviceId), (const));
94*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::optional<PropertyMap>, getConfiguration, (int32_t deviceId), (const));
95*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::optional<RawAbsoluteAxisInfo>, getAbsoluteAxisInfo,
96*38e8c45fSAndroid Build Coastguard Worker                 (int32_t deviceId, int axis), (const));
97*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, hasRelativeAxis, (int32_t deviceId, int axis), (const));
98*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, hasInputProperty, (int32_t deviceId, int property), (const));
99*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, hasMscEvent, (int32_t deviceId, int mscEvent), (const));
100*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, setKeyRemapping,
101*38e8c45fSAndroid Build Coastguard Worker                 (int32_t deviceId, (const std::map<int32_t, int32_t>& keyRemapping)), (const));
102*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(status_t, mapKey,
103*38e8c45fSAndroid Build Coastguard Worker                 (int32_t deviceId, int scanCode, int usageCode, int32_t metaState,
104*38e8c45fSAndroid Build Coastguard Worker                  int32_t* outKeycode, int32_t* outMetaState, uint32_t* outFlags),
105*38e8c45fSAndroid Build Coastguard Worker                 (const));
106*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(status_t, mapAxis, (int32_t deviceId, int scanCode, AxisInfo* outAxisInfo),
107*38e8c45fSAndroid Build Coastguard Worker                 (const));
108*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, setExcludedDevices, (const std::vector<std::string>& devices));
109*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::vector<RawEvent>, getEvents, (int timeoutMillis));
110*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::vector<TouchVideoFrame>, getVideoFrames, (int32_t deviceId));
111*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD((base::Result<std::pair<InputDeviceSensorType, int32_t>>), mapSensor,
112*38e8c45fSAndroid Build Coastguard Worker                 (int32_t deviceId, int32_t absCode), (const, override));
113*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::vector<int32_t>, getRawBatteryIds, (int32_t deviceId), (const, override));
114*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::optional<RawBatteryInfo>, getRawBatteryInfo,
115*38e8c45fSAndroid Build Coastguard Worker                 (int32_t deviceId, int32_t BatteryId), (const, override));
116*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::vector<int32_t>, getRawLightIds, (int32_t deviceId), (const, override));
117*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::optional<RawLightInfo>, getRawLightInfo, (int32_t deviceId, int32_t lightId),
118*38e8c45fSAndroid Build Coastguard Worker                 (const, override));
119*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::optional<int32_t>, getLightBrightness, (int32_t deviceId, int32_t lightId),
120*38e8c45fSAndroid Build Coastguard Worker                 (const, override));
121*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, setLightBrightness, (int32_t deviceId, int32_t lightId, int32_t brightness),
122*38e8c45fSAndroid Build Coastguard Worker                 (override));
123*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD((std::optional<std::unordered_map<LightColor, int32_t>>), getLightIntensities,
124*38e8c45fSAndroid Build Coastguard Worker                 (int32_t deviceId, int32_t lightId), (const, override));
125*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, setLightIntensities,
126*38e8c45fSAndroid Build Coastguard Worker                 (int32_t deviceId, int32_t lightId,
127*38e8c45fSAndroid Build Coastguard Worker                  (std::unordered_map<LightColor, int32_t>)intensities),
128*38e8c45fSAndroid Build Coastguard Worker                 (override));
129*38e8c45fSAndroid Build Coastguard Worker 
130*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::optional<RawLayoutInfo>, getRawLayoutInfo, (int32_t deviceId),
131*38e8c45fSAndroid Build Coastguard Worker                 (const, override));
132*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(int32_t, getScanCodeState, (int32_t deviceId, int32_t scanCode), (const, override));
133*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(int32_t, getKeyCodeState, (int32_t deviceId, int32_t keyCode), (const, override));
134*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(int32_t, getSwitchState, (int32_t deviceId, int32_t sw), (const, override));
135*38e8c45fSAndroid Build Coastguard Worker 
136*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::optional<int32_t>, getAbsoluteAxisValue, (int32_t deviceId, int32_t axis),
137*38e8c45fSAndroid Build Coastguard Worker                 (const, override));
138*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(base::Result<std::vector<int32_t>>, getMtSlotValues,
139*38e8c45fSAndroid Build Coastguard Worker                 (int32_t deviceId, int32_t axis, size_t slotCount), (const, override));
140*38e8c45fSAndroid Build Coastguard Worker 
141*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(int32_t, getKeyCodeForKeyLocation, (int32_t deviceId, int32_t locationKeyCode),
142*38e8c45fSAndroid Build Coastguard Worker                 (const, override));
143*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, markSupportedKeyCodes,
144*38e8c45fSAndroid Build Coastguard Worker                 (int32_t deviceId, const std::vector<int32_t>& keyCodes, uint8_t* outFlags),
145*38e8c45fSAndroid Build Coastguard Worker                 (const, override));
146*38e8c45fSAndroid Build Coastguard Worker 
147*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, hasScanCode, (int32_t deviceId, int32_t scanCode), (const, override));
148*38e8c45fSAndroid Build Coastguard Worker 
149*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, hasKeyCode, (int32_t deviceId, int32_t keyCode), (const, override));
150*38e8c45fSAndroid Build Coastguard Worker 
151*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, hasLed, (int32_t deviceId, int32_t led), (const, override));
152*38e8c45fSAndroid Build Coastguard Worker 
153*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, setLedState, (int32_t deviceId, int32_t led, bool on), (override));
154*38e8c45fSAndroid Build Coastguard Worker 
155*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, getVirtualKeyDefinitions,
156*38e8c45fSAndroid Build Coastguard Worker                 (int32_t deviceId, std::vector<VirtualKeyDefinition>& outVirtualKeys),
157*38e8c45fSAndroid Build Coastguard Worker                 (const, override));
158*38e8c45fSAndroid Build Coastguard Worker 
159*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(const std::shared_ptr<KeyCharacterMap>, getKeyCharacterMap, (int32_t deviceId),
160*38e8c45fSAndroid Build Coastguard Worker                 (const, override));
161*38e8c45fSAndroid Build Coastguard Worker 
162*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, setKeyboardLayoutOverlay,
163*38e8c45fSAndroid Build Coastguard Worker                 (int32_t deviceId, std::shared_ptr<KeyCharacterMap> map), (override));
164*38e8c45fSAndroid Build Coastguard Worker 
165*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, vibrate, (int32_t deviceId, const VibrationElement& effect), (override));
166*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, cancelVibrate, (int32_t deviceId), (override));
167*38e8c45fSAndroid Build Coastguard Worker 
168*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::vector<int32_t>, getVibratorIds, (int32_t deviceId), (const, override));
169*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::optional<int32_t>, getBatteryCapacity, (int32_t deviceId, int32_t batteryId),
170*38e8c45fSAndroid Build Coastguard Worker                 (const, override));
171*38e8c45fSAndroid Build Coastguard Worker 
172*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::optional<int32_t>, getBatteryStatus, (int32_t deviceId, int32_t batteryId),
173*38e8c45fSAndroid Build Coastguard Worker                 (const, override));
174*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, requestReopenDevices, (), (override));
175*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, wake, (), (override));
176*38e8c45fSAndroid Build Coastguard Worker 
177*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, dump, (std::string& dump), (const, override));
178*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, monitor, (), (const, override));
179*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, isDeviceEnabled, (int32_t deviceId), (const, override));
180*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(status_t, enableDevice, (int32_t deviceId), (override));
181*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(status_t, disableDevice, (int32_t deviceId), (override));
182*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, sysfsNodeChanged, (const std::string& sysfsNodePath), (override));
183*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, setKernelWakeEnabled, (int32_t deviceId, bool enabled), (override));
184*38e8c45fSAndroid Build Coastguard Worker };
185*38e8c45fSAndroid Build Coastguard Worker 
186*38e8c45fSAndroid Build Coastguard Worker class MockPointerChoreographerPolicyInterface : public PointerChoreographerPolicyInterface {
187*38e8c45fSAndroid Build Coastguard Worker public:
188*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::shared_ptr<PointerControllerInterface>, createPointerController,
189*38e8c45fSAndroid Build Coastguard Worker                 (PointerControllerInterface::ControllerType), (override));
190*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, notifyPointerDisplayIdChanged,
191*38e8c45fSAndroid Build Coastguard Worker                 (ui::LogicalDisplayId displayId, const vec2& position), (override));
192*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, isInputMethodConnectionActive, (), (override));
193*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, notifyMouseCursorFadedOnTyping, (), (override));
194*38e8c45fSAndroid Build Coastguard Worker };
195*38e8c45fSAndroid Build Coastguard Worker 
196*38e8c45fSAndroid Build Coastguard Worker class MockInputDevice : public InputDevice {
197*38e8c45fSAndroid Build Coastguard Worker public:
MockInputDevice(InputReaderContext * context,int32_t id,int32_t generation,const InputDeviceIdentifier & identifier)198*38e8c45fSAndroid Build Coastguard Worker     MockInputDevice(InputReaderContext* context, int32_t id, int32_t generation,
199*38e8c45fSAndroid Build Coastguard Worker                     const InputDeviceIdentifier& identifier)
200*38e8c45fSAndroid Build Coastguard Worker           : InputDevice(context, id, generation, identifier) {}
201*38e8c45fSAndroid Build Coastguard Worker 
202*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(uint32_t, getSources, (), (const, override));
203*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::optional<DisplayViewport>, getAssociatedViewport, (), (const));
204*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(KeyboardType, getKeyboardType, (), (const, override));
205*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, isEnabled, (), ());
206*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, isExternal, (), (override));
207*38e8c45fSAndroid Build Coastguard Worker 
208*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, dump, (std::string& dump, const std::string& eventHubDevStr), ());
209*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, addEmptyEventHubDevice, (int32_t eventHubId), ());
210*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::list<NotifyArgs>, addEventHubDevice,
211*38e8c45fSAndroid Build Coastguard Worker                 (nsecs_t when, int32_t eventHubId, const InputReaderConfiguration& readerConfig),
212*38e8c45fSAndroid Build Coastguard Worker                 ());
213*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, removeEventHubDevice, (int32_t eventHubId), ());
214*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::list<NotifyArgs>, configure,
215*38e8c45fSAndroid Build Coastguard Worker                 (nsecs_t when, const InputReaderConfiguration& readerConfig,
216*38e8c45fSAndroid Build Coastguard Worker                  ConfigurationChanges changes),
217*38e8c45fSAndroid Build Coastguard Worker                 ());
218*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::list<NotifyArgs>, reset, (nsecs_t when), ());
219*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::list<NotifyArgs>, process, (const RawEvent* rawEvents, size_t count), ());
220*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::list<NotifyArgs>, timeoutExpired, (nsecs_t when), ());
221*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::list<NotifyArgs>, updateExternalStylusState, (const StylusState& state), ());
222*38e8c45fSAndroid Build Coastguard Worker 
223*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(InputDeviceInfo, getDeviceInfo, (), ());
224*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(int32_t, getKeyCodeState, (uint32_t sourceMask, int32_t keyCode), ());
225*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(int32_t, getScanCodeState, (uint32_t sourceMask, int32_t scanCode), ());
226*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(int32_t, getSwitchState, (uint32_t sourceMask, int32_t switchCode), ());
227*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(int32_t, getKeyCodeForKeyLocation, (int32_t locationKeyCode), (const));
228*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, markSupportedKeyCodes,
229*38e8c45fSAndroid Build Coastguard Worker                 (uint32_t sourceMask, const std::vector<int32_t>& keyCodes, uint8_t* outFlags), ());
230*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::list<NotifyArgs>, vibrate,
231*38e8c45fSAndroid Build Coastguard Worker                 (const VibrationSequence& sequence, ssize_t repeat, int32_t token), ());
232*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::list<NotifyArgs>, cancelVibrate, (int32_t token), ());
233*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, isVibrating, (), ());
234*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::vector<int32_t>, getVibratorIds, (), ());
235*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::list<NotifyArgs>, cancelTouch, (nsecs_t when, nsecs_t readTime), ());
236*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, enableSensor,
237*38e8c45fSAndroid Build Coastguard Worker                 (InputDeviceSensorType sensorType, std::chrono::microseconds samplingPeriod,
238*38e8c45fSAndroid Build Coastguard Worker                  std::chrono::microseconds maxBatchReportLatency),
239*38e8c45fSAndroid Build Coastguard Worker                 ());
240*38e8c45fSAndroid Build Coastguard Worker 
241*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, disableSensor, (InputDeviceSensorType sensorType), ());
242*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, flushSensor, (InputDeviceSensorType sensorType), ());
243*38e8c45fSAndroid Build Coastguard Worker 
244*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::optional<int32_t>, getBatteryEventHubId, (), (const));
245*38e8c45fSAndroid Build Coastguard Worker 
246*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, setLightColor, (int32_t lightId, int32_t color), ());
247*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(bool, setLightPlayerId, (int32_t lightId, int32_t playerId), ());
248*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::optional<int32_t>, getLightColor, (int32_t lightId), ());
249*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::optional<int32_t>, getLightPlayerId, (int32_t lightId), ());
250*38e8c45fSAndroid Build Coastguard Worker 
251*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(int32_t, getMetaState, (), ());
252*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, setKeyboardType, (KeyboardType keyboardType), ());
253*38e8c45fSAndroid Build Coastguard Worker 
254*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(const PropertyMap&, getConfiguration, (), (const, override));
255*38e8c45fSAndroid Build Coastguard Worker 
256*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(NotifyDeviceResetArgs, notifyReset, (nsecs_t when), ());
257*38e8c45fSAndroid Build Coastguard Worker 
258*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(std::optional<ui::LogicalDisplayId>, getAssociatedDisplayId, (), ());
259*38e8c45fSAndroid Build Coastguard Worker 
260*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(void, updateLedState, (bool reset), ());
261*38e8c45fSAndroid Build Coastguard Worker 
262*38e8c45fSAndroid Build Coastguard Worker     MOCK_METHOD(size_t, getMapperCount, (), ());
263*38e8c45fSAndroid Build Coastguard Worker 
getGeneration()264*38e8c45fSAndroid Build Coastguard Worker     virtual int32_t getGeneration() const override { return mGeneration; }
bumpGeneration()265*38e8c45fSAndroid Build Coastguard Worker     virtual void bumpGeneration() override { mGeneration++; }
266*38e8c45fSAndroid Build Coastguard Worker 
267*38e8c45fSAndroid Build Coastguard Worker private:
268*38e8c45fSAndroid Build Coastguard Worker     int32_t mGeneration = 0;
269*38e8c45fSAndroid Build Coastguard Worker };
270*38e8c45fSAndroid Build Coastguard Worker } // namespace android
271