• Home
Name Date Size #Lines LOC

..--

entry/12-May-2024-459433

screenshot/device/12-May-2024-

.gitignoreD12-May-2024121 88

README.mdD12-May-2024655 189

README_zh.mdD12-May-20241.6 KiB3317

build-profile.json5D12-May-20241 KiB4341

hvigorfile.jsD12-May-2024174 21

package.jsonD12-May-2024378 1918

README.md

1# Power Management
2
3### Introduction
4
5This sample shows how to power off a device, restart the system, and check the screen status.
6
7### Usage
8
91. To power off a device, tap the **Power off** button, and click **OK** in the displayed dialog. To quit, tap **Cancel** in the displayed dialog.
10
112. To restart the system, touch the **Restart** button, and click **OK** in the displayed dialog. To quit, tap **Cancel** in the displayed dialog.
12
133. To check whether the screen is on or off, tap the **Check screen status** button. The check result will be shown in the displayed dialog.
14
15### Constraints
16
17This sample can only be run on standard-system devices.
18

README_zh.md

1# 系统电源管理
2
3### 简介
4
5本示例展示了关机、重启以及检测亮灭屏状态的功能。实现效果如下:
6
7![](screenshot/device/main.png)
8
9### 相关概念
10
11电源管理:该模块主要提供重启、关机、查询屏幕状态等接口。
12
13### 相关权限
14
15电源管理权限:[ohos.permission.REBOO](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/permission-list.md)
16
17### 使用说明
18
191.点击**关机**按钮,并在弹框中点击确定,系统将关机。点击取消,则关闭弹窗。
20
212.点击**重启**按钮,并在弹框中点击确定,系统将重启。点击取消,则关闭弹窗。
22
233.点击**检测亮灭屏状态**按钮,将会把检测的结果信息展示在显示窗口中。
24
25### 约束与限制
26
271.本示例仅支持在标准系统上运行。
28
292.本示例需要使用DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022)才可编译运行。
30
313.本示例需要使用@ohos.power系统权限的系统接口。使用Full SDK时需要手动从镜像站点获取,并在DevEco Studio中替换,具体操作可参考[替换指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md)32
334.本示例所配置的权限ohos.permission.REBOOT为system_basic级别(相关权限级别可通过[权限定义列表](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/permission-list.md)查看),需要手动配置对应级别的权限签名(具体操作可查看[自动化签名方案](https://docs.openharmony.cn/pages/v3.2Beta/zh-cn/application-dev/security/hapsigntool-overview.md/))