Checks whether the specified rule exists in the collection of added rules. If the rule is of the thread level, this operation is performed only on the current thread.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [hichecker.containsCheckRule](#hicheckercontainscheckrule9) instead.
Checks whether the specified rule exists in the collection of added rules. If the rule is of the thread level, this operation is performed only on the current thread.
| INCLUDE_ASYNC | 1 | Asynchronous call flag. By default, only synchronous calls are traced. If this flag is set, both synchronous and asynchronous calls will be traced. |
The Input Consumer module implements listening for key events.
The Input Consumer module implements listening for combination key events.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs of this module are system APIs and cannot be called by third-party applications.
> - The APIs provided by this module are system APIs.
Enables listening for combination key events. When a combination key event that meets the specified conditions occurs, **keyOptions** will be passed as an input parameter to **callback**.
This is a system API.
Enables listening for combination key events. This API uses an asynchronous callback to return the combination key data when a combination key event that meets the specified condition occurs.
| type | string | Yes| Type of the key input event to listen for. Only **key** is supported.|
| keyOptions | [keyOptions](#keyoptions) | Yes| Key option, which specifies the condition for combination key input.|
| callback | Callback<KeyOptions> | Yes| Callback used to return the result.<br> When a key input event that meets the specified options occurs, **keyOptions** will be passed as an input parameter to **callback**.|
| callback | Callback<KeyOptions> | Yes | Callback used to return the combination key data when a combination key event that meets the specified condition occurs.|
| callback | Callback<KeyOptions> | No | Callback for which listening is disabled. If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.|
**Example**
```js
letleftAltKey=2045;
lettabKey=2049;
// Disable listening for a single callback function.
| preKeys | Array | Yes| Array of precedent keys. This parameter can be left empty. There is no requirement on the sequence of precedent keys.|
| finalKey | Number | Yes| Final key in the combination key. This parameter cannot be left blank.|
| isFinalKeyDown | boolean | Yes| Whether the final key is pressed or released. By default, the final key is pressed.|
| finalKeyDownDuration | Number | Yes| Duration for pressing the final key. By default, there is no requirement on the duration.|
| Name | Type | Readable | Writable | Description |
| --------- | ------ | ---- | ---- | ------- |
| preKeys | Array\<number> | Yes | No| Front key set. The number of front keys ranges from 0 to 4. There is no requirement on the sequence of the keys.|
| finalKey | number | Yes | No| Final key. This parameter is mandatory. A callback function is triggered by the final key.|
| isFinalKeyDown | boolean | Yes | No| Whether the final key is pressed.|
| finalKeyDownDuration | number | Yes | No| Duration within which the final key is pressed. If the value is **0**, the callback function is triggered immediately. If the value is greater than **0** and the value of **isFinalKeyDown** is **true**, the callback function is triggered when the key press duration is longer than the value of this parameter. If the value of **isFinalKeyDown** is **false**, the callback function is triggered when the duration from key press to key release is less than the value of this parameter. |
The Key Injection module implements injection of key events.
> **NOTE**<br>
> **NOTE**
>
> - The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs of this module are system APIs and cannot be called by third-party applications.
> - The APIs provided by this module are system APIs.
## Modules to Import
...
...
@@ -21,9 +21,7 @@ import inputEventClient from '@ohos.multimodalInput.inputEventClient';
injectEvent({KeyEvent: KeyEvent}): void
Injects a key event.
This is a system API.
Injects a key event. Currently, key injection is supported only for the **Back** key (key value 2).
The Input Monitor module implements listening for global touch events.
The Input Monitor module implements listening for events of input devices (namely, touchscreen and mouse).
> **NOTE**<br>
> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> **NOTE**
>
> - The APIs of this module are system APIs and cannot be called by third-party applications.
> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs provided by this module are system APIs.
## Modules to Import
...
...
@@ -16,80 +17,73 @@ import inputMonitor from '@ohos.multimodalInput.inputMonitor';
| type | string | Yes | Type of the input device event. The value is **touch**.|
| receiver | [TouchEventReceiver](#toucheventreceiver) | No | Callback for which listening is disabled. If this parameter is not specified, listening will be disabled for all callbacks registered by the current application. |
**Example**
**Example**
```js
// Disable listening globally.
// Disable listening for a single callback function.
functioncallback(touchEvent){
console.log(`Monitor on success ${JSON.stringify(touchEvent)}`);
| type | string | Yes | Type of the input device event. The value is **mouse**.|
| receiver | Callback<MouseEvent> | No | Callback for which listening is disabled. If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.|
**Example**
```js
// Disable listening globally.
// Disable listening for a single callback.
functioncallback(mouseEvent){
console.log(`Monitor on success ${JSON.stringify(mouseEvent)}`);
| Boolean | Result indicating whether the touch event has been consumed by the input monitor. The value **true** indicates that the touch event has been consumed, and the value **false** indicates the opposite.|
| Boolean | Result indicating whether the touch event will be dispatched to the window. The value **true** indicates that the touch event will be dispatched to the window, and the value **false** indicates the opposite.|
**Example**
**Example**
```js
try{
inputMonitor.on("touch",(event)=>{
// If true is returned, all subsequent events of this operation will be consumed by the listener, instead of being distributed to the window.
returnfalse;
inputMonitor.on("touch",touchEvent=>{
if(touchEvent.touches.length==3){// Three fingers are pressed.
The Key Event module provides key events reported by an input device.
Represents key events reported by an input device.
> **NOTE**<br>
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Represents mouse events reported by an input device.
> **NOTE**<br>
> **NOTE**
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
...
...
@@ -15,75 +15,75 @@ import {Action,Button,Axis,AxisValue,MouseEvent} from '@ohos.multimodalInput.mou
| screenX | number | Yes| No| X coordinate of the mouse pointer on the screen.|
| screenY | number | Yes| No| Y coordinate of the mouse pointer on the screen.|
| windowX | number | Yes| No| X coordinate of the mouse pointer in the window.|
| windowY | number | Yes| No| Y coordinate of the mouse pointer in the window.|
| rawDeltaX | number | Yes| No| X axis offset relative to the previous reported mouse pointer position. When the mouse pointer is at the edge of the screen, the value may be less than the difference of the X coordinate reported twice.|
| rawDeltaY | number | Yes| No| Y axis offset relative to the previous reported mouse pointer position.|
| button | Button | Yes| No| Button that is currently pressed or released.|
| pressedButtons | Button[] | Yes| No| Button that is being pressed.|
| axes | AxisValue[] | Yes| No| All axis data contained in the event.|
| pressedKeys | KeyCode[] | Yes| No| List of pressed keys.|
| ctrlKey | boolean | Yes| No| Whether ctrlKey is being pressed.|
| altKey | boolean | Yes| No| Whether altKey is being pressed.|
| shiftKey | boolean | Yes| No| Whether shiftKey is being pressed.|
| logoKey | boolean | Yes| No| Whether logoKey is being pressed.|
| fnKey | boolean | Yes| No| Whether fnKey is being pressed.|
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>- **true**: The cellular data service is enabled.<br>- **false**: The cellular data service is disabled.|
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>**true**: The cellular data service is enabled.<br>**false**: The cellular data service is disabled.|
**Example**
...
...
@@ -280,7 +273,7 @@ Checks whether the cellular data service is enabled. This API uses a promise to
| Promise\<boolean\> | Promise used to return the result.<br>- **true**: The cellular data service is enabled.<br>- **false**: The cellular data service is disabled.|
| Promise\<boolean\> | Promise used to return the result.<br>**true**: The cellular data service is enabled.<br>**false**: The cellular data service is disabled.|
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>- **true**: The cellular data roaming service is enabled. <br>- **false**: The cellular data roaming service is disabled. |
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.|
| Promise\<boolean\> | Promise used to return the result.<br>- **true**: The cellular data roaming service is enabled.<br>- **false**: The cellular data roaming service is disabled.|
| Promise\<boolean\> | Promise used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.|
**Example**
...
...
@@ -585,7 +578,6 @@ promise.then((data) => {
});
```
## DataFlowType
Defines the cellular data flow type.
...
...
@@ -602,14 +594,14 @@ Defines the cellular data flow type.
## DataConnectState
Describes the connection status of a cellular data connection.
Describes the connection status of a cellular data link.