mirror of
https://github.com/openharmony/applications_screenlock.git
synced 2026-07-01 10:23:02 -04:00
@@ -26,13 +26,15 @@ const TAG = 'ScreenLock-ScreenLockModel';
|
||||
export default class ScreenLockModel {
|
||||
@SysFaultLogger({FAULT_ID: FaultID.SCREEN_LOCK_MANAGER, MSG: "call func on failed"})
|
||||
eventListener(callback: Callback<String>) {
|
||||
let isSuccess = ScreenLockMar.onSystemEvent((err, event)=>{
|
||||
Log.showInfo(TAG, `eventListener:callback:${event.eventType}`)
|
||||
callback(event.eventType);
|
||||
if (err) {
|
||||
Log.showError(TAG, `on callback error -> ${JSON.stringify(err)}`);
|
||||
}
|
||||
});
|
||||
let isSuccess = null
|
||||
try {
|
||||
isSuccess = ScreenLockMar.onSystemEvent((event)=>{
|
||||
Log.showInfo(TAG, `eventListener:callback:${event.eventType}`)
|
||||
callback(event.eventType);
|
||||
});
|
||||
} catch (err: any) {
|
||||
Log.showError(TAG, `on callback error -> ${JSON.stringify(err)}`);
|
||||
}
|
||||
if (!isSuccess) {
|
||||
callback('serviceRestart');
|
||||
}
|
||||
|
||||
@@ -78,6 +78,9 @@
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.CONNECT_IME_ABILITY"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.ACCESS_SCREEN_LOCK_INNER"
|
||||
}
|
||||
],
|
||||
"extensionAbilities": [
|
||||
|
||||
@@ -72,6 +72,12 @@
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.SET_WALLPAPER"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.CONNECT_IME_ABILITY"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.ACCESS_SCREEN_LOCK_INNER"
|
||||
}
|
||||
],
|
||||
"extensionAbilities": [
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user