• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2023 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/**
17 * @file
18 * @kit InputKit
19 */
20
21import { Callback } from './@ohos.base';
22import { MouseEvent } from './@ohos.multimodalInput.mouseEvent';
23import type display from './@ohos.display';
24import type { TouchEvent } from './@ohos.multimodalInput.touchEvent';
25import type { Rotate, Pinch, ThreeFingersSwipe, FourFingersSwipe, SwipeInward } from './@ohos.multimodalInput.gestureEvent';
26import type { ThreeFingersTap, TouchGestureEvent } from './@ohos.multimodalInput.gestureEvent';
27import type { FingerprintEvent } from './@ohos.multimodalInput.shortKey';
28import type { KeyEvent } from './@ohos.multimodalInput.keyEvent';
29import type { KeyCode } from './@ohos.multimodalInput.keyCode';
30
31/**
32 * The inputMonitor module implements listening for events of input devices, including the touchscreen, mouse, touchpad, etc.
33 * System API, available only to system processes
34 *
35 * @namespace inputMonitor
36 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
37 * @systemapi hide for inner use
38 * @since 7
39 */
40declare namespace inputMonitor {
41  /**
42   * Defines the callback for touch (touchscreen) events.
43   *
44   * @interface TouchEventReceiver
45   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
46   * @systemapi hide for inner use
47   * @since 7
48   */
49  interface TouchEventReceiver {
50    /**
51     * Callback used to receive touch input events.
52     *
53     * @param { TouchEvent } touchEvent - the reported touch event.
54     * @returns { Boolean } Result indicating whether the touch event will be dispatched to the window.
55     * The value true indicates that the touch event will be dispatched to the window, and the value false indicates the opposite.
56     * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
57     * @systemapi hide for inner use
58     * @since 7
59     */
60    (touchEvent: TouchEvent): Boolean;
61  }
62
63  /**
64   * Enables listening for global touch (touchscreen) events.
65   *
66   * @permission ohos.permission.INPUT_MONITORING
67   * @param { 'touch' } type - Event type. This field has a fixed value of touch.
68   * @param { TouchEventReceiver } receiver - Callback used to return touch events asynchronously.
69   * @throws { BusinessError } 201 - Permission denied.
70   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
71   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
72   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
73   * @systemapi hide for inner use
74   * @since 7
75   */
76  /**
77   * Enables listening for global touch (touchscreen) events.
78   *
79   * @permission ohos.permission.INPUT_MONITORING
80   * @param { 'touch' } type - Event type. This field has a fixed value of touch.
81   * @param { TouchEventReceiver } receiver - Callback used to return touch events asynchronously.
82   * @throws { BusinessError } 201 - Permission denied.
83   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
84   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
85   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
86   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
87   * @systemapi hide for inner use
88   * @since 12
89   */
90  function on(type: 'touch', receiver: TouchEventReceiver): void;
91
92  /**
93   * Enables listening for global mouse events.
94   *
95   * @permission ohos.permission.INPUT_MONITORING
96   * @param { 'mouse' } type - Event type. This field has a fixed value of mouse.
97   * @param { Callback<MouseEvent> } receiver - Callback used to return mouse events asynchronously.
98   * @throws { BusinessError } 201 - Permission denied.
99   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
100   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
101   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
102   * @systemapi hide for inner use
103   * @since 9
104   */
105  /**
106   * Enables listening for global mouse events.
107   *
108   * @permission ohos.permission.INPUT_MONITORING
109   * @param { 'mouse' } type - Event type. This field has a fixed value of mouse.
110   * @param { Callback<MouseEvent> } receiver - Callback used to return mouse events asynchronously.
111   * @throws { BusinessError } 201 - Permission denied.
112   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
113   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
114   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
115   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
116   * @systemapi hide for inner use
117   * @since 12
118   */
119  function on(type: 'mouse', receiver: Callback<MouseEvent>): void;
120
121  /**
122   * Enables listening for mouse events. When the mouse pointer moves to the specified rectangular area, a callback is triggered.
123   *
124   * @permission ohos.permission.INPUT_MONITORING
125   * @param { 'mouse' } type - Event type. This field has a fixed value of mouse.
126   * @param { display.Rect[] } rect - Rectangular area where a callback is triggered. One or two rectangular areas can be specified.
127   * @param { Callback<MouseEvent> } receiver - Callback used to return mouse events asynchronously.
128   * @throws { BusinessError } 201 - Permission denied.
129   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
130   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
131   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
132   * @systemapi hide for inner use
133   * @since 11
134   */
135  /**
136   * Enables listening for mouse events. When the mouse pointer moves to the specified rectangular area, a callback is triggered.
137   *
138   * @permission ohos.permission.INPUT_MONITORING
139   * @param { 'mouse' } type - Event type. This field has a fixed value of mouse.
140   * @param { display.Rect[] } rect - Rectangular area where a callback is triggered. One or two rectangular areas can be specified.
141   * @param { Callback<MouseEvent> } receiver - Callback used to return mouse events asynchronously.
142   * @throws { BusinessError } 201 - Permission denied.
143   * @throws { BusinessError } 202 - SystemAPI permit error.
144   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
145   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
146   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
147   * @systemapi hide for inner use
148   * @since 12
149   */
150  function on(type: 'mouse', rect: display.Rect[], receiver: Callback<MouseEvent>): void;
151
152  /**
153   * Disables listening for global touch (touchscreen) events.
154   *
155   * @permission ohos.permission.INPUT_MONITORING
156   * @param { 'touch' } type - Event type. This field has a fixed value of touch.
157   * @param { TouchEventReceiver } receiver - Callback for which listening is disabled.
158   * If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.
159   * @throws { BusinessError } 201 - Permission denied.
160   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
161   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
162   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
163   * @systemapi hide for inner use
164   * @since 7
165   */
166  /**
167   * Disables listening for global touch (touchscreen) events.
168   *
169   * @permission ohos.permission.INPUT_MONITORING
170   * @param { 'touch' } type - Event type. This field has a fixed value of touch.
171   * @param { TouchEventReceiver } receiver - Callback for which listening is disabled.
172   * If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.
173   * @throws { BusinessError } 201 - Permission denied.
174   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
175   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
176   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
177   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
178   * @systemapi hide for inner use
179   * @since 12
180   */
181  function off(type: 'touch', receiver?: TouchEventReceiver): void;
182
183  /**
184   * Disables listening for global mouse events.
185   *
186   * @permission ohos.permission.INPUT_MONITORING
187   * @param { 'mouse' } type - Event type. This field has a fixed value of mouse.
188   * @param { Callback<MouseEvent> } receiver - Callback for which listening is disabled.
189   * If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.
190   * @throws { BusinessError } 201 - Permission denied.
191   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
192   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
193   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
194   * @systemapi hide for inner use
195   * @since 9
196   */
197  /**
198   * Disables listening for global mouse events.
199   *
200   * @permission ohos.permission.INPUT_MONITORING
201   * @param { 'mouse' } type - Event type. This field has a fixed value of mouse.
202   * @param { Callback<MouseEvent> } receiver - Callback for which listening is disabled.
203   * If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.
204   * @throws { BusinessError } 201 - Permission denied.
205   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
206   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
207   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
208   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
209   * @systemapi hide for inner use
210   * @since 12
211   */
212  function off(type: 'mouse', receiver?: Callback<MouseEvent>): void;
213
214  /**
215   * Enables listening for global touchpad pinch events.
216   *
217   * @permission ohos.permission.INPUT_MONITORING
218   * @param { 'pinch' } type - Event type. This field has a fixed value of pinch.
219   * @param { Callback<Pinch> } receiver - Callback used to return pinch events asynchronously.
220   * @throws { BusinessError } 201 - Permission denied.
221   * @throws { BusinessError } 202 - SystemAPI permit error.
222   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
223   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
224   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
225   * @systemapi hide for inner use
226   * @since 10
227   */
228  function on(type: 'pinch', receiver: Callback<Pinch>): void;
229
230  /**
231   * Disables listening for global touchpad pinch events.
232   *
233   * @permission ohos.permission.INPUT_MONITORING
234   * @param { 'pinch' } type - Event type. This field has a fixed value of pinch.
235   * @param { Callback<Pinch> } receiver - Callback for which listening is disabled.
236   * If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.
237   * @throws { BusinessError } 201 - Permission denied.
238   * @throws { BusinessError } 202 - SystemAPI permit error.
239   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
240   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
241   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
242   * @systemapi hide for inner use
243   * @since 10
244   */
245  function off(type: 'pinch', receiver?: Callback<Pinch>): void;
246
247  /**
248   * Enables listening for global touchpad pinch events.
249   *
250   * @permission ohos.permission.INPUT_MONITORING
251   * @param { 'pinch' } type - Event type, which is **pinch**.
252   * @param { number } fingers - Number of fingers that trigger the pinch. The value must be greater than or equal to 2.
253   * @param { Callback<Pinch> } receiver - Callback used to return pinch events asynchronously.
254   * @throws { BusinessError } 201 - Permission denied.
255   * @throws { BusinessError } 202 - SystemAPI permit error.
256   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
257   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
258   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
259   * @systemapi hide for inner use
260   * @since 11
261   */
262  function on(type: 'pinch', fingers: number, receiver: Callback<Pinch>): void;
263
264  /**
265   * Disables listening for global touchpad pinch events.
266   *
267   * @permission ohos.permission.INPUT_MONITORING
268   * @param { 'pinch' } type - Event type. This field has a fixed value of pinch.
269   * @param { number } fingers - Number of fingers that trigger the pinch. The value must be greater than or equal to 2.
270   * @param { Callback<Pinch> } receiver - Callback for which listening is disabled.
271   * If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.
272   * @throws { BusinessError } 201 - Permission denied.
273   * @throws { BusinessError } 202 - SystemAPI permit error.
274   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
275   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
276   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
277   * @systemapi hide for inner use
278   * @since 11
279   */
280  function off(type: 'pinch', fingers: number, receiver?: Callback<Pinch>): void;
281
282  /**
283   * Enables listening for rotation events of the touchpad.
284   *
285   * @permission ohos.permission.INPUT_MONITORING
286   * @param { 'rotate' } type - Event type. This field has a fixed value of rotate.
287   * @param { number } fingers - Number of fingers that trigger a rotation. The value must not be greater than 2.
288   * @param { Callback<Rotate> } receiver - Callback used to return rotation events asynchronously.
289   * @throws { BusinessError } 201 - Permission denied.
290   * @throws { BusinessError } 202 - SystemAPI permit error.
291   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
292   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
293   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
294   * @systemapi hide for inner use
295   * @since 11
296   */
297  function on(type: 'rotate', fingers: number, receiver: Callback<Rotate>): void;
298
299  /**
300   * Disables listening for rotation events of the touchpad.
301   *
302   * @permission ohos.permission.INPUT_MONITORING
303   * @param { 'rotate' } type - Event type. This field has a fixed value of rotate.
304   * @param { number } fingers - Number of fingers that trigger a rotation. The value must not be greater than 2.
305   * @param { Callback<Rotate> } receiver - Callback for which listening is disabled.
306   * If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.
307   * @throws { BusinessError } 201 - Permission denied.
308   * @throws { BusinessError } 202 - SystemAPI permit error.
309   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
310   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
311   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
312   * @systemapi hide for inner use
313   * @since 11
314   */
315  function off(type: 'rotate', fingers: number, receiver?: Callback<Rotate>): void;
316
317  /**
318   * Enables listening for three-finger swipe events.
319   *
320   * @permission ohos.permission.INPUT_MONITORING
321   * @param { 'threeFingersSwipe' } type - Event type. This field has a fixed value of threeFingersSwipe.
322   * @param { Callback<ThreeFingersSwipe> } receiver - Callback used to return three-finger swipe events asynchronously.
323   * @throws { BusinessError } 201 - Permission denied.
324   * @throws { BusinessError } 202 - SystemAPI permit error.
325   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
326   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
327   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
328   * @systemapi hide for inner use
329   * @since 10
330   */
331  function on(type: 'threeFingersSwipe', receiver: Callback<ThreeFingersSwipe>): void;
332
333  /**
334   * Disables listening for three-finger swipe events.
335   *
336   * @permission ohos.permission.INPUT_MONITORING
337   * @param { 'threeFingersSwipe' } type - Event type. This field has a fixed value of threeFingersSwipe.
338   * @param { Callback<ThreeFingersSwipe> } receiver - Callback for which listening is disabled.
339   * If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.
340   * @throws { BusinessError } 201 - Permission denied.
341   * @throws { BusinessError } 202 - SystemAPI permit error.
342   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
343   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
344   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
345   * @systemapi hide for inner use
346   * @since 10
347   */
348  function off(type: 'threeFingersSwipe', receiver?: Callback<ThreeFingersSwipe>): void;
349
350  /**
351   * Enables listening for four-finger swipe events.
352   *
353   * @permission ohos.permission.INPUT_MONITORING
354   * @param { 'fourFingersSwipe' } type - Event type. This field has a fixed value of fourFingersSwipe.
355   * @param { Callback<FourFingersSwipe> } receiver - Callback used to return four-finger swipe events asynchronously.
356   * @throws { BusinessError } 201 - Permission denied.
357   * @throws { BusinessError } 202 - SystemAPI permit error.
358   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
359   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
360   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
361   * @systemapi hide for inner use
362   * @since 10
363   */
364  function on(type: 'fourFingersSwipe', receiver: Callback<FourFingersSwipe>): void;
365
366  /**
367   * Disables listening for four-finger swipe events.
368   *
369   * @permission ohos.permission.INPUT_MONITORING
370   * @param { 'fourFingersSwipe' } type - Event type. This field has a fixed value of fourFingersSwipe.
371   * @param { Callback<FourFingersSwipe> } receiver - Callback for which listening is disabled.
372   * If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.
373   * @throws { BusinessError } 201 - Permission denied.
374   * @throws { BusinessError } 202 - SystemAPI permit error.
375   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
376   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
377   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
378   * @systemapi hide for inner use
379   * @since 10
380   */
381  function off(type: 'fourFingersSwipe', receiver?: Callback<FourFingersSwipe>): void;
382
383  /**
384   * Enables listening for three-finger tap events.
385   *
386   * @permission ohos.permission.INPUT_MONITORING
387   * @param { 'threeFingersTap' } type - Event type. This field has a fixed value of threeFingersTap.
388   * @param { Callback<ThreeFingersTap> } receiver - Callback used to return three-finger tap events asynchronously.
389   * @throws { BusinessError } 201 - Permission denied.
390   * @throws { BusinessError } 202 - SystemAPI permit error.
391   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
392   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
393   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
394   * @systemapi hide for inner use
395   * @since 11
396   */
397  function on(type: 'threeFingersTap', receiver: Callback<ThreeFingersTap>): void;
398
399  /**
400   * Disables listening for three-finger tap events.
401   *
402   * @permission ohos.permission.INPUT_MONITORING
403   * @param { 'threeFingersTap' } type - Event type. This field has a fixed value of threeFingersTap.
404   * @param { Callback<ThreeFingersTap> } receiver - Callback for which listening is disabled.
405   * If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.
406   * @throws { BusinessError } 201 - Permission denied.
407   * @throws { BusinessError } 202 - SystemAPI permit error.
408   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
409   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
410   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
411   * @systemapi hide for inner use
412   * @since 11
413   */
414  function off(type: 'threeFingersTap', receiver?: Callback<ThreeFingersTap>): void;
415
416  /**
417   * Enables listening for fingerprint key events.
418   *
419   * @permission ohos.permission.INPUT_MONITORING
420   * @param { 'fingerprint' } type - Event type, which is **fingerprint**.
421   * @param { Callback<FingerprintEvent> } receiver - Callback used to receive the reported data.
422   * @throws { BusinessError } 201 - Permission denied.
423   * @throws { BusinessError } 202 - SystemAPI permit error.
424   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
425   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
426   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
427   * @systemapi hide for inner use
428   * @since 12
429   */
430  function on(type: 'fingerprint', receiver: Callback<FingerprintEvent>): void;
431
432  /**
433   * Cancels listening for fingerprint key events.
434   *
435   * @permission ohos.permission.INPUT_MONITORING
436   * @param { 'fingerprint' } type - Event type, which is **fingerprint**.
437   * @param { Callback<FingerprintEvent> } receiver - Callback used to receive the reported data.
438   * @throws { BusinessError } 201 - Permission denied.
439   * @throws { BusinessError } 202 - SystemAPI permit error.
440   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
441   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
442   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
443   * @systemapi hide for inner use
444   * @since 12
445   */
446  function off(type: 'fingerprint', receiver?: Callback<FingerprintEvent>): void;
447
448  /**
449   * Enables listening touchPad swipe inward events.
450   *
451   * @permission ohos.permission.INPUT_MONITORING
452   * @param { 'swipeInward' } type - Event type, which is **swipeInward**.
453   * @param { Callback<SwipeInward> } receiver - Callback used to receive the reported data.
454   * @throws { BusinessError } 201 - Permission denied.
455   * @throws { BusinessError } 202 - SystemAPI permit error.
456   * @throws { BusinessError } 401 - Parameter error.
457   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
458   * @systemapi hide for inner use
459   * @since 12
460   */
461  function on(type: 'swipeInward', receiver: Callback<SwipeInward>): void;
462
463  /**
464   * Cancel listening touchPad swipe inward events.
465   *
466   * @permission ohos.permission.INPUT_MONITORING
467   * @param { 'swipeInward' } type - Event type, which is **swipeInward**.
468   * @param { Callback<SwipeInward> } receiver - Callback used to receive the reported data.
469   * @throws { BusinessError } 201 - Permission denied.
470   * @throws { BusinessError } 202 - SystemAPI permit error.
471   * @throws { BusinessError } 401 - Parameter error.
472   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
473   * @systemapi hide for inner use
474   * @since 12
475   */
476  function off(type: 'swipeInward', receiver?: Callback<SwipeInward>): void;
477
478  /**
479   * Enables listening for touchscreen swipe events.
480   *
481   * @permission ohos.permission.INPUT_MONITORING
482   * @param { 'touchscreenSwipe' } type - Event type. This field has a fixed value of touchscreenSwipe.
483   * @param { number } fingers - Number of fingers that trigger the swipe. The value range is [3, 5].
484   * @param { Callback<TouchGestureEvent> } receiver - Callback used to return touchscreen swipe events asynchronously.
485   * @throws { BusinessError } 201 - Permission denied.
486   * @throws { BusinessError } 202 - Caller is not a system application.
487   * @throws { BusinessError } 401 - Parameter error. Possible causes:
488   *                                 1.Mandatory parameters are left unspecified;
489   *                                 2.Incorrect parameter types.
490   *                                 3.Parameter verification failed.
491   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
492   * @systemapi hide for inner use
493   * @since 18
494   */
495  function on(type: 'touchscreenSwipe', fingers: number, receiver: Callback<TouchGestureEvent>): void;
496
497  /**
498   * Disables listening for touchscreen swipe events.
499   *
500   * @permission ohos.permission.INPUT_MONITORING
501   * @param { 'touchscreenSwipe' } type - Event type. This field has a fixed value of touchscreenSwipe.
502   * @param { number } fingers - Number of fingers that trigger the swipe. The value range is [3, 5].
503   * @param { Callback<TouchGestureEvent> } receiver - Callback for which listening is disabled.
504   * If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.
505   * @throws { BusinessError } 201 - Permission denied.
506   * @throws { BusinessError } 202 - Caller is not a system application.
507   * @throws { BusinessError } 401 - Parameter error. Possible causes:
508   *                                 1.Mandatory parameters are left unspecified;
509   *                                 2.Incorrect parameter types.
510   *                                 3.Parameter verification failed.
511   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
512   * @systemapi hide for inner use
513   * @since 18
514   */
515  function off(type: 'touchscreenSwipe', fingers: number, receiver?: Callback<TouchGestureEvent>): void;
516
517  /**
518   * Enables listening for touchscreen pinch events.
519   *
520   * @permission ohos.permission.INPUT_MONITORING
521   * @param { 'touchscreenPinch' } type - Event type. This field has a fixed value of touchscreenPinch.
522   * @param { number } fingers - Number of fingers that trigger the pinch. The value range is [4, 5].
523   * @param { Callback<TouchGestureEvent> } receiver - Callback used to return touchscreen pinch events asynchronously.
524   * @throws { BusinessError } 201 - Permission denied.
525   * @throws { BusinessError } 202 - Caller is not a system application.
526   * @throws { BusinessError } 401 - Parameter error. Possible causes:
527   *                                 1.Mandatory parameters are left unspecified;
528   *                                 2.Incorrect parameter types.
529   *                                 3.Parameter verification failed.
530   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
531   * @systemapi hide for inner use
532   * @since 18
533   */
534  function on(type: 'touchscreenPinch', fingers: number, receiver: Callback<TouchGestureEvent>): void;
535
536  /**
537   * Disables listening for touchscreen pinch events.
538   *
539   * @permission ohos.permission.INPUT_MONITORING
540   * @param { 'touchscreenPinch' } type - Event type. This field has a fixed value of touchscreenPinch.
541   * @param { number } fingers - Number of fingers that trigger the pinch. The value range is [4, 5].
542   * @param { Callback<TouchGestureEvent> } receiver - Callback for which listening is disabled.
543   * If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.
544   * @throws { BusinessError } 201 - Permission denied.
545   * @throws { BusinessError } 202 - Caller is not a system application.
546   * @throws { BusinessError } 401 - Parameter error. Possible causes:
547   *                                 1.Mandatory parameters are left unspecified;
548   *                                 2.Incorrect parameter types.
549   *                                 3.Parameter verification failed.
550   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
551   * @systemapi hide for inner use
552   * @since 18
553   */
554  function off(type: 'touchscreenPinch', fingers: number, receiver?: Callback<TouchGestureEvent>): void;
555
556/**
557   * Listens for the press and release events of the specified key, which can be the META_LEFT, META_RIGHT, power, or volume key.
558   *
559   * @permission ohos.permission.INPUT_MONITORING
560   * @param { 'keyPressed' } type - Event type. This parameter has a fixed value of keyPressed.
561   * @param { Array<KeyCode> }  keys - Key code list.
562   * The options are KEYCODE_META_LEFT, KEYCODE_META_RIGHT, KEYCODE_POWER, KEYCODE_VOLUME_DOWN, and KEYCODE_VOLUME_UP.
563   * @param { Callback<KeyEvent> } receiver - Callback used to receive reported data.
564   * @throws { BusinessError } 201 - Permission denied.
565   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
566   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
567   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
568   * @throws { BusinessError } 4100001 - Event listening not supported for the key.
569   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
570   * @systemapi hide for inner use
571   * @since 15
572   */
573  function on(type: 'keyPressed', keys: Array<KeyCode>, receiver: Callback<KeyEvent>): void;
574
575/**
576   * Cancels listening for the press and release events of the specified key, which can be the META_LEFT, META_RIGHT, power, or volume key.
577   * This API must be used together with inputMonitor.on ('keyPressed').
578   *
579   * @permission ohos.permission.INPUT_MONITORING
580   * @param { 'keyPressed' } type - Event type. This parameter has a fixed value of keyPressed.
581   * @param { Callback<KeyEvent> } receiver - Callback for which listening is disabled.
582   * If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.
583   * @throws { BusinessError } 201 - Permission denied.
584   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
585   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
586   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
587   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
588   * @systemapi hide for inner use
589   * @since 15
590   */
591  function off(type: 'keyPressed', receiver?: Callback<KeyEvent>): void;
592
593  /**
594   * Queries the most recent touch events, with a maximum of 100 events supported.
595   * The returned touch event contains only the following valid information: actionTime, sourceType, isInject, pressure, tiltX, tiltY.
596   *
597   * @permission ohos.permission.INPUT_MONITORING
598   * @param { number } count - Number of touch events to query.
599   * @returns { Promise<Array<TouchEvent>> } Returns the result through a promise.
600   * @throws { BusinessError } 201 - Permission denied.
601   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
602   * @syscap SystemCapability.MultimodalInput.Input.InputMonitor
603   * @systemapi hide for inner use
604   * @since 20
605   */
606  function queryTouchEvents(count: number) : Promise<Array<TouchEvent>>;
607}
608export default inputMonitor;
609