diff --git a/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts index 950088fc292fc6cd326ff6121b47cf943ebbb19c..bb1414f40fe67e56ebef9de2be0ba6be099b681c 100644 --- a/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -16,6 +16,10 @@ import Ability from '@ohos.application.Ability' import commonEvent from '@ohos.commonEvent' +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + export default class MainAbility extends Ability { onCreate(want, launchParam) { // Ability is creating, initialize resources for this ability @@ -48,6 +52,7 @@ export default class MainAbility extends Ability { } onForeground() { + sleep(1000) // Ability has brought to foreground console.log("ACTS_NewWant MainAbility onForeground") if (globalThis.abilityWant.action == 'startHapC') { diff --git a/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts index 70dd29e22def32f76e65823d8a300886ce0899a8..0ad3fb9240cf8dc1594c119f9c0d85d8da89b213 100644 --- a/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -16,6 +16,10 @@ import Ability from '@ohos.application.Ability' import commonEvent from '@ohos.commonEvent' +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + export default class MainAbility extends Ability { onCreate(want, launchParam) { // Ability is creating, initialize resources for this ability @@ -48,6 +52,7 @@ export default class MainAbility extends Ability { } onForeground() { + sleep(1000) // Ability has brought to foreground console.log("ACTS_NewWant MainAbility onForeground") if (globalThis.abilityWant.action == 'startHapB') { diff --git a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts index 8dbd22aa90fc244b2217842c1deaafb29e75d487..5f1c85af6b79936e2e23ed5c8654cd1905b95af2 100644 --- a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -16,6 +16,10 @@ import Ability from '@ohos.application.Ability' import commonEvent from '@ohos.commonEvent' +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + export default class MainAbility extends Ability { onCreate(want, launchParam) { // Ability is creating, initialize resources for this ability @@ -48,6 +52,7 @@ export default class MainAbility extends Ability { } onForeground() { + sleep(1000) // Ability has brought to foreground console.log("ACTS_NewWant MainAbility onForeground") if (globalThis.abilityWant.action == 'startStandard0400') { diff --git a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts index 9f0688daa9e0d7534fac867c7279eae255ba0a59..59d1e26d099b0ccd93ce3c9b5baae38b4a6151e7 100644 --- a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts +++ b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -16,6 +16,10 @@ import Ability from '@ohos.application.Ability' import commonEvent from '@ohos.commonEvent' +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + export default class SecondAbility extends Ability { onCreate(want, launchParam) { @@ -48,6 +52,7 @@ export default class SecondAbility extends Ability { } onForeground() { + sleep(1000) // Ability has brought to foreground var connId; console.log("ACTS_NewWant SecondAbility onForeground")