From 7447e183fa2b51c9be79309d5f12479e1f59e303 Mon Sep 17 00:00:00 2001 From: chengxingzhen Date: Thu, 24 Nov 2022 19:24:20 +0800 Subject: [PATCH] =?UTF-8?q?fixed=2040187b9=20from=20https://gitee.com/chen?= =?UTF-8?q?gxingzhen/xts=5Facts=5Fmaster/pulls/6681=20xst=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=94=A8=E4=BE=8B=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chengxingzhen --- .../entry/src/main/ets/MainAbility3/app.ets | 8 +++++++- .../entry/src/main/ets/MainAbility4/app.ets | 8 ++++++-- .../entry/src/main/ets/MainAbility5/app.ets | 8 ++++++-- .../fasupportfunctiontwo/src/main/ets/MainAbility/app.ets | 8 ++++++-- .../entry/src/main/ets/MainAbility/app.ets | 8 ++++++-- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility3/app.ets b/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility3/app.ets index 14fe5be1e..c8c90ee7d 100644 --- a/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility3/app.ets +++ b/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility3/app.ets @@ -19,6 +19,7 @@ import bundle from '@ohos.bundle'; var TAG1 = "Fa:SupportFunction:MainAbility3:"; var listPush1 = "Fa_SupportFunction_MainAbility3_"; var lifeList = []; +let setDisplayOrientation1 = 0; export default { onCreate() { console.log(TAG1 + 'onCreate'); @@ -39,6 +40,11 @@ export default { ability_featureAbility.getContext().setDisplayOrientation(orientation, (error, setDisplayOrientation) => { console.log(TAG1 + "setDisplayOrientation data = " + JSON.stringify(setDisplayOrientation)); console.log(TAG1 + "setDisplayOrientation error = " + JSON.stringify(error)); + if (setDisplayOrientation == undefined) { + setDisplayOrientation1 = 1 + } else { + console.log(`${TAG1} setDisplayOrientation callBack is error: ${JSON.stringify(setDisplayOrientation)}`); + } ability_featureAbility.getContext().getDisplayOrientation((error, displayOrientationAfter) => { console.log(TAG1 + "getDisplayOrientation2 data = " + JSON.stringify(displayOrientationAfter)); @@ -49,7 +55,7 @@ export default { displayOrientationBefore: displayOrientationBefore, displayOrientationAfter: displayOrientationAfter, lifeList: lifeList, - setDisplayOrientation: setDisplayOrientation + setDisplayOrientation: setDisplayOrientation1 } } commonEvent.publish(listPush1 + "onActive", options, (err) => { diff --git a/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility4/app.ets b/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility4/app.ets index 7e674d958..de5a02d9b 100644 --- a/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility4/app.ets +++ b/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility4/app.ets @@ -33,7 +33,7 @@ export default { let displayOrientationBefore = undefined; let displayOrientationAfter = undefined; - let setDisplayOrientation = undefined; + let setDisplayOrientation = 0; let orientation = undefined; let number = undefined; let wantNum = undefined; @@ -116,7 +116,11 @@ export default { await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => { console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data)); - setDisplayOrientation = data; + if (data == undefined) { + setDisplayOrientation = 1 + } else { + console.log(`${TAG1} setDisplayOrientation callBack is error: ${JSON.stringify(data)}`); + } }).catch((error) => { console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error)); }) diff --git a/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility5/app.ets b/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility5/app.ets index 83a4e386d..508552e06 100644 --- a/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility5/app.ets +++ b/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility5/app.ets @@ -33,7 +33,7 @@ export default { let displayOrientationBefore = undefined; let displayOrientationAfter = undefined; - let setDisplayOrientation = undefined; + let setDisplayOrientation = 0; let orientation = bundle.DisplayOrientation.FOLLOW_RECENT; await ability_featureAbility.getContext().getDisplayOrientation().then((data) => { @@ -45,7 +45,11 @@ export default { await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => { console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data)); - setDisplayOrientation = data; + if (data == undefined) { + setDisplayOrientation = 1 + } else { + console.log(`${TAG1} setDisplayOrientation callBack is error: ${JSON.stringify(data)}`); + } }).catch((error) => { console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error)); }) diff --git a/ability/ability_runtime/actssupportfunction/fasupportfunction/fasupportfunctiontwo/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actssupportfunction/fasupportfunction/fasupportfunctiontwo/src/main/ets/MainAbility/app.ets index 8a51518b4..2cbd05f2d 100644 --- a/ability/ability_runtime/actssupportfunction/fasupportfunction/fasupportfunctiontwo/src/main/ets/MainAbility/app.ets +++ b/ability/ability_runtime/actssupportfunction/fasupportfunction/fasupportfunctiontwo/src/main/ets/MainAbility/app.ets @@ -33,7 +33,7 @@ export default { let displayOrientationBefore = undefined; let displayOrientationAfter = undefined; - let setDisplayOrientation = undefined; + let setDisplayOrientation = 0; let orientation = bundle.DisplayOrientation.FOLLOW_RECENT; await ability_featureAbility.getContext().getDisplayOrientation().then((data) => { @@ -45,7 +45,11 @@ export default { await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => { console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data)); - setDisplayOrientation = data; + if (data == undefined) { + setDisplayOrientation = 1 + } else { + console.log(`${TAG1} setDisplayOrientation callBack is error: ${JSON.stringify(data)}`); + } }).catch((error) => { console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error)); }) diff --git a/ability/ability_runtime/actssupportfunction/fasupportfunctionthree/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actssupportfunction/fasupportfunctionthree/entry/src/main/ets/MainAbility/app.ets index 1272fea8a..8083aa6d3 100644 --- a/ability/ability_runtime/actssupportfunction/fasupportfunctionthree/entry/src/main/ets/MainAbility/app.ets +++ b/ability/ability_runtime/actssupportfunction/fasupportfunctionthree/entry/src/main/ets/MainAbility/app.ets @@ -33,7 +33,7 @@ export default { let displayOrientationBefore = undefined; let displayOrientationAfter = undefined; - let setDisplayOrientation = undefined; + let setDisplayOrientation = 0; let orientation = bundle.DisplayOrientation.FOLLOW_RECENT; await ability_featureAbility.getContext().getDisplayOrientation().then((data) => { @@ -45,7 +45,11 @@ export default { await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => { console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data)); - setDisplayOrientation = data; + if (data == undefined) { + setDisplayOrientation = 1 + } else { + console.log(`${TAG1} setDisplayOrientation callBack is error: ${JSON.stringify(data)}`); + } }).catch((error) => { console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error)); }) -- GitLab