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 14fe5be1e3573ebffb951324c07e6da6721db68b..c8c90ee7dea155d4697d92973c5bb11b06998d41 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 7e674d95858e429ec4a7a4cba97deba468c1579d..de5a02d9b0b9828a8f2c11e1757038cd222e198d 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 83a4e386d82c47580a01e2d3b7928490e3c99682..508552e064c9ebdd52bf70ccd3623da7a3872b41 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 8a51518b4fd84878416f8c6fba7ad1044c13c6bf..2cbd05f2dcc6d4adaa12a1420dffdc3d201fe38e 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 1272fea8a5607e5703c29896381f781ec5f97fc8..8083aa6d308b1ebd7aa11b9d1ba6a83adfd9e3c9 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)); })