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 
SubscribeSwitchEvent(std::function<void (std::shared_ptr<SwitchEvent>)> callback,SwitchEvent::SwitchType switchType)110 int32_t InputManager::SubscribeSwitchEvent(std::function<void(std::shared_ptr<SwitchEvent>)> callback,
111     SwitchEvent::SwitchType switchType)
112 {
113     return InputMgrImpl.SubscribeSwitchEvent(static_cast<int32_t>(switchType), callback);
114 }
115 
UnsubscribeSwitchEvent(int32_t subscriberId)116 void InputManager::UnsubscribeSwitchEvent(int32_t subscriberId)
117 {
118     InputMgrImpl.UnsubscribeSwitchEvent(subscriberId);
119 }
120 
AddMonitor(std::function<void (std::shared_ptr<KeyEvent>)> monitor)121 int32_t InputManager::AddMonitor(std::function<void(std::shared_ptr<KeyEvent>)> monitor)
122 {
123     return InputMgrImpl.AddMonitor(monitor);
124 }
125 
AddMonitor(std::function<void (std::shared_ptr<PointerEvent>)> monitor)126 int32_t InputManager::AddMonitor(std::function<void(std::shared_ptr<PointerEvent>)> monitor)
127 {
128     return InputMgrImpl.AddMonitor(monitor);
129 }
130 
AddMonitor(std::shared_ptr<IInputEventConsumer> monitor,HandleEventType eventType)131 int32_t InputManager::AddMonitor(std::shared_ptr<IInputEventConsumer> monitor, HandleEventType eventType)
132 {
133     return InputMgrImpl.AddMonitor(monitor, eventType);
134 }
135 
RemoveMonitor(int32_t monitorId)136 void InputManager::RemoveMonitor(int32_t monitorId)
137 {
138     InputMgrImpl.RemoveMonitor(monitorId);
139 }
140 
MarkConsumed(int32_t monitorId,int32_t eventId)141 void InputManager::MarkConsumed(int32_t monitorId, int32_t eventId)
142 {
143     InputMgrImpl.MarkConsumed(monitorId, eventId);
144 }
145 
MoveMouse(int32_t offsetX,int32_t offsetY)146 void InputManager::MoveMouse(int32_t offsetX, int32_t offsetY)
147 {
148     InputMgrImpl.MoveMouse(offsetX, offsetY);
149 }
150 
AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptor)151 int32_t InputManager::AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptor)
152 {
153     return InputMgrImpl.AddInterceptor(interceptor);
154 }
155 
AddInterceptor(std::function<void (std::shared_ptr<KeyEvent>)> interceptor)156 int32_t InputManager::AddInterceptor(std::function<void(std::shared_ptr<KeyEvent>)> interceptor)
157 {
158     return InputMgrImpl.AddInterceptor(interceptor);
159 }
160 
AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptor,int32_t priority,uint32_t deviceTags)161 int32_t InputManager::AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptor, int32_t priority,
162     uint32_t deviceTags)
163 {
164     return InputMgrImpl.AddInterceptor(interceptor, priority, deviceTags);
165 }
166 
RemoveInterceptor(int32_t interceptorId)167 void InputManager::RemoveInterceptor(int32_t interceptorId)
168 {
169     InputMgrImpl.RemoveInterceptor(interceptorId);
170 }
171 
SimulateInputEvent(std::shared_ptr<KeyEvent> keyEvent)172 void InputManager::SimulateInputEvent(std::shared_ptr<KeyEvent> keyEvent)
173 {
174     CHKPV(keyEvent);
175     LogTracer lt(keyEvent->GetId(), keyEvent->GetEventType(), keyEvent->GetKeyAction());
176     keyEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
177     InputMgrImpl.SimulateInputEvent(keyEvent);
178 }
179 
SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent)180 void InputManager::SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent)
181 {
182     CHKPV(pointerEvent);
183     LogTracer lt(pointerEvent->GetId(), pointerEvent->GetEventType(), pointerEvent->GetPointerAction());
184     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
185     InputMgrImpl.SimulateInputEvent(pointerEvent);
186 }
187 
SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent,float zOrder)188 void InputManager::SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent, float zOrder)
189 {
190     CHKPV(pointerEvent);
191     LogTracer lt(pointerEvent->GetId(), pointerEvent->GetEventType(), pointerEvent->GetPointerAction());
192     pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
193     pointerEvent->SetZOrder(zOrder);
194     InputMgrImpl.SimulateInputEvent(pointerEvent);
195 }
196 
RegisterDevListener(std::string type,std::shared_ptr<IInputDeviceListener> listener)197 int32_t InputManager::RegisterDevListener(std::string type, std::shared_ptr<IInputDeviceListener> listener)
198 {
199     return InputMgrImpl.RegisterDevListener(type, listener);
200 }
201 
UnregisterDevListener(std::string type,std::shared_ptr<IInputDeviceListener> listener)202 int32_t InputManager::UnregisterDevListener(std::string type, std::shared_ptr<IInputDeviceListener> listener)
203 {
204     return InputMgrImpl.UnregisterDevListener(type, listener);
205 }
206 
GetDeviceIds(std::function<void (std::vector<int32_t> &)> callback)207 int32_t InputManager::GetDeviceIds(std::function<void(std::vector<int32_t>&)> callback)
208 {
209     return InputMgrImpl.GetDeviceIds(callback);
210 }
211 
GetDevice(int32_t deviceId,std::function<void (std::shared_ptr<InputDevice>)> callback)212 int32_t InputManager::GetDevice(int32_t deviceId,
213     std::function<void(std::shared_ptr<InputDevice>)> callback)
214 {
215     return InputMgrImpl.GetDevice(deviceId, callback);
216 }
217 
SupportKeys(int32_t deviceId,std::vector<int32_t> keyCodes,std::function<void (std::vector<bool> &)> callback)218 int32_t InputManager::SupportKeys(int32_t deviceId, std::vector<int32_t> keyCodes,
219     std::function<void(std::vector<bool>&)> callback)
220 {
221     return InputMgrImpl.SupportKeys(deviceId, keyCodes, callback);
222 }
223 
SetMouseScrollRows(int32_t Rows)224 int32_t InputManager::SetMouseScrollRows(int32_t Rows)
225 {
226     return InputMgrImpl.SetMouseScrollRows(Rows);
227 }
228 
GetMouseScrollRows(int32_t & Rows)229 int32_t InputManager::GetMouseScrollRows(int32_t &Rows)
230 {
231     return InputMgrImpl.GetMouseScrollRows(Rows);
232 }
233 
SetCustomCursor(int32_t windowId,void * pixelMap,int32_t focusX,int32_t focusY)234 int32_t InputManager::SetCustomCursor(int32_t windowId, void* pixelMap, int32_t focusX, int32_t focusY)
235 {
236     return InputMgrImpl.SetCustomCursor(windowId, focusX, focusY, pixelMap);
237 }
238 
SetMouseIcon(int32_t windowId,void * pixelMap)239 int32_t InputManager::SetMouseIcon(int32_t windowId, void* pixelMap)
240 {
241     return InputMgrImpl.SetMouseIcon(windowId, pixelMap);
242 }
243 
SetPointerSize(int32_t size)244 int32_t InputManager::SetPointerSize(int32_t size)
245 {
246     return InputMgrImpl.SetPointerSize(size);
247 }
248 
GetPointerSize(int32_t & size)249 int32_t InputManager::GetPointerSize(int32_t &size)
250 {
251     return InputMgrImpl.GetPointerSize(size);
252 }
253 
SetMouseHotSpot(int32_t windowId,int32_t hotSpotX,int32_t hotSpotY)254 int32_t InputManager::SetMouseHotSpot(int32_t windowId, int32_t hotSpotX, int32_t hotSpotY)
255 {
256     return InputMgrImpl.SetMouseHotSpot(windowId, hotSpotX, hotSpotY);
257 }
258 
SetMousePrimaryButton(int32_t primaryButton)259 int32_t InputManager::SetMousePrimaryButton(int32_t primaryButton)
260 {
261     return InputMgrImpl.SetMousePrimaryButton(primaryButton);
262 }
263 
GetMousePrimaryButton(int32_t & primaryButton)264 int32_t InputManager::GetMousePrimaryButton(int32_t &primaryButton)
265 {
266     return InputMgrImpl.GetMousePrimaryButton(primaryButton);
267 }
268 
SetHoverScrollState(bool state)269 int32_t InputManager::SetHoverScrollState(bool state)
270 {
271     return InputMgrImpl.SetHoverScrollState(state);
272 }
273 
GetHoverScrollState(bool & state)274 int32_t InputManager::GetHoverScrollState(bool &state)
275 {
276     return InputMgrImpl.GetHoverScrollState(state);
277 }
278 
SetPointerVisible(bool visible,int32_t priority)279 int32_t InputManager::SetPointerVisible(bool visible, int32_t priority)
280 {
281     return InputMgrImpl.SetPointerVisible(visible, priority);
282 }
283 
IsPointerVisible()284 bool InputManager::IsPointerVisible()
285 {
286     return InputMgrImpl.IsPointerVisible();
287 }
288 
SetPointerColor(int32_t color)289 int32_t InputManager::SetPointerColor(int32_t color)
290 {
291     return InputMgrImpl.SetPointerColor(color);
292 }
293 
GetPointerColor(int32_t & color)294 int32_t InputManager::GetPointerColor(int32_t &color)
295 {
296     return InputMgrImpl.GetPointerColor(color);
297 }
298 
EnableCombineKey(bool enable)299 int32_t InputManager::EnableCombineKey(bool enable)
300 {
301     return InputMgrImpl.EnableCombineKey(enable);
302 }
303 
SetPointerSpeed(int32_t speed)304 int32_t InputManager::SetPointerSpeed(int32_t speed)
305 {
306     return InputMgrImpl.SetPointerSpeed(speed);
307 }
308 
GetPointerSpeed(int32_t & speed)309 int32_t InputManager::GetPointerSpeed(int32_t &speed)
310 {
311     return InputMgrImpl.GetPointerSpeed(speed);
312 }
313 
GetKeyboardType(int32_t deviceId,std::function<void (int32_t)> callback)314 int32_t InputManager::GetKeyboardType(int32_t deviceId, std::function<void(int32_t)> callback)
315 {
316     return InputMgrImpl.GetKeyboardType(deviceId, callback);
317 }
318 
SetAnrObserver(std::shared_ptr<IAnrObserver> observer)319 void InputManager::SetAnrObserver(std::shared_ptr<IAnrObserver> observer)
320 {
321     InputMgrImpl.SetAnrObserver(observer);
322 }
323 
SetPointerStyle(int32_t windowId,PointerStyle pointerStyle,bool isUiExtension)324 int32_t InputManager::SetPointerStyle(int32_t windowId, PointerStyle pointerStyle, bool isUiExtension)
325 {
326     return InputMgrImpl.SetPointerStyle(windowId, pointerStyle, isUiExtension);
327 }
328 
GetPointerStyle(int32_t windowId,PointerStyle & pointerStyle,bool isUiExtension)329 int32_t InputManager::GetPointerStyle(int32_t windowId, PointerStyle &pointerStyle, bool isUiExtension)
330 {
331     return InputMgrImpl.GetPointerStyle(windowId, pointerStyle, isUiExtension);
332 }
333 
GetFunctionKeyState(int32_t funcKey)334 bool InputManager::GetFunctionKeyState(int32_t funcKey)
335 {
336     return InputMgrImpl.GetFunctionKeyState(funcKey);
337 }
338 
SetFunctionKeyState(int32_t funcKey,bool enable)339 int32_t InputManager::SetFunctionKeyState(int32_t funcKey, bool enable)
340 {
341     return InputMgrImpl.SetFunctionKeyState(funcKey, enable);
342 }
343 
SetPointerLocation(int32_t x,int32_t y)344 int32_t InputManager::SetPointerLocation(int32_t x, int32_t y)
345 {
346     return InputMgrImpl.SetPointerLocation(x, y);
347 }
348 
EnterCaptureMode(int32_t windowId)349 int32_t InputManager::EnterCaptureMode(int32_t windowId)
350 {
351     return InputMgrImpl.EnterCaptureMode(windowId);
352 }
353 
LeaveCaptureMode(int32_t windowId)354 int32_t InputManager::LeaveCaptureMode(int32_t windowId)
355 {
356     return InputMgrImpl.LeaveCaptureMode(windowId);
357 }
358 
AppendExtraData(const ExtraData & extraData)359 void InputManager::AppendExtraData(const ExtraData& extraData)
360 {
361     InputMgrImpl.AppendExtraData(extraData);
362 }
363 
EnableInputDevice(bool enable)364 int32_t InputManager::EnableInputDevice(bool enable)
365 {
366     return InputMgrImpl.EnableInputDevice(enable);
367 }
368 
AddVirtualInputDevice(std::shared_ptr<InputDevice> device,int32_t & deviceId)369 int32_t InputManager::AddVirtualInputDevice(std::shared_ptr<InputDevice> device, int32_t &deviceId)
370 {
371     return InputMgrImpl.AddVirtualInputDevice(device, deviceId);
372 }
373 
RemoveVirtualInputDevice(int32_t deviceId)374 int32_t InputManager::RemoveVirtualInputDevice(int32_t deviceId)
375 {
376     return InputMgrImpl.RemoveVirtualInputDevice(deviceId);
377 }
378 
SetKeyDownDuration(const std::string & businessId,int32_t delay)379 int32_t InputManager::SetKeyDownDuration(const std::string& businessId, int32_t delay)
380 {
381     return InputMgrImpl.SetKeyDownDuration(businessId, delay);
382 }
383 
SetKeyboardRepeatDelay(int32_t delay)384 int32_t InputManager::SetKeyboardRepeatDelay(int32_t delay)
385 {
386     return InputMgrImpl.SetKeyboardRepeatDelay(delay);
387 }
388 
SetKeyboardRepeatRate(int32_t rate)389 int32_t InputManager::SetKeyboardRepeatRate(int32_t rate)
390 {
391     return InputMgrImpl.SetKeyboardRepeatRate(rate);
392 }
393 
GetKeyboardRepeatDelay(std::function<void (int32_t)> callback)394 int32_t InputManager::GetKeyboardRepeatDelay(std::function<void(int32_t)> callback)
395 {
396     return InputMgrImpl.GetKeyboardRepeatDelay(callback);
397 }
398 
GetKeyboardRepeatRate(std::function<void (int32_t)> callback)399 int32_t InputManager::GetKeyboardRepeatRate(std::function<void(int32_t)> callback)
400 {
401     return InputMgrImpl.GetKeyboardRepeatRate(callback);
402 }
403 
404 #ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT
SetEnhanceConfig(uint8_t * cfg,uint32_t cfgLen)405 void InputManager::SetEnhanceConfig(uint8_t *cfg, uint32_t cfgLen)
406 {
407     InputMgrImpl.SetEnhanceConfig(cfg, cfgLen);
408 }
409 #endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT
410 
SetTouchpadScrollSwitch(bool switchFlag)411 int32_t InputManager::SetTouchpadScrollSwitch(bool switchFlag)
412 {
413     return InputMgrImpl.SetTouchpadScrollSwitch(switchFlag);
414 }
415 
GetTouchpadScrollSwitch(bool & switchFlag)416 int32_t InputManager::GetTouchpadScrollSwitch(bool &switchFlag)
417 {
418     return InputMgrImpl.GetTouchpadScrollSwitch(switchFlag);
419 }
SetTouchpadScrollDirection(bool state)420 int32_t InputManager::SetTouchpadScrollDirection(bool state)
421 {
422     return InputMgrImpl.SetTouchpadScrollDirection(state);
423 }
424 
GetTouchpadScrollDirection(bool & state)425 int32_t InputManager::GetTouchpadScrollDirection(bool &state)
426 {
427     return InputMgrImpl.GetTouchpadScrollDirection(state);
428 }
SetTouchpadTapSwitch(bool switchFlag)429 int32_t InputManager::SetTouchpadTapSwitch(bool switchFlag)
430 {
431     return InputMgrImpl.SetTouchpadTapSwitch(switchFlag);
432 }
433 
GetTouchpadTapSwitch(bool & switchFlag)434 int32_t InputManager::GetTouchpadTapSwitch(bool &switchFlag)
435 {
436     return InputMgrImpl.GetTouchpadTapSwitch(switchFlag);
437 }
438 
SetTouchpadPointerSpeed(int32_t speed)439 int32_t InputManager::SetTouchpadPointerSpeed(int32_t speed)
440 {
441     return InputMgrImpl.SetTouchpadPointerSpeed(speed);
442 }
443 
GetTouchpadPointerSpeed(int32_t & speed)444 int32_t InputManager::GetTouchpadPointerSpeed(int32_t &speed)
445 {
446     return InputMgrImpl.GetTouchpadPointerSpeed(speed);
447 }
448 
SetTouchpadPinchSwitch(bool switchFlag)449 int32_t InputManager::SetTouchpadPinchSwitch(bool switchFlag)
450 {
451     return InputMgrImpl.SetTouchpadPinchSwitch(switchFlag);
452 }
453 
GetTouchpadPinchSwitch(bool & switchFlag)454 int32_t InputManager::GetTouchpadPinchSwitch(bool &switchFlag)
455 {
456     return InputMgrImpl.GetTouchpadPinchSwitch(switchFlag);
457 }
458 
SetTouchpadSwipeSwitch(bool switchFlag)459 int32_t InputManager::SetTouchpadSwipeSwitch(bool switchFlag)
460 {
461     return InputMgrImpl.SetTouchpadSwipeSwitch(switchFlag);
462 }
463 
GetTouchpadSwipeSwitch(bool & switchFlag)464 int32_t InputManager::GetTouchpadSwipeSwitch(bool &switchFlag)
465 {
466     return InputMgrImpl.GetTouchpadSwipeSwitch(switchFlag);
467 }
468 
SetTouchpadRightClickType(int32_t type)469 int32_t InputManager::SetTouchpadRightClickType(int32_t type)
470 {
471     return InputMgrImpl.SetTouchpadRightClickType(type);
472 }
473 
GetTouchpadRightClickType(int32_t & type)474 int32_t InputManager::GetTouchpadRightClickType(int32_t &type)
475 {
476     return InputMgrImpl.GetTouchpadRightClickType(type);
477 }
478 
SetTouchpadRotateSwitch(bool rotateSwitch)479 int32_t InputManager::SetTouchpadRotateSwitch(bool rotateSwitch)
480 {
481     return InputMgrImpl.SetTouchpadRotateSwitch(rotateSwitch);
482 }
483 
GetTouchpadRotateSwitch(bool & rotateSwitch)484 int32_t InputManager::GetTouchpadRotateSwitch(bool &rotateSwitch)
485 {
486     return InputMgrImpl.GetTouchpadRotateSwitch(rotateSwitch);
487 }
488 
SetTouchpadDoubleTapAndDragState(bool switchFlag)489 int32_t InputManager::SetTouchpadDoubleTapAndDragState(bool switchFlag)
490 {
491     return InputMgrImpl.SetTouchpadDoubleTapAndDragState(switchFlag);
492 }
493 
GetTouchpadDoubleTapAndDragState(bool & switchFlag)494 int32_t InputManager::GetTouchpadDoubleTapAndDragState(bool &switchFlag)
495 {
496     return InputMgrImpl.GetTouchpadDoubleTapAndDragState(switchFlag);
497 }
498 
EnableHardwareCursorStats(bool enable)499 int32_t InputManager::EnableHardwareCursorStats(bool enable)
500 {
501     return InputMgrImpl.EnableHardwareCursorStats(enable);
502 }
503 
GetHardwareCursorStats(uint32_t & frameCount,uint32_t & vsyncCount)504 int32_t InputManager::GetHardwareCursorStats(uint32_t &frameCount, uint32_t &vsyncCount)
505 {
506     return InputMgrImpl.GetHardwareCursorStats(frameCount, vsyncCount);
507 }
508 
GetPointerSnapshot(void * pixelMapPtr)509 int32_t InputManager::GetPointerSnapshot(void *pixelMapPtr)
510 {
511     return InputMgrImpl.GetPointerSnapshot(pixelMapPtr);
512 }
513 
SetWindowPointerStyle(WindowArea area,int32_t pid,int32_t windowId)514 void InputManager::SetWindowPointerStyle(WindowArea area, int32_t pid, int32_t windowId)
515 {
516     InputMgrImpl.SetWindowPointerStyle(area, pid, windowId);
517 }
518 
ClearWindowPointerStyle(int32_t pid,int32_t windowId)519 void InputManager::ClearWindowPointerStyle(int32_t pid, int32_t windowId)
520 {
521     InputMgrImpl.ClearWindowPointerStyle(pid, windowId);
522 }
523 
SetNapStatus(int32_t pid,int32_t uid,std::string bundleName,int32_t napStatus)524 void InputManager::SetNapStatus(int32_t pid, int32_t uid, std::string bundleName, int32_t napStatus)
525 {
526     InputMgrImpl.SetNapStatus(pid, uid, bundleName, napStatus);
527 }
528 
SetShieldStatus(int32_t shieldMode,bool isShield)529 int32_t InputManager::SetShieldStatus(int32_t shieldMode, bool isShield)
530 {
531     return InputMgrImpl.SetShieldStatus(shieldMode, isShield);
532 }
533 
GetShieldStatus(int32_t shieldMode,bool & isShield)534 int32_t InputManager::GetShieldStatus(int32_t shieldMode, bool &isShield)
535 {
536     return InputMgrImpl.GetShieldStatus(shieldMode, isShield);
537 }
538 
AddServiceWatcher(std::shared_ptr<IInputServiceWatcher> watcher)539 void InputManager::AddServiceWatcher(std::shared_ptr<IInputServiceWatcher> watcher)
540 {
541     InputMgrImpl.AddServiceWatcher(watcher);
542 }
543 
RemoveServiceWatcher(std::shared_ptr<IInputServiceWatcher> watcher)544 void InputManager::RemoveServiceWatcher(std::shared_ptr<IInputServiceWatcher> watcher)
545 {
546     InputMgrImpl.RemoveServiceWatcher(watcher);
547 }
548 
MarkProcessed(int32_t eventId,int64_t actionTime,bool enable)549 int32_t InputManager::MarkProcessed(int32_t eventId, int64_t actionTime, bool enable)
550 {
551     LogTracer lt(eventId, 0, 0);
552     if (enable) {
553         return InputMgrImpl.MarkProcessed(eventId, actionTime);
554     }
555     MMI_HILOGD("Skip MarkProcessed eventId:%{public}d", eventId);
556     return RET_OK;
557 }
558 
GetKeyState(std::vector<int32_t> & pressedKeys,std::map<int32_t,int32_t> & specialKeysState)559 int32_t InputManager::GetKeyState(std::vector<int32_t> &pressedKeys, std::map<int32_t, int32_t> &specialKeysState)
560 {
561     return InputMgrImpl.GetKeyState(pressedKeys, specialKeysState);
562 }
563 
Authorize(bool isAuthorize)564 void InputManager::Authorize(bool isAuthorize)
565 {
566     InputMgrImpl.Authorize(isAuthorize);
567 }
568 
HasIrEmitter(bool & hasIrEmitter)569 int32_t InputManager::HasIrEmitter(bool &hasIrEmitter)
570 {
571     return InputMgrImpl.HasIrEmitter(hasIrEmitter);
572 }
573 
GetInfraredFrequencies(std::vector<InfraredFrequency> & requencys)574 int32_t InputManager::GetInfraredFrequencies(std::vector<InfraredFrequency>& requencys)
575 {
576     return InputMgrImpl.GetInfraredFrequencies(requencys);
577 }
578 
TransmitInfrared(int64_t number,std::vector<int64_t> & pattern)579 int32_t InputManager::TransmitInfrared(int64_t number, std::vector<int64_t>& pattern)
580 {
581     return InputMgrImpl.TransmitInfrared(number, pattern);
582 }
583 
SetCurrentUser(int32_t userId)584 int32_t InputManager::SetCurrentUser(int32_t userId)
585 {
586     return InputMgrImpl.SetCurrentUser(userId);
587 }
588 
GetWinSyncBatchSize(int32_t maxAreasCount,int32_t displayCount)589 int32_t InputManager::GetWinSyncBatchSize(int32_t maxAreasCount, int32_t displayCount)
590 {
591     return InputMgrImpl.GetWinSyncBatchSize(maxAreasCount, displayCount);
592 }
593 
AncoAddConsumer(std::shared_ptr<IAncoConsumer> consumer)594 int32_t InputManager::AncoAddConsumer(std::shared_ptr<IAncoConsumer> consumer)
595 {
596     return InputMgrImpl.AncoAddChannel(consumer);
597 }
598 
AncoRemoveConsumer(std::shared_ptr<IAncoConsumer> consumer)599 int32_t InputManager::AncoRemoveConsumer(std::shared_ptr<IAncoConsumer> consumer)
600 {
601     return InputMgrImpl.AncoRemoveChannel(consumer);
602 }
603 
SkipPointerLayer(bool isSkip)604 int32_t InputManager::SkipPointerLayer(bool isSkip)
605 {
606     return InputMgrImpl.SkipPointerLayer(isSkip);
607 }
608 
RegisterWindowStateErrorCallback(std::function<void (int32_t,int32_t)> callback)609 int32_t InputManager::RegisterWindowStateErrorCallback(std::function<void(int32_t, int32_t)> callback)
610 {
611     return InputMgrImpl.RegisterWindowStateErrorCallback(callback);
612 }
613 
ConvertToCapiKeyAction(int32_t keyAction)614 int32_t InputManager::ConvertToCapiKeyAction(int32_t keyAction)
615 {
616     return InputMgrImpl.ConvertToCapiKeyAction(keyAction);
617 }
618 
GetIntervalSinceLastInput(int64_t & timeInterval)619 int32_t InputManager::GetIntervalSinceLastInput(int64_t &timeInterval)
620 {
621     return InputMgrImpl.GetIntervalSinceLastInput(timeInterval);
622 }
623 } // namespace MMI
624 } // namespace OHOS
625