diff --git a/ability/ability_runtime/actsforresult/forresulttest/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts b/ability/ability_runtime/actsforresult/forresulttest/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts index 7bb898e0bb1f6bb6b53a0d7967d2f99ebbcb0628..bea25f9672330b3a9e0aceee3c52c2eb2d7491db 100644 --- a/ability/ability_runtime/actsforresult/forresulttest/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts +++ b/ability/ability_runtime/actsforresult/forresulttest/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts @@ -50,7 +50,7 @@ export default class UiExtAbility extends UIExtensionAbility { str: data.want.parameters.action, result: data.resultCode } - } + }; commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => { console.debug('====>AsyncCallback_0200 first publish err:' + JSON.stringify(err)); }); diff --git a/ability/ability_runtime/actsforresult/main/entry/src/main/ets/otherability/OtherAbility.ts b/ability/ability_runtime/actsforresult/main/entry/src/main/ets/otherability/OtherAbility.ts index 0170d1a268deb8c66b530fc7a1445f3588a08d7e..e8f3616fcb39201b217e7fde3cf9e612195003d9 100644 --- a/ability/ability_runtime/actsforresult/main/entry/src/main/ets/otherability/OtherAbility.ts +++ b/ability/ability_runtime/actsforresult/main/entry/src/main/ets/otherability/OtherAbility.ts @@ -14,10 +14,12 @@ */ import UIAbility from '@ohos.app.ability.UIAbility'; import hilog from '@ohos.hilog'; -import window from '@ohos.window'; +import type window from '@ohos.window'; + +const CUMULATIVE = 2; export default class OtherAbility extends UIAbility { - asyncCallback_0300: number = 0; + circulate: number = 0; onCreate(want, launchParam) { console.log('=====> OtherAbility onCreate =====>'); @@ -46,9 +48,9 @@ export default class OtherAbility extends UIAbility { onForeground() { console.log('=====> OtherAbility onForeground =====>'); - this.asyncCallback_0300++; - console.log(`=====> OtherAbility asyncCallback_0300 count: ${this.asyncCallback_0300}`); - if (this.asyncCallback_0300 === 2) { + this.circulate++; + console.log(`=====> OtherAbility circulate count: ${this.circulate}`); + if (this.circulate === CUMULATIVE) { this.context.terminateSelfWithResult({ resultCode: 0, want: { diff --git a/ability/ability_runtime/actsforresult/maintest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsforresult/maintest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts index 5564c8ce2e56c9be115796b05d29d4e31dc4f0a1..288289c4842ae069a1b5f9ac68af8a586033f448 100644 --- a/ability/ability_runtime/actsforresult/maintest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ b/ability/ability_runtime/actsforresult/maintest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -39,14 +39,14 @@ export default class OpenHarmonyTestRunner implements TestRunner { hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'; + let testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'; let lMonitor = { abilityName: testAbilityName, onAbilityCreate: onAbilityCreateCallback, }; abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName; - var debug = abilityDelegatorArguments.parameters['-D']; + let cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName; + let debug = abilityDelegatorArguments.parameters['-D']; if (debug == 'true') { cmd += ' -D' }