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 * Global input event listener 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 * Callback used to receive touch input events. If **true** is returned, the touch input is consumed, 43 * and the system performs the closing operation. 44 * 45 * @interface TouchEventReceiver 46 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 47 * @systemapi hide for inner use 48 * @since 7 49 */ 50 interface TouchEventReceiver { 51 /** 52 * Callback used to receive touch input events. 53 * 54 * @param { TouchEvent } touchEvent - the reported touch event. 55 * @returns { Boolean } Returns true indicates the touch input is consumed, the value false indicates 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 * Listens for touch input events. 65 * 66 * @permission ohos.permission.INPUT_MONITORING 67 * @param { 'touch' } type - Event type, which is **touch**. 68 * @param { TouchEventReceiver } receiver - Callback used to receive the reported data. 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 * Listens for touch input events. 78 * 79 * @permission ohos.permission.INPUT_MONITORING 80 * @param { 'touch' } type - Event type, which is **touch**. 81 * @param { TouchEventReceiver } receiver - Callback used to receive the reported data. 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 * Listens for mouse input events. 94 * 95 * @permission ohos.permission.INPUT_MONITORING 96 * @param { 'mouse' } type - Event type, which is **mouse**. 97 * @param { Callback<MouseEvent> } receiver - Callback used to receive the reported data. 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 * Listens for mouse input events. 107 * 108 * @permission ohos.permission.INPUT_MONITORING 109 * @param { 'mouse' } type - Event type, which is **mouse**. 110 * @param { Callback<MouseEvent> } receiver - Callback used to receive the reported data. 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 * Listens for mouse input events when the mouse arrow is within the specified rectangular area. 123 * 124 * @permission ohos.permission.INPUT_MONITORING 125 * @param { 'mouse' } type - Event type, which is **mouse**. 126 * @param { display.Rect[] } rect - A specified rectangular area that can trigger a callback, with a maximum of two. 127 * @param { Callback<MouseEvent> } receiver - Callback used to receive the reported data. 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 * Listens for mouse input events when the mouse arrow is within the specified rectangular area. 137 * 138 * @permission ohos.permission.INPUT_MONITORING 139 * @param { 'mouse' } type - Event type, which is **mouse**. 140 * @param { display.Rect[] } rect - A specified rectangular area that can trigger a callback, with a maximum of two. 141 * @param { Callback<MouseEvent> } receiver - Callback used to receive the reported data. 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 * Cancel listening for touch input events. 154 * 155 * @permission ohos.permission.INPUT_MONITORING 156 * @param { 'touch' } type - Event type, which is **touch**. 157 * @param { TouchEventReceiver } receiver - Callback used to receive the reported data. 158 * @throws { BusinessError } 201 - Permission denied. 159 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 160 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 161 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 162 * @systemapi hide for inner use 163 * @since 7 164 */ 165 /** 166 * Cancel listening for touch input events. 167 * 168 * @permission ohos.permission.INPUT_MONITORING 169 * @param { 'touch' } type - Event type, which is **touch**. 170 * @param { TouchEventReceiver } receiver - Callback used to receive the reported data. 171 * @throws { BusinessError } 201 - Permission denied. 172 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 173 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 174 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 175 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 176 * @systemapi hide for inner use 177 * @since 12 178 */ 179 function off(type: 'touch', receiver?: TouchEventReceiver): void; 180 181 /** 182 * Cancel listening for mouse input events. 183 * 184 * @permission ohos.permission.INPUT_MONITORING 185 * @param { 'mouse' } type - Event type, which is **mouse**. 186 * @param { Callback<MouseEvent> } receiver - Callback used to receive the reported data. 187 * @throws { BusinessError } 201 - Permission denied. 188 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 189 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 190 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 191 * @systemapi hide for inner use 192 * @since 9 193 */ 194 /** 195 * Cancel listening for mouse input events. 196 * 197 * @permission ohos.permission.INPUT_MONITORING 198 * @param { 'mouse' } type - Event type, which is **mouse**. 199 * @param { Callback<MouseEvent> } receiver - Callback used to receive the reported data. 200 * @throws { BusinessError } 201 - Permission denied. 201 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 202 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 203 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 204 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 205 * @systemapi hide for inner use 206 * @since 12 207 */ 208 function off(type: 'mouse', receiver?: Callback<MouseEvent>): void; 209 210 /** 211 * Listens for touchPad pinch events. 212 * 213 * @permission ohos.permission.INPUT_MONITORING 214 * @param { 'pinch' } type - Event type, which is **pinch**. 215 * @param { Callback<Pinch> } receiver - Callback used to receive the reported data. 216 * @throws { BusinessError } 201 - Permission denied. 217 * @throws { BusinessError } 202 - SystemAPI permit error. 218 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 219 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 220 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 221 * @systemapi hide for inner use 222 * @since 10 223 */ 224 function on(type: 'pinch', receiver: Callback<Pinch>): void; 225 226 /** 227 * Cancel listening for touchPad pinch events. 228 * 229 * @permission ohos.permission.INPUT_MONITORING 230 * @param { 'pinch' } type - Event type, which is **pinch**. 231 * @param { Callback<Pinch> } receiver - Callback used to receive the reported data. 232 * @throws { BusinessError } 201 - Permission denied. 233 * @throws { BusinessError } 202 - SystemAPI permit error. 234 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 235 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 236 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 237 * @systemapi hide for inner use 238 * @since 10 239 */ 240 function off(type: 'pinch', receiver?: Callback<Pinch>): void; 241 242 /** 243 * Listens for touchPad fingers pinch events. 244 * 245 * @permission ohos.permission.INPUT_MONITORING 246 * @param { 'pinch' } type - Event type, which is **pinch**. 247 * @param { number } fingers - the number of fingers. 248 * @param { Callback<Pinch> } receiver - Callback used to receive the reported data. 249 * @throws { BusinessError } 201 - Permission denied. 250 * @throws { BusinessError } 202 - SystemAPI permit error. 251 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 252 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 253 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 254 * @systemapi hide for inner use 255 * @since 11 256 */ 257 function on(type: 'pinch', fingers: number, receiver: Callback<Pinch>): void; 258 259 /** 260 * Cancel listening for touchPad fingers pinch events. 261 * 262 * @permission ohos.permission.INPUT_MONITORING 263 * @param { 'pinch' } type - Event type, which is **pinch**. 264 * @param { number } fingers - the number of fingers. 265 * @param { Callback<Pinch> } receiver - Callback used to receive the reported data. 266 * @throws { BusinessError } 201 - Permission denied. 267 * @throws { BusinessError } 202 - SystemAPI permit error. 268 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 269 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 270 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 271 * @systemapi hide for inner use 272 * @since 11 273 */ 274 function off(type: 'pinch', fingers: number, receiver?: Callback<Pinch>): void; 275 276 /** 277 * Listens for touchPad fingers rotate events. 278 * 279 * @permission ohos.permission.INPUT_MONITORING 280 * @param { 'rotate' } type - Event type, which is **rotate**. 281 * @param { number } fingers - the number of fingers. 282 * @param { Callback<Rotate> } receiver - Callback used to receive the reported data. 283 * @throws { BusinessError } 201 - Permission denied. 284 * @throws { BusinessError } 202 - SystemAPI permit error. 285 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 286 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 287 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 288 * @systemapi hide for inner use 289 * @since 11 290 */ 291 function on(type: 'rotate', fingers: number, receiver: Callback<Rotate>): void; 292 293 /** 294 * Cancel listening for touchPad fingers rotate events. 295 * 296 * @permission ohos.permission.INPUT_MONITORING 297 * @param { 'rotate' } type - Event type, which is **rotate**. 298 * @param { number } fingers - the number of fingers. 299 * @param { Callback<Rotate> } receiver - Callback used to receive the reported data. 300 * @throws { BusinessError } 201 - Permission denied. 301 * @throws { BusinessError } 202 - SystemAPI permit error. 302 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 303 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 304 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 305 * @systemapi hide for inner use 306 * @since 11 307 */ 308 function off(type: 'rotate', fingers: number, receiver?: Callback<Rotate>): void; 309 310 /** 311 * Listens for touchPad three fingers swipe events. 312 * 313 * @permission ohos.permission.INPUT_MONITORING 314 * @param { 'threeFingersSwipe' } type - Event type, which is **threeFingersSwipe**. 315 * @param { Callback<ThreeFingersSwipe> } receiver - Callback used to receive the reported data. 316 * @throws { BusinessError } 201 - Permission denied. 317 * @throws { BusinessError } 202 - SystemAPI permit error. 318 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 319 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 320 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 321 * @systemapi hide for inner use 322 * @since 10 323 */ 324 function on(type: 'threeFingersSwipe', receiver: Callback<ThreeFingersSwipe>): void; 325 326 /** 327 * Cancel listening touchPad three fingers swipe events. 328 * 329 * @permission ohos.permission.INPUT_MONITORING 330 * @param { 'threeFingersSwipe' } type - Event type, which is **threeFingersSwipe**. 331 * @param { Callback<ThreeFingersSwipe> } receiver - Callback used to receive the reported data. 332 * @throws { BusinessError } 201 - Permission denied. 333 * @throws { BusinessError } 202 - SystemAPI permit error. 334 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 335 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 336 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 337 * @systemapi hide for inner use 338 * @since 10 339 */ 340 function off(type: 'threeFingersSwipe', receiver?: Callback<ThreeFingersSwipe>): void; 341 342 /** 343 * Listens for touchPad four fingers swipe events. 344 * 345 * @permission ohos.permission.INPUT_MONITORING 346 * @param { 'fourFingersSwipe' } type - Event type, which is **fourFingersSwipe**.. 347 * @param { Callback<FourFingersSwipe> } receiver - Callback used to receive the reported data. 348 * @throws { BusinessError } 201 - Permission denied. 349 * @throws { BusinessError } 202 - SystemAPI permit error. 350 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 351 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 352 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 353 * @systemapi hide for inner use 354 * @since 10 355 */ 356 function on(type: 'fourFingersSwipe', receiver: Callback<FourFingersSwipe>): void; 357 358 /** 359 * Cancel listening touchPad four finger swipe events. 360 * 361 * @permission ohos.permission.INPUT_MONITORING 362 * @param { 'fourFingersSwipe' } type - Event type, which is **fourFingersSwipe**. 363 * @param { Callback<FourFingersSwipe> } receiver - Callback used to receive the reported data. 364 * @throws { BusinessError } 201 - Permission denied. 365 * @throws { BusinessError } 202 - SystemAPI permit error. 366 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 367 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 368 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 369 * @systemapi hide for inner use 370 * @since 10 371 */ 372 function off(type: 'fourFingersSwipe', receiver?: Callback<FourFingersSwipe>): void; 373 374 /** 375 * Listens for touchPad three fingers tap events. 376 * 377 * @permission ohos.permission.INPUT_MONITORING 378 * @param { 'threeFingersTap' } type - Event type, which is **threeFingersTap**. 379 * @param { Callback<ThreeFingersTap> } receiver - Callback used to receive the reported data. 380 * @throws { BusinessError } 201 - Permission denied. 381 * @throws { BusinessError } 202 - SystemAPI permit error. 382 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 383 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 384 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 385 * @systemapi hide for inner use 386 * @since 11 387 */ 388 function on(type: 'threeFingersTap', receiver: Callback<ThreeFingersTap>): void; 389 390 /** 391 * Cancel listening touchPad three fingers tap events. 392 * 393 * @permission ohos.permission.INPUT_MONITORING 394 * @param { 'threeFingersTap' } type - Event type, which is **threeFingersTap**. 395 * @param { Callback<ThreeFingersTap> } receiver - Callback used to receive the reported data. 396 * @throws { BusinessError } 201 - Permission denied. 397 * @throws { BusinessError } 202 - SystemAPI permit error. 398 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 399 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 400 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 401 * @systemapi hide for inner use 402 * @since 11 403 */ 404 function off(type: 'threeFingersTap', receiver?: Callback<ThreeFingersTap>): void; 405 406 /** 407 * Enables listening for fingerprint key events. 408 * 409 * @permission ohos.permission.INPUT_MONITORING 410 * @param { 'fingerprint' } type - Event type, which is **fingerprint**. 411 * @param { Callback<FingerprintEvent> } receiver - Callback used to receive the reported data. 412 * @throws { BusinessError } 201 - Permission denied. 413 * @throws { BusinessError } 202 - SystemAPI permit error. 414 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 415 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 416 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 417 * @systemapi hide for inner use 418 * @since 12 419 */ 420 function on(type: 'fingerprint', receiver: Callback<FingerprintEvent>): void; 421 422 /** 423 * Cancels listening for fingerprint key events. 424 * 425 * @permission ohos.permission.INPUT_MONITORING 426 * @param { 'fingerprint' } type - Event type, which is **fingerprint**. 427 * @param { Callback<FingerprintEvent> } receiver - Callback used to receive the reported data. 428 * @throws { BusinessError } 201 - Permission denied. 429 * @throws { BusinessError } 202 - SystemAPI permit error. 430 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 431 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 432 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 433 * @systemapi hide for inner use 434 * @since 12 435 */ 436 function off(type: 'fingerprint', receiver?: Callback<FingerprintEvent>): void; 437 438 /** 439 * Enables listening touchPad swipe inward events. 440 * 441 * @permission ohos.permission.INPUT_MONITORING 442 * @param { 'swipeInward' } type - Event type, which is **swipeInward**. 443 * @param { Callback<SwipeInward> } receiver - Callback used to receive the reported data. 444 * @throws { BusinessError } 201 - Permission denied. 445 * @throws { BusinessError } 202 - SystemAPI permit error. 446 * @throws { BusinessError } 401 - Parameter error. 447 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 448 * @systemapi hide for inner use 449 * @since 12 450 */ 451 function on(type: 'swipeInward', receiver: Callback<SwipeInward>): void; 452 453 /** 454 * Cancel listening touchPad swipe inward events. 455 * 456 * @permission ohos.permission.INPUT_MONITORING 457 * @param { 'swipeInward' } type - Event type, which is **swipeInward**. 458 * @param { Callback<SwipeInward> } receiver - Callback used to receive the reported data. 459 * @throws { BusinessError } 201 - Permission denied. 460 * @throws { BusinessError } 202 - SystemAPI permit error. 461 * @throws { BusinessError } 401 - Parameter error. 462 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 463 * @systemapi hide for inner use 464 * @since 12 465 */ 466 function off(type: 'swipeInward', receiver?: Callback<SwipeInward>): void; 467 468 /** 469 * Enables listening touchscreen swipe gesture events. 470 * 471 * @permission ohos.permission.INPUT_MONITORING 472 * @param { 'touchscreenSwipe' } type - Touchscreen gesture type. 473 * @param { number } fingers - Number of fingers. 474 * @param { Callback<TouchGestureEvent> } receiver - Callback used to receive reported data. 475 * @throws { BusinessError } 201 - Permission denied. 476 * @throws { BusinessError } 202 - Caller is not a system application. 477 * @throws { BusinessError } 401 - Parameter error. Possible causes: 478 * 1.Mandatory parameters are left unspecified; 479 * 2.Incorrect parameter types. 480 * 3.Parameter verification failed. 481 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 482 * @systemapi hide for inner use 483 * @since 18 484 */ 485 function on(type: 'touchscreenSwipe', fingers: number, receiver: Callback<TouchGestureEvent>): void; 486 487 /** 488 * Disables listening touchscreen swipe gesture events. 489 * 490 * @permission ohos.permission.INPUT_MONITORING 491 * @param { 'touchscreenSwipe' } type - Touchscreen gesture type. 492 * @param { number } fingers - Number of fingers. 493 * @param { Callback<TouchGestureEvent> } receiver - Callback used to receive reported data. 494 * @throws { BusinessError } 201 - Permission denied. 495 * @throws { BusinessError } 202 - Caller is not a system application. 496 * @throws { BusinessError } 401 - Parameter error. Possible causes: 497 * 1.Mandatory parameters are left unspecified; 498 * 2.Incorrect parameter types. 499 * 3.Parameter verification failed. 500 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 501 * @systemapi hide for inner use 502 * @since 18 503 */ 504 function off(type: 'touchscreenSwipe', fingers: number, receiver?: Callback<TouchGestureEvent>): void; 505 506 /** 507 * Enables listening touchscreen pinch gesture events. 508 * 509 * @permission ohos.permission.INPUT_MONITORING 510 * @param { 'touchscreenPinch' } type - Touch screen gesture type. 511 * @param { number } fingers - Number of fingers. 512 * @param { Callback<TouchGestureEvent> } receiver - Callback used to receive reported data. 513 * @throws { BusinessError } 201 - Permission denied. 514 * @throws { BusinessError } 202 - Caller is not a system application. 515 * @throws { BusinessError } 401 - Parameter error. Possible causes: 516 * 1.Mandatory parameters are left unspecified; 517 * 2.Incorrect parameter types. 518 * 3.Parameter verification failed. 519 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 520 * @systemapi hide for inner use 521 * @since 18 522 */ 523 function on(type: 'touchscreenPinch', fingers: number, receiver: Callback<TouchGestureEvent>): void; 524 525 /** 526 * Disables listening touchscreen pinch gesture events. 527 * 528 * @permission ohos.permission.INPUT_MONITORING 529 * @param { 'touchscreenPinch' } type - Touchscreen gesture type. 530 * @param { number } fingers - Number of fingers. 531 * @param { Callback<TouchGestureEvent> } receiver - Callback used to receive reported data. 532 * @throws { BusinessError } 201 - Permission denied. 533 * @throws { BusinessError } 202 - Caller is not a system application. 534 * @throws { BusinessError } 401 - Parameter error. Possible causes: 535 * 1.Mandatory parameters are left unspecified; 536 * 2.Incorrect parameter types. 537 * 3.Parameter verification failed. 538 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 539 * @systemapi hide for inner use 540 * @since 18 541 */ 542 function off(type: 'touchscreenPinch', fingers: number, receiver?: Callback<TouchGestureEvent>): void; 543 544/** 545 * Enables listening for release events of specified keys, such as the logo, power, and volume keys. 546 * 547 * @permission ohos.permission.INPUT_MONITORING 548 * @param { 'keyPressed' } type - Event type, which is **keyPressed**. 549 * @param { Array<KeyCode> } keys - Key list. 550 * @param { Callback<KeyEvent> } receiver - Callback used to receive the reported data. 551 * @throws { BusinessError } 201 - Permission denied. 552 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 553 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 554 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 555 * @throws { BusinessError } 4100001 - Event listening not supported for the key. 556 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 557 * @systemapi hide for inner use 558 * @since 15 559 */ 560 function on(type: 'keyPressed', keys: Array<KeyCode>, receiver: Callback<KeyEvent>): void; 561 562/** 563 * Disables listening for release events of specified keys. 564 * 565 * @permission ohos.permission.INPUT_MONITORING 566 * @param { 'keyPressed' } type - Event type, which is **keyPressed**. 567 * @param { Callback<KeyEvent> } receiver - Callback used to receive the reported data. 568 * @throws { BusinessError } 201 - Permission denied. 569 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 570 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 571 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 572 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor 573 * @systemapi hide for inner use 574 * @since 15 575 */ 576 function off(type: 'keyPressed', receiver?: Callback<KeyEvent>): void; 577} 578export default inputMonitor; 579