• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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)