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 f6d3f74f8d3d1fe1a47699f2145ce36656d12027..77be5d42664377268168611a65121be111df62cd 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 @@ -18,10 +18,12 @@ import commonEvent from '@ohos.commonEvent'; var TAG1 = "Fa:SupportFunction:MainAbility:"; var listPush1 = "Fa_SupportFunction_MainAbility_"; var lifeList = []; +var lifeListActive = []; export default { onCreate() { console.log(TAG1 + 'onCreate'); lifeList.push('onCreate'); + lifeListActive.push('onCreate'); ability_featureAbility.getWant().then((data) => { console.log(TAG1 + "getWant data = " + JSON.stringify(data)); @@ -31,6 +33,7 @@ export default { ability_featureAbility.getContext().setWakeUpScreen(true).then((data) => { console.log(TAG1 + "setWakeUpScreen data = " + JSON.stringify(data)); lifeList.push('wakeUpScreen'); + lifeListActive.push('wakeUpScreen'); let options = { parameters: { lifeList: lifeList @@ -51,6 +54,7 @@ export default { console.log(TAG1 + "setWakeUpScreen data = " + JSON.stringify(data)); console.log(TAG1 + "setWakeUpScreen error = " + JSON.stringify(error)); lifeList.push('wakeUpScreen'); + lifeListActive.push('wakeUpScreen'); let options = { parameters: { lifeList: lifeList @@ -66,6 +70,7 @@ export default { ability_featureAbility.getContext().setWakeUpScreen(false).then((data) => { console.log(TAG1 + "setWakeUpScreen data = " + JSON.stringify(data)); lifeList.push('wakeUpScreen'); + lifeListActive.push('wakeUpScreen'); let options = { parameters: { lifeList: lifeList @@ -90,11 +95,11 @@ export default { }, onActive() { console.log(TAG1 + 'onActive'); - lifeList.push('onActive'); + lifeListActive.push('onActive'); let options = { parameters: { - lifeList: lifeList + lifeList: lifeListActive } } commonEvent.publish(listPush1 + "onActive", options, (err) => { 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 afb0ad280d59d283cc9a8f26b9cbdb86b3326814..cb9889b10d8a8a1bad84f3c3667197fae337b683 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 @@ -18,10 +18,12 @@ import commonEvent from '@ohos.commonEvent'; var TAG1 = "Fa:SupportFunction:MainAbility2:"; var listPush1 = "Fa_SupportFunction_MainAbility2_"; var lifeList = []; +var lifeListActive = []; export default { async onCreate() { console.log(TAG1 + 'onCreate'); lifeList.push('onCreate'); + lifeListActive.push('onCreate'); ability_featureAbility.getWant().then(async (data) => { console.log(TAG1 + "getWant data = " + JSON.stringify(data)); @@ -43,6 +45,7 @@ export default { } await sleep(300); lifeList.push('wakeUpScreen'); + lifeListActive.push('wakeUpScreen'); let options = { parameters: { lifeList: lifeList @@ -60,11 +63,11 @@ export default { }, onActive() { console.log(TAG1 + 'onActive'); - lifeList.push('onActive'); + lifeListActive.push('onActive'); let options = { parameters: { - lifeList: lifeList + lifeList: lifeListActive } } commonEvent.publish(listPush1 + "onActive", options, (err) => {