diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 29c0feade15478a40b571437bc2cb2b8d0ae227f..32f98fcb313fc0a69573b831a15b1a1f6837333e 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -44,18 +44,18 @@ export default class EntryAbility extends UIAbility { } this.windowClass = data; try { - this.windowClass.setWindowLayoutFullScreen(this.isLayoutFullScreen, (err: BusinessError) => { - const errCode: number = err.code; - if (errCode) { - Logger.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err)); - return; - } - Logger.info('Succeeded in setting the window layout to full-screen mode.'); + let promise = this.windowClass.setWindowLayoutFullScreen(this.isLayoutFullScreen); + promise.then(() => { + console.info('Succeeded in setting the window layout to full-screen mode.'); + }).catch((err: BusinessError) => { + console.error(`Failed to set the window layout to full-screen mode. Cause code: ${err.code}, message: ${err.message}`); }); } catch (exception) { - Logger.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(exception)); + console.error(`Failed to set the window layout to full-screen mode. Cause code: ${exception.code}, message: ${exception.message}`); + } + if (canIUse('SystemCapability.Window.SessionManager')) { + this.windowClass.setSpecificSystemBarEnabled('status', false); } - this.windowClass.setSpecificSystemBarEnabled('status', false); }) windowStage.loadContent('pages/Index', (err) => {