| callback | AsyncCallback<boolean> | Yes| Returns **true** if the screen is locked; returns **false** otherwise.|
| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns **true** if the screen is locked; returns **false** otherwise.|
**Example**
**Example**
...
@@ -50,6 +51,7 @@ Checks whether the screen is locked. This API uses a promise to return the resul
...
@@ -50,6 +51,7 @@ Checks whether the screen is locked. This API uses a promise to return the resul
| Promise<boolean> | Promise used to return the result.|
| Promise<boolean> | Promise used to return the result.|
...
@@ -77,9 +79,10 @@ Checks whether a device is in secure mode. This API uses an asynchronous callbac
...
@@ -77,9 +79,10 @@ Checks whether a device is in secure mode. This API uses an asynchronous callbac
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<boolean> | Yes| Returns **true** if the device is in secure mode; returns **false** otherwise.|
| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns **true** if the device is in secure mode; returns **false** otherwise.|
**Example**
**Example**
...
@@ -103,6 +106,7 @@ Checks whether a device is in secure mode. This API uses a promise to return the
...
@@ -103,6 +106,7 @@ Checks whether a device is in secure mode. This API uses a promise to return the
Locks the screen. This API uses an asynchronous callback to return the result.
Locks the screen. This API uses an asynchronous callback to return the result.
...
@@ -184,9 +190,10 @@ Locks the screen. This API uses an asynchronous callback to return the result.
...
@@ -184,9 +190,10 @@ Locks the screen. This API uses an asynchronous callback to return the result.
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation failed, an error message is returned.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation fails, an error message is returned.|
**Example**
**Example**
...
@@ -202,7 +209,7 @@ Locks the screen. This API uses an asynchronous callback to return the result.
...
@@ -202,7 +209,7 @@ Locks the screen. This API uses an asynchronous callback to return the result.
## screenlock.lockScreen<sup>9+</sup>
## screenlock.lockScreen<sup>9+</sup>
lockScreen(): Promise<void>
lockScreen(): Promise<boolean>
Locks the screen. This API uses a promise to return the result.
Locks the screen. This API uses a promise to return the result.
...
@@ -238,6 +245,7 @@ Subscribes to screen lock status changes.
...
@@ -238,6 +245,7 @@ Subscribes to screen lock status changes.
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type.<br>- **"beginWakeUp"**: Wakeup starts.<br>- **"endWakeUp"**: Wakeup ends.<br>- **"beginScreenOn"**: Screen turn-on starts.<br>- **"endScreenOn"**: Screen turn-on ends.<br>- **"beginScreenOff"**: Screen turn-off starts.<br>- **"endScreenOff"**: Screen turn-off ends.<br>- **"unlockScreen"**: The screen is unlocked.<br>- **"beginExitAnimation"**: Animation starts to exit.|
| type | string | Yes| Event type.<br>- **"beginWakeUp"**: Wakeup starts.<br>- **"endWakeUp"**: Wakeup ends.<br>- **"beginScreenOn"**: Screen turn-on starts.<br>- **"endScreenOn"**: Screen turn-on ends.<br>- **"beginScreenOff"**: Screen turn-off starts.<br>- **"endScreenOff"**: Screen turn-off ends.<br>- **"unlockScreen"**: The screen is unlocked.<br>- **"beginExitAnimation"**: Animation starts to exit.|
...
@@ -262,6 +270,7 @@ Subscribes to screen lock status changes.
...
@@ -262,6 +270,7 @@ Subscribes to screen lock status changes.
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type.<br>- **"beginSleep"**: The screen enters sleep mode.<br>- **"endSleep"**: The screen exits sleep mode.<br>- **"changeUser"**: The user is switched.|
| type | string | Yes| Event type.<br>- **"beginSleep"**: The screen enters sleep mode.<br>- **"endSleep"**: The screen exits sleep mode.<br>- **"changeUser"**: The user is switched.|
...
@@ -285,6 +294,7 @@ Subscribes to screen lock status changes.
...
@@ -285,6 +294,7 @@ Subscribes to screen lock status changes.
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type.<br>- **"screenlockEnabled"**: Screen lock is enabled.|
| type | string | Yes| Event type.<br>- **"screenlockEnabled"**: Screen lock is enabled.|
...
@@ -310,6 +320,7 @@ Unsubscribes from screen lock status changes.
...
@@ -310,6 +320,7 @@ Unsubscribes from screen lock status changes.
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type.<br>- **"beginWakeUp"**: Wakeup starts.<br>- **"endWakeUp"**: Wakeup ends.<br>- **"beginScreenOn"**: Screen turn-on starts.<br>- **"endScreenOn"**: Screen turn-on ends.<br>- **"beginScreenOff"**: Screen turn-off starts.<br>- **"endScreenOff"**: Screen turn-off ends.<br>- **"unlockScreen"**: The screen is unlocked.<br>- **"beginExitAnimation"**: Animation starts to exit.<br>- **"screenlockEnabled"**: Screen lock is enabled.<br>- **"beginSleep"**: The screen enters sleep mode.<br>- **"endSleep"**: The screen exits sleep mode.<br>- **"changeUser"**: The user is switched.|
| type | string | Yes| Event type.<br>- **"beginWakeUp"**: Wakeup starts.<br>- **"endWakeUp"**: Wakeup ends.<br>- **"beginScreenOn"**: Screen turn-on starts.<br>- **"endScreenOn"**: Screen turn-on ends.<br>- **"beginScreenOff"**: Screen turn-off starts.<br>- **"endScreenOff"**: Screen turn-off ends.<br>- **"unlockScreen"**: The screen is unlocked.<br>- **"beginExitAnimation"**: Animation starts to exit.<br>- **"screenlockEnabled"**: Screen lock is enabled.<br>- **"beginSleep"**: The screen enters sleep mode.<br>- **"endSleep"**: The screen exits sleep mode.<br>- **"changeUser"**: The user is switched.|
...
@@ -334,6 +345,7 @@ Sends an event to the screen lock service. This API uses an asynchronous callbac
...
@@ -334,6 +345,7 @@ Sends an event to the screen lock service. This API uses an asynchronous callbac
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API and cannot be called by third-party applications.
| parameter | number | Yes| Screen unlock status.<br>- **0**: The unlock is successful.<br>- **1**: The unlock failed.<br>- **2**: The unlock was canceled.|
| parameter | number | Yes| Screen unlock status.<br>- **0**: The unlock is successful.<br>- **1**: The unlock failed.<br>- **2**: The unlock was canceled.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise\<boolean\> | Promise used to return the result.|
| Promise\<boolean\> | Promise used to return the result.|