diff --git a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaShowOnLock.test.ets b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaShowOnLock.test.ets index 26f8e0c1f9c09781c198455cb88e6a1fa5c3b43e..f938b0608da11dd9626acd1e909d6b7cea3c43d8 100644 --- a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaShowOnLock.test.ets +++ b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaShowOnLock.test.ets @@ -105,12 +105,12 @@ export default function FaShowOnLockTest() { let status1 = undefined; let status2 = undefined; let lifeList = []; - let listCheck = ["onCreate", "onActive"]; - let onActive = "Fa_SupportFunction_MainAbility_onActive"; + let listCheck = ["onCreate", "wakeUpScreen"]; + let wakeUpScreen = "Fa_SupportFunction_MainAbility_wakeUpScreen"; var subscriber; var subscribeInfo = { - events: [onActive] + events: [wakeUpScreen] } await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); @@ -119,7 +119,7 @@ export default function FaShowOnLockTest() { commonEvent.subscribe(subscriber, async (err, data) => { console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); - if (data.event == onActive) { + if (data.event == wakeUpScreen) { lifeList = data.parameters.lifeList; setTimeout(async () => { await power.isScreenOn().then((data) => { @@ -162,8 +162,7 @@ export default function FaShowOnLockTest() { bundleName: "ohos.acts.aafwk.test.fasupportfunction", abilityName: "ohos.acts.aafwk.test.fasupportfunction.MainAbility", parameters: { - number: 1, - flag: true + number: 1 } } await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { @@ -187,12 +186,12 @@ export default function FaShowOnLockTest() { let status1 = undefined; let status2 = undefined; let lifeList = []; - let listCheck = ["onCreate", "onActive"]; - let onActive = "Fa_SupportFunction_MainAbility_onActive"; + let listCheck = ["onCreate", "wakeUpScreen"]; + let wakeUpScreen = "Fa_SupportFunction_MainAbility_wakeUpScreen"; var subscriber; var subscribeInfo = { - events: [onActive] + events: [wakeUpScreen] } await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); @@ -201,7 +200,7 @@ export default function FaShowOnLockTest() { commonEvent.subscribe(subscriber, async (err, data) => { console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); - if (data.event == onActive) { + if (data.event == wakeUpScreen) { lifeList = data.parameters.lifeList; setTimeout(async () => { await power.isScreenOn().then((data) => { @@ -244,8 +243,7 @@ export default function FaShowOnLockTest() { bundleName: "ohos.acts.aafwk.test.fasupportfunction", abilityName: "ohos.acts.aafwk.test.fasupportfunction.MainAbility", parameters: { - number: 2, - flag: true + number: 2 } } await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { @@ -269,12 +267,12 @@ export default function FaShowOnLockTest() { let status1 = undefined; let status2 = undefined; let lifeList = []; - let listCheck = ["onCreate", "onActive"]; - let onActive = "Fa_SupportFunction_MainAbility_onActive"; + let listCheck = ["onCreate", "wakeUpScreen"]; + let wakeUpScreen = "Fa_SupportFunction_MainAbility_wakeUpScreen"; var subscriber; var subscribeInfo = { - events: [onActive] + events: [wakeUpScreen] } await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); @@ -283,7 +281,7 @@ export default function FaShowOnLockTest() { commonEvent.subscribe(subscriber, async (err, data) => { console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); - if (data.event == onActive) { + if (data.event == wakeUpScreen) { lifeList = data.parameters.lifeList; setTimeout(async () => { await power.isScreenOn().then((data) => { @@ -326,8 +324,7 @@ export default function FaShowOnLockTest() { bundleName: "ohos.acts.aafwk.test.fasupportfunction", abilityName: "ohos.acts.aafwk.test.fasupportfunction.MainAbility", parameters: { - number: 3, - flag: true + number: 3 } } await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { @@ -352,13 +349,13 @@ export default function FaShowOnLockTest() { let status2 = undefined; let status3 = undefined; let lifeList = []; - let listCheck = ["onCreate", "onActive"]; - let onActive = "Fa_SupportFunction_MainAbility2_onActive"; + let listCheck = ["onCreate", "wakeUpScreen"]; + let wakeUpScreen = "Fa_SupportFunction_MainAbility2_wakeUpScreen"; let wakeUpErr = "Fa_SupportFunction_MainAbility2_wakeUpErr"; var subscriber; var subscribeInfo = { - events: [onActive, wakeUpErr] + events: [wakeUpScreen, wakeUpErr] } await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); @@ -371,7 +368,7 @@ export default function FaShowOnLockTest() { status3 = true; } - if (data.event == onActive) { + if (data.event == wakeUpScreen) { lifeList = data.parameters.lifeList; setTimeout(async () => { await power.isScreenOn().then((data) => { @@ -415,8 +412,7 @@ export default function FaShowOnLockTest() { bundleName: "ohos.acts.aafwk.test.fasupportfunction", abilityName: "ohos.acts.aafwk.test.fasupportfunction.MainAbility2", parameters: { - number: 1, - flag: true + number: 1 } } await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { @@ -441,13 +437,13 @@ export default function FaShowOnLockTest() { let status2 = undefined; let status3 = undefined; let lifeList = []; - let listCheck = ["onCreate", "onActive"]; - let onActive = "Fa_SupportFunction_MainAbility2_onActive"; + let listCheck = ["onCreate", "wakeUpScreen"]; + let wakeUpScreen = "Fa_SupportFunction_MainAbility2_wakeUpScreen"; let wakeUpErr = "Fa_SupportFunction_MainAbility2_wakeUpErr"; var subscriber; var subscribeInfo = { - events: [onActive, wakeUpErr] + events: [wakeUpScreen, wakeUpErr] } await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); @@ -460,7 +456,7 @@ export default function FaShowOnLockTest() { status3 = true; } - if (data.event == onActive) { + if (data.event == wakeUpScreen) { lifeList = data.parameters.lifeList; setTimeout(async () => { await power.isScreenOn().then((data) => { @@ -504,8 +500,7 @@ export default function FaShowOnLockTest() { bundleName: "ohos.acts.aafwk.test.fasupportfunction", abilityName: "ohos.acts.aafwk.test.fasupportfunction.MainAbility2", parameters: { - number: 2, - flag: true + number: 2 } } await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { @@ -530,13 +525,13 @@ export default function FaShowOnLockTest() { let status2 = undefined; let status3 = undefined; let lifeList = []; - let listCheck = ["onCreate", "onActive"]; - let onActive = "Fa_SupportFunction_MainAbility2_onActive"; + let listCheck = ["onCreate", "wakeUpScreen"]; + let wakeUpScreen = "Fa_SupportFunction_MainAbility2_wakeUpScreen"; let wakeUpErr = "Fa_SupportFunction_MainAbility2_wakeUpErr"; var subscriber; var subscribeInfo = { - events: [onActive, wakeUpErr] + events: [wakeUpScreen, wakeUpErr] } await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); @@ -549,7 +544,7 @@ export default function FaShowOnLockTest() { status3 = true; } - if (data.event == onActive) { + if (data.event == wakeUpScreen) { lifeList = data.parameters.lifeList; setTimeout(async () => { await power.isScreenOn().then((data) => { @@ -593,8 +588,7 @@ export default function FaShowOnLockTest() { bundleName: "ohos.acts.aafwk.test.fasupportfunction", abilityName: "ohos.acts.aafwk.test.fasupportfunction.MainAbility2", parameters: { - number: 3, - flag: true + number: 3 } } await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { @@ -619,13 +613,13 @@ export default function FaShowOnLockTest() { let status2 = undefined; let status3 = undefined; let lifeList = []; - let listCheck = ["onCreate", "onActive"]; - let onActive = "Fa_SupportFunction_MainAbility2_onActive"; + let listCheck = ["onCreate", "wakeUpScreen"]; + let wakeUpScreen = "Fa_SupportFunction_MainAbility2_wakeUpScreen"; let wakeUpErr = "Fa_SupportFunction_MainAbility2_wakeUpErr"; var subscriber; var subscribeInfo = { - events: [onActive, wakeUpErr] + events: [wakeUpScreen, wakeUpErr] } await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); @@ -638,7 +632,7 @@ export default function FaShowOnLockTest() { status3 = true; } - if (data.event == onActive) { + if (data.event == wakeUpScreen) { lifeList = data.parameters.lifeList; setTimeout(async () => { await power.isScreenOn().then((data) => { @@ -682,8 +676,7 @@ export default function FaShowOnLockTest() { bundleName: "ohos.acts.aafwk.test.fasupportfunction", abilityName: "ohos.acts.aafwk.test.fasupportfunction.MainAbility2", parameters: { - number: 4, - flag: true + number: 4 } } await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { @@ -708,13 +701,13 @@ export default function FaShowOnLockTest() { let status2 = undefined; let status3 = undefined; let lifeList = []; - let listCheck = ["onCreate", "onActive"]; - let onActive = "Fa_SupportFunction_MainAbility2_onActive"; + let listCheck = ["onCreate", "wakeUpScreen"]; + let wakeUpScreen = "Fa_SupportFunction_MainAbility2_wakeUpScreen"; let wakeUpErr = "Fa_SupportFunction_MainAbility2_wakeUpErr"; var subscriber; var subscribeInfo = { - events: [onActive, wakeUpErr] + events: [wakeUpScreen, wakeUpErr] } await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); @@ -727,7 +720,7 @@ export default function FaShowOnLockTest() { status3 = true; } - if (data.event == onActive) { + if (data.event == wakeUpScreen) { lifeList = data.parameters.lifeList; setTimeout(async () => { await power.isScreenOn().then((data) => { @@ -771,8 +764,7 @@ export default function FaShowOnLockTest() { bundleName: "ohos.acts.aafwk.test.fasupportfunction", abilityName: "ohos.acts.aafwk.test.fasupportfunction.MainAbility2", parameters: { - number: 5, - flag: true + number: 5 } } await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { diff --git a/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility/app.ets index ec797b3757d82e0291246133fa34886cb462024b..f6d3f74f8d3d1fe1a47699f2145ce36656d12027 100644 --- a/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility/app.ets +++ b/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility/app.ets @@ -30,6 +30,15 @@ export default { try { ability_featureAbility.getContext().setWakeUpScreen(true).then((data) => { console.log(TAG1 + "setWakeUpScreen data = " + JSON.stringify(data)); + lifeList.push('wakeUpScreen'); + let options = { + parameters: { + lifeList: lifeList + } + } + commonEvent.publish(listPush1 + "wakeUpScreen", options, (err) => { + console.log(TAG1 + listPush1 + "wakeUpScreen"); + }); }).catch((error) => { console.log(TAG1 + "setWakeUpScreen error = " + JSON.stringify(error)); }) @@ -41,12 +50,30 @@ export default { ability_featureAbility.getContext().setWakeUpScreen(true, (error, data) => { console.log(TAG1 + "setWakeUpScreen data = " + JSON.stringify(data)); console.log(TAG1 + "setWakeUpScreen error = " + JSON.stringify(error)); + lifeList.push('wakeUpScreen'); + let options = { + parameters: { + lifeList: lifeList + } + } + commonEvent.publish(listPush1 + "wakeUpScreen", options, (err) => { + console.log(TAG1 + listPush1 + "wakeUpScreen"); + }); }) } if(data.parameters.number == 3) { try { ability_featureAbility.getContext().setWakeUpScreen(false).then((data) => { console.log(TAG1 + "setWakeUpScreen data = " + JSON.stringify(data)); + lifeList.push('wakeUpScreen'); + let options = { + parameters: { + lifeList: lifeList + } + } + commonEvent.publish(listPush1 + "wakeUpScreen", options, (err) => { + console.log(TAG1 + listPush1 + "wakeUpScreen"); + }); }).catch((error) => { console.log(TAG1 + "setWakeUpScreen error = " + JSON.stringify(error)); }) @@ -54,17 +81,6 @@ export default { console.log(TAG1 + "setWakeUpScreen catch error = " + JSON.stringify(error)); } } - if (data.parameters.flag) { - lifeList.push('onActive'); - let options = { - parameters: { - lifeList: lifeList - } - } - commonEvent.publish(listPush1 + "onActive", options, (err) => { - console.log(TAG1 + listPush1 + "onActive"); - }); - } }).catch((error) => { console.log(TAG1 + "getWant error = " + JSON.stringify(error)); }) diff --git a/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility2/app.ets b/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility2/app.ets index d10150fd017e6e24d6cd4dad2cc2a22e052454e7..afb0ad280d59d283cc9a8f26b9cbdb86b3326814 100644 --- a/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility2/app.ets +++ b/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/ets/MainAbility2/app.ets @@ -42,17 +42,15 @@ export default { setWakeUpScreenP(ability_featureAbility, {status1: true, status2: true}) } await sleep(300); - if (data.parameters.flag) { - lifeList.push('onActive'); - let options = { - parameters: { - lifeList: lifeList - } + lifeList.push('wakeUpScreen'); + let options = { + parameters: { + lifeList: lifeList } - commonEvent.publish(listPush1 + "onActive", options, (err) => { - console.log(TAG1 + listPush1 + "onActive"); - }); } + commonEvent.publish(listPush1 + "wakeUpScreen", options, (err) => { + console.log(TAG1 + listPush1 + "wakeUpScreen"); + }); }).catch((error) => { console.log(TAG1 + "getWant error = " + JSON.stringify(error)); }) diff --git a/ability/ability_runtime/apicover/apicoverhaptest/Test.json b/ability/ability_runtime/apicover/apicoverhaptest/Test.json index 87505c03415073a9245dd672f3771f6a68b9cc1c..a3ce23c8d8ea00a561f32e4496d30ee24853a2de 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/Test.json +++ b/ability/ability_runtime/apicover/apicoverhaptest/Test.json @@ -18,6 +18,14 @@ ], "type": "AppInstallKit", "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "power-shell wakeup", + "power-shell setmode 602", + "uinput -T -d 300 600 -m 300 600 300 100 -u 300 100" + ] } ] }