• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 #ifndef INPUT_MANAGER_H
17 #define INPUT_MANAGER_H
18 
19 #include <list>
20 #include <map>
21 #include <memory>
22 
23 #include "event_handler.h"
24 #include "nocopyable.h"
25 
26 #include "error_multimodal.h"
27 #include "extra_data.h"
28 #include "i_anr_observer.h"
29 #include "i_input_device_listener.h"
30 #include "i_input_event_consumer.h"
31 #include "i_input_event_filter.h"
32 #include "input_device.h"
33 #include "key_option.h"
34 #include "pointer_style.h"
35 #include "window_info.h"
36 
37 namespace OHOS {
38 namespace MMI {
39 class InputManager {
40 public:
41     /**
42      * @brief Obtains an <b>InputManager</b> instance.
43      * @return Returns the pointer to the <b>InputManager</b> instance.
44      * @since 9
45      */
46     static InputManager *GetInstance();
47     virtual ~InputManager() = default;
48 
49     int32_t GetDisplayBindInfo(DisplayBindInfos &infos);
50     int32_t SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg);
51 
52     /**
53      * @brief Updates the screen and window information.
54      * @param displayGroupInfo Indicates the logical screen information.
55      * @since 9
56      */
57     void UpdateDisplayInfo(const DisplayGroupInfo &displayGroupInfo);
58 
59     int32_t AddInputEventFilter(std::shared_ptr<IInputEventFilter> filter, int32_t priority, uint32_t deviceTags);
60     int32_t RemoveInputEventFilter(int32_t filterId);
61 
62     /**
63      * @brief Sets a consumer for the window input event of the current process.
64      * @param inputEventConsumer Indicates the consumer to set. The window input event of the current process
65      * will be called back to the consumer object for processing.
66      * @since 9
67      */
68     void SetWindowInputEventConsumer(std::shared_ptr<IInputEventConsumer> inputEventConsumer);
69 
70     /**
71      * @brief Sets a window input event consumer that runs on the specified thread.
72      * @param inputEventConsumer Indicates the consumer to set.
73      * @param eventHandler Indicates the thread running the consumer.
74      * @since 9
75      */
76     void SetWindowInputEventConsumer(std::shared_ptr<IInputEventConsumer> inputEventConsumer,
77         std::shared_ptr<AppExecFwk::EventHandler> eventHandler);
78 
79     /**
80      * @brief Subscribes to the key input event that meets a specific condition. When such an event occurs,
81      * the <b>callback</b> specified is invoked to process the event.
82      * @param keyOption Indicates the condition of the key input event.
83      * @param callback Indicates the callback.
84      * @return Returns the subscription ID, which uniquely identifies a subscription in the process.
85      * If the value is greater than or equal to <b>0</b>,
86      * the subscription is successful. Otherwise, the subscription fails.
87      * @since 9
88      */
89     int32_t SubscribeKeyEvent(std::shared_ptr<KeyOption> keyOption,
90         std::function<void(std::shared_ptr<KeyEvent>)> callback);
91 
92     /**
93      * @brief Unsubscribes from a key input event.
94      * @param subscriberId Indicates the subscription ID, which is the return value of <b>SubscribeKeyEvent</b>.
95      * @return void
96      * @since 9
97      */
98     void UnsubscribeKeyEvent(int32_t subscriberId);
99 
100     /**
101      * @brief Subscribes to the switch input event that meets a specific condition. When such an event occurs,
102      * the <b>callback</b> specified is invoked to process the event.
103      * @param callback Indicates the callback.
104      * @return Returns the subscription ID, which uniquely identifies a subscription in the process.
105      * If the value is greater than or equal to <b>0</b>,
106      * the subscription is successful. Otherwise, the subscription fails.
107      * @since 9
108      */
109     int32_t SubscribeSwitchEvent(std::function<void(std::shared_ptr<SwitchEvent>)> callback);
110 
111     /**
112      * @brief Unsubscribes from a switch input event.
113      * @param subscriberId Indicates the subscription ID, which is the return value of <b>SubscribeKeyEvent</b>.
114      * @return void
115      * @since 9
116      */
117     void UnsubscribeSwitchEvent(int32_t subscriberId);
118 
119     /**
120      * @brief Adds an input event monitor. After such a monitor is added,
121      * an input event is copied and distributed to the monitor while being distributed to the original target.
122      * @param monitor Indicates the input event monitor. After an input event is generated,
123      * the functions of the monitor object will be called.
124      * @return Returns the monitor ID, which uniquely identifies a monitor in the process.
125      * If the value is greater than or equal to <b>0</b>, the monitor is successfully added. Otherwise,
126      * the monitor fails to be added.
127      * @since 9
128      */
129     int32_t AddMonitor(std::function<void(std::shared_ptr<KeyEvent>)> monitor);
130 
131     /**
132      * @brief Adds an input event monitor. After such a monitor is added,
133      * an input event is copied and distributed to the monitor while being distributed to the original target.
134      * @param monitor Indicates the input event monitor. After an input event is generated,
135      * the functions of the monitor object will be called.
136      * @return Returns the monitor ID, which uniquely identifies a monitor in the process.
137      * If the value is greater than or equal to <b>0</b>, the monitor is successfully added. Otherwise,
138      * the monitor fails to be added.
139      * @since 9
140      */
141     int32_t AddMonitor(std::function<void(std::shared_ptr<PointerEvent>)> monitor);
142 
143     /**
144      * @brief Adds an input event monitor. After such a monitor is added,
145      * an input event is copied and distributed to the monitor while being distributed to the original target.
146      * @param monitor Indicates the input event monitor. After an input event is generated,
147      * the functions of the monitor object will be called.
148      * @return Returns the monitor ID, which uniquely identifies a monitor in the process.
149      * If the value is greater than or equal to <b>0</b>, the monitor is successfully added. Otherwise,
150      * the monitor fails to be added.
151      * @since 9
152      */
153     int32_t AddMonitor(std::shared_ptr<IInputEventConsumer> monitor);
154 
155     /**
156      * @brief Removes a monitor.
157      * @param monitorId Indicates the monitor ID, which is the return value of <b>AddMonitor</b>.
158      * @return void
159      * @since 9
160      */
161     void RemoveMonitor(int32_t monitorId);
162 
163     /**
164      * @brief Marks that a monitor has consumed a touchscreen input event. After being consumed,
165      * the touchscreen input event will not be distributed to the original target.
166      * @param monitorId Indicates the monitor ID.
167      * @param eventId Indicates the ID of the consumed touchscreen input event.
168      * @return void
169      * @since 9
170      */
171     void MarkConsumed(int32_t monitorId, int32_t eventId);
172 
173     /**
174      * @brief Moves the cursor to the specified position.
175      * @param offsetX Indicates the offset on the X axis.
176      * @param offsetY Indicates the offset on the Y axis.
177      * @return void
178      * @since 9
179      */
180     void MoveMouse(int32_t offsetX, int32_t offsetY);
181 
182     /**
183      * @brief Adds an input event interceptor. After such an interceptor is added,
184      * an input event will be distributed to the interceptor instead of the original target and monitor.
185      * @param interceptor Indicates the input event interceptor. After an input event is generated,
186      * the functions of the interceptor object will be called.
187      * @return Returns the interceptor ID, which uniquely identifies an interceptor in the process.
188      * If the value is greater than or equal to <b>0</b>,the interceptor is successfully added. Otherwise,
189      * the interceptor fails to be added.
190      * @since 9
191      */
192     int32_t AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptor);
193     int32_t AddInterceptor(std::function<void(std::shared_ptr<KeyEvent>)> interceptor);
194     int32_t AddInterceptor(std::shared_ptr<IInputEventConsumer> interceptor, int32_t priority, uint32_t deviceTags);
195 
196     /**
197      * @brief Removes an interceptor.
198      * @param interceptorId Indicates the interceptor ID, which is the return value of <b>AddInterceptor</b>.
199      * @return void
200      * @since 9
201      */
202     void RemoveInterceptor(int32_t interceptorId);
203 
204     /**
205      * @brief Simulates a key input event. This event will be distributed and
206      * processed in the same way as the event reported by the input device.
207      * @param keyEvent Indicates the key input event to simulate.
208      * @return void
209      * @since 9
210      */
211     void SimulateInputEvent(std::shared_ptr<KeyEvent> keyEvent);
212 
213     /**
214      * @brief Simulates a touchpad input event, touchscreen input event, or mouse device input event.
215      * This event will be distributed and processed in the same way as the event reported by the input device.
216      * @param pointerEvent Indicates the touchpad input event, touchscreen input event,
217      * or mouse device input event to simulate.
218      * @return void
219      * @since 9
220      */
221     void SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent);
222 
223     /**
224      * @brief Simulates a key input event.
225      * This event will be sent to hmos container.
226      * @param keyEvent Indicates the key input event to simulate.
227      * @return void
228      * @since 9
229      */
230     void SimulateInputEventToHmosContainer(std::shared_ptr<KeyEvent> keyEvent);
231 
232     /**
233      * @brief Simulates a touchpad input event, touchscreen input event, or mouse device input event.
234      * This event will be sent to hmos container.
235      * @param pointerEvent Indicates the touchpad input event, touchscreen input event,
236      * or mouse device input event to simulate.
237      * @return void
238      * @since 9
239      */
240     void SimulateInputEventToHmosContainer(std::shared_ptr<PointerEvent> pointerEvent);
241 
242     /**
243      * @brief Starts listening for an input device event.
244      * @param type Indicates the type of the input device event, which is <b>change</b>.
245      * @param listener Indicates the listener for the input device event.
246      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
247      * @since 9
248      */
249     int32_t RegisterDevListener(std::string type, std::shared_ptr<IInputDeviceListener> listener);
250 
251     /**
252      * @brief Stops listening for an input device event.
253      * @param type Indicates the type of the input device event, which is <b>change</b>.
254      * @param listener Indicates the listener for the input device event.
255      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
256      * @since 9
257      */
258     int32_t UnregisterDevListener(std::string type, std::shared_ptr<IInputDeviceListener> listener = nullptr);
259 
260     /**
261      * @brief Obtains the information about an input device.
262      * @param callback Indicates the callback used to receive the reported data.
263      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
264      * @since 9
265      */
266     int32_t GetDeviceIds(std::function<void(std::vector<int32_t>&)> callback);
267 
268     /**
269      * @brief Obtains the information about an input device.
270      * @param deviceId Indicates the ID of the input device whose information is to be obtained.
271      * @param callback Indicates the callback used to receive the reported data.
272      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
273      * @since 9
274      */
275     int32_t GetDevice(int32_t deviceId, std::function<void(std::shared_ptr<InputDevice>)> callback);
276 
277     /**
278      * @brief Checks whether the specified key codes of an input device are supported.
279      * @param deviceId Indicates the ID of the input device.
280      * @param keyCodes Indicates the key codes of the input device.
281      * @param callback Indicates the callback used to receive the reported data.
282      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
283      * @since 9
284      */
285     int32_t SupportKeys(int32_t deviceId, std::vector<int32_t> keyCodes,
286         std::function<void(std::vector<bool>&)> callback);
287 
288     /**
289      * @brief Sets the number of the mouse scrolling rows.
290      * @param rows Indicates the number of the mouse scrolling rows.
291      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
292      * @since 9
293      */
294     int32_t SetMouseScrollRows(int32_t rows);
295 
296     /**
297      * @brief Set pixelMap to override ohos mouse icon resouce.
298      * @param windowId Indicates the windowId of the window
299      * @param pixelMap Indicates the image resouce for this mouse icon. which realtype must be OHOS::Media::PixelMap*
300      * @return vint32_t
301      * @since 10
302      */
303     int32_t SetMouseIcon(int32_t windowId, void* pixelMap);
304 
305     /**
306      * @brief Set mouse icon hot spot.
307      * @param windowId Indicates the windowId of the window
308      * @param hotSpotX Indicates the hot spot x for this mouse icon.
309      * @param hotSpotY Indicates the hot spot y for this mouse icon.
310      * @return vint32_t
311      * @since 10
312      */
313     int32_t SetMouseHotSpot(int32_t windowId, int32_t hotSpotX, int32_t hotSpotY);
314 
315     /**
316      * @brief Gets the number of the mouse scrolling rows.
317      * @param rows Indicates the number of the mouse scrolling rows.
318      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
319      * @since 9
320      */
321     int32_t GetMouseScrollRows(int32_t &rows);
322 
323     /**
324      * @brief Sets pointer size.
325      * @param size Indicates pointer size.
326      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
327      * @since 9
328      */
329     int32_t SetPointerSize(int32_t size);
330 
331     /**
332      * @brief Gets pointer size.
333      * @param size Indicates pointer size.
334      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
335      * @since 9
336      */
337     int32_t GetPointerSize(int32_t &size);
338 
339     /**
340      * @brief Sets mouse primary button.
341      * @param primaryButton Indicates the ID of the mouse primary button.The value 0 indicates that
342      * the primary button is left button.The value 1 indicates that the primary button is right button.
343      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
344      * @since 9
345      */
346     int32_t SetMousePrimaryButton(int32_t primaryButton);
347 
348     /**
349      * @brief Gets mouse primary button.
350      * @param primaryButton Indicates the ID of the mouse primary button.The value 0 indicates that
351      * the primary button is left button.The value 1 indicates that the primary button is right button.
352      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
353      * @since 9
354      */
355     int32_t GetMousePrimaryButton(int32_t &primaryButton);
356 
357     /**
358      * @brief Sets whether the mouse hover scroll is enabled in inactive window.
359      * @param state Indicates whether the mouse hover scroll is enabled in inactive window. The value true
360      * indicates that the mouse hover scroll is enabled, and the value false indicates the opposite.
361      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
362      * @since 9
363      */
364     int32_t SetHoverScrollState(bool state);
365 
366     /**
367      * @brief Gets a status whether the mouse hover scroll is enabled in inactive window.
368      * @param state Indicates whether the mouse hover scroll is enabled in inactive window. The value true
369      * indicates that the mouse hover scroll is enabled, and the value false indicates the opposite.
370      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
371      * @since 9
372      */
373     int32_t GetHoverScrollState(bool &state);
374 
375     /**
376      * @brief Sets whether the pointer icon is visible.
377      * @param visible Indicates whether the pointer icon is visible. The value <b>true</b> indicates that
378      * the pointer icon is visible, and the value <b>false</b> indicates the opposite.
379      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
380      * @since 9
381      */
382     int32_t SetPointerVisible(bool visible);
383 
384     /**
385      * @brief Checks whether the pointer icon is visible.
386      * @return Returns <b>true</b> if the pointer icon is visible; returns <b>false</b> otherwise.
387      * @since 9
388      */
389     bool IsPointerVisible();
390 
391     /**
392      * @brief Sets the mouse pointer style.
393      * @param windowId Indicates the ID of the window for which the mouse pointer style is set.
394      * @param pointerStyle Indicates the ID of the mouse pointer style.
395      * @return Returns <b>0</b> if the operation is successful; returns an error code otherwise.
396      * @since 9
397      */
398     int32_t SetPointerStyle(int32_t windowId, PointerStyle pointerStyle);
399 
400     /**
401      * @brief Obtains the mouse pointer style.
402      * @param windowId Indicates the ID of the window for which the mouse pointer style is obtained.
403      * @param pointerStyle Indicates the ID of the mouse pointer style.
404      * @return Returns <b>0</b> if the operation is successful; returns an error code otherwise.
405      * @since 9
406      */
407     int32_t GetPointerStyle(int32_t windowId, PointerStyle &pointerStyle);
408 
409     /**
410      * @brief Sets pointer color.
411      * @param color Indicates pointer color.
412      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
413      * @since 9
414      */
415     int32_t SetPointerColor(int32_t color);
416 
417     /**
418      * @brief Gets pointer color.
419      * @param color Indicates pointer color.
420      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
421      * @since 9
422      */
423     int32_t GetPointerColor(int32_t &color);
424 
425     /**
426      * @brief Sets the mouse pointer speed, which ranges from 1 to 11.
427      * @param speed Indicates the mouse pointer speed to set.
428      * @return Returns <b>RET_OK</b> if success; returns <b>RET_ERR</b> otherwise.
429      * @since 9
430      */
431     int32_t SetPointerSpeed(int32_t speed);
432 
433     /**
434      * @brief Obtains the mouse pointer speed.
435      * @param speed Indicates the mouse pointer speed to get.
436      * @return Returns the mouse pointer speed if the operation is successful; returns <b>RET_ERR</b> otherwise.
437      * @since 9
438      */
439     int32_t GetPointerSpeed(int32_t &speed);
440 
441     /**
442      * @brief Queries the keyboard type.
443      * @param deviceId Indicates the keyboard device ID.
444      * @param callback Callback used to return the keyboard type.
445      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
446      * @since 9
447      */
448     int32_t GetKeyboardType(int32_t deviceId, std::function<void(int32_t)> callback);
449 
450     /**
451      * @brief Sets the observer for events indicating that the application does not respond.
452      * @param observer Indicates the observer for events indicating that the application does not respond.
453      * @return void
454      * @since 9
455      */
456     void SetAnrObserver(std::shared_ptr<IAnrObserver> observer);
457 
458     /**
459      * @brief Obtains the enablement status of the specified function key on the keyboard.
460      * @param funcKey Indicates the function key. Currently, the following function keys are supported:
461      * NUM_LOCK_FUNCTION_KEY
462      * CAPS_LOCK_FUNCTION_KEY
463      * SCROLL_LOCK_FUNCTION_KEY
464      * @return Returns <b>true</b> if the function key is enabled;
465      * returns <b>false</b> otherwise.
466      */
467     bool GetFunctionKeyState(int32_t funcKey);
468 
469     /**
470      * @brief Sets the enablement status of the specified function key on the keyboard.
471      * @param funcKey Indicates the function key. Currently, the following function keys are supported:
472      * NUM_LOCK_FUNCTION_KEY
473      * CAPS_LOCK_FUNCTION_KEY
474      * SCROLL_LOCK_FUNCTION_KEY
475      * @param isEnable Indicates the enablement status to set.
476      * @return Returns <b>0</b> if success; returns a non-0 value otherwise.
477      */
478     int32_t SetFunctionKeyState(int32_t funcKey, bool enable);
479 
480     /**
481      * @brief Sets the absolute coordinate of mouse.
482      * @param x Specifies the x coordinate of the mouse to be set.
483      * @param y Specifies the y coordinate of the mouse to be set.
484      * @return void
485      */
486     void SetPointerLocation(int32_t x, int32_t y);
487 
488     /**
489      * @brief 进入捕获模式
490      * @param windowId 窗口id.
491      * @return 进入捕获模式成功或失败.
492      * @since 9
493      */
494     int32_t EnterCaptureMode(int32_t windowId);
495 
496     /**
497      * @brief 退出捕获模式
498      * @param windowId 窗口id.
499      * @return 退出捕获模式成功或失败.
500      * @since 9
501      */
502     int32_t LeaveCaptureMode(int32_t windowId);
503 
504     int32_t GetWindowPid(int32_t windowId);
505 
506     /**
507      * @brief pointer event添加辅助信息
508      * @param extraData 添加的信息.
509      * @return void
510      * @since 9
511      */
512     void AppendExtraData(const ExtraData& extraData);
513 
514     /**
515      * @brief 使能或者禁用输入设备
516      * @param enable 输入设备的使能状态
517      * @return 返回0表示接口调用成功,否则,表示接口调用失败。
518      * @since 9
519      */
520     int32_t EnableInputDevice(bool enable);
521 
522      /**
523      * @brief 自定义设置快捷键拉起ability延迟时间
524      * @param businessId 应用在ability_launch_config.json中注册的唯一标识符.
525      * @param delay 延迟时间 0-4000ms
526      * @return 设置快捷键拉起ability延迟时间成功或失败
527      * @since 10
528      */
529     int32_t SetKeyDownDuration(const std::string &businessId, int32_t delay);
530 
531     /**
532      * @brief Sets the keyboard repeat delay, which ranges from 300 to 1000.
533      * @param delay Indicates the keyboard repeat delay to set.
534      * @return Returns <b>RET_OK</b> if success; returns <b>RET_ERR</b> otherwise.
535      * @since 10
536      */
537     int32_t SetKeyboardRepeatDelay(int32_t delay);
538 
539     /**
540      * @brief Sets the keyboard repeat rate, which ranges from 36 to 100.
541      * @param rate Indicates the keyboard repeat rate to set.
542      * @return Returns <b>RET_OK</b> if success; returns <b>RET_ERR</b> otherwise.
543      * @since 10
544      */
545     int32_t SetKeyboardRepeatRate(int32_t rate);
546 
547     /**
548      * @brief Gets the keyboard repeat delay.
549      * @param callback Callback used to return the keyboard repeat delay.
550      * @return Returns <b>RET_OK</b> if success; returns <b>RET_ERR</b> otherwise.
551      * @since 10
552      */
553     int32_t GetKeyboardRepeatDelay(std::function<void(int32_t)> callback);
554 
555     /**
556      * @brief Gets the keyboard repeat rate.
557      * @param callback Callback used to return the keyboard repeat rate.
558      * @return Returns <b>RET_OK</b> if success; returns <b>RET_ERR</b> otherwise.
559      * @since 10
560      */
561     int32_t GetKeyboardRepeatRate(std::function<void(int32_t)> callback);
562 
563     /**
564      * @brief Set the switch of touchpad scroll.
565      * @param switchFlag Indicates the touchpad scroll switch state.
566      * @return if success; returns a non-0 value otherwise.
567      * @since 9
568      */
569     int32_t SetTouchpadScrollSwitch(bool switchFlag);
570 
571     /**
572      * @brief Get the switch of touchpad scroll.
573      * @param switchFlag Indicates the touchpad scroll switch state.
574      * @return if success; returns a non-0 value otherwise.
575      * @since 9
576      */
577     int32_t GetTouchpadScrollSwitch(bool &switchFlag);
578 
579     /**
580      * @brief Set the switch of touchpad scroll direction.
581      * @param state Indicates the touchpad scroll switch direction state.
582      * @return if success; returns a non-0 value otherwise.
583      * @since 9
584      */
585     int32_t SetTouchpadScrollDirection(bool state);
586 
587     /**
588      * @brief Get the switch of touchpad scroll direction.
589      * @param state Indicates the touchpad scroll switch direction state.
590      * @return if success; returns a non-0 value otherwise.
591      * @since 9
592      */
593     int32_t GetTouchpadScrollDirection(bool &state);
594 
595     /**
596      * @brief Set the switch of touchpad tap.
597      * @param switchFlag Indicates the touchpad tap switch state.
598      * @return if success; returns a non-0 value otherwise.
599      * @since 9
600      */
601     int32_t SetTouchpadTapSwitch(bool switchFlag);
602 
603     /**
604      * @brief Get the switch of touchpad tap.
605      * @param switchFlag Indicates the touchpad tap switch state.
606      * @return if success; returns a non-0 value otherwise.
607      * @since 9
608      */
609     int32_t GetTouchpadTapSwitch(bool &switchFlag);
610 
611     /**
612      * @brief Set the touchpad poniter speed.
613      * @param speed Indicates the touchpad pointer speed.
614      * @return if success; returns a non-0 value otherwise.
615      * @since 9
616      */
617     int32_t SetTouchpadPointerSpeed(int32_t speed);
618 
619     /**
620      * @brief Get the touchpad poniter speed.
621      * @param speed Indicates the touchpad pointer speed.
622      * @return if success; returns a non-0 value otherwise.
623      * @since 9
624      */
625     int32_t GetTouchpadPointerSpeed(int32_t &speed);
626 
627     /**
628      * @brief Set the switch of touchpad pinch.
629      * @param switchFlag Indicates the touchpad pinch switch state.
630      * @return if success; returns a non-0 value otherwise.
631      * @since 9
632      */
633     int32_t SetTouchpadPinchSwitch(bool switchFlag);
634 
635     /**
636      * @brief Get the switch of touchpad pinch.
637      * @param switchFlag Indicates the touchpad pinch switch state.
638      * @return if success; returns a non-0 value otherwise.
639      * @since 9
640      */
641     int32_t GetTouchpadPinchSwitch(bool &switchFlag);
642 
643     /**
644      * @brief Set the switch of touchpad swipe.
645      * @param switchFlag Indicates the touchpad swipe switch state.
646      * @return if success; returns a non-0 value otherwise.
647      * @since 9
648      */
649     int32_t SetTouchpadSwipeSwitch(bool switchFlag);
650 
651     /**
652      * @brief Get the switch of touchpad swipe.
653      * @param switchFlag Indicates the touchpad swipe switch state.
654      * @return if success; returns a non-0 value otherwise.
655      * @since 9
656      */
657     int32_t GetTouchpadSwipeSwitch(bool &switchFlag);
658 
659     /**
660      * @brief Set the touchpad right click type.
661      * @param type Indicates the touchpad right menu type.
662      * @return if success; returns a non-0 value otherwise.
663      * @since 9
664      */
665     int32_t SetTouchpadRightClickType(int32_t type);
666 
667     /**
668      * @brief Get the touchpad right click type.
669      * @param type Indicates the touchpad right menu type.
670      * @return if success; returns a non-0 value otherwise.
671      * @since 9
672      */
673     int32_t GetTouchpadRightClickType(int32_t &type);
674 
675 #ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT
676     /**
677      * @brief Sets the enhance config of the security component.
678      * @param cfg Indicates the security component enhance config.
679      * @param cfgLen Indicates the security component enhance config len.
680      * @return void.
681      * @since 9
682      */
683     void SetEnhanceConfig(uint8_t *cfg, uint32_t cfgLen);
684 #endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT
685 
686 private:
687     InputManager() = default;
688     DISALLOW_COPY_AND_MOVE(InputManager);
689     static InputManager *instance_;
690 };
691 } // namespace MMI
692 } // namespace OHOS
693 #endif // INPUT_MANAGER_H
694