口令输入界面可以被截屏或者录屏,参考https://developer.huawei.com/consumer/cn/doc/best-practices-V5/bpta-harmony-application-security-V5\#section18516943133816
其中
let windowClass: window.Window = window.findWindow(“test”);
请问我的EntryAbility.ets中,并没有额外写相关createWindow之类的方法,是默认的onWindowStageCreate中拿到windowStage,那这种默认情况下的创建的窗口,我要如何在具体页面的组件中拿到这个窗口呢,这个窗口的name是什么?
onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate')
GlobalContext.getContext().setObject('windowStage', windowStage)
GlobalContext.getContext().setObject('uiAbilityContext', this.context)
windowStage.loadContent('pages/SplashPage', (err) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '')
return
}
// 持久化数据初始化
initPersistProps([
{ key: 'agreeAppProtocol', defaultValue: false },
{ key: 'userInfo', defaultValue: '' },
])
// 持久化存储存入全局 AppStorage
UserInfo.setAppStorageFromPersist()
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.')
})
}
可以使用getMainWindow
https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-window-V5\#getmainwindow9