!130 【锁屏】解决重启场景无法解锁的问题

Merge pull request !130 from lwf/zpp/0330
This commit is contained in:
openharmony_ci 2024-03-30 13:47:27 +00:00 committed by Gitee
commit 603fff04c8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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! ");