提交 d45391d8 编写于 作者: W wangdongqi

Signed-off-by: wangdongqi <wangdongqi2@huawei.com>

 Changes to be committed:

 Changes to be committed:

 Changes to be committed:

 Changes to be committed:

 Changes to be committed:
上级 d0a9bc2c
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
## 导入模块 ## 导入模块
```js ```js
import screenlock from '@ohos.screenLock'; import screenLock from '@ohos.screenLock';
``` ```
## EventType<sup>9+</sup> ## EventType<sup>9+</sup>
...@@ -50,7 +50,7 @@ import screenlock from '@ohos.screenLock'; ...@@ -50,7 +50,7 @@ import screenlock from '@ohos.screenLock';
| eventType | [EventType](#eventtype9) | 是 | 系统事件类型。 | | eventType | [EventType](#eventtype9) | 是 | 系统事件类型。 |
| params | string | 是 | 系统事件参数。 | | params | string | 是 | 系统事件参数。 |
## screenlock.isLocked<sup>9+</sup> ## screenLock.isLocked<sup>9+</sup>
isLocked(): boolean isLocked(): boolean
...@@ -69,10 +69,10 @@ isLocked(): boolean ...@@ -69,10 +69,10 @@ isLocked(): boolean
**示例:** **示例:**
```js ```js
let isLocked = screenlock.isLocked(); let isLocked = screenLock.isLocked();
``` ```
## screenlock.unlock<sup>9+</sup> ## screenLock.unlock<sup>9+</sup>
unlock(callback: AsyncCallback&lt;boolean&gt;): void unlock(callback: AsyncCallback&lt;boolean&gt;): void
...@@ -98,17 +98,17 @@ unlock(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -98,17 +98,17 @@ unlock(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
```js ```js
screenlock.unlock((err, data) => { screenLock.unlock((err, data) => {
if (err) { if (err) {
console.error(`Failed to unlock the screen, because: ${err.message}`); console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`);
return; return;
} }
console.info(`unlock the screen successfully. result: ${data}`); console.info(`Succeeded in unlocking the screen. result: ${data}`);
}); });
``` ```
## screenlock.unlock<sup>9+</sup> ## screenLock.unlock<sup>9+</sup>
unlock(): Promise&lt;boolean&gt; unlock(): Promise&lt;boolean&gt;
...@@ -134,15 +134,15 @@ unlock(): Promise&lt;boolean&gt; ...@@ -134,15 +134,15 @@ unlock(): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.unlock().then((data) => { screenLock.unlock().then((data) => {
console.info(`unlock the screen successfully. result: ${data}`); console.info(`Succeeded in unlocking the screen. result: ${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to unlock the screen, because: ${err.message}`); console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`);
}); });
``` ```
## screenlock.lock<sup>9+</sup> ## screenLock.lock<sup>9+</sup>
lock(callback: AsyncCallback&lt;boolean&gt;): void lock(callback: AsyncCallback&lt;boolean&gt;): void
...@@ -170,17 +170,17 @@ lock(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -170,17 +170,17 @@ lock(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
```js ```js
screenlock.lock((err, data) => { screenLock.lock((err, data) => {
if (err) { if (err) {
console.error(`Failed to lock the screen, because: ${err.message}`); console.error(`Failed to lock the screen, Code: ${err.code}, message: ${err.message}`);
return; return;
} }
console.info(`lock the screen successfully. result: ${data}`); console.info(`Succeeded in locking the screen. result: ${data}`);
}); });
``` ```
## screenlock.lock<sup>9+</sup> ## screenLock.lock<sup>9+</sup>
lock(): Promise&lt;boolean&gt; lock(): Promise&lt;boolean&gt;
...@@ -208,15 +208,15 @@ lock(): Promise&lt;boolean&gt; ...@@ -208,15 +208,15 @@ lock(): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.lock().then((data) => { screenLock.lock().then((data) => {
console.info(`lock the screen successfully. result: ${data}`); console.info(`Succeeded in locking the screen. result: ${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to lock the screen, because: ${err.message}`); console.error(`Failed to lock the screen, Code: ${err.code}, message: ${err.message}`);
}); });
``` ```
## screenlock.onSystemEvent<sup>9+</sup> ## screenLock.onSystemEvent<sup>9+</sup>
onSystemEvent(callback: Callback&lt;SystemEvent&gt;): boolean onSystemEvent(callback: Callback&lt;SystemEvent&gt;): boolean
...@@ -250,17 +250,17 @@ onSystemEvent(callback: Callback&lt;SystemEvent&gt;): boolean ...@@ -250,17 +250,17 @@ onSystemEvent(callback: Callback&lt;SystemEvent&gt;): boolean
**示例:** **示例:**
```js ```js
try { try {
let isSuccess = screenlock.onSystemEvent((event) => { let isSuccess = screenLock.onSystemEvent((event) => {
console.log(`Register the system event which related to screenlock successfully. eventType: ${event.eventType}`) console.log(`Succeeded in Registering the system event which related to screenlock. eventType: ${event.eventType}`)
}); });
} catch (err) { } catch (err) {
console.error(`Failed to register the system event which related to screenlock, because: ${err.message}`) console.error(`Failed to register the system event which related to screenlock, Code: ${err.code}, message: ${err.message}`)
} }
``` ```
## 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
...@@ -290,17 +290,17 @@ sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback&lt ...@@ -290,17 +290,17 @@ sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback&lt
**示例:** **示例:**
```js ```js
screenlock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => { screenLock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => {
if (err) { if (err) {
console.error(`Failed to send screenlock event, because: ${err.message}`); console.error(`Failed to send screenlock event, Code: ${err.code}, message: ${err.message}`);
return; return;
} }
console.info(`Send screenlock event successfully. result: ${result}`); console.info(`Succeeded in Sending screenlock event. result: ${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;
...@@ -335,15 +335,15 @@ sendScreenLockEvent(event: String, parameter: number): Promise&lt;boolean&gt; ...@@ -335,15 +335,15 @@ sendScreenLockEvent(event: String, parameter: number): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => { screenLock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => {
console.info(`Send screenlock event successfully. result: ${result}`); console.info(`Succeeded in Sending screenlock event. result: ${result}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to send screenlock event, because: ${err.message}`); console.error(`Failed to send screenlock event, Code: ${err.code}, message: ${err.message}`);
}); });
``` ```
## screenlock.isScreenLocked<sup>(deprecated)</sup> ## screenLock.isScreenLocked<sup>(deprecated)</sup>
isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void
...@@ -363,17 +363,17 @@ isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -363,17 +363,17 @@ isScreenLocked(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
```js ```js
screenlock.isScreenLocked((err, data)=>{ screenLock.isScreenLocked((err, data)=>{
if (err) { if (err) {
console.error(`Failed to obtain whether the screen is locked, because: ${err.message}`); console.error(`Failed to obtain whether the screen is locked, Code: ${err.code}, message: ${err.message}`);
return; return;
} }
console.info(`Obtain whether the screen is locked successfully. result: ${data}`); console.info(`Succeeded in Obtaining whether the screen is locked. result: ${data}`);
}); });
``` ```
## screenlock.isScreenLocked<sup>(deprecated)</sup> ## screenLock.isScreenLocked<sup>(deprecated)</sup>
isScreenLocked(): Promise&lt;boolean&gt; isScreenLocked(): Promise&lt;boolean&gt;
...@@ -393,15 +393,15 @@ isScreenLocked(): Promise&lt;boolean&gt; ...@@ -393,15 +393,15 @@ isScreenLocked(): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.isScreenLocked().then((data) => { screenLock.isScreenLocked().then((data) => {
console.info(`Obtain whether the screen is locked successfully. result: ${data}`); console.info(`Succeeded in Obtaining whether the screen is locked. result: ${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to obtain whether the screen is locked, because: ${err.message}`); console.error(`Failed to obtain whether the screen is locked, Code: ${err.code}, message: ${err.message}`);
}); });
``` ```
## screenlock.isSecureMode<sup>(deprecated)</sup> ## screenLock.isSecureMode<sup>(deprecated)</sup>
isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void
...@@ -421,17 +421,17 @@ isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -421,17 +421,17 @@ isSecureMode(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
```js ```js
screenlock.isSecureMode((err, data)=>{ screenLock.isSecureMode((err, data)=>{
if (err) { if (err) {
console.error(`Failed to obtain whether the device is in secure mode, because: ${err.message}`); console.error(`Failed to obtain whether the device is in secure mode, Code: ${err.code}, message: ${err.message}`);
return; return;
} }
console.info(`Obtain whether the device is in secure mode successfully. result: ${data}`); console.info(`Succeeded in Obtaining whether the device is in secure mode. result: ${data}`);
}); });
``` ```
## screenlock.isSecureMode<sup>(deprecated)</sup> ## screenLock.isSecureMode<sup>(deprecated)</sup>
isSecureMode(): Promise&lt;boolean&gt; isSecureMode(): Promise&lt;boolean&gt;
...@@ -451,14 +451,15 @@ isSecureMode(): Promise&lt;boolean&gt; ...@@ -451,14 +451,15 @@ isSecureMode(): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
screenlock.isSecureMode().then((data) => { screenLock.isSecureMode().then((data) => {
console.info(`Obtain whether the device is in secure mode successfully. result: ${data}`); console.info(`Succeeded in Obtaining whether the device is in secure mode. result: ${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Failed to obtain whether the device is in secure mode, because: ${err.message}`); console.error(`Failed to obtain whether the device is in secure mode, Code: ${err.code}, message: ${err.message}`);
}); });
``` ```
## screenlock.unlockScreen<sup>(deprecated)</sup>
## screenLock.unlockScreen<sup>(deprecated)</sup>
unlockScreen(callback: AsyncCallback&lt;void&gt;): void unlockScreen(callback: AsyncCallback&lt;void&gt;): void
...@@ -478,17 +479,17 @@ unlockScreen(callback: AsyncCallback&lt;void&gt;): void ...@@ -478,17 +479,17 @@ unlockScreen(callback: AsyncCallback&lt;void&gt;): void
**示例:** **示例:**
```js ```js
screenlock.unlockScreen((err) => { screenLock.unlockScreen((err) => {
if (err) { if (err) {
console.error(`Failed to unlock the screen, because: ${err.message}`); console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`);
return; return;
} }
console.info('unlock the screen successfully.'); console.info(`Succeeded unlocking the screen.`);
}); });
``` ```
## screenlock.unlockScreen<sup>(deprecated)</sup> ## screenLock.unlockScreen<sup>(deprecated)</sup>
unlockScreen(): Promise&lt;void&gt; unlockScreen(): Promise&lt;void&gt;
...@@ -508,10 +509,10 @@ unlockScreen(): Promise&lt;void&gt; ...@@ -508,10 +509,10 @@ unlockScreen(): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
screenlock.unlockScreen().then(() => { screenLock.unlockScreen().then(() => {
console.info('unlock the screen successfully.'); console.info('Succeeded unlocking the screen.');
}).catch((err) => { }).catch((err) => {
console.error(`Failed to unlock the screen, because: ${err.message}`); console.error(`Failed to unlock the screen, Code: ${err.code}, message: ${err.message}`);
}); });
``` ```
# 主题框架子系统锁屏管理ChangeLog
## cl.screenlock.1 代码实例名称变更
锁屏管理的包名为'@ohos.screenLock',在导入时,使用的代码实例应为screenLock,而不是screenlock。
**变更影响**
无。
**关键的接口/组件变更**
修改前的接口调用:
```js
screenlock.isLocked();
screenlock.unlock();
screenlock.lock();
screenlock.onSystemEvent(event=>{});
screenlock.sendScreenLockEvent('unlockScreenResult', 0);
screenlock.isScreenLocked()
screenlock.isSecureMode();
screenlock.unlockScreen();
```
修改后的接口调用:
```js
screenLock.isLocked();
screenLock.unlock();
screenLock.lock();
screenLock.onSystemEvent(event=>{});
screenLock.sendScreenLockEvent('unlockScreenResult', 0);
screenLock.isScreenLocked()
screenLock.isSecureMode();
screenLock.unlockScreen();
```
**适配指导**
导入时使用screenLock,例如::
修改前
```js
import screenlock from '@ohos.screenLock';
```
修改后
```js
import screenLock from '@ohos.screenLock';
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册