• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..17-Mar-2025-

figures/H17-Mar-2025-

frameworks/H17-Mar-2025-982608

interfaces/H17-Mar-2025-3,4322,316

plugins/H17-Mar-2025-7,9375,745

sa_profile/H17-Mar-2025-6041

services/H17-Mar-2025-7,5715,725

utils/H17-Mar-2025-3,1012,335

LICENSEH A D17-Mar-202511.1 KiB202169

OAT.xmlH A D17-Mar-20255.6 KiB8736

README.mdH A D17-Mar-20254.9 KiB10477

README_ZH.mdH A D17-Mar-20254.4 KiB10477

bundle.jsonH A D17-Mar-20256.5 KiB173172

standby_service.gniH A D17-Mar-20253.3 KiB10277

README.md

1# Device Standby
2## Introduction<a name="section11660541593"></a>
3To improve device endurance and reduce device power consumption, the system will limit the use of resources by backend applications when the device enters a standby idle state. Developers can apply for inclusion in standby resource control for their applications based on their own situation, or temporarily not be controlled by standby resources.
4
5**Image 1**  Device Standby system structure
6
7![](figures/zh-en_image.png)
8
9## Directory Structure<a name="section161941989596"></a>
10
11```
12/foundation/resourceschedule/device_standby
13├── frameworks       # API interface
14├── interfaces
15│   ├── innerkits    # inside interface
16│   └── kits         # outside interface
17├── sa_profile       # component service configruation
18├── services         # service implements
19└── utils            # commone utils
20└── plugins          # plugins(state detection、decision、transition、exection)
21└── bundle.json      # component discription and build file
22```
23
24### Inner Module Introduction<a name="section114564657874"></a>
25
26|Module Name   |Discription    |
27|------------|---------------|
28|interface   |1.provide inner dump function, exemption, notification interfaces. |
29|            |2.provide constraint interfaces. |
30|sa_profile  |config standby service in service management.|
31|services    |1.core services implements. |
32|            |2.notification, search function. |
33|plugins     |1.status detection. |
34|            |2.limit application source decision.|
35|            |3.change device status.  |
36|            |4.execte strategy|
37|utils       |1.common tools, log ability|
38|            |2.reference configuration |
39|frameworks  |provide Apis.|
40
41## Device Standby<a name="section1312121216216"></a>
42
43|Interface   |Discription    |
44|------------|---------------|
45|function getExemptedApps(resourceTypes: number, callback: AsyncCallback<Array&lt;ExemptedAppInfo&gt;>): void; |Returns the information about the specified exempted application. |
46|function getExemptedApps(resourceTypes: number): Promise<Array&lt;ExemptedAppInfo&gt;>; |Returns the information about the specified exempted application. |
47|function requestExemptionResource(request: ResourceRequest): void; |Requests exemption resources.|
48|function releaseExemptionResource(request: ResourceRequest): void; |Releases exemption resources.|
49
50## Usage Guidelines<a name="section114564657874"></a>
51
52When the device application is not used for a long time or by pressing a button, this component can put the device application into standby mode. Standby mode does not affect application usage and can also extend battery life. Through this module interface, developers can apply for or cancel standby resource control for applications. Before using these apis, please apply permission first: ohos.permission.DEVICE_STANDBY_EXEMPTION.
53
54### ResourceType
55
56The type of exemption resources requested by the application.
57
58|Name   |Value   |Discription|
59| ------------ | ------------ |--------------|
60|NETWORK    |1   |The resource for non-standby network access.|
61|RUNNING_LOCK    |2   |The resource for non-standby cpu running-lock.|
62|TIMER     |4   |The resource for non-standby timer.|
63|WORK_SCHEDULER     |8   |The resource for non-standby workscheduler.|
64|AUTO_SYNC      |16   |The resource for non-standby automatic synchronization.|
65|PUSH     |32   |The resource for non-standby push-kit.|
66|FREEZE       |64   |The resource for non-standby freezing application.|
67
68### ExemptedAppInfo
69
70Information about an exempted application.
71
72|Name  |Type   | Required   |Discription   |
73| ------------ | ------------ |------------ | ------------ |
74|[resourceTypes](#resourcetype)   | number  | Yes   |The set of resource types that an application requests.   |
75|name   |string   | Yes   |  The application name.  |
76|duration   | number  | Yes   | The exemption duration. |
77
78### ResourceRequest
79
80The request of standby resources.
81
82|Name  |Type   | Required   |Discription   |
83| ------------ | ------------ |------------| ------------ |
84|[resourceTypes](#resourcetype)   | number  | Yes   |The set of resource types that an application requests.|
85|uid   | number  | Yes   |The application uid.|
86|name   |string   | Yes   |The application name.|
87|duration   | number  | Yes   |The exemption duration.|
88|reason   |string   | Yes   |The reason for the request.|
89
90## Repositories Involved<a name="section1371113476307"></a>
91
92Resource Schedule subsystem
93
94[**resourceschedule_device_standby**](https://gitee.com/openharmony/resourceschedule_device_standby)
95
96[resourceschedule_work_scheduler](https://gitee.com/openharmony/resourceschedule_work_scheduler)
97
98[notification_ces_standard](https://gitee.com/openharmony/notification_ces_standard)
99
100[appexecfwk_standard](https://gitee.com/openharmony/appexecfwk_standard)
101
102[powermgr_battery_manager](https://gitee.com/openharmony/powermgr_battery_manager)
103
104[resourceschedule_background_task_mgr](https://gitee.com/openharmony/resourceschedule_background_task_mgr)

README_ZH.md

1# 设备待机部件
2## 简介<a name="section11660541593"></a>
3为提高设备续航,降低设备功耗,在设备进入待机空闲状态时,系统会限制后台应用使用资源。开发者可以根据自身情况,为自己的应用申请纳入待机资源管控,或者暂时不被待机资源管控。
4
5**图 1**  设备待机部件整体架构图
6
7![](figures/zh-cn_image.png)
8
9## 目录<a name="section161941989596"></a>
10
11```
12/foundation/resourceschedule/device_standby
13├── frameworks       # 接口实现
14├── interfaces
15│   ├── innerkits    # 对内接口目录
16│   └── kits         # 对外接口目录
17├── sa_profile       # 组件服务配置
18├── services         # 组件服务实现
19└── utils            # 组件工具实现
20└── plugins          # 插件(状态监控、决策、转换、执行)
21└── bundle.json      # 部件描述及编译文件
22```
23
24### 部件内子模块职责说明<a name="section114564657874"></a>
25
26|子模块名称   |功能职责描述    |
27|------------|---------------|
28|interface   |1.对外提供inner级别dump维测、豁免、通知接口。 |
29|            |2.提供约束接口。 |
30|sa_profile  |在服务管理中配置standby服务。|
31|services    |1.内部核心服务功能实现。 |
32|            |2.通知、查询功能。 |
33|plugins     |1.状态监控。 |
34|            |2.决策是否限制设备应用资源。|
35|            |3.转换设备状态。  |
36|            |4.执行策略。|
37|utils       |1.通用工具、日志实现。|
38|            |2.相关配置读写。 |
39|frameworks  |配置对外接口框架能力。|
40
41## 设备待机管控<a name="section1312121216216"></a>
42
43|接口名   |接口描述    |
44|------------|---------------|
45|function getExemptedApps(resourceTypes: number, callback: AsyncCallback<Array&lt;ExemptedAppInfo&gt;>): void; |获取进入待机模式的应用名单,使用Callback异步回调。 |
46|function getExemptedApps(resourceTypes: number): Promise<Array&lt;ExemptedAppInfo&gt;>; |获取进入待机模式的应用名单,使用Promise异步回调。 |
47|function requestExemptionResource(request: ResourceRequest): void; |应用订阅申请豁免,使应用临时不进入待机管控。|
48|function releaseExemptionResource(request: ResourceRequest): void; |取消应用订阅申请豁免。|
49
50## 使用说明<a name="section114564657874"></a>
51
52当设备应用长时间未被使用或通过按键,本部件可以使设备应用进入待机模式。待机模式不影响应用使用,还可以延长电池续航时间。通过本模块接口,开发者可为应用申请或取消待机资源管控。使用时需先申请权限:ohos.permission.DEVICE_STANDBY_EXEMPTION53
54### ResourceType
55
56非待机应用资源枚举。
57
58|名称   |值   |说明|
59| ------------ | ------------ |--------------|
60|NETWORK    |1   |网络访问资源|
61|RUNNING_LOCK    |2   |cpu-runninglock资源|
62|TIMER     |4   | timer任务资源|
63|WORK_SCHEDULER     |8   | work任务资源|
64|AUTO_SYNC      |16   | 自动同步的资源 |
65|PUSH     |32   | pushkit资源|
66|FREEZE       |64   | 冻结应用资源|
67
68### ExemptedAppInfo
69
70豁免应用信息,未进入待机管控的应用信息。
71
72|名称  |类型   | 必填   |说明   |
73| ------------ | ------------ |------------ | ------------ |
74|[resourceTypes](#resourcetype)   | number  | 是   |应用的资源类型   |
75|name   |string   | 是   |  应用名  |
76|duration   | number  | 是   | 豁免时长 |
77
78### ResourceRequest
79
80待机资源请求体。
81
82|名称   |类型   | 必填   |说明   |
83| ------------ | ------------ |------------| ------------ |
84|[resourceTypes](#resourcetype)   | number  | 是   |应用的资源类型   |
85|uid   | number  | 是   |应用uid   |
86|name   |string   | 是   | 应用名称  |
87|duration   | number  | 是   | 豁免时长 |
88|reason   |string   | 是   |  申请原因  |
89
90## 相关仓<a name="section1371113476307"></a>
91
92资源调度子系统
93
94[**resourceschedule_device_standby**](https://gitee.com/openharmony/resourceschedule_device_standby)
95
96[resourceschedule_work_scheduler](https://gitee.com/openharmony/resourceschedule_work_scheduler)
97
98[notification_ces_standard](https://gitee.com/openharmony/notification_ces_standard)
99
100[appexecfwk_standard](https://gitee.com/openharmony/appexecfwk_standard)
101
102[powermgr_battery_manager](https://gitee.com/openharmony/powermgr_battery_manager)
103
104[resourceschedule_background_task_mgr](https://gitee.com/openharmony/resourceschedule_background_task_mgr)