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