Merge pull request !63 from 鲍亚永/change_misc_components
miscservices_screenlock
Introduction
Provide three-party APP with the ability to request unlockScreen, query the screenlock status, and query whether to set the screenlock password. Provide screenOn callback, screenOff callback, screenSaver in and out callback, user switching callback, and screenlock manager service running status callback to the operation management
subsystem architecture diagram

Warehouse path
/base/miscservices/screenlock
Introduction to framework code
/base/miscservices/screenlock ├── figures # architecture diagram ├── frameworks/innerkitsimpl # interface provided for app ├── interfaces # interface code provided by module │ ├── innerkits # inter service interface │ └── kits # napi interface ├── sa_profile # module contains the config files of system services and processes ├── services # implementation of screenlock manager service ├── test # unit test of interface └── utils # module contains log printing and constants for ordered commonEvent
JS APIs and instructions
- JS APIs function isScreenLocked(callback: AsyncCallback): void; query the screenlock status,callback mode function isScreenLocked(): Promise; void; query the screenlock status,Promise mode
function isSecureMode(callback: AsyncCallback): void; query whether to set screenlock password (gesture, digital password, pin, SIM),callback mode function isSecureMode(): Promise; query whether to set screenlock password (gesture, digital password, pin, SIM),Promise mode
function unlockScreen(callback: AsyncCallback): void; request unlockScreen,callback mode function unlockScreen(): Promise; request unlockScreen,Promise mode
- JS APIs instructions // Import module import screenLock from '@ohos.screenLock';
// query the screenlock status asynchronously with a Promise
screenLock.isScreenLocked()
.then((value) => {
console.log(success to screenLock.isScreenLocked: ${value});
}).catch((err) => {
console.error(failed to screenLock.isScreenLocked because ${err.message})
});
// query the screenlock status asynchronously with a callback
screenLock.isScreenLocked((err, value) => {
if (err) {
console.error(failed to screenLock.isScreenLocked because ${err.message});
return;
}
console.log(success to screenLock.isScreenLocked: ${value});
});
Debugging method
- Compile command
./build.sh --product-name (Fill in the specific product name, such as:Hi3516DV300) --build-target screenlock_native
- push so file
in $root\out\ohos-arm-release\miscservices\screenlock_native,push libscreenlock_server.z.so libscreenlock_client.z.so libscreenlock_utils.z.so to system/lib,and push libscreenlockability.z.so to system/lib/module/app下.make sure the four so files is readable at least.
- reboot
Participation contribution
- Fork warehouse
- Submission code
- Create a new pull request
- Commit is complete