commit "bugfix screenlock"

Signed-off-by: lwf <liweifeng10@huawei.com>
This commit is contained in:
lwf 2024-03-30 19:35:47 +08:00
parent 399770642c
commit 81f8775a6e
2 changed files with 8 additions and 1 deletions

View File

@ -25,6 +25,7 @@ import hiDebug from '@ohos.hidebug';
import systemParameter from '@ohos.systemparameter';
import { CommonEventPublishData } from 'commonEvent/commonEventPublishData';
import {Callback} from '@ohos.base';
import { UIContext } from '@ohos.arkui.UIContext';
const TAG = 'ScreenLock-ScreenLockService';
const URI_DIGITALPASSWORD = 'pages/digitalPassword'
@ -261,8 +262,10 @@ export class ScreenLockService {
let slidestatus = AppStorage.Get('slidestatus')
if(!slidestatus){
AppStorage.SetOrCreate('slidestatus', true);
const UIContext: UIContext = AppStorage.get('UIContext');
Log.showInfo(TAG, `this.UIContext is ${UIContext}`)
Log.showInfo(TAG, `unlockScreen Router.push`);
Router.push({ uri: mRouterPath });
UIContext.getRouter().pushUrl({ url: mRouterPath })
}
}
})

View File

@ -20,6 +20,7 @@ import Log from '../../../../../../common/src/main/ets/default/Log'
import Constants from '../../../../../../features/screenlock/src/main/ets/com/ohos/common/constants'
import AbilityManager from '../../../../../../common/src/main/ets/default/abilitymanager/abilityManager'
import sTimeManager from '../../../../../../common/src/main/ets/default/TimeManager'
import { UIContext } from '@ohos.arkui.UIContext'
const TAG = "ScreenLock-ServiceExtAbility"
@ -36,6 +37,9 @@ class ServiceExtAbility extends ServiceExtension {
Log.showDebug(TAG, `createWindow name:${name}`)
windowManager.create(this.context, name, windowManager.WindowType.TYPE_KEYGUARD).then((win) => {
win.loadContent("pages/index").then(() => {
const UIContext: UIContext = win.getUIContext();
Log.showInfo(TAG, 'get UIContext successful,' + JSON.stringify(UIContext));
AppStorage.SetOrCreate('UIContext', UIContext);
Log.showInfo(TAG, name + " window loadContent in then! ")
win.show().then(() => {
Log.showInfo(TAG, "then begin " + name + " window show in then! ");