1 /*
2  * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "input_manager.h"
17 
18 #include "define_multimodal.h"
19 #include "error_multimodal.h"
20 #include "input_handler_type.h"
21 #include "input_manager_impl.h"
22 #include "multimodal_event_handler.h"
23 
24 #undef MMI_LOG_TAG
25 #define MMI_LOG_TAG "InputManager"
26 
27 namespace OHOS {
28 namespace MMI {
29 InputManager *InputManager::instance_ = new (std::nothrow) InputManager();
30 
GetInstance()31 InputManager *InputManager::GetInstance()
32 {
33     return instance_;
34 }
35 
GetDisplayBindInfo(DisplayBindInfos &infos)36 int32_t InputManager::GetDisplayBindInfo(DisplayBindInfos &infos)
37 {
38     return InputMgrImpl.GetDisplayBindInfo(infos);
39 }
40 
GetAllMmiSubscribedEvents(std::map<std::tuple<int32_t, int32_t, std::string>, int32_t> &datas)41 int32_t InputManager::GetAllMmiSubscribedEvents(std::map<std::tuple<int32_t, int32_t, std::string>, int32_t> &datas)
42 {
43     return InputMgrImpl.GetAllMmiSubscribedEvents(datas);
44 }
45 
SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg)46 int32_t InputManager::SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg)
47 {
48     return InputMgrImpl.SetDisplayBind(deviceId, displayId, msg);
49 }
50 
GetWindowPid(int32_t windowId)51 int32_t InputManager::GetWindowPid(int32_t windowId)
52 {
53     return InputMgrImpl.GetWindowPid(windowId);
54 }
55 
UpdateDisplayInfo(const DisplayGroupInfo &displayGroupInfo)56 int32_t InputManager::UpdateDisplayInfo(const DisplayGroupInfo &displayGroupInfo)
57 {
58     return InputMgrImpl.UpdateDisplayInfo(displayGroupInfo);
59 }
60 
UpdateWindowInfo(const WindowGroupInfo &windowGroupInfo)61 int32_t InputManager::UpdateWindowInfo(const WindowGroupInfo &windowGroupInfo)
62 {
63     return InputMgrImpl.UpdateWindowInfo(windowGroupInfo);
64 }
65 
AddInputEventFilter(std::shared_ptr<IInputEventFilter> filter, int32_t priority, uint32_t deviceTags)66 int32_t InputManager::AddInputEventFilter(std::shared_ptr<IInputEventFilter> filter, int32_t priority,
67     uint32_t deviceTags)
68 {
69     return InputMgrImpl.AddInputEventFilter(filter, priority, deviceTags);
70 }
71 
RemoveInputEventFilter(int32_t filterId)72 int32_t InputManager::RemoveInputEventFilter(int32_t filterId)
73 {
74     return InputMgrImpl.RemoveInputEventFilter(filterId);
75 }
76 
AddInputEventObserver(std::shared_ptr<MMIEventObserver> observer)77 int32_t InputManager::AddInputEventObserver(std::shared_ptr<MMIEventObserver> observer)
78 {
79     return InputMgrImpl.AddInputEventObserver(observer);
80 }
81 
RemoveInputEventObserver(std::shared_ptr<MMIEventObserver> observer)82 int32_t InputManager::RemoveInputEventObserver(std::shared_ptr<MMIEventObserver> observer)
83 {
84     return InputMgrImpl.RemoveInputEventObserver(observer);
85 }
86 
SetWindowInputEventConsumer(std::shared_ptr<IInputEventConsumer> inputEventConsumer)87 void InputManager::SetWindowInputEventConsumer(std::shared_ptr<IInputEventConsumer> inputEventConsumer)
88 {
89     InputMgrImpl.SetWindowInputEventConsumer(inputEventConsumer, nullptr);
90 }
91 
SetWindowInputEventConsumer(std::shared_ptr<IInputEventConsumer> inputEventConsumer, std::shared_ptr<AppExecFwk::EventHandler> eventHandler)92 void InputManager::SetWindowInputEventConsumer(std::shared_ptr<IInputEventConsumer> inputEventConsumer,
93     std::shared_ptr<AppExecFwk::EventHandler> eventHandler)
94 {
95     CHKPV(eventHandler);
96     InputMgrImpl.SetWindowInputEventConsumer(inputEventConsumer, eventHandler);
97 }
98 
SubscribeKeyEvent(std::shared_ptr<KeyOption> keyOption, std::function<void(std::shared_ptr<KeyEvent>)> callback)99 int32_t InputManager::SubscribeKeyEvent(std::shared_ptr<KeyOption> keyOption,
100     std::function<void(std::shared_ptr<KeyEvent>)> callback)
101 {
102     return InputMgrImpl.SubscribeKeyEvent(keyOption, callback);
103 }
104 
UnsubscribeKeyEvent(int32_t subscriberId)105 void InputManager::UnsubscribeKeyEvent(int32_t subscriberId)
106 {
107     InputMgrImpl.UnsubscribeKeyEvent(subscriberId);
108 }
109 
SubscribeHotkey(std::shared_ptr<KeyOption> keyOption, std::function<void(std::shared_ptr<KeyEvent>)> callback)110 int32_t InputManager::SubscribeHotkey(std::shared_ptr<KeyOption> keyOption,
111     std::function<void(std::shared_ptr<KeyEvent>)> callback)
112 {
113     return InputMgrImpl.SubscribeHotkey(keyOption, callback);
114 }
115 
UnsubscribeHotkey(int32_t subscriberId)116 void InputManager::UnsubscribeHotkey(int32_t subscriberId)
117 {
118     InputMgrImpl.UnsubscribeHotkey(subscriberId);
119 }
120 
SubscribeSwitchEvent(std::function<void(std::shared_ptr<SwitchEvent>)> callback, SwitchEvent::SwitchType switchType)121 int32_t InputManager::SubscribeSwitchEvent(std::function<void(std::shared_ptr<SwitchEvent>)> callback,
122     SwitchEvent::SwitchType switchType)
123 {
124     return InputMgrImpl.SubscribeSwitchEvent(static_cast<int32_t>(switchType), callback);
125 }
126 
UnsubscribeSwitchEvent(int32_t subscriberId)127 void InputManager::UnsubscribeSwitchEvent(int32_t subscriberId)
128 {
129     InputMgrImpl.UnsubscribeSwitchEvent(subscriberId);
130 }
131 
AddMonitor(std::function<void(std::shared_ptr<KeyEvent>)> monitor)132 int32_t InputManager::AddMonitor(std::function<void(std::shared_ptr<KeyEvent>)> monitor)
133 {
134     return InputMgrImpl.AddMonitor(monitor);
135 }
136 
AddMonitor(std::function<void(std::shared_ptr<PointerEvent>)> monitor)137 int32_t InputManager::AddMonitor(std::function<void(std::shared_ptr<PointerEvent>)> monitor)
138 {
139     return InputMgrImpl.AddMonitor(monitor);
140 }
141 
AddMonitor(std::shared_ptr<IInputEventConsumer> monitor, HandleEventType eventType)142 int32_t InputManager::AddMonitor(std::shared_ptr<IInputEventConsumer> monitor, HandleEventType eventType)
143 {
144     return InputMgrImpl.AddMonitor(monitor, eventType);
145 }
146 
AddMonitor(std::shared_ptr<IInputEventConsumer> monitor, std::vector<int32_t> actionsType)147 int32_t InputManager::AddMonitor(std::shared_ptr<IInputEventConsumer> monitor, std::vector<int32_t> actionsType)
148 {
149     return InputMgrImpl.AddMonitor(monitor, actionsType);
150 }
151 
RemoveMonitor(int32_t monitorId)152 void InputManager::RemoveMonitor(int32_t monitorId)
153 {
154     InputMgrImpl.RemoveMonitor(monitorId);
155 }
156 
AddGestureMonitor( std::shared_ptr<IInputEventConsumer> consumer, TouchGestureType type, int32_t fingers)157 int32_t InputManager::AddGestureMonitor(
158     std::shared_ptr<IInputEventConsumer> consumer, TouchGestureType type, int32_t fingers)
159 {
160     return InputMgrImpl.AddGestureMonitor(consumer, type, fingers);
161 }
162 
RemoveGestureMonitor(int32_t monitorId)163 int32_t InputManager::RemoveGestureMonitor(int32_t monitorId)
164 {
165     return InputMgrImpl.RemoveGestureMonitor(monitorId);
166 }
167 
MarkConsumed(int32_t monitorId, int32_t eventId)168 void InputManager::MarkConsumed(int32_t monitorId, int32_t eventId)
169 {
170     InputMgrImpl.MarkConsumed(monitorId, eventId);
171 }
172 
MoveMouse(int32_t offsetX, int32_t offsetY)173 void InputManager::MoveMouse(int32_t offsetX, int32_t offsetY)
174 {
175     InputMgrImpl.MoveMouse(offsetX, offsetY);
176 }
177 
AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptor)178 int32_t InputManager::AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptor)
179 {
180     return InputMgrImpl.AddInterceptor(interceptor);
181 }
182 
AddInterceptor(std::function<void(std::shared_ptr<KeyEvent>)> interceptor)183 int32_t InputManager::AddInterceptor(std::function<void(std::shared_ptr<KeyEvent>)> interceptor)
184 {
185     return InputMgrImpl.AddInterceptor(interceptor);
186 }
187 
AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptor, int32_t priority, uint32_t deviceTags)188 int32_t InputManager::AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptor, int32_t priority,
189     uint32_t deviceTags)
190 {
191     return InputMgrImpl.AddInterceptor(interceptor, priority, deviceTags);
192 }
193 
RemoveInterceptor(int32_t interceptorId)194 void InputManager::RemoveInterceptor(int32_t interceptorId)
195 {
196     InputMgrImpl.RemoveInterceptor(interceptorId);
197 }
198 
SimulateInputEvent(std::shared_ptr<KeyEvent> keyEvent)199 void InputManager::SimulateInputEvent(std::shared_ptr<KeyEvent> keyEvent)
200 {
201     LogTracer lt(keyEvent->GetId(), keyEvent->GetEventType(), keyEvent->GetKeyAction());
202     keyEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
203     InputMgrImpl.SimulateInputEvent(keyEvent);
204 }
205 
SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent)206 void InputManager::SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent)
207 {
208     LogTracer lt(pointerEvent->GetId(), pointerEvent->GetEventType(), pointerEvent->GetPointerAction());
209     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
210     InputMgrImpl.SimulateInputEvent(pointerEvent);
211 }
212 
SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent, float zOrder)213 void InputManager::SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent, float zOrder)
214 {
215     CHKPV(pointerEvent);
216     LogTracer lt(pointerEvent->GetId(), pointerEvent->GetEventType(), pointerEvent->GetPointerAction());
217     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
218     pointerEvent->SetZOrder(zOrder);
219     InputMgrImpl.SimulateInputEvent(pointerEvent);
220 }
221 
SimulateTouchPadEvent(std::shared_ptr<PointerEvent> pointerEvent)222 void InputManager::SimulateTouchPadEvent(std::shared_ptr<PointerEvent> pointerEvent)
223 {
224     CHKPV(pointerEvent);
225     LogTracer lt(pointerEvent->GetId(), pointerEvent->GetEventType(), pointerEvent->GetPointerAction());
226     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
227     InputMgrImpl.SimulateTouchPadEvent(pointerEvent);
228 }
229 
RegisterDevListener(std::string type, std::shared_ptr<IInputDeviceListener> listener)230 int32_t InputManager::RegisterDevListener(std::string type, std::shared_ptr<IInputDeviceListener> listener)
231 {
232     return InputMgrImpl.RegisterDevListener(type, listener);
233 }
234 
UnregisterDevListener(std::string type, std::shared_ptr<IInputDeviceListener> listener)235 int32_t InputManager::UnregisterDevListener(std::string type, std::shared_ptr<IInputDeviceListener> listener)
236 {
237     return InputMgrImpl.UnregisterDevListener(type, listener);
238 }
239 
GetDeviceIds(std::function<void(std::vector<int32_t>&)> callback)240 int32_t InputManager::GetDeviceIds(std::function<void(std::vector<int32_t>&)> callback)
241 {
242     return InputMgrImpl.GetDeviceIds(callback);
243 }
244 
GetDevice(int32_t deviceId, std::function<void(std::shared_ptr<InputDevice>)> callback)245 int32_t InputManager::GetDevice(int32_t deviceId,
246     std::function<void(std::shared_ptr<InputDevice>)> callback)
247 {
248     return InputMgrImpl.GetDevice(deviceId, callback);
249 }
250 
SupportKeys(int32_t deviceId, std::vector<int32_t> keyCodes, std::function<void(std::vector<bool>&)> callback)251 int32_t InputManager::SupportKeys(int32_t deviceId, std::vector<int32_t> keyCodes,
252     std::function<void(std::vector<bool>&)> callback)
253 {
254     return InputMgrImpl.SupportKeys(deviceId, keyCodes, callback);
255 }
256 
SetMouseScrollRows(int32_t Rows)257 int32_t InputManager::SetMouseScrollRows(int32_t Rows)
258 {
259     return InputMgrImpl.SetMouseScrollRows(Rows);
260 }
261 
GetMouseScrollRows(int32_t &Rows)262 int32_t InputManager::GetMouseScrollRows(int32_t &Rows)
263 {
264     return InputMgrImpl.GetMouseScrollRows(Rows);
265 }
266 
SetCustomCursor(int32_t windowId, void* pixelMap, int32_t focusX, int32_t focusY)267 int32_t InputManager::SetCustomCursor(int32_t windowId, void* pixelMap, int32_t focusX, int32_t focusY)
268 {
269     return InputMgrImpl.SetCustomCursor(windowId, focusX, focusY, pixelMap);
270 }
271 
SetMouseIcon(int32_t windowId, void* pixelMap)272 int32_t InputManager::SetMouseIcon(int32_t windowId, void* pixelMap)
273 {
274     return InputMgrImpl.SetMouseIcon(windowId, pixelMap);
275 }
276 
SetPointerSize(int32_t size)277 int32_t InputManager::SetPointerSize(int32_t size)
278 {
279     return InputMgrImpl.SetPointerSize(size);
280 }
281 
GetPointerSize(int32_t &size)282 int32_t InputManager::GetPointerSize(int32_t &size)
283 {
284     return InputMgrImpl.GetPointerSize(size);
285 }
286 
SetMouseHotSpot(int32_t windowId, int32_t hotSpotX, int32_t hotSpotY)287 int32_t InputManager::SetMouseHotSpot(int32_t windowId, int32_t hotSpotX, int32_t hotSpotY)
288 {
289     return InputMgrImpl.SetMouseHotSpot(windowId, hotSpotX, hotSpotY);
290 }
291 
SetMousePrimaryButton(int32_t primaryButton)292 int32_t InputManager::SetMousePrimaryButton(int32_t primaryButton)
293 {
294     return InputMgrImpl.SetMousePrimaryButton(primaryButton);
295 }
296 
GetMousePrimaryButton(int32_t &primaryButton)297 int32_t InputManager::GetMousePrimaryButton(int32_t &primaryButton)
298 {
299     return InputMgrImpl.GetMousePrimaryButton(primaryButton);
300 }
301 
SetHoverScrollState(bool state)302 int32_t InputManager::SetHoverScrollState(bool state)
303 {
304     return InputMgrImpl.SetHoverScrollState(state);
305 }
306 
GetHoverScrollState(bool &state)307 int32_t InputManager::GetHoverScrollState(bool &state)
308 {
309     return InputMgrImpl.GetHoverScrollState(state);
310 }
311 
SetPointerVisible(bool visible, int32_t priority)312 int32_t InputManager::SetPointerVisible(bool visible, int32_t priority)
313 {
314     return InputMgrImpl.SetPointerVisible(visible, priority);
315 }
316 
IsPointerVisible()317 bool InputManager::IsPointerVisible()
318 {
319     return InputMgrImpl.IsPointerVisible();
320 }
321 
SetPointerColor(int32_t color)322 int32_t InputManager::SetPointerColor(int32_t color)
323 {
324     return InputMgrImpl.SetPointerColor(color);
325 }
326 
GetPointerColor(int32_t &color)327 int32_t InputManager::GetPointerColor(int32_t &color)
328 {
329     return InputMgrImpl.GetPointerColor(color);
330 }
331 
EnableCombineKey(bool enable)332 int32_t InputManager::EnableCombineKey(bool enable)
333 {
334     return InputMgrImpl.EnableCombineKey(enable);
335 }
336 
SetPointerSpeed(int32_t speed)337 int32_t InputManager::SetPointerSpeed(int32_t speed)
338 {
339     return InputMgrImpl.SetPointerSpeed(speed);
340 }
341 
GetPointerSpeed(int32_t &speed)342 int32_t InputManager::GetPointerSpeed(int32_t &speed)
343 {
344     return InputMgrImpl.GetPointerSpeed(speed);
345 }
346 
GetKeyboardType(int32_t deviceId, std::function<void(int32_t)> callback)347 int32_t InputManager::GetKeyboardType(int32_t deviceId, std::function<void(int32_t)> callback)
348 {
349     return InputMgrImpl.GetKeyboardType(deviceId, callback);
350 }
351 
SetAnrObserver(std::shared_ptr<IAnrObserver> observer)352 void InputManager::SetAnrObserver(std::shared_ptr<IAnrObserver> observer)
353 {
354     InputMgrImpl.SetAnrObserver(observer);
355 }
356 
SetPointerStyle(int32_t windowId, PointerStyle pointerStyle, bool isUiExtension)357 int32_t InputManager::SetPointerStyle(int32_t windowId, PointerStyle pointerStyle, bool isUiExtension)
358 {
359     return InputMgrImpl.SetPointerStyle(windowId, pointerStyle, isUiExtension);
360 }
361 
GetPointerStyle(int32_t windowId, PointerStyle &pointerStyle, bool isUiExtension)362 int32_t InputManager::GetPointerStyle(int32_t windowId, PointerStyle &pointerStyle, bool isUiExtension)
363 {
364     return InputMgrImpl.GetPointerStyle(windowId, pointerStyle, isUiExtension);
365 }
366 
GetFunctionKeyState(int32_t funcKey)367 bool InputManager::GetFunctionKeyState(int32_t funcKey)
368 {
369     return InputMgrImpl.GetFunctionKeyState(funcKey);
370 }
371 
SetFunctionKeyState(int32_t funcKey, bool enable)372 int32_t InputManager::SetFunctionKeyState(int32_t funcKey, bool enable)
373 {
374     return InputMgrImpl.SetFunctionKeyState(funcKey, enable);
375 }
376 
SetPointerLocation(int32_t x, int32_t y)377 int32_t InputManager::SetPointerLocation(int32_t x, int32_t y)
378 {
379     return InputMgrImpl.SetPointerLocation(x, y);
380 }
381 
EnterCaptureMode(int32_t windowId)382 int32_t InputManager::EnterCaptureMode(int32_t windowId)
383 {
384     return InputMgrImpl.EnterCaptureMode(windowId);
385 }
386 
LeaveCaptureMode(int32_t windowId)387 int32_t InputManager::LeaveCaptureMode(int32_t windowId)
388 {
389     return InputMgrImpl.LeaveCaptureMode(windowId);
390 }
391 
AppendExtraData(const ExtraData& extraData)392 void InputManager::AppendExtraData(const ExtraData& extraData)
393 {
394     InputMgrImpl.AppendExtraData(extraData);
395 }
396 
EnableInputDevice(bool enable)397 int32_t InputManager::EnableInputDevice(bool enable)
398 {
399     return InputMgrImpl.EnableInputDevice(enable);
400 }
401 
AddVirtualInputDevice(std::shared_ptr<InputDevice> device, int32_t &deviceId)402 int32_t InputManager::AddVirtualInputDevice(std::shared_ptr<InputDevice> device, int32_t &deviceId)
403 {
404     return InputMgrImpl.AddVirtualInputDevice(device, deviceId);
405 }
406 
RemoveVirtualInputDevice(int32_t deviceId)407 int32_t InputManager::RemoveVirtualInputDevice(int32_t deviceId)
408 {
409     return InputMgrImpl.RemoveVirtualInputDevice(deviceId);
410 }
411 
SetKeyDownDuration(const std::string& businessId, int32_t delay)412 int32_t InputManager::SetKeyDownDuration(const std::string& businessId, int32_t delay)
413 {
414     return InputMgrImpl.SetKeyDownDuration(businessId, delay);
415 }
416 
SetKeyboardRepeatDelay(int32_t delay)417 int32_t InputManager::SetKeyboardRepeatDelay(int32_t delay)
418 {
419     return InputMgrImpl.SetKeyboardRepeatDelay(delay);
420 }
421 
SetKeyboardRepeatRate(int32_t rate)422 int32_t InputManager::SetKeyboardRepeatRate(int32_t rate)
423 {
424     return InputMgrImpl.SetKeyboardRepeatRate(rate);
425 }
426 
GetKeyboardRepeatDelay(std::function<void(int32_t)> callback)427 int32_t InputManager::GetKeyboardRepeatDelay(std::function<void(int32_t)> callback)
428 {
429     return InputMgrImpl.GetKeyboardRepeatDelay(callback);
430 }
431 
GetKeyboardRepeatRate(std::function<void(int32_t)> callback)432 int32_t InputManager::GetKeyboardRepeatRate(std::function<void(int32_t)> callback)
433 {
434     return InputMgrImpl.GetKeyboardRepeatRate(callback);
435 }
436 
437 #ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT
SetEnhanceConfig(uint8_t *cfg, uint32_t cfgLen)438 void InputManager::SetEnhanceConfig(uint8_t *cfg, uint32_t cfgLen)
439 {
440     InputMgrImpl.SetEnhanceConfig(cfg, cfgLen);
441 }
442 #endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT
443 
SetTouchpadScrollSwitch(bool switchFlag)444 int32_t InputManager::SetTouchpadScrollSwitch(bool switchFlag)
445 {
446     return InputMgrImpl.SetTouchpadScrollSwitch(switchFlag);
447 }
448 
GetTouchpadScrollSwitch(bool &switchFlag)449 int32_t InputManager::GetTouchpadScrollSwitch(bool &switchFlag)
450 {
451     return InputMgrImpl.GetTouchpadScrollSwitch(switchFlag);
452 }
SetTouchpadScrollDirection(bool state)453 int32_t InputManager::SetTouchpadScrollDirection(bool state)
454 {
455     return InputMgrImpl.SetTouchpadScrollDirection(state);
456 }
457 
GetTouchpadScrollDirection(bool &state)458 int32_t InputManager::GetTouchpadScrollDirection(bool &state)
459 {
460     return InputMgrImpl.GetTouchpadScrollDirection(state);
461 }
SetTouchpadTapSwitch(bool switchFlag)462 int32_t InputManager::SetTouchpadTapSwitch(bool switchFlag)
463 {
464     return InputMgrImpl.SetTouchpadTapSwitch(switchFlag);
465 }
466 
GetTouchpadTapSwitch(bool &switchFlag)467 int32_t InputManager::GetTouchpadTapSwitch(bool &switchFlag)
468 {
469     return InputMgrImpl.GetTouchpadTapSwitch(switchFlag);
470 }
471 
SetTouchpadPointerSpeed(int32_t speed)472 int32_t InputManager::SetTouchpadPointerSpeed(int32_t speed)
473 {
474     return InputMgrImpl.SetTouchpadPointerSpeed(speed);
475 }
476 
GetTouchpadPointerSpeed(int32_t &speed)477 int32_t InputManager::GetTouchpadPointerSpeed(int32_t &speed)
478 {
479     return InputMgrImpl.GetTouchpadPointerSpeed(speed);
480 }
481 
SetTouchpadPinchSwitch(bool switchFlag)482 int32_t InputManager::SetTouchpadPinchSwitch(bool switchFlag)
483 {
484     return InputMgrImpl.SetTouchpadPinchSwitch(switchFlag);
485 }
486 
GetTouchpadPinchSwitch(bool &switchFlag)487 int32_t InputManager::GetTouchpadPinchSwitch(bool &switchFlag)
488 {
489     return InputMgrImpl.GetTouchpadPinchSwitch(switchFlag);
490 }
491 
SetTouchpadSwipeSwitch(bool switchFlag)492 int32_t InputManager::SetTouchpadSwipeSwitch(bool switchFlag)
493 {
494     return InputMgrImpl.SetTouchpadSwipeSwitch(switchFlag);
495 }
496 
GetTouchpadSwipeSwitch(bool &switchFlag)497 int32_t InputManager::GetTouchpadSwipeSwitch(bool &switchFlag)
498 {
499     return InputMgrImpl.GetTouchpadSwipeSwitch(switchFlag);
500 }
501 
SetTouchpadRightClickType(int32_t type)502 int32_t InputManager::SetTouchpadRightClickType(int32_t type)
503 {
504     return InputMgrImpl.SetTouchpadRightClickType(type);
505 }
506 
GetTouchpadRightClickType(int32_t &type)507 int32_t InputManager::GetTouchpadRightClickType(int32_t &type)
508 {
509     return InputMgrImpl.GetTouchpadRightClickType(type);
510 }
511 
SetTouchpadRotateSwitch(bool rotateSwitch)512 int32_t InputManager::SetTouchpadRotateSwitch(bool rotateSwitch)
513 {
514     return InputMgrImpl.SetTouchpadRotateSwitch(rotateSwitch);
515 }
516 
GetTouchpadRotateSwitch(bool &rotateSwitch)517 int32_t InputManager::GetTouchpadRotateSwitch(bool &rotateSwitch)
518 {
519     return InputMgrImpl.GetTouchpadRotateSwitch(rotateSwitch);
520 }
521 
EnableHardwareCursorStats(bool enable)522 int32_t InputManager::EnableHardwareCursorStats(bool enable)
523 {
524     return InputMgrImpl.EnableHardwareCursorStats(enable);
525 }
526 
GetHardwareCursorStats(uint32_t &frameCount, uint32_t &vsyncCount)527 int32_t InputManager::GetHardwareCursorStats(uint32_t &frameCount, uint32_t &vsyncCount)
528 {
529     return InputMgrImpl.GetHardwareCursorStats(frameCount, vsyncCount);
530 }
531 
GetPointerSnapshot(void *pixelMapPtr)532 int32_t InputManager::GetPointerSnapshot(void *pixelMapPtr)
533 {
534     return InputMgrImpl.GetPointerSnapshot(pixelMapPtr);
535 }
536 
SetTouchpadScrollRows(int32_t rows)537 int32_t InputManager::SetTouchpadScrollRows(int32_t rows)
538 {
539     return InputMgrImpl.SetTouchpadScrollRows(rows);
540 }
541 
GetTouchpadScrollRows(int32_t &rows)542 int32_t InputManager::GetTouchpadScrollRows(int32_t &rows)
543 {
544     return InputMgrImpl.GetTouchpadScrollRows(rows);
545 }
546 
SetWindowPointerStyle(WindowArea area, int32_t pid, int32_t windowId)547 void InputManager::SetWindowPointerStyle(WindowArea area, int32_t pid, int32_t windowId)
548 {
549     InputMgrImpl.SetWindowPointerStyle(area, pid, windowId);
550 }
551 
ClearWindowPointerStyle(int32_t pid, int32_t windowId)552 void InputManager::ClearWindowPointerStyle(int32_t pid, int32_t windowId)
553 {
554     InputMgrImpl.ClearWindowPointerStyle(pid, windowId);
555 }
556 
SetNapStatus(int32_t pid, int32_t uid, std::string bundleName, int32_t napStatus)557 void InputManager::SetNapStatus(int32_t pid, int32_t uid, std::string bundleName, int32_t napStatus)
558 {
559     InputMgrImpl.SetNapStatus(pid, uid, bundleName, napStatus);
560 }
561 
SetShieldStatus(int32_t shieldMode, bool isShield)562 int32_t InputManager::SetShieldStatus(int32_t shieldMode, bool isShield)
563 {
564     return InputMgrImpl.SetShieldStatus(shieldMode, isShield);
565 }
566 
GetShieldStatus(int32_t shieldMode, bool &isShield)567 int32_t InputManager::GetShieldStatus(int32_t shieldMode, bool &isShield)
568 {
569     return InputMgrImpl.GetShieldStatus(shieldMode, isShield);
570 }
571 
AddServiceWatcher(std::shared_ptr<IInputServiceWatcher> watcher)572 void InputManager::AddServiceWatcher(std::shared_ptr<IInputServiceWatcher> watcher)
573 {
574     InputMgrImpl.AddServiceWatcher(watcher);
575 }
576 
RemoveServiceWatcher(std::shared_ptr<IInputServiceWatcher> watcher)577 void InputManager::RemoveServiceWatcher(std::shared_ptr<IInputServiceWatcher> watcher)
578 {
579     InputMgrImpl.RemoveServiceWatcher(watcher);
580 }
581 
MarkProcessed(int32_t eventId, int64_t actionTime, bool enable)582 int32_t InputManager::MarkProcessed(int32_t eventId, int64_t actionTime, bool enable)
583 {
584     LogTracer lt(eventId, 0, 0);
585     if (enable) {
586         return InputMgrImpl.MarkProcessed(eventId, actionTime);
587     }
588     MMI_HILOGD("Skip MarkProcessed eventId:%{public}d", eventId);
589     return RET_OK;
590 }
591 
GetKeyState(std::vector<int32_t> &pressedKeys, std::map<int32_t, int32_t> &specialKeysState)592 int32_t InputManager::GetKeyState(std::vector<int32_t> &pressedKeys, std::map<int32_t, int32_t> &specialKeysState)
593 {
594     return InputMgrImpl.GetKeyState(pressedKeys, specialKeysState);
595 }
596 
Authorize(bool isAuthorize)597 void InputManager::Authorize(bool isAuthorize)
598 {
599     InputMgrImpl.Authorize(isAuthorize);
600 }
601 
HasIrEmitter(bool &hasIrEmitter)602 int32_t InputManager::HasIrEmitter(bool &hasIrEmitter)
603 {
604     return InputMgrImpl.HasIrEmitter(hasIrEmitter);
605 }
606 
GetInfraredFrequencies(std::vector<InfraredFrequency>& requencys)607 int32_t InputManager::GetInfraredFrequencies(std::vector<InfraredFrequency>& requencys)
608 {
609     return InputMgrImpl.GetInfraredFrequencies(requencys);
610 }
611 
TransmitInfrared(int64_t number, std::vector<int64_t>& pattern)612 int32_t InputManager::TransmitInfrared(int64_t number, std::vector<int64_t>& pattern)
613 {
614     return InputMgrImpl.TransmitInfrared(number, pattern);
615 }
616 
617 #ifdef OHOS_BUILD_ENABLE_VKEYBOARD
SetVKeyboardArea(double topLeftX, double topLeftY, double bottomRightX, double bottomRightY)618 int32_t InputManager::SetVKeyboardArea(double topLeftX, double topLeftY, double bottomRightX, double bottomRightY)
619 {
620     return InputMgrImpl.SetVKeyboardArea(topLeftX, topLeftY, bottomRightX, bottomRightY);
621 }
622 
SetMotionSpace(std::string& keyName, bool useShift, std::vector<int32_t>& pattern)623 int32_t InputManager::SetMotionSpace(std::string& keyName, bool useShift, std::vector<int32_t>& pattern)
624 {
625     return InputMgrImpl.SetMotionSpace(keyName, useShift, pattern);
626 }
627 #endif // OHOS_BUILD_ENABLE_VKEYBOARD
628 
SetCurrentUser(int32_t userId)629 int32_t InputManager::SetCurrentUser(int32_t userId)
630 {
631     return InputMgrImpl.SetCurrentUser(userId);
632 }
633 
SetMoveEventFilters(bool flag)634 int32_t InputManager::SetMoveEventFilters(bool flag)
635 {
636     return InputMgrImpl.SetMoveEventFilters(flag);
637 }
638 
SetTouchpadThreeFingersTapSwitch(bool switchFlag)639 int32_t InputManager::SetTouchpadThreeFingersTapSwitch(bool switchFlag)
640 {
641     return InputMgrImpl.SetTouchpadThreeFingersTapSwitch(switchFlag);
642 }
643 
GetTouchpadThreeFingersTapSwitch(bool &switchFlag)644 int32_t InputManager::GetTouchpadThreeFingersTapSwitch(bool &switchFlag)
645 {
646     return InputMgrImpl.GetTouchpadThreeFingersTapSwitch(switchFlag);
647 }
648 
GetWinSyncBatchSize(int32_t maxAreasCount, int32_t displayCount)649 int32_t InputManager::GetWinSyncBatchSize(int32_t maxAreasCount, int32_t displayCount)
650 {
651     return InputMgrImpl.GetWinSyncBatchSize(maxAreasCount, displayCount);
652 }
653 
AncoAddConsumer(std::shared_ptr<IAncoConsumer> consumer)654 int32_t InputManager::AncoAddConsumer(std::shared_ptr<IAncoConsumer> consumer)
655 {
656     return InputMgrImpl.AncoAddChannel(consumer);
657 }
658 
AncoRemoveConsumer(std::shared_ptr<IAncoConsumer> consumer)659 int32_t InputManager::AncoRemoveConsumer(std::shared_ptr<IAncoConsumer> consumer)
660 {
661     return InputMgrImpl.AncoRemoveChannel(consumer);
662 }
663 
SkipPointerLayer(bool isSkip)664 int32_t InputManager::SkipPointerLayer(bool isSkip)
665 {
666     return InputMgrImpl.SkipPointerLayer(isSkip);
667 }
668 
RegisterWindowStateErrorCallback(std::function<void(int32_t, int32_t)> callback)669 int32_t InputManager::RegisterWindowStateErrorCallback(std::function<void(int32_t, int32_t)> callback)
670 {
671     return InputMgrImpl.RegisterWindowStateErrorCallback(callback);
672 }
673 
GetIntervalSinceLastInput(int64_t &timeInterval)674 int32_t InputManager::GetIntervalSinceLastInput(int64_t &timeInterval)
675 {
676     return InputMgrImpl.GetIntervalSinceLastInput(timeInterval);
677 }
678 
GetAllSystemHotkeys(std::vector<std::unique_ptr<KeyOption>> &keyOptions, int32_t &count)679 int32_t InputManager::GetAllSystemHotkeys(std::vector<std::unique_ptr<KeyOption>> &keyOptions, int32_t &count)
680 {
681     return InputMgrImpl.GetAllSystemHotkeys(keyOptions, count);
682 }
683 
ConvertToCapiKeyAction(int32_t keyAction)684 int32_t InputManager::ConvertToCapiKeyAction(int32_t keyAction)
685 {
686     return InputMgrImpl.ConvertToCapiKeyAction(keyAction);
687 }
688 } // namespace MMI
689 } // namespace OHOS
690