diff --git a/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/ets/MainAbility/MainAbility.ts index 2ae3700cbd8de4dce793e71e3dd931604cb16792..f2f7d879280b9d7544483e777677954f73e8456a 100644 --- a/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/ets/MainAbility/MainAbility.ts @@ -22,8 +22,9 @@ var caller; var event_getcaller = "getcaller.com.example.systemcalltest.SecondAbility"; var event_call = "call.com.example.systemcalltest.SecondAbility"; var event_release = "release.com.example.systemcalltest.SecondAbility"; +var event_onRemoteStateChangeCall = "onRemoteStateChangeCall.com.example.systemcalltest.SecondAbility"; var subscribeInfo = { - events: [event_getcaller, event_call, event_release, ], + events: [event_getcaller, event_call, event_release, event_onRemoteStateChangeCall], }; class MySequenceable { @@ -100,6 +101,13 @@ function releaseCallee() { commonEvent.unsubscribe(subscriber, unsubscribeCallback); } +function onRemoteStateChangeCall(){ + function OnRemoteStateChangeCallback (msg){ + console.log('SystemAppCallerB MainAbility onRemoteStateChange ' + msg); + } + caller.onRemoteStateChange(OnRemoteStateChangeCallback) +} + function startNext(context) { let want = { bundleName: "com.example.systemappcallerc", @@ -122,6 +130,9 @@ export default class MainAbility extends Ability { case event_release: releaseCallee(); break; + case event_onRemoteStateChangeCall: + onRemoteStateChangeCall(); + break; default: console.log('SystemAppCallerB MainAbility subscribeCallBack event error:' + data.event); break; diff --git a/ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/MainAbility2/MainAbility2.ts index 3b9e42318f228157c7ee6cc2d1cfe25d7ca96f76..115dfc356ffea15a11e45f49b839880a82e8e8a2 100644 --- a/ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ b/ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -43,6 +43,10 @@ export default class MainAbility2 extends Ability { let requestInfo = dialogRequest.getRequestInfo(want); if (requestInfo) { globalThis.validRequestInfo = true; + globalThis.windowRectLeft = requestInfo.windowRect.left; + globalThis.windowRectTop = requestInfo.windowRect.top; + globalThis.windowRectWidth = requestInfo.windowRect.width; + globalThis.windowRectHeight = requestInfo.windowRect.height; console.log("MainAbility2 requestInfo is valid"); } else { console.log("MainAbility2 requestInfo is invalid"); diff --git a/ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/test/Ability.test.ets index 6c0e0c1f32be30522bd2b395ddb2667d21af59cd..5ced12453bb70e2ab8eb5178da878e6864e42f38 100644 --- a/ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/test/Ability.test.ets @@ -111,6 +111,10 @@ export default function abilityTest() { expect(globalThis.requestDialogSuccess).assertTrue(); expect(globalThis.validRequestInfo).assertTrue(); expect(globalThis.validRequestCallback).assertTrue(); + expect(typeof globalThis.windowRectLeft).assertEqual('number'); + expect(typeof globalThis.windowRectTop).assertEqual('number'); + expect(typeof globalThis.windowRectWidth).assertEqual('number'); + expect(typeof globalThis.windowRectHeight).assertEqual('number'); commonEvent.unsubscribe(subscriber, unSubscribeCallback); done(); } diff --git a/ability/ability_runtime/actsuiextensiontest/uiextensionprovider/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsuiextensiontest/uiextensionprovider/entry/src/main/ets/pages/index.ets index 6320394ecc1b8e0bba7c2c17a8af458454bac391..b74f4b036f6aac2156043f8fd4f047225d106ba8 100644 --- a/ability/ability_runtime/actsuiextensiontest/uiextensionprovider/entry/src/main/ets/pages/index.ets +++ b/ability/ability_runtime/actsuiextensiontest/uiextensionprovider/entry/src/main/ets/pages/index.ets @@ -62,6 +62,26 @@ struct Index { commonEventManager.unsubscribe(subscriber, async (err, data) => { console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); }); + } else if (data.event == "terminateSelfPromise") { + this.session.terminateSelf().then((data)=>{ + console.log(TAG + "terminateSelfPromise : " + JSON.stringify(data)); + }).catch((err)=>{ + console.log(TAG + "terminateSelfPromise : " + JSON.stringify(err)); + }) + } else if (data.event == "terminateSelfCallback") { + this.session.terminateSelf((err, data)=>{ + console.log(TAG + "terminateSelfCallback : " + JSON.stringify(data)); + }) + } else if (data.event == "setWindowPrivacyModeFalseCallback") { + this.session.setWindowPrivacyMode(false, (err, data)=>{ + console.log(TAG + "setWindowPrivacyModeFalseCallback : " + JSON.stringify(data)); + }) + } else if (data.event == "setWindowPrivacyModeFalsePromise") { + this.session.setWindowPrivacyMode(false).then(()=>{ + console.log(TAG + "setWindowPrivacyModeFalsePromise : " + JSON.stringify(data)); + }).catch((err)=>{ + console.log(TAG + "setWindowPrivacyModeFalsePromise : " + JSON.stringify(err)); + }) } }); }).catch((error) => { diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/MainAbility/MainAbility.ts index ca5263d634999812de884905631f6bc301fbab71..54f34663076bebd8cc86dfe6cc6c1fe729f6c85f 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -35,7 +35,7 @@ export default class MainAbility extends Ability { onWindowStageRestore(windowStage){ console.log("[Demo] MainAbility onWindowStageRestore") - } + } onWindowStageDestroy() { // Main window is destroyed, release UI related resources @@ -52,6 +52,15 @@ export default class MainAbility extends Ability { console.log("[Demo] MainAbility onBackground") } + onContinue(wantParam){ + console.log("[Demo] MainAbility onContinue") + return undefined; + } + + onBackPressed(){ + return false + } + onConfigurationUpdate(config) { console.log('[Demo] MainAbility onConfigurationUpdate: ' + this.context.config.language) console.log('[Demo] MainAbility onConfigurationUpdate: ' + config.language) diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/ThirdAbility/SecondAbility.ts b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/ThirdAbility/SecondAbility.ts index 1a5b2c784f236553ab0bdc2cfffacd7ae774408d..76cff208d273dd5d4bf514b8edb1329cc35591d2 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/ThirdAbility/SecondAbility.ts +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/ThirdAbility/SecondAbility.ts @@ -64,4 +64,7 @@ export default class SecondAbility extends Ability { wantParam[wantConstant.Params.SHARE_ABSTRACT_KEY] = {Abstract:"share data"}, wantParam[wantConstant.Params.SHARE_URL_KEY] = {uri:"www.baidu.com"} } + onPrepareToTerminate(){ + return false + } }; \ No newline at end of file diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets index 546732a8e88694d1df1e752cf29db30f706d6d7e..4b28e2be01eeda38a836bdef3a58932bc7788dba 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets @@ -26,6 +26,7 @@ import abilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry import common from '@ohos.app.ability.common'; import contextConstant from "@ohos.app.ability.contextConstant" import wantConstant from "@ohos.app.ability.wantConstant" +import formBindingData from '@ohos.app.form.formBindingData'; let EXTENSION_INFO_ERR = 16000001; let INNER_ERROR = 16000050; @@ -522,9 +523,12 @@ export default function ApiCoverTest() { expect(1).assertEqual(abilityConstant.MemoryLevel.MEMORY_LEVEL_LOW) expect(2).assertEqual(abilityConstant.MemoryLevel.MEMORY_LEVEL_CRITICAL) expect(5).assertEqual(abilityConstant.LaunchReason.SHARE) + expect(0).assertEqual(abilityConstant.ContinueState.ACTIVE) + expect(1).assertEqual(abilityConstant.ContinueState.INACTIVE) expect('ohos.extra.param.key.contentTitle').assertEqual(wantConstant.Params.CONTENT_TITLE_KEY) expect('ohos.extra.param.key.shareAbstract').assertEqual(wantConstant.Params.SHARE_ABSTRACT_KEY) expect('ohos.extra.param.key.shareUrl').assertEqual(wantConstant.Params.SHARE_URL_KEY) + expect('ohos.ability.params.abilityRecoveryRestart').assertEqual(wantConstant.Params.ABILITY_RECOVERY_RESTART) done() }); @@ -723,6 +727,8 @@ export default function ApiCoverTest() { expect(data[i].processName.length).assertLarger(0); expect(Array.isArray(data[i].bundleNames)).assertEqual(true); expect(data[i].bundleNames.length).assertLarger(0); + expect(typeof data[i].state).assertEqual("number"); + expect(data[i].state).assertLarger(0); } done(); }) @@ -782,5 +788,59 @@ export default function ApiCoverTest() { done(); }) }) + /* + * @tc.number SUB_AA_Form_formBindingData_0100 + * @tc.name Create FormBindingData + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_Form_formBindingData_0100', 0, async function (done) { + TAG = 'SUB_AA_Form_formBindingData_0100'; + let formData = {}; + let proxies = [ + { + "key": "detail", + "subscriberId": "11" + } + ] + let formBinding = formBindingData.createFormBindingData(formData); + formBinding["proxies"] = proxies; + expect(formBinding != undefined).assertTrue() + done() + }) + + /* + * @tc.number SUB_AA_UIAbilityContext_setMissionContinueState_0100 + * @tc.name setMissionContinueState with callback for Ability. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_UIAbilityContext_setMissionContinueState_0100', 0, async function (done) { + TAG = 'SUB_AA_UIAbilityContext_setMissionContinueState_0100'; + globalThis.abilityContext.setMissionContinueState(0, (err, data)=>{ + console.log(`${TAG} setMissionContinueState data ${JSON.stringify(err)}`); + expect(data).assertEqual(undefined); + done(); + }) + }) + + /* + * @tc.number SUB_AA_UIAbilityContext_setMissionContinueState_0200 + * @tc.name setMissionContinueState with promise for Ability. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_UIAbilityContext_setMissionContinueState_0200', 0, async function (done) { + TAG = 'SUB_AA_UIAbilityContext_setMissionContinueState_0200'; + globalThis.abilityContext.setMissionContinueState(0).then((data)=>{ + console.log(`${TAG} setMissionContinueState data ${JSON.stringify(data)}`); + expect(data).assertEqual(undefined); + done(); + }).catch((err)=>{ + console.log(`${TAG} setMissionContinueState promise err ${JSON.stringify(err)}`); + expect().assertFail(); + done(); + }) + }) }) } diff --git a/ability/ability_runtime/context/actsstageappcontext/actsstageappcontexttest/entry/src/main/ets/test/StageAppContext.test.ets b/ability/ability_runtime/context/actsstageappcontext/actsstageappcontexttest/entry/src/main/ets/test/StageAppContext.test.ets index 8ae50880b8130fd840e737a8976f3aefe8f68bd4..8a16a8c43567d05a3b2ebf26ed9cb669a5a3469a 100644 --- a/ability/ability_runtime/context/actsstageappcontext/actsstageappcontexttest/entry/src/main/ets/test/StageAppContext.test.ets +++ b/ability/ability_runtime/context/actsstageappcontext/actsstageappcontexttest/entry/src/main/ets/test/StageAppContext.test.ets @@ -240,5 +240,24 @@ export default function stageAppContextTest(abilityContext) { }) done(); }); + + /** + * @tc.number: SUB_AA_OpenHarmony_ApplicationContext_1800 + * @tc.name: getProcessRunningInformation test 2 + * getProcessRunningInformation test + * @tc.desc: Function test + * @tc.level 3 + */ + it('SUB_AA_OpenHarmony_ApplicationContext_1800', 0, async function (done) { + let TAG = "SUB_AA_OpenHarmony_ApplicationContext_1800"; + console.log(TAG + " --- start"); + let context = globalThis.abilityStageContext.getApplicationContext(); + context.getProcessRunningInformation((err, data) => { + console.log(TAG + " result = " + JSON.stringify(data)); + expect(data[0].processName).assertEqual("com.example.stageappcontexttest"); + expect(typeof data[0].state).assertEqual("number"); + }) + done(); + }); }) } \ No newline at end of file