mirror of
https://github.com/openharmony/powermgr_powermgr_lite.git
synced 2026-06-30 22:17:53 -04:00
adaed469f8
Signed-off-by: zpyHH <zhengpengyue1@huawei.com>
5.6 KiB
5.6 KiB
Lite Power Manager
Introduction
The lite power manager provides the following capabilities:
- Managing sleep and wakeup locks.
- Keeping the device screen always on using a lock
Figure 1 Lite power manager architecture
Directory Structure
base/powermgr/powermgr_lite
├── figures # Architecture figures
├── frameworks # Frameworks
│ ├── include # Header files
│ └── src # Source files
├── interfaces # APIs
│ ├── innerkits # Internal APIs
│ └── kits # External APIs
├── services # Services
│ ├── include # Header files
│ └── src # Source files
└── utils # Utilities
├── include # Header files
└── src # Source files
Usage
Available APIs
The following table lists the JavaScript APIs provided by the lite power manager.
RunningLock *CreateRunningLock(const char *name, RunningLockType type, RunningLockFlag flag) |
|
Usage Guidelines
Runninglock Management
The lite power manager provides APIs to create, obtain, and release Runninglock objects.
The sample code is as follows:
const RunningLock *lock = CreateRunningLock("runinglock_example", RUNNINGLOCK_BACKGROUND, RUNNINGLOCK_FLAG_NONE);
if (lock == NULL) {
return;
}
BOOL ret = AcquireRunningLock(lock);
if (ret == FLASE) {
DestroyRunningLock(lock);
return;
}
ReleaseRunningLock(lock);
DestroyRunningLock(lock); // Must release runninglock before destroyed
