提交 551b992f 编写于 作者: E ester.zhou

Update doc (15745)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 5cc343cf
# @ohos.screenLock (Screenlock) # @ohos.screenLock (Screen Lock)
The **screenlock** module is a system module in OpenHarmony. It provides APIs for screen lock applications to subscribe to screen lock status changes as well as callbacks for them to receive the results. It also provides APIs for third-party applications to unlock the screen, obtain the screen locked status, and check whether a lock screen password has been set. The **screenlock** module is a system module in OpenHarmony. It provides APIs for screen lock applications to subscribe to screen lock status changes as well as callbacks for them to receive the results. It also provides APIs for third-party applications to unlock the screen, obtain the screen locked status, and check whether a lock screen password has been set.
...@@ -12,12 +12,14 @@ The **screenlock** module is a system module in OpenHarmony. It provides APIs fo ...@@ -12,12 +12,14 @@ The **screenlock** module is a system module in OpenHarmony. It provides APIs fo
import screenlock from '@ohos.screenLock'; import screenlock from '@ohos.screenLock';
``` ```
## EventType ## EventType<sup>9+</sup>
Defines the system event type. Defines the system event type.
**System capability**: SystemCapability.MiscServices.ScreenLock **System capability**: SystemCapability.MiscServices.ScreenLock
**System API**: This is a system API.
| Event Type | Description | | Event Type | Description |
| ------------------ | ------------------------ | | ------------------ | ------------------------ |
| beginWakeUp | Wakeup starts.| | beginWakeUp | Wakeup starts.|
...@@ -35,15 +37,17 @@ Defines the system event type. ...@@ -35,15 +37,17 @@ Defines the system event type.
| screenlockEnabled | Screen lock is enabled. | | screenlockEnabled | Screen lock is enabled. |
| serviceRestart | The screen lock service is restarted. | | serviceRestart | The screen lock service is restarted. |
## SystemEvent ## SystemEvent<sup>9+</sup>
Defines the structure of the system event callback. Defines the structure of the system event callback.
**System capability**: SystemCapability.MiscServices.ScreenLock **System capability**: SystemCapability.MiscServices.ScreenLock
**System API**: This is a system API.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ------ | ---- | ------------- | | --------- | ------ | ---- | ------------- |
| eventType | [EventType](#eventtype) | Yes | System event type.| | eventType | [EventType](#eventtype9) | Yes | System event type.|
| params | string | Yes | System event parameters.| | params | string | Yes | System event parameters.|
## screenlock.isLocked<sup>9+</sup> ## screenlock.isLocked<sup>9+</sup>
...@@ -205,7 +209,7 @@ Registers a callback for system events related to screen locking. This API can b ...@@ -205,7 +209,7 @@ Registers a callback for system events related to screen locking. This API can b
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ----------------- | | -------- | ------------------------- | ---- | ----------------- |
| callback | Callback\<[SystemEvent](#systemevent)> | Yes | Callback for system events related to screen locking.| | callback | Callback\<[SystemEvent](#systemevent9)> | Yes | Callback for system events related to screen locking.|
**Return value** **Return value**
...@@ -228,7 +232,7 @@ try { ...@@ -228,7 +232,7 @@ try {
## screenlock.sendScreenLockEvent<sup>9+</sup> ## screenlock.sendScreenLockEvent<sup>9+</sup>
sendScreenLockEvent(event: string, parameter: number, callback: AsyncCallback&lt;boolean&gt;): void sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback&lt;boolean&gt;): void
Sends an event to the screen lock service. This API uses an asynchronous callback to return the result. Sends an event to the screen lock service. This API uses an asynchronous callback to return the result.
...@@ -240,7 +244,7 @@ Sends an event to the screen lock service. This API uses an asynchronous callbac ...@@ -240,7 +244,7 @@ Sends an event to the screen lock service. This API uses an asynchronous callbac
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ------------------------ | ---- | -------------------- | | --------- | ------------------------ | ---- | -------------------- |
| event | string | Yes | Event type.<br>- **"unlockScreenResult"**: Screen unlock result.<br>- **"lockScreenResult"**: Screen lock result.<br>- **"screenDrawDone"**: Screen drawing is complete.| | event | String | Yes | Event type.<br>- **"unlockScreenResult"**: Screen unlock result.<br>- **"lockScreenResult"**: Screen lock result.<br>- **"screenDrawDone"**: Screen drawing is complete.|
| parameter | number | Yes | Result.<br>- **0**: The operation is successful. For example, the screen is locked or unlocked successfully.<br>- **1**, the operation fails. For example, screen locking or unlocking fails.<br>- **2**: The operation is canceled. For example, screen locking or unlocking is canceled.| | parameter | number | Yes | Result.<br>- **0**: The operation is successful. For example, the screen is locked or unlocked successfully.<br>- **1**, the operation fails. For example, screen locking or unlocking fails.<br>- **2**: The operation is canceled. For example, screen locking or unlocking is canceled.|
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. The **value** true means that the event is sent successfully, and **false** means the opposite. | | callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. The **value** true means that the event is sent successfully, and **false** means the opposite. |
...@@ -259,7 +263,7 @@ screenlock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => { ...@@ -259,7 +263,7 @@ screenlock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => {
## screenlock.sendScreenLockEvent<sup>9+</sup> ## screenlock.sendScreenLockEvent<sup>9+</sup>
sendScreenLockEvent(event: string, parameter: number): Promise&lt;boolean&gt; sendScreenLockEvent(event: String, parameter: number): Promise&lt;boolean&gt;
Sends an event to the screen lock service. This API uses a promise to return the result. Sends an event to the screen lock service. This API uses a promise to return the result.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册