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 "input_manager_impl.h"
20 #include "hitrace_meter.h"
21 #include "pre_monitor_manager.h"
22
23 #undef MMI_LOG_TAG
24 #define MMI_LOG_TAG "InputManager"
25
26 namespace OHOS {
27 namespace MMI {
28 InputManager *InputManager::instance_ = new (std::nothrow) InputManager();
29
30 const std::map<int32_t, int32_t> MOUSE_TO_TOUCH_PARAM_MAP = {
31 {PointerEvent::SOURCE_TYPE_MOUSE, PointerEvent::SOURCE_TYPE_TOUCHSCREEN},
32 {PointerEvent::POINTER_ACTION_BUTTON_DOWN, PointerEvent::POINTER_ACTION_DOWN},
33 {PointerEvent::POINTER_ACTION_BUTTON_UP, PointerEvent::POINTER_ACTION_UP},
34 {PointerEvent::TOOL_TYPE_MOUSE, PointerEvent::TOOL_TYPE_FINGER},
35 {PointerEvent::MOUSE_BUTTON_LEFT, PointerEvent::POINTER_INITIAL_VALUE}
36 };
37
38 const std::map<int32_t, int32_t> TOUCH_TO_MOUSE_PARAM_MAP = {
39 {PointerEvent::POINTER_ACTION_DOWN, PointerEvent::POINTER_ACTION_BUTTON_DOWN},
40 {PointerEvent::POINTER_ACTION_UP, PointerEvent::POINTER_ACTION_BUTTON_UP},
41 {PointerEvent::TOOL_TYPE_FINGER, PointerEvent::TOOL_TYPE_MOUSE}
42 };
43
GetInstance()44 InputManager *InputManager::GetInstance()
45 {
46 return instance_;
47 }
48
GetDisplayBindInfo(DisplayBindInfos & infos)49 int32_t InputManager::GetDisplayBindInfo(DisplayBindInfos &infos)
50 {
51 return InputMgrImpl.GetDisplayBindInfo(infos);
52 }
53
GetAllMmiSubscribedEvents(std::map<std::tuple<int32_t,int32_t,std::string>,int32_t> & datas)54 int32_t InputManager::GetAllMmiSubscribedEvents(std::map<std::tuple<int32_t, int32_t, std::string>, int32_t> &datas)
55 {
56 return InputMgrImpl.GetAllMmiSubscribedEvents(datas);
57 }
58
SetDisplayBind(int32_t deviceId,int32_t displayId,std::string & msg)59 int32_t InputManager::SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg)
60 {
61 return InputMgrImpl.SetDisplayBind(deviceId, displayId, msg);
62 }
63
GetWindowPid(int32_t windowId)64 int32_t InputManager::GetWindowPid(int32_t windowId)
65 {
66 return InputMgrImpl.GetWindowPid(windowId);
67 }
68
UpdateDisplayInfo(const UserScreenInfo & userScreenInfo)69 int32_t InputManager::UpdateDisplayInfo(const UserScreenInfo &userScreenInfo)
70 {
71 return InputMgrImpl.UpdateDisplayInfo(userScreenInfo);
72 }
73
UpdateWindowInfo(const WindowGroupInfo & windowGroupInfo)74 int32_t InputManager::UpdateWindowInfo(const WindowGroupInfo &windowGroupInfo)
75 {
76 return InputMgrImpl.UpdateWindowInfo(windowGroupInfo);
77 }
78
AddInputEventFilter(std::shared_ptr<IInputEventFilter> filter,int32_t priority,uint32_t deviceTags)79 int32_t InputManager::AddInputEventFilter(std::shared_ptr<IInputEventFilter> filter, int32_t priority,
80 uint32_t deviceTags)
81 {
82 return InputMgrImpl.AddInputEventFilter(filter, priority, deviceTags);
83 }
84
RemoveInputEventFilter(int32_t filterId)85 int32_t InputManager::RemoveInputEventFilter(int32_t filterId)
86 {
87 return InputMgrImpl.RemoveInputEventFilter(filterId);
88 }
89
AddInputEventObserver(std::shared_ptr<MMIEventObserver> observer)90 int32_t InputManager::AddInputEventObserver(std::shared_ptr<MMIEventObserver> observer)
91 {
92 return InputMgrImpl.AddInputEventObserver(observer);
93 }
94
RemoveInputEventObserver(std::shared_ptr<MMIEventObserver> observer)95 int32_t InputManager::RemoveInputEventObserver(std::shared_ptr<MMIEventObserver> observer)
96 {
97 return InputMgrImpl.RemoveInputEventObserver(observer);
98 }
99
SetWindowInputEventConsumer(std::shared_ptr<IInputEventConsumer> inputEventConsumer)100 int32_t InputManager::SetWindowInputEventConsumer(std::shared_ptr<IInputEventConsumer> inputEventConsumer)
101 {
102 // LCOV_EXCL_START
103 return InputMgrImpl.SetWindowInputEventConsumer(inputEventConsumer, nullptr);
104 // LCOV_EXCL_STOP
105 }
106
SetWindowInputEventConsumer(std::shared_ptr<IInputEventConsumer> inputEventConsumer,std::shared_ptr<AppExecFwk::EventHandler> eventHandler)107 int32_t InputManager::SetWindowInputEventConsumer(std::shared_ptr<IInputEventConsumer> inputEventConsumer,
108 std::shared_ptr<AppExecFwk::EventHandler> eventHandler)
109 {
110 // LCOV_EXCL_START
111 CHKPR(eventHandler, RET_ERR);
112 return InputMgrImpl.SetWindowInputEventConsumer(inputEventConsumer, eventHandler);
113 // LCOV_EXCL_STOP
114 }
115
SubscribeKeyEvent(std::shared_ptr<KeyOption> keyOption,std::function<void (std::shared_ptr<KeyEvent>)> callback)116 int32_t InputManager::SubscribeKeyEvent(std::shared_ptr<KeyOption> keyOption,
117 std::function<void(std::shared_ptr<KeyEvent>)> callback)
118 {
119 return InputMgrImpl.SubscribeKeyEvent(keyOption, callback);
120 }
121
UnsubscribeKeyEvent(int32_t subscriberId)122 void InputManager::UnsubscribeKeyEvent(int32_t subscriberId)
123 {
124 InputMgrImpl.UnsubscribeKeyEvent(subscriberId);
125 }
126
SubscribeHotkey(std::shared_ptr<KeyOption> keyOption,std::function<void (std::shared_ptr<KeyEvent>)> callback)127 int32_t InputManager::SubscribeHotkey(std::shared_ptr<KeyOption> keyOption,
128 std::function<void(std::shared_ptr<KeyEvent>)> callback)
129 {
130 return InputMgrImpl.SubscribeHotkey(keyOption, callback);
131 }
132
UnsubscribeHotkey(int32_t subscriberId)133 void InputManager::UnsubscribeHotkey(int32_t subscriberId)
134 {
135 InputMgrImpl.UnsubscribeHotkey(subscriberId);
136 }
137
SubscribeKeyMonitor(const KeyMonitorOption & keyOption,std::function<void (std::shared_ptr<KeyEvent>)> callback)138 int32_t InputManager::SubscribeKeyMonitor(const KeyMonitorOption &keyOption,
139 std::function<void(std::shared_ptr<KeyEvent>)> callback)
140 {
141 return InputMgrImpl.SubscribeKeyMonitor(keyOption, callback);
142 }
143
UnsubscribeKeyMonitor(int32_t subscriberId)144 int32_t InputManager::UnsubscribeKeyMonitor(int32_t subscriberId)
145 {
146 return InputMgrImpl.UnsubscribeKeyMonitor(subscriberId);
147 }
148
SubscribeSwitchEvent(std::function<void (std::shared_ptr<SwitchEvent>)> callback,SwitchEvent::SwitchType switchType)149 int32_t InputManager::SubscribeSwitchEvent(std::function<void(std::shared_ptr<SwitchEvent>)> callback,
150 SwitchEvent::SwitchType switchType)
151 {
152 return InputMgrImpl.SubscribeSwitchEvent(static_cast<int32_t>(switchType), callback);
153 }
154
UnsubscribeSwitchEvent(int32_t subscriberId)155 void InputManager::UnsubscribeSwitchEvent(int32_t subscriberId)
156 {
157 InputMgrImpl.UnsubscribeSwitchEvent(subscriberId);
158 }
159
QuerySwitchStatus(SwitchEvent::SwitchType switchType,SwitchEvent::SwitchState & state)160 int32_t InputManager::QuerySwitchStatus(SwitchEvent::SwitchType switchType, SwitchEvent::SwitchState &state)
161 {
162 auto inState = static_cast<int32_t>(state);
163 int32_t ret = InputMgrImpl.QuerySwitchStatus(static_cast<int32_t>(switchType), inState);
164 state = static_cast<SwitchEvent::SwitchState>(inState);
165 return ret;
166 }
167
SubscribeTabletProximity(std::function<void (std::shared_ptr<PointerEvent>)> callback)168 int32_t InputManager::SubscribeTabletProximity(std::function<void(std::shared_ptr<PointerEvent>)> callback)
169 {
170 return InputMgrImpl.SubscribeTabletProximity(callback);
171 }
172
UnsubscribetabletProximity(int32_t subscriberId)173 void InputManager::UnsubscribetabletProximity(int32_t subscriberId)
174 {
175 InputMgrImpl.UnsubscribetabletProximity(subscriberId);
176 }
177
SubscribeLongPressEvent(const LongPressRequest & longPressRequest,std::function<void (LongPressEvent)> callback)178 int32_t InputManager::SubscribeLongPressEvent(const LongPressRequest &longPressRequest,
179 std::function<void(LongPressEvent)> callback)
180 {
181 return InputMgrImpl.SubscribeLongPressEvent(longPressRequest, callback);
182 }
183
UnsubscribeLongPressEvent(int32_t subscriberId)184 void InputManager::UnsubscribeLongPressEvent(int32_t subscriberId)
185 {
186 InputMgrImpl.UnsubscribeLongPressEvent(subscriberId);
187 }
188
AddMonitor(std::function<void (std::shared_ptr<KeyEvent>)> monitor)189 int32_t InputManager::AddMonitor(std::function<void(std::shared_ptr<KeyEvent>)> monitor)
190 {
191 // LCOV_EXCL_START
192 return InputMgrImpl.AddMonitor(monitor);
193 // LCOV_EXCL_STOP
194 }
195
AddMonitor(std::function<void (std::shared_ptr<PointerEvent>)> monitor)196 int32_t InputManager::AddMonitor(std::function<void(std::shared_ptr<PointerEvent>)> monitor)
197 {
198 // LCOV_EXCL_START
199 return InputMgrImpl.AddMonitor(monitor);
200 // LCOV_EXCL_STOP
201 }
202
AddMonitor(std::shared_ptr<IInputEventConsumer> monitor,HandleEventType eventType)203 int32_t InputManager::AddMonitor(std::shared_ptr<IInputEventConsumer> monitor, HandleEventType eventType)
204 {
205 return InputMgrImpl.AddMonitor(monitor, eventType);
206 }
207
AddMonitor(std::shared_ptr<IInputEventConsumer> monitor,std::vector<int32_t> actionsType)208 int32_t InputManager::AddMonitor(std::shared_ptr<IInputEventConsumer> monitor, std::vector<int32_t> actionsType)
209 {
210 return InputMgrImpl.AddMonitor(monitor, actionsType);
211 }
212
AddPreMonitor(std::shared_ptr<IInputEventConsumer> monitor,HandleEventType eventType,std::vector<int32_t> keys)213 int32_t InputManager::AddPreMonitor(
214 std::shared_ptr<IInputEventConsumer> monitor, HandleEventType eventType, std::vector<int32_t> keys)
215 {
216 return PRE_MONITOR_MGR.AddHandler(monitor, eventType, keys);
217 }
218
RemovePreMonitor(int32_t monitorId)219 void InputManager::RemovePreMonitor(int32_t monitorId)
220 {
221 PRE_MONITOR_MGR.RemoveHandler(monitorId);
222 }
223
RemoveMonitor(int32_t monitorId)224 void InputManager::RemoveMonitor(int32_t monitorId)
225 {
226 InputMgrImpl.RemoveMonitor(monitorId);
227 }
228
AddGestureMonitor(std::shared_ptr<IInputEventConsumer> consumer,TouchGestureType type,int32_t fingers)229 int32_t InputManager::AddGestureMonitor(
230 std::shared_ptr<IInputEventConsumer> consumer, TouchGestureType type, int32_t fingers)
231 {
232 return InputMgrImpl.AddGestureMonitor(consumer, type, fingers);
233 }
234
RemoveGestureMonitor(int32_t monitorId)235 int32_t InputManager::RemoveGestureMonitor(int32_t monitorId)
236 {
237 return InputMgrImpl.RemoveGestureMonitor(monitorId);
238 }
239
MarkConsumed(int32_t monitorId,int32_t eventId)240 void InputManager::MarkConsumed(int32_t monitorId, int32_t eventId)
241 {
242 InputMgrImpl.MarkConsumed(monitorId, eventId);
243 }
244
MoveMouse(int32_t offsetX,int32_t offsetY)245 void InputManager::MoveMouse(int32_t offsetX, int32_t offsetY)
246 {
247 InputMgrImpl.MoveMouse(offsetX, offsetY);
248 }
249
AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptor)250 int32_t InputManager::AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptor)
251 {
252 return InputMgrImpl.AddInterceptor(interceptor);
253 }
254
AddInterceptor(std::function<void (std::shared_ptr<KeyEvent>)> interceptor)255 int32_t InputManager::AddInterceptor(std::function<void(std::shared_ptr<KeyEvent>)> interceptor)
256 {
257 return InputMgrImpl.AddInterceptor(interceptor);
258 }
259
AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptor,int32_t priority,uint32_t deviceTags)260 int32_t InputManager::AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptor, int32_t priority,
261 uint32_t deviceTags)
262 {
263 return InputMgrImpl.AddInterceptor(interceptor, priority, deviceTags);
264 }
265
RemoveInterceptor(int32_t interceptorId)266 void InputManager::RemoveInterceptor(int32_t interceptorId)
267 {
268 InputMgrImpl.RemoveInterceptor(interceptorId);
269 }
270
SimulateInputEvent(std::shared_ptr<KeyEvent> keyEvent)271 void InputManager::SimulateInputEvent(std::shared_ptr<KeyEvent> keyEvent)
272 {
273 LogTracer lt(keyEvent->GetId(), keyEvent->GetEventType(), keyEvent->GetKeyAction());
274 keyEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
275 InputMgrImpl.SimulateInputEvent(keyEvent);
276 }
277
SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent,bool isAutoToVirtualScreen,int32_t useCoordinate)278 void InputManager::SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent, bool isAutoToVirtualScreen,
279 int32_t useCoordinate)
280 {
281 LogTracer lt(pointerEvent->GetId(), pointerEvent->GetEventType(), pointerEvent->GetPointerAction());
282 pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
283 #ifdef OHOS_BUILD_ENABLE_ONE_HAND_MODE
284 pointerEvent->SetAutoToVirtualScreen(isAutoToVirtualScreen);
285 #endif // OHOS_BUILD_ENABLE_ONE_HAND_MODE
286 PointerEvent::PointerItem pointerItem;
287 if (pointerEvent->GetPointerItem(pointerEvent->GetPointerId(), pointerItem)) {
288 MMI_HILOGD("isAutoToVirtualScreen:%{public}s, DXY:{%{private}d, %{private}d}, "
289 "FDXY:{%{private}.5f, %{private}.5f}",
290 isAutoToVirtualScreen ? "true" : "false", pointerItem.GetDisplayX(), pointerItem.GetDisplayY(),
291 pointerItem.GetFixedDisplayXPos(), pointerItem.GetFixedDisplayYPos());
292 } else {
293 MMI_HILOGD("isAutoToVirtualScreen=%{public}s", isAutoToVirtualScreen ? "true" : "false");
294 }
295 InputMgrImpl.SimulateInputEvent(pointerEvent, useCoordinate);
296 }
297
SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent,float zOrder,bool isAutoToVirtualScreen,int32_t useCoordinate)298 void InputManager::SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent, float zOrder,
299 bool isAutoToVirtualScreen, int32_t useCoordinate)
300 {
301 CHKPV(pointerEvent);
302 LogTracer lt(pointerEvent->GetId(), pointerEvent->GetEventType(), pointerEvent->GetPointerAction());
303 pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
304 pointerEvent->SetZOrder(zOrder);
305 #ifdef OHOS_BUILD_ENABLE_ONE_HAND_MODE
306 pointerEvent->SetAutoToVirtualScreen(isAutoToVirtualScreen);
307 #endif // OHOS_BUILD_ENABLE_ONE_HAND_MODE
308 PointerEvent::PointerItem pointerItem;
309 if (pointerEvent->GetPointerItem(pointerEvent->GetPointerId(), pointerItem)) {
310 MMI_HILOGD("zOrder:%{public}f, isAutoToVirtualScreen:%{public}s, DXY:{%{private}d, %{private}d}, "
311 "FDXY:{%{private}.5f, %{private}.5f}",
312 zOrder, isAutoToVirtualScreen ? "true" : "false", pointerItem.GetDisplayX(), pointerItem.GetDisplayY(),
313 pointerItem.GetFixedDisplayXPos(), pointerItem.GetFixedDisplayYPos());
314 } else {
315 MMI_HILOGD("zOrder=%{public}f, isAutoToVirtualScreen=%{public}s", zOrder,
316 isAutoToVirtualScreen ? "true" : "false");
317 }
318 InputMgrImpl.SimulateInputEvent(pointerEvent, useCoordinate);
319 }
320
SimulateTouchPadInputEvent(std::shared_ptr<PointerEvent> pointerEvent,const TouchpadCDG & touchpadCDG)321 void InputManager::SimulateTouchPadInputEvent(std::shared_ptr<PointerEvent> pointerEvent,
322 const TouchpadCDG &touchpadCDG)
323 {
324 CHKPV(pointerEvent);
325 LogTracer lt(pointerEvent->GetId(), pointerEvent->GetEventType(), pointerEvent->GetPointerAction());
326 pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
327 pointerEvent->SetZOrder(touchpadCDG.zOrder);
328 InputMgrImpl.SimulateTouchPadInputEvent(pointerEvent, touchpadCDG);
329 }
330
SimulateTouchPadEvent(std::shared_ptr<PointerEvent> pointerEvent)331 void InputManager::SimulateTouchPadEvent(std::shared_ptr<PointerEvent> pointerEvent)
332 {
333 CHKPV(pointerEvent);
334 LogTracer lt(pointerEvent->GetId(), pointerEvent->GetEventType(), pointerEvent->GetPointerAction());
335 pointerEvent->AddFlag(InputEvent::EVENT_FLAG_SIMULATE);
336 InputMgrImpl.SimulateTouchPadEvent(pointerEvent);
337 }
338
TransformMouseEventToTouchEvent(std::shared_ptr<PointerEvent> pointerEvent)339 bool InputManager::TransformMouseEventToTouchEvent(std::shared_ptr<PointerEvent> pointerEvent)
340 {
341 CHKPF(pointerEvent);
342 if (pointerEvent->GetSourceType() != PointerEvent::SOURCE_TYPE_MOUSE) {
343 MMI_HILOGD("It's not MouseEvent, don't need to transform");
344 return true;
345 }
346
347 int32_t result = -1;
348 if (MOUSE_TO_TOUCH_PARAM_MAP.count(pointerEvent->GetSourceType()) > 0) {
349 result = MOUSE_TO_TOUCH_PARAM_MAP.at(pointerEvent->GetSourceType());
350 pointerEvent->SetSourceType(result);
351 }
352
353 if (MOUSE_TO_TOUCH_PARAM_MAP.count(pointerEvent->GetPointerAction()) > 0) {
354 result = MOUSE_TO_TOUCH_PARAM_MAP.at(pointerEvent->GetPointerAction());
355 pointerEvent->SetPointerAction(result);
356 pointerEvent->SetOriginPointerAction(result);
357 }
358
359 if (MOUSE_TO_TOUCH_PARAM_MAP.count(pointerEvent->GetButtonId()) > 0) {
360 result = MOUSE_TO_TOUCH_PARAM_MAP.at(pointerEvent->GetButtonId());
361 pointerEvent->SetButtonId(result);
362 }
363
364 int32_t pointerId = pointerEvent->GetPointerId();
365 PointerEvent::PointerItem pointerItem;
366 if (!pointerEvent->GetPointerItem(pointerId, pointerItem)) {
367 MMI_HILOGE("Can't find pointer item, pointer:%{public}d", pointerId);
368 return false;
369 }
370
371 if (MOUSE_TO_TOUCH_PARAM_MAP.count(pointerItem.GetToolType()) > 0) {
372 result = MOUSE_TO_TOUCH_PARAM_MAP.at(pointerItem.GetToolType());
373 pointerItem.SetToolType(result);
374 }
375
376 pointerEvent->UpdatePointerItem(pointerId, pointerItem);
377 return true;
378 }
379
TransformTouchEventToMouseEvent(std::shared_ptr<PointerEvent> pointerEvent)380 bool InputManager::TransformTouchEventToMouseEvent(std::shared_ptr<PointerEvent> pointerEvent)
381 {
382 CHKPF(pointerEvent);
383 if (pointerEvent->GetSourceType() != PointerEvent::SOURCE_TYPE_TOUCHSCREEN) {
384 MMI_HILOGD("It's not TouchEvent, don't need to transform");
385 return true;
386 }
387
388 int32_t result = -1;
389 pointerEvent->SetSourceType(PointerEvent::SOURCE_TYPE_MOUSE);
390
391 if (TOUCH_TO_MOUSE_PARAM_MAP.count(pointerEvent->GetPointerAction()) > 0) {
392 result = TOUCH_TO_MOUSE_PARAM_MAP.at(pointerEvent->GetPointerAction());
393 pointerEvent->SetPointerAction(result);
394 pointerEvent->SetOriginPointerAction(result);
395 }
396
397 int32_t pointerId = pointerEvent->GetPointerId();
398 PointerEvent::PointerItem pointerItem;
399 if (!pointerEvent->GetPointerItem(pointerId, pointerItem)) {
400 MMI_HILOGE("Can't find pointer item, pointer:%{public}d", pointerId);
401 return false;
402 }
403
404 if (TOUCH_TO_MOUSE_PARAM_MAP.count(pointerItem.GetToolType()) > 0) {
405 result = TOUCH_TO_MOUSE_PARAM_MAP.at(pointerItem.GetToolType());
406 pointerItem.SetToolType(result);
407 }
408
409 if (pointerItem.GetTargetWindowId() > 0) {
410 pointerItem.SetTargetWindowId(PointerEvent::POINTER_INITIAL_VALUE);
411 }
412
413 pointerEvent->SetButtonId(PointerEvent::MOUSE_BUTTON_LEFT);
414
415 pointerEvent->UpdatePointerItem(pointerId, pointerItem);
416 return true;
417 }
418
RegisterDevListener(std::string type,std::shared_ptr<IInputDeviceListener> listener)419 int32_t InputManager::RegisterDevListener(std::string type, std::shared_ptr<IInputDeviceListener> listener)
420 {
421 return InputMgrImpl.RegisterDevListener(type, listener);
422 }
423
UnregisterDevListener(std::string type,std::shared_ptr<IInputDeviceListener> listener)424 int32_t InputManager::UnregisterDevListener(std::string type, std::shared_ptr<IInputDeviceListener> listener)
425 {
426 return InputMgrImpl.UnregisterDevListener(type, listener);
427 }
428
GetDeviceIds(std::function<void (std::vector<int32_t> &)> callback)429 int32_t InputManager::GetDeviceIds(std::function<void(std::vector<int32_t>&)> callback)
430 {
431 return InputMgrImpl.GetDeviceIds(callback);
432 }
433
GetDevice(int32_t deviceId,std::function<void (std::shared_ptr<InputDevice>)> callback)434 int32_t InputManager::GetDevice(int32_t deviceId,
435 std::function<void(std::shared_ptr<InputDevice>)> callback)
436 {
437 return InputMgrImpl.GetDevice(deviceId, callback);
438 }
439
SupportKeys(int32_t deviceId,std::vector<int32_t> keyCodes,std::function<void (std::vector<bool> &)> callback)440 int32_t InputManager::SupportKeys(int32_t deviceId, std::vector<int32_t> keyCodes,
441 std::function<void(std::vector<bool>&)> callback)
442 {
443 return InputMgrImpl.SupportKeys(deviceId, keyCodes, callback);
444 }
445
SetMouseScrollRows(int32_t Rows)446 int32_t InputManager::SetMouseScrollRows(int32_t Rows)
447 {
448 return InputMgrImpl.SetMouseScrollRows(Rows);
449 }
450
GetMouseScrollRows(int32_t & Rows)451 int32_t InputManager::GetMouseScrollRows(int32_t &Rows)
452 {
453 return InputMgrImpl.GetMouseScrollRows(Rows);
454 }
455
SetCustomCursor(int32_t windowId,void * pixelMap,int32_t focusX,int32_t focusY)456 int32_t InputManager::SetCustomCursor(int32_t windowId, void* pixelMap, int32_t focusX, int32_t focusY)
457 {
458 return InputMgrImpl.SetCustomCursor(windowId, focusX, focusY, pixelMap);
459 }
460
SetMouseIcon(int32_t windowId,void * pixelMap)461 int32_t InputManager::SetMouseIcon(int32_t windowId, void* pixelMap)
462 {
463 return InputMgrImpl.SetMouseIcon(windowId, pixelMap);
464 }
465
SetPointerSize(int32_t size)466 int32_t InputManager::SetPointerSize(int32_t size)
467 {
468 return InputMgrImpl.SetPointerSize(size);
469 }
470
GetPointerSize(int32_t & size)471 int32_t InputManager::GetPointerSize(int32_t &size)
472 {
473 return InputMgrImpl.GetPointerSize(size);
474 }
475
GetCursorSurfaceId(uint64_t & surfaceId)476 int32_t InputManager::GetCursorSurfaceId(uint64_t &surfaceId)
477 {
478 return InputMgrImpl.GetCursorSurfaceId(surfaceId);
479 }
480
SetMouseHotSpot(int32_t windowId,int32_t hotSpotX,int32_t hotSpotY)481 int32_t InputManager::SetMouseHotSpot(int32_t windowId, int32_t hotSpotX, int32_t hotSpotY)
482 {
483 return InputMgrImpl.SetMouseHotSpot(windowId, hotSpotX, hotSpotY);
484 }
485
SetMousePrimaryButton(int32_t primaryButton)486 int32_t InputManager::SetMousePrimaryButton(int32_t primaryButton)
487 {
488 return InputMgrImpl.SetMousePrimaryButton(primaryButton);
489 }
490
GetMousePrimaryButton(int32_t & primaryButton)491 int32_t InputManager::GetMousePrimaryButton(int32_t &primaryButton)
492 {
493 return InputMgrImpl.GetMousePrimaryButton(primaryButton);
494 }
495
SetHoverScrollState(bool state)496 int32_t InputManager::SetHoverScrollState(bool state)
497 {
498 return InputMgrImpl.SetHoverScrollState(state);
499 }
500
GetHoverScrollState(bool & state)501 int32_t InputManager::GetHoverScrollState(bool &state)
502 {
503 return InputMgrImpl.GetHoverScrollState(state);
504 }
505
SetPointerVisible(bool visible,int32_t priority)506 int32_t InputManager::SetPointerVisible(bool visible, int32_t priority)
507 {
508 return InputMgrImpl.SetPointerVisible(visible, priority);
509 }
510
IsPointerVisible()511 bool InputManager::IsPointerVisible()
512 {
513 return InputMgrImpl.IsPointerVisible();
514 }
515
SetPointerColor(int32_t color)516 int32_t InputManager::SetPointerColor(int32_t color)
517 {
518 return InputMgrImpl.SetPointerColor(color);
519 }
520
GetPointerColor(int32_t & color)521 int32_t InputManager::GetPointerColor(int32_t &color)
522 {
523 return InputMgrImpl.GetPointerColor(color);
524 }
525
EnableCombineKey(bool enable)526 int32_t InputManager::EnableCombineKey(bool enable)
527 {
528 return InputMgrImpl.EnableCombineKey(enable);
529 }
530
SetPointerSpeed(int32_t speed)531 int32_t InputManager::SetPointerSpeed(int32_t speed)
532 {
533 return InputMgrImpl.SetPointerSpeed(speed);
534 }
535
GetPointerSpeed(int32_t & speed)536 int32_t InputManager::GetPointerSpeed(int32_t &speed)
537 {
538 return InputMgrImpl.GetPointerSpeed(speed);
539 }
540
GetKeyboardType(int32_t deviceId,std::function<void (int32_t)> callback)541 int32_t InputManager::GetKeyboardType(int32_t deviceId, std::function<void(int32_t)> callback)
542 {
543 return InputMgrImpl.GetKeyboardType(deviceId, callback);
544 }
545
SetAnrObserver(std::shared_ptr<IAnrObserver> observer)546 void InputManager::SetAnrObserver(std::shared_ptr<IAnrObserver> observer)
547 {
548 // LCOV_EXCL_START
549 InputMgrImpl.SetAnrObserver(observer);
550 // LCOV_EXCL_STOP
551 }
552
SetPointerStyle(int32_t windowId,PointerStyle pointerStyle,bool isUiExtension)553 int32_t InputManager::SetPointerStyle(int32_t windowId, PointerStyle pointerStyle, bool isUiExtension)
554 {
555 return InputMgrImpl.SetPointerStyle(windowId, pointerStyle, isUiExtension);
556 }
557
GetPointerStyle(int32_t windowId,PointerStyle & pointerStyle,bool isUiExtension)558 int32_t InputManager::GetPointerStyle(int32_t windowId, PointerStyle &pointerStyle, bool isUiExtension)
559 {
560 return InputMgrImpl.GetPointerStyle(windowId, pointerStyle, isUiExtension);
561 }
562
GetFunctionKeyState(int32_t funcKey,bool & state)563 int32_t InputManager::GetFunctionKeyState(int32_t funcKey, bool &state)
564 {
565 return InputMgrImpl.GetFunctionKeyState(funcKey, state);
566 }
567
SetFunctionKeyState(int32_t funcKey,bool enable)568 int32_t InputManager::SetFunctionKeyState(int32_t funcKey, bool enable)
569 {
570 return InputMgrImpl.SetFunctionKeyState(funcKey, enable);
571 }
572
SetPointerLocation(int32_t x,int32_t y,int32_t displayId)573 int32_t InputManager::SetPointerLocation(int32_t x, int32_t y, int32_t displayId)
574 {
575 return InputMgrImpl.SetPointerLocation(x, y, displayId);
576 }
577
GetPointerLocation(int32_t & displayId,double & displayX,double & displayY)578 int32_t InputManager::GetPointerLocation(int32_t &displayId, double &displayX, double &displayY)
579 {
580 return InputMgrImpl.GetPointerLocation(displayId, displayX, displayY);
581 }
582
EnterCaptureMode(int32_t windowId)583 int32_t InputManager::EnterCaptureMode(int32_t windowId)
584 {
585 return InputMgrImpl.EnterCaptureMode(windowId);
586 }
587
LeaveCaptureMode(int32_t windowId)588 int32_t InputManager::LeaveCaptureMode(int32_t windowId)
589 {
590 return InputMgrImpl.LeaveCaptureMode(windowId);
591 }
592
AppendExtraData(const ExtraData & extraData)593 int32_t InputManager::AppendExtraData(const ExtraData& extraData)
594 {
595 return InputMgrImpl.AppendExtraData(extraData);
596 }
597
EnableInputDevice(bool enable)598 int32_t InputManager::EnableInputDevice(bool enable)
599 {
600 return InputMgrImpl.EnableInputDevice(enable);
601 }
602
AddVirtualInputDevice(std::shared_ptr<InputDevice> device,int32_t & deviceId)603 int32_t InputManager::AddVirtualInputDevice(std::shared_ptr<InputDevice> device, int32_t &deviceId)
604 {
605 return InputMgrImpl.AddVirtualInputDevice(device, deviceId);
606 }
607
RemoveVirtualInputDevice(int32_t deviceId)608 int32_t InputManager::RemoveVirtualInputDevice(int32_t deviceId)
609 {
610 return InputMgrImpl.RemoveVirtualInputDevice(deviceId);
611 }
612
SetKeyDownDuration(const std::string & businessId,int32_t delay)613 int32_t InputManager::SetKeyDownDuration(const std::string& businessId, int32_t delay)
614 {
615 return InputMgrImpl.SetKeyDownDuration(businessId, delay);
616 }
617
SetKeyboardRepeatDelay(int32_t delay)618 int32_t InputManager::SetKeyboardRepeatDelay(int32_t delay)
619 {
620 return InputMgrImpl.SetKeyboardRepeatDelay(delay);
621 }
622
SetKeyboardRepeatRate(int32_t rate)623 int32_t InputManager::SetKeyboardRepeatRate(int32_t rate)
624 {
625 return InputMgrImpl.SetKeyboardRepeatRate(rate);
626 }
627
GetKeyboardRepeatDelay(std::function<void (int32_t)> callback)628 int32_t InputManager::GetKeyboardRepeatDelay(std::function<void(int32_t)> callback)
629 {
630 return InputMgrImpl.GetKeyboardRepeatDelay(callback);
631 }
632
GetKeyboardRepeatRate(std::function<void (int32_t)> callback)633 int32_t InputManager::GetKeyboardRepeatRate(std::function<void(int32_t)> callback)
634 {
635 return InputMgrImpl.GetKeyboardRepeatRate(callback);
636 }
637
638 #ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT
SetEnhanceConfig(uint8_t * cfg,uint32_t cfgLen)639 void InputManager::SetEnhanceConfig(uint8_t *cfg, uint32_t cfgLen)
640 {
641 InputMgrImpl.SetEnhanceConfig(cfg, cfgLen);
642 }
643 #endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT
644
SetTouchpadScrollSwitch(bool switchFlag)645 int32_t InputManager::SetTouchpadScrollSwitch(bool switchFlag)
646 {
647 return InputMgrImpl.SetTouchpadScrollSwitch(switchFlag);
648 }
649
GetTouchpadScrollSwitch(bool & switchFlag)650 int32_t InputManager::GetTouchpadScrollSwitch(bool &switchFlag)
651 {
652 return InputMgrImpl.GetTouchpadScrollSwitch(switchFlag);
653 }
SetTouchpadScrollDirection(bool state)654 int32_t InputManager::SetTouchpadScrollDirection(bool state)
655 {
656 return InputMgrImpl.SetTouchpadScrollDirection(state);
657 }
658
GetTouchpadScrollDirection(bool & state)659 int32_t InputManager::GetTouchpadScrollDirection(bool &state)
660 {
661 return InputMgrImpl.GetTouchpadScrollDirection(state);
662 }
SetTouchpadTapSwitch(bool switchFlag)663 int32_t InputManager::SetTouchpadTapSwitch(bool switchFlag)
664 {
665 return InputMgrImpl.SetTouchpadTapSwitch(switchFlag);
666 }
667
GetTouchpadTapSwitch(bool & switchFlag)668 int32_t InputManager::GetTouchpadTapSwitch(bool &switchFlag)
669 {
670 return InputMgrImpl.GetTouchpadTapSwitch(switchFlag);
671 }
672
SetTouchpadPointerSpeed(int32_t speed)673 int32_t InputManager::SetTouchpadPointerSpeed(int32_t speed)
674 {
675 return InputMgrImpl.SetTouchpadPointerSpeed(speed);
676 }
677
GetTouchpadPointerSpeed(int32_t & speed)678 int32_t InputManager::GetTouchpadPointerSpeed(int32_t &speed)
679 {
680 return InputMgrImpl.GetTouchpadPointerSpeed(speed);
681 }
682
GetTouchpadCDG(TouchpadCDG & touchpadCDG)683 int32_t InputManager::GetTouchpadCDG(TouchpadCDG &touchpadCDG)
684 {
685 return InputMgrImpl.GetTouchpadCDG(touchpadCDG);
686 }
687
SetTouchpadPinchSwitch(bool switchFlag)688 int32_t InputManager::SetTouchpadPinchSwitch(bool switchFlag)
689 {
690 return InputMgrImpl.SetTouchpadPinchSwitch(switchFlag);
691 }
692
GetTouchpadPinchSwitch(bool & switchFlag)693 int32_t InputManager::GetTouchpadPinchSwitch(bool &switchFlag)
694 {
695 return InputMgrImpl.GetTouchpadPinchSwitch(switchFlag);
696 }
697
SetTouchpadSwipeSwitch(bool switchFlag)698 int32_t InputManager::SetTouchpadSwipeSwitch(bool switchFlag)
699 {
700 return InputMgrImpl.SetTouchpadSwipeSwitch(switchFlag);
701 }
702
GetTouchpadSwipeSwitch(bool & switchFlag)703 int32_t InputManager::GetTouchpadSwipeSwitch(bool &switchFlag)
704 {
705 return InputMgrImpl.GetTouchpadSwipeSwitch(switchFlag);
706 }
707
SetTouchpadRightClickType(int32_t type)708 int32_t InputManager::SetTouchpadRightClickType(int32_t type)
709 {
710 return InputMgrImpl.SetTouchpadRightClickType(type);
711 }
712
GetTouchpadRightClickType(int32_t & type)713 int32_t InputManager::GetTouchpadRightClickType(int32_t &type)
714 {
715 return InputMgrImpl.GetTouchpadRightClickType(type);
716 }
717
SetTouchpadRotateSwitch(bool rotateSwitch)718 int32_t InputManager::SetTouchpadRotateSwitch(bool rotateSwitch)
719 {
720 return InputMgrImpl.SetTouchpadRotateSwitch(rotateSwitch);
721 }
722
GetTouchpadRotateSwitch(bool & rotateSwitch)723 int32_t InputManager::GetTouchpadRotateSwitch(bool &rotateSwitch)
724 {
725 return InputMgrImpl.GetTouchpadRotateSwitch(rotateSwitch);
726 }
727
SetTouchpadDoubleTapAndDragState(bool switchFlag)728 int32_t InputManager::SetTouchpadDoubleTapAndDragState(bool switchFlag)
729 {
730 return InputMgrImpl.SetTouchpadDoubleTapAndDragState(switchFlag);
731 }
732
GetTouchpadDoubleTapAndDragState(bool & switchFlag)733 int32_t InputManager::GetTouchpadDoubleTapAndDragState(bool &switchFlag)
734 {
735 return InputMgrImpl.GetTouchpadDoubleTapAndDragState(switchFlag);
736 }
737
EnableHardwareCursorStats(bool enable)738 int32_t InputManager::EnableHardwareCursorStats(bool enable)
739 {
740 return InputMgrImpl.EnableHardwareCursorStats(enable);
741 }
742
GetHardwareCursorStats(uint32_t & frameCount,uint32_t & vsyncCount)743 int32_t InputManager::GetHardwareCursorStats(uint32_t &frameCount, uint32_t &vsyncCount)
744 {
745 return InputMgrImpl.GetHardwareCursorStats(frameCount, vsyncCount);
746 }
747
GetPointerSnapshot(void * pixelMapPtr)748 int32_t InputManager::GetPointerSnapshot(void *pixelMapPtr)
749 {
750 return InputMgrImpl.GetPointerSnapshot(pixelMapPtr);
751 }
752
SetTouchpadScrollRows(int32_t rows)753 int32_t InputManager::SetTouchpadScrollRows(int32_t rows)
754 {
755 return InputMgrImpl.SetTouchpadScrollRows(rows);
756 }
757
GetTouchpadScrollRows(int32_t & rows)758 int32_t InputManager::GetTouchpadScrollRows(int32_t &rows)
759 {
760 return InputMgrImpl.GetTouchpadScrollRows(rows);
761 }
762
ClearWindowPointerStyle(int32_t pid,int32_t windowId)763 void InputManager::ClearWindowPointerStyle(int32_t pid, int32_t windowId)
764 {
765 InputMgrImpl.ClearWindowPointerStyle(pid, windowId);
766 }
767
SetNapStatus(int32_t pid,int32_t uid,const std::string & bundleName,int32_t napStatus)768 void InputManager::SetNapStatus(int32_t pid, int32_t uid, const std::string &bundleName, int32_t napStatus)
769 {
770 InputMgrImpl.SetNapStatus(pid, uid, bundleName, napStatus);
771 }
772
SetShieldStatus(int32_t shieldMode,bool isShield)773 int32_t InputManager::SetShieldStatus(int32_t shieldMode, bool isShield)
774 {
775 return InputMgrImpl.SetShieldStatus(shieldMode, isShield);
776 }
777
GetShieldStatus(int32_t shieldMode,bool & isShield)778 int32_t InputManager::GetShieldStatus(int32_t shieldMode, bool &isShield)
779 {
780 return InputMgrImpl.GetShieldStatus(shieldMode, isShield);
781 }
782
AddServiceWatcher(std::shared_ptr<IInputServiceWatcher> watcher)783 void InputManager::AddServiceWatcher(std::shared_ptr<IInputServiceWatcher> watcher)
784 {
785 InputMgrImpl.AddServiceWatcher(watcher);
786 }
787
RemoveServiceWatcher(std::shared_ptr<IInputServiceWatcher> watcher)788 void InputManager::RemoveServiceWatcher(std::shared_ptr<IInputServiceWatcher> watcher)
789 {
790 InputMgrImpl.RemoveServiceWatcher(watcher);
791 }
792
MarkProcessed(int32_t eventId,int64_t actionTime,bool enable)793 int32_t InputManager::MarkProcessed(int32_t eventId, int64_t actionTime, bool enable)
794 {
795 LogTracer lt(eventId, 0, 0);
796 if (enable) {
797 return InputMgrImpl.MarkProcessed(eventId, actionTime);
798 }
799 MMI_HILOGD("Skip MarkProcessed eventId:%{public}d", eventId);
800 return RET_OK;
801 }
802
GetKeyState(std::vector<int32_t> & pressedKeys,std::map<int32_t,int32_t> & specialKeysState)803 int32_t InputManager::GetKeyState(std::vector<int32_t> &pressedKeys, std::map<int32_t, int32_t> &specialKeysState)
804 {
805 return InputMgrImpl.GetKeyState(pressedKeys, specialKeysState);
806 }
807
Authorize(bool isAuthorize)808 void InputManager::Authorize(bool isAuthorize)
809 {
810 InputMgrImpl.Authorize(isAuthorize);
811 }
812
RequestInjection(int32_t & status,int32_t & reqId)813 int32_t InputManager::RequestInjection(int32_t &status, int32_t &reqId)
814 {
815 int32_t ret = InputMgrImpl.RequestInjection(status, reqId);
816 return ret;
817 }
818
QueryAuthorizedStatus(int32_t & status)819 int32_t InputManager::QueryAuthorizedStatus(int32_t &status)
820 {
821 int32_t ret = InputMgrImpl.QueryAuthorizedStatus(status);
822 return ret;
823 }
824
RequestInjectionCallback(int32_t reqId,int32_t status)825 void InputManager::RequestInjectionCallback(int32_t reqId, int32_t status)
826 {
827 std::lock_guard<std::mutex> lock(mutexMapCallBack_);
828 auto itFind = mapCallBack_.find(reqId);
829 if (itFind != mapCallBack_.end()) {
830 itFind->second(status);
831 mapCallBack_.erase(itFind);
832 }
833 }
834
InsertRequestInjectionCallback(int32_t reqId,std::function<void (int32_t)> fun)835 void InputManager::InsertRequestInjectionCallback(int32_t reqId, std::function<void(int32_t)> fun)
836 {
837 std::lock_guard<std::mutex> lock(mutexMapCallBack_);
838 mapCallBack_[reqId] = fun;
839 }
840
HasIrEmitter(bool & hasIrEmitter)841 int32_t InputManager::HasIrEmitter(bool &hasIrEmitter)
842 {
843 return InputMgrImpl.HasIrEmitter(hasIrEmitter);
844 }
845
GetInfraredFrequencies(std::vector<InfraredFrequency> & requencys)846 int32_t InputManager::GetInfraredFrequencies(std::vector<InfraredFrequency>& requencys)
847 {
848 return InputMgrImpl.GetInfraredFrequencies(requencys);
849 }
850
TransmitInfrared(int64_t number,std::vector<int64_t> & pattern)851 int32_t InputManager::TransmitInfrared(int64_t number, std::vector<int64_t>& pattern)
852 {
853 return InputMgrImpl.TransmitInfrared(number, pattern);
854 }
855
856 #ifdef OHOS_BUILD_ENABLE_VKEYBOARD
CreateVKeyboardDevice(sptr<IRemoteObject> & vkeyboardDevice)857 int32_t InputManager::CreateVKeyboardDevice(sptr<IRemoteObject> &vkeyboardDevice)
858 {
859 return InputMgrImpl.CreateVKeyboardDevice(vkeyboardDevice);
860 }
861 #endif // OHOS_BUILD_ENABLE_VKEYBOARD
862
SetCurrentUser(int32_t userId)863 int32_t InputManager::SetCurrentUser(int32_t userId)
864 {
865 return InputMgrImpl.SetCurrentUser(userId);
866 }
867
SetMoveEventFilters(bool flag)868 int32_t InputManager::SetMoveEventFilters(bool flag)
869 {
870 return InputMgrImpl.SetMoveEventFilters(flag);
871 }
872
SetTouchpadThreeFingersTapSwitch(bool switchFlag)873 int32_t InputManager::SetTouchpadThreeFingersTapSwitch(bool switchFlag)
874 {
875 return InputMgrImpl.SetTouchpadThreeFingersTapSwitch(switchFlag);
876 }
877
GetTouchpadThreeFingersTapSwitch(bool & switchFlag)878 int32_t InputManager::GetTouchpadThreeFingersTapSwitch(bool &switchFlag)
879 {
880 return InputMgrImpl.GetTouchpadThreeFingersTapSwitch(switchFlag);
881 }
882
GetWinSyncBatchSize(int32_t maxAreasCount,int32_t displayCount)883 int32_t InputManager::GetWinSyncBatchSize(int32_t maxAreasCount, int32_t displayCount)
884 {
885 return InputMgrImpl.GetWinSyncBatchSize(maxAreasCount, displayCount);
886 }
887
AncoAddConsumer(std::shared_ptr<IAncoConsumer> consumer)888 int32_t InputManager::AncoAddConsumer(std::shared_ptr<IAncoConsumer> consumer)
889 {
890 return InputMgrImpl.AncoAddChannel(consumer);
891 }
892
AncoRemoveConsumer(std::shared_ptr<IAncoConsumer> consumer)893 int32_t InputManager::AncoRemoveConsumer(std::shared_ptr<IAncoConsumer> consumer)
894 {
895 return InputMgrImpl.AncoRemoveChannel(consumer);
896 }
897
SkipPointerLayer(bool isSkip)898 int32_t InputManager::SkipPointerLayer(bool isSkip)
899 {
900 return InputMgrImpl.SkipPointerLayer(isSkip);
901 }
902
RegisterWindowStateErrorCallback(std::function<void (int32_t,int32_t)> callback)903 int32_t InputManager::RegisterWindowStateErrorCallback(std::function<void(int32_t, int32_t)> callback)
904 {
905 return InputMgrImpl.RegisterWindowStateErrorCallback(callback);
906 }
907
GetIntervalSinceLastInput(int64_t & timeInterval)908 int32_t InputManager::GetIntervalSinceLastInput(int64_t &timeInterval)
909 {
910 return InputMgrImpl.GetIntervalSinceLastInput(timeInterval);
911 }
912
GetAllSystemHotkeys(std::vector<std::unique_ptr<KeyOption>> & keyOptions,int32_t & count)913 int32_t InputManager::GetAllSystemHotkeys(std::vector<std::unique_ptr<KeyOption>> &keyOptions, int32_t &count)
914 {
915 return InputMgrImpl.GetAllSystemHotkeys(keyOptions, count);
916 }
917
ConvertToCapiKeyAction(int32_t keyAction)918 int32_t InputManager::ConvertToCapiKeyAction(int32_t keyAction)
919 {
920 return InputMgrImpl.ConvertToCapiKeyAction(keyAction);
921 }
922
SetInputDeviceEnabled(int32_t deviceId,bool enable,std::function<void (int32_t)> callback)923 int32_t InputManager::SetInputDeviceEnabled(int32_t deviceId, bool enable, std::function<void(int32_t)> callback)
924 {
925 return InputMgrImpl.SetInputDeviceEnabled(deviceId, enable, callback);
926 }
927
ShiftAppPointerEvent(const ShiftWindowParam & param,bool autoGenDown)928 int32_t InputManager::ShiftAppPointerEvent(const ShiftWindowParam ¶m, bool autoGenDown)
929 {
930 HITRACE_METER_NAME(HITRACE_TAG_MULTIMODALINPUT, "shift pointer event entry");
931 return InputMgrImpl.ShiftAppPointerEvent(param, autoGenDown);
932 }
933
SetCustomCursor(int32_t windowId,CustomCursor cursor,CursorOptions options)934 int32_t InputManager::SetCustomCursor(int32_t windowId, CustomCursor cursor, CursorOptions options)
935 {
936 return InputMgrImpl.SetCustomCursor(windowId, cursor, options);
937 }
938
CheckKnuckleEvent(float pointX,float pointY,bool & isKnuckleType)939 int32_t InputManager::CheckKnuckleEvent(float pointX, float pointY, bool &isKnuckleType)
940 {
941 return InputMgrImpl.CheckKnuckleEvent(pointX, pointY, isKnuckleType);
942 }
943
SetMultiWindowScreenId(uint64_t screenId,uint64_t displayNodeScreenId)944 void InputManager::SetMultiWindowScreenId(uint64_t screenId, uint64_t displayNodeScreenId)
945 {
946 InputMgrImpl.SetMultiWindowScreenId(screenId, displayNodeScreenId);
947 }
948
SetKnuckleSwitch(bool knuckleSwitch)949 int32_t InputManager::SetKnuckleSwitch(bool knuckleSwitch)
950 {
951 return InputMgrImpl.SetKnuckleSwitch(knuckleSwitch);
952 }
953
LaunchAiScreenAbility()954 int32_t InputManager::LaunchAiScreenAbility()
955 {
956 return InputMgrImpl.LaunchAiScreenAbility();
957 }
958
GetMaxMultiTouchPointNum(int32_t & pointNum)959 int32_t InputManager::GetMaxMultiTouchPointNum(int32_t &pointNum)
960 {
961 return InputMgrImpl.GetMaxMultiTouchPointNum(pointNum);
962 }
963
SetInputDeviceConsumer(const std::vector<std::string> & deviceNames,std::shared_ptr<IInputEventConsumer> consumer)964 int32_t InputManager::SetInputDeviceConsumer(const std::vector<std::string>& deviceNames,
965 std::shared_ptr<IInputEventConsumer> consumer)
966 {
967 return InputMgrImpl.SetInputDeviceConsumer(deviceNames, consumer);
968 }
969
SubscribeInputActive(std::shared_ptr<IInputEventConsumer> inputEventConsumer,int64_t interval)970 int32_t InputManager::SubscribeInputActive(std::shared_ptr<IInputEventConsumer> inputEventConsumer, int64_t interval)
971 {
972 return InputMgrImpl.SubscribeInputActive(inputEventConsumer, interval);
973 }
974
UnsubscribeInputActive(int32_t subscribeId)975 void InputManager::UnsubscribeInputActive(int32_t subscribeId)
976 {
977 InputMgrImpl.UnsubscribeInputActive(subscribeId);
978 }
979
SetMouseAccelerateMotionSwitch(int32_t deviceId,bool enable)980 int32_t InputManager::SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable)
981 {
982 return InputMgrImpl.SetMouseAccelerateMotionSwitch(deviceId, enable);
983 }
984
SwitchScreenCapturePermission(uint32_t permissionType,bool enable)985 int32_t InputManager::SwitchScreenCapturePermission(uint32_t permissionType, bool enable)
986 {
987 return InputMgrImpl.SwitchScreenCapturePermission(permissionType, enable);
988 }
989
ClearMouseHideFlag(int32_t eventId)990 int32_t InputManager::ClearMouseHideFlag(int32_t eventId)
991 {
992 return InputMgrImpl.ClearMouseHideFlag(eventId);
993 }
994
QueryPointerRecord(int32_t count,std::vector<std::shared_ptr<PointerEvent>> & pointerList)995 int32_t InputManager::QueryPointerRecord(int32_t count, std::vector<std::shared_ptr<PointerEvent>> &pointerList)
996 {
997 return InputMgrImpl.QueryPointerRecord(count, pointerList);
998 }
999 } // namespace MMI
1000 } // namespace OHOS
1001