1# theme_screenlock_mgr 2 3#### Introduction 4Provide three-party APP with the ability to request unlockScreen, query the screenlock status, and query whether to set the screenlock password. 5Provide screenOn callback, screenOff callback, screenSaver in and out callback, user switching callback, and screenlock manager service running status callback to the operation management 6 7**subsystem architecture diagram** 8 9 10#### Warehouse path 11/base/theme/screenlock_mgr 12 13#### Introduction to framework code 14/base/theme/screenlock_mgr 15├── figures # architecture diagram 16├── frameworks/innerkitsimpl # interface provided for app 17├── interfaces # interface code provided by module 18│ ├── innerkits # inter service interface 19│ └── kits # napi interface 20├── sa_profile # module contains the config files of system services and processes 21├── services # implementation of screenlock manager service 22├── test # unit test of interface 23└── utils # module contains log printing and constants for ordered commonEvent 24 25#### JS APIs and instructions 261. JS APIs 27function isScreenLocked(callback: AsyncCallback<boolean>): void; query the screenlock status,callback mode 28function isScreenLocked(): Promise<boolean>; void; query the screenlock status,Promise mode 29 30function isSecureMode(callback: AsyncCallback<boolean>): void; query whether to set screenlock password (gesture, digital password, pin, SIM),callback mode 31function isSecureMode(): Promise<boolean>; query whether to set screenlock password (gesture, digital password, pin, SIM),Promise mode 32 33function unlockScreen(callback: AsyncCallback<void>): void; request unlockScreen,callback mode 34function unlockScreen(): Promise<void>; request unlockScreen,Promise mode 35 362. JS APIs instructions 37// Import module 38import screenLock from '@ohos.screenLock'; 39 40// query the screenlock status asynchronously with a Promise 41screenLock.isScreenLocked() 42 .then((value) => { 43 console.log(`success to screenLock.isScreenLocked: ${value}`); 44 }).catch((err) => { 45 console.error(`failed to screenLock.isScreenLocked because ${err.message}`) 46 }); 47 48 49// query the screenlock status asynchronously with a callback 50screenLock.isScreenLocked((err, value) => { 51 if (err) { 52 console.error(`failed to screenLock.isScreenLocked because ${err.message}`); 53 return; 54 } 55 console.log(`success to screenLock.isScreenLocked: ${value}`); 56 }); 57 58#### Debugging method 59 601. Compile command 61 62./build.sh --product-name (Fill in the specific product name, such as:Hi3516DV300) --build-target screenlock_native 63 642. push so file 65 66in $root\out\ohos-arm-release\miscservices\screenlock_native,push libscreenlock_server.z.so libscreenlock_client.z.so 67libscreenlock_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. 68 693. reboot 70 71#### Participation contribution 72 731. Fork warehouse 742. Submission code 753. Create a new pull request 764. Commit is complete 77 78