未验证 提交 03de8509 编写于 作者: O openharmony_ci 提交者: Gitee

!2452 #I4ZEPC:修正电源管理power和runningLock的API DOC

Merge pull request !2452 from hujun211/master
......@@ -25,7 +25,7 @@ shutdownDevice(reason: string): void
此接口为系统接口,三方应用不支持调用。
**需要权限:** ohos.permission.SHUTDOWN
**需要权限:** ohos.permission.REBOOT
**参数:**
......@@ -47,7 +47,7 @@ rebootDevice(reason: string): void
重启设备。
**需要权限:** ohos.permission.REBOOT(重启权限)、ohos.permission.REBOOT_UPDATER(重启并进入updater模式的权限)
**需要权限:** ohos.permission.REBOOT(重启权限)、ohos.permission.REBOOT_RECOVERY(重启并进入recovery或者updater模式的权限)
**参数:**
......@@ -71,7 +71,7 @@ isScreenOn(callback: AsyncCallback<boolean>): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ---------------------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 指定的callback回调方法,用于获取返回值。<br/>callback返回值:亮屏返回true,灭屏返回false。 |
......
......@@ -107,16 +107,16 @@ createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback&l
**示例:**
```
runningLock.createRunningLock("running_lock_test", runningLock.RunningLockType.BACKGROUND)
.then(runninglock => {
var used = runninglock.isUsed();
console.info('runninglock is used: ' + used);
runninglock.lock(500);
used = runninglock.isUsed();
console.info('after lock runninglock is used ' + used);
})
.catch(error => {
console.log('create runningLock test error: ' + error);
runningLock.createRunningLock("running_lock_test", runningLock.RunningLockType.BACKGROUND, (error, lockIns) => {
if (typeof error === "undefined") {
console.log('create runningLock test error: ' + error);
} else {
var used = lockIns.isUsed();
console.info('runninglock is used: ' + used);
lockIns.lock(500);
used = lockIns.isUsed();
console.info('after lock runninglock is used ' + used);
}
})
```
......@@ -172,9 +172,9 @@ lock(timeout: number): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | -------------------- |
| timeout | number | 否 | 锁定和持有RunningLock的时长。 |
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | -------------------------- |
| timeout | number | 否 | 锁定和持有RunningLock的时长,单位:毫秒。 |
**示例:**
......@@ -185,7 +185,7 @@ runningLock.createRunningLock("running_lock_test", runningLock.RunningLockType.B
console.info('create runningLock success')
})
.catch(error => {
console.log('Lock runningLock test error: ' + error)
console.log('create runningLock test error: ' + error)
});
```
......@@ -204,10 +204,10 @@ unlock(): void
runningLock.createRunningLock("running_lock_test", runningLock.RunningLockType.BACKGROUND)
.then(runningLock => {
runningLock.unlock()
console.info('unLock runningLock success')
console.info('create and unLock runningLock success')
})
.catch(error => {
console.log('unLock runningLock test error: ' + error)
console.log('create runningLock test error: ' + error)
});
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册