diff --git a/ability/ability_runtime/actssupportfunction/BUILD.gn b/ability/ability_runtime/actssupportfunction/BUILD.gn index f8ce4d0871a287dec9ea923194c8494ff50a2956..b79c4e83021b10af79dc6b3bc102c2d51674e996 100644 --- a/ability/ability_runtime/actssupportfunction/BUILD.gn +++ b/ability/ability_runtime/actssupportfunction/BUILD.gn @@ -17,9 +17,12 @@ group("actssupportfunction") { testonly = true if (is_standard_system) { deps = [ + "actsonandoffscreentest:ActsOnAndOffScreenTest", "actssupportfunctiontest:ActsSupportFunctionTest", + "faonandoffscreen:FaOnAndOffScreen", "fasupportfunction:fasupportfunction", "fasupportfunctionthree:fasupportfunctionthree", + "stageonandoffscreen:StageOnAndOffScreen", "stagesupportfunction:StageSupportFunction", ] } diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/app.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..0e1b95a94f8f01c5febab78595e5295d1f3be0b7 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsonandoffscreentest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon": "$media:app_icon", + "label": "$string:app_name", + "description" : "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d0dc3a93dbce6bd228a2968ecd9885fc364e9dcf --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsOnAndOffScreenTest" + } + ] +} diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/BUILD.gn b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3fe950e9b1ebd17bd036c168914acb514a33e23e --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsOnAndOffScreenTest") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":actsonandoffscreentest_js_assets", + ":actsonandoffscreentest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsOnAndOffScreenTest" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsonandoffscreentest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsonandoffscreentest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsonandoffscreentest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsonandoffscreentest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/Test.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4553d0904aa1784824061c0793aa049d7cbc5aa2 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/Test.json @@ -0,0 +1,23 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.actsonandoffscreentest", + "module-name": "entry", + "shell-timeout": "600000", + "testcase-timeout":"30000" + }, + "kits": [ + { + "test-file-name": [ + "ActsOnAndOffScreenTest.hap", + "FaOnAndOffScreen.hap", + "StageOnAndOffScreen.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..8d3ffd1340628c7919ecdc7cb5dd81d37c483445 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/Application/MyAbilityStage.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityStage from "@ohos.application.AbilityStage"; + +var TAG0 = 'ActsOnAndOffScreenTest:MyAbilityStage:'; +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log(TAG0 + "onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..8e765bf1f7f376c6871a5a1a4b0d35164d256de8 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; + +var TAG1 = 'ActsOnAndOffScreenTest:MainAbility:'; +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log(TAG1 + 'onCreate'); + + globalThis.abilityTestContext = this.context; + globalThis.abilityWant = want; + globalThis.abilityWant.parameters.timeout = 15000; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.log('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log(TAG1 + 'onDestroy'); + } + + onWindowStageCreate(windowStage) { + console.log(TAG1 + 'onWindowStageCreate'); + + windowStage.loadContent("pages/index", (err, data) => { + if (err.code) { + console.log(TAG1 + 'Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.log(TAG1 + 'Succeeded in loading the content. Data: ' + JSON.stringify(data)); + }); + } + + onWindowStageDestroy() { + console.log(TAG1 + 'onWindowStageDestroy'); + } + + onForeground() { + console.log(TAG1 + 'onForeground'); + } + + onBackground() { + console.log(TAG1 + 'onBackground'); + } +}; diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..7977b1e28cfa0007b46f0df33b5290187ab81553 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined +var TAG = "ActsOnAndOffScreenTest == " +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log(TAG + "onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.log(TAG + "addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.log(TAG + "OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log(TAG + 'OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + globalThis.abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = 'MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.log(TAG + 'cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.log(TAG + 'executeShellCommand : err : ' + JSON.stringify(err)); + console.log(TAG + 'executeShellCommand : data : ' + d.stdResult); + console.log(TAG + 'executeShellCommand : data : ' + d.exitCode); + }) + console.log(TAG + 'OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..05c74b67a7f5d3318febb5f2c1cc22506bdf5679 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + aboutToAppear() { + console.log('ActsOnAndOffScreenTest MainAbility index aboutToAppear') + } + + @State message: string = 'Hello World ActsOnAndOffScreenTest 1' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d711f4be534262ffd210c8a392852a2297f5f27 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import onAndOffScreenTest from './OnAndOffScreenTest.test'; + +export default function testsuite() { + onAndOffScreenTest(); +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..44f8b82751c7dfa698bc482f14dd6869f95a10bd --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets @@ -0,0 +1,610 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import { BY,UiDriver,UiComponent } from '@ohos.uitest'; +import commonEvent from '@ohos.commonEvent'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +import power from '@ohos.power'; + +export default function OnAndOffScreenTest() { + + describe('OnAndOffScreenTest', function () { + + let TAG = ""; + let TAG1 = "SUB_AA_OpenHarmony == "; + let sleepTimeOne = 1000; + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + + async function slideScreen(TAG) { + console.log(TAG + "slideScreen start"); + var driver = UiDriver.create(); + await driver.swipe(1000, 3000, 1000, 500, 1200); + await driver.delayMs(500); + console.log(TAG + "slideScreen end"); + } + + async function executeShellCommand(cmd, TAG) { + console.log(TAG + "executeShellCommand start : " + JSON.stringify(cmd)); + await abilityDelegator.executeShellCommand(cmd).then((data) => { + console.log(TAG + "executeShellCommand : data : " + data.stdResult); + console.log(TAG + "executeShellCommand : data : " + data.exitCode); + }).catch((error) => { + console.log(TAG + "executeShellCommand error : " + JSON.stringify(error)); + }) + } + + beforeEach(async (done) => { + console.log(TAG1 + "beforeEach called"); + let status = undefined; + await power.isScreenOn().then((data) => { + console.log(TAG1 + "isScreenOn data = " + JSON.stringify(data)); + status = data; + }).catch((error) => { + console.log(TAG1 + "isScreenOn error = " + JSON.stringify(error)); + }) + + if (!status) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG1); + await slideScreen(TAG1); + } + + setTimeout(() => { + console.log(TAG1 + "beforeEach end"); + done(); + }, sleepTimeOne); + }) + + afterEach(async (done) => { + console.log(TAG1 + "afterEach called"); + let cmd1 = "aa force-stop ohos.acts.aafwk.test.faonandoffscreen"; + await executeShellCommand(cmd1, TAG1); + let cmd2 = "aa force-stop ohos.acts.aafwk.test.stageonandoffscreen"; + await executeShellCommand(cmd2, TAG1); + + setTimeout(() => { + console.log(TAG1 + "afterEach end"); + done(); + }, sleepTimeOne); + }) + + /* + * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0100 + * @tc.name : Verify the life cycle of on / off screen ability + * @tc.desc : FA model is applied in the foreground, and the device is locked. + */ + it('SUB_AA_OpenHarmony_OnAndOffScreen_0100', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0100 == '; + console.log(TAG + "begin"); + + let status1 = undefined; + let lifeList = []; + let listCheck = ["onCreate", "onActive", "onInactive", "onHide"]; + let onActive = "FaOnAndOffScreen_MainAbility_onActive"; + let onHide = "FaOnAndOffScreen_MainAbility_onHide"; + + var subscriber; + var subscribeInfo = { + events: [onActive, onHide] + } + await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); + subscriber = data; + + commonEvent.subscribe(subscriber, async (err, data) => { + console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); + + if (data.event == onActive) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + } + + if (data.event == onHide) { + lifeList = data.parameters.lifeList; + setTimeout(async () => { + commonEvent.unsubscribe(subscriber, async (err, data) => { + console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); + expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); + expect(status1).assertTrue(); + done(); + }); + }, sleepTimeOne); + } + }); + }).catch((error) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + await power.isScreenOn().then((data) => { + console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); + status1 = data; + }).catch((error) => { + console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + let wantNum = { + bundleName: "ohos.acts.aafwk.test.faonandoffscreen", + abilityName: "ohos.acts.aafwk.test.faonandoffscreen.MainAbility" + } + await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { + console.log(TAG + "startAbility data = " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + "startAbility error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + }) + + /* + * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0200 + * @tc.name : Verify the life cycle of on / off screen ability + * @tc.desc : FA model is applied in the foreground, the device locks the screen, and then unlocks. + */ + it('SUB_AA_OpenHarmony_OnAndOffScreen_0200', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0200 == '; + console.log(TAG + "begin"); + + let status1 = undefined; + let lifeList = []; + let listCheck = ["onCreate", "onActive", "onInactive", "onHide", "onShow"]; + let onActive = "FaOnAndOffScreen_MainAbility_onActive"; + let onHide = "FaOnAndOffScreen_MainAbility_onHide"; + let onShow = "FaOnAndOffScreen_MainAbility_onShow"; + + var subscriber; + var subscribeInfo = { + events: [onActive, onHide, onShow] + } + await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); + subscriber = data; + + commonEvent.subscribe(subscriber, async (err, data) => { + console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); + + if (data.event == onActive) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + } + + if (data.event == onHide) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + await slideScreen(TAG); + } + + if (data.event == onShow) { + lifeList = data.parameters.lifeList; + setTimeout(async () => { + commonEvent.unsubscribe(subscriber, async (err, data) => { + console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); + expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); + expect(status1).assertTrue(); + done(); + }); + }, sleepTimeOne); + } + }); + }).catch((error) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + await power.isScreenOn().then((data) => { + console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); + status1 = data; + }).catch((error) => { + console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + let wantNum = { + bundleName: "ohos.acts.aafwk.test.faonandoffscreen", + abilityName: "ohos.acts.aafwk.test.faonandoffscreen.MainAbility" + } + await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { + console.log(TAG + "startAbility data = " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + "startAbility error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + }) + + /* + * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0300 + * @tc.name : Verify the life cycle of on / off screen ability + * @tc.desc : Stage model is applied in the foreground, and the device locks the screen. + */ + it('SUB_AA_OpenHarmony_OnAndOffScreen_0300', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0300 == '; + console.log(TAG + "begin"); + + let status1 = undefined; + let lifeList = []; + let listCheck = ["onCreate", "onForeground", "onBackground"]; + let onForeground = "StageOnAndOffScreen_MainAbility_onForeground"; + let onBackground = "StageOnAndOffScreen_MainAbility_onBackground"; + + var subscriber; + var subscribeInfo = { + events: [onForeground, onBackground] + } + await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); + subscriber = data; + + commonEvent.subscribe(subscriber, async (err, data) => { + console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); + + if (data.event == onForeground) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + } + + if (data.event == onBackground) { + lifeList = data.parameters.lifeList; + setTimeout(async () => { + commonEvent.unsubscribe(subscriber, async (err, data) => { + console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); + expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); + expect(status1).assertTrue(); + done(); + }); + }, sleepTimeOne); + } + }); + }).catch((error) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + await power.isScreenOn().then((data) => { + console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); + status1 = data; + }).catch((error) => { + console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + let wantNum = { + bundleName: "ohos.acts.aafwk.test.stageonandoffscreen", + abilityName: "MainAbility" + } + await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { + console.log(TAG + "startAbility data = " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + "startAbility error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + }) + + /* + * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0400 + * @tc.name : Verify the life cycle of on / off screen ability + * @tc.desc : The stage model is applied in the foreground, the device locks the screen, and then unlocks. + */ + it('SUB_AA_OpenHarmony_OnAndOffScreen_0400', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0400 == '; + console.log(TAG + "begin"); + + let flag = false; + let status1 = undefined; + let lifeList = []; + let listCheck = ["onCreate", "onForeground", "onBackground", "onForeground"]; + let onForeground = "StageOnAndOffScreen_MainAbility_onForeground"; + let onBackground = "StageOnAndOffScreen_MainAbility_onBackground"; + + var subscriber; + var subscribeInfo = { + events: [onForeground, onBackground] + } + await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); + subscriber = data; + + commonEvent.subscribe(subscriber, async (err, data) => { + console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); + + if (data.event == onForeground && !flag) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + flag = true; + } else if (data.event == onForeground && flag) { + lifeList = data.parameters.lifeList; + setTimeout(async () => { + commonEvent.unsubscribe(subscriber, async (err, data) => { + console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); + expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); + expect(status1).assertTrue(); + done(); + }); + }, sleepTimeOne); + } + + if (data.event == onBackground) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + await slideScreen(TAG); + } + }); + }).catch((error) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + await power.isScreenOn().then((data) => { + console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); + status1 = data; + }).catch((error) => { + console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + let wantNum = { + bundleName: "ohos.acts.aafwk.test.stageonandoffscreen", + abilityName: "MainAbility" + } + await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { + console.log(TAG + "startAbility data = " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + "startAbility error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + }) + + /* + * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0500 + * @tc.name : Verify the life cycle of on / off screen ability + * @tc.desc : Application in the background, device lock screen. + */ + it('SUB_AA_OpenHarmony_OnAndOffScreen_0500', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0500 == '; + console.log(TAG + "begin"); + + let status1 = undefined; + let lifeList = []; + let listCheck = ["onCreate", "onWindowStageCreate", "onForeground", "onBackground"]; + let onCreate = "StageOnAndOffScreen_MainAbility2_onCreate"; + let onWindowStageCreate = "StageOnAndOffScreen_MainAbility2_onWindowStageCreate"; + let onForeground = "StageOnAndOffScreen_MainAbility2_onForeground"; + let onBackground = "StageOnAndOffScreen_MainAbility2_onBackground"; + let onWindowStageDestroy = "StageOnAndOffScreen_MainAbility2_onWindowStageDestroy"; + let onDestroy = "StageOnAndOffScreen_MainAbility2_onDestroy"; + let onForeground2 = "StageOnAndOffScreen_MainAbility3_onForeground"; + let onBackground2 = "StageOnAndOffScreen_MainAbility3_onBackground"; + + var subscriber; + var subscribeInfo = { + events: [onCreate, onWindowStageCreate, onForeground, onBackground, onWindowStageDestroy, onDestroy, + onForeground2, onBackground2] + } + await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); + subscriber = data; + + commonEvent.subscribe(subscriber, async (err, data) => { + console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); + + if (data.event == onCreate) { + lifeList.push("onCreate"); + } + + if (data.event == onWindowStageCreate) { + lifeList.push("onWindowStageCreate"); + } + + if (data.event == onForeground) { + lifeList.push("onForeground"); + } + + if (data.event == onBackground) { + lifeList.push("onBackground"); + } + + if (data.event == onWindowStageDestroy) { + lifeList.push("onWindowStageDestroy"); + } + + if (data.event == onDestroy) { + lifeList.push("onDestroy"); + } + + if (data.event == onForeground2) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + } + + if (data.event == onBackground2) { + setTimeout(async () => { + commonEvent.unsubscribe(subscriber, async (err, data) => { + console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); + expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); + expect(status1).assertTrue(); + done(); + }); + }, sleepTimeOne); + } + }); + }).catch((error) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + await power.isScreenOn().then((data) => { + console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); + status1 = data; + }).catch((error) => { + console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + let wantNum = { + bundleName: "ohos.acts.aafwk.test.stageonandoffscreen", + abilityName: "MainAbility2" + } + await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { + console.log(TAG + "startAbility data = " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + "startAbility error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + }) + + /* + * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0600 + * @tc.name : Verify the life cycle of on / off screen ability + * @tc.desc : Application in the background, device lock screen. + */ + it('SUB_AA_OpenHarmony_OnAndOffScreen_0600', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0600 == '; + console.log(TAG + "begin"); + + let flag = false; + let status1 = undefined; + let lifeList = []; + let listCheck = ["onCreate", "onWindowStageCreate", "onForeground", "onBackground"]; + let onCreate = "StageOnAndOffScreen_MainAbility2_onCreate"; + let onWindowStageCreate = "StageOnAndOffScreen_MainAbility2_onWindowStageCreate"; + let onForeground = "StageOnAndOffScreen_MainAbility2_onForeground"; + let onBackground = "StageOnAndOffScreen_MainAbility2_onBackground"; + let onWindowStageDestroy = "StageOnAndOffScreen_MainAbility2_onWindowStageDestroy"; + let onDestroy = "StageOnAndOffScreen_MainAbility2_onDestroy"; + let onForeground2 = "StageOnAndOffScreen_MainAbility3_onForeground"; + let onBackground2 = "StageOnAndOffScreen_MainAbility3_onBackground"; + + var subscriber; + var subscribeInfo = { + events: [onCreate, onWindowStageCreate, onForeground, onBackground, onWindowStageDestroy, onDestroy, + onForeground2, onBackground2] + } + await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); + subscriber = data; + + commonEvent.subscribe(subscriber, async (err, data) => { + console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); + + if (data.event == onCreate) { + lifeList.push("onCreate"); + } + + if (data.event == onWindowStageCreate) { + lifeList.push("onWindowStageCreate"); + } + + if (data.event == onForeground) { + lifeList.push("onForeground"); + } + + if (data.event == onBackground) { + lifeList.push("onBackground"); + } + + if (data.event == onWindowStageDestroy) { + lifeList.push("onWindowStageDestroy"); + } + + if (data.event == onDestroy) { + lifeList.push("onDestroy"); + } + + if (data.event == onForeground2 && !flag) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + flag = true; + } else if (data.event == onForeground2 && flag) { + setTimeout(async () => { + commonEvent.unsubscribe(subscriber, async (err, data) => { + console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); + expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); + expect(status1).assertTrue(); + done(); + }); + }, sleepTimeOne); + } + + if (data.event == onBackground2) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + await slideScreen(TAG); + } + }); + }).catch((error) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + await power.isScreenOn().then((data) => { + console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); + status1 = data; + }).catch((error) => { + console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + let wantNum = { + bundleName: "ohos.acts.aafwk.test.stageonandoffscreen", + abilityName: "MainAbility2" + } + await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { + console.log(TAG + "startAbility data = " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + "startAbility error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + }) + + /* + * @tc.number : SUB_AA_OpenHarmony_Share_1000 + * @tc.name : Verify the ability implicit start + * @tc.desc : Verify that the capability is started implicitly, and the input parameter is a nonexistent action. + */ + it('SUB_AA_OpenHarmony_Share_1000', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_Share_1000 == '; + console.log(TAG + "begin"); + + let wantNum = { + action: "ohos.acts.aafwk.aafwk.aafwk", + } + await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { + console.log(TAG + "startAbility data = " + JSON.stringify(data)); + expect().assertFail(); + done(); + }).catch((error) => { + console.log(TAG + "startAbility error = " + JSON.stringify(error)); + done(); + }) + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/module.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..f81b1543a04f1b750c63ed035fc6e161102f855b --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbc9aa9617e97c45440e1d3d66afc1154837012 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..917ecd4da54d99cac4cea51deef18431f433d742 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "ActsOnAndOffScreenTest" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..feec276e105eeb8d621c20aaf838f318b0a94150 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/signature/openharmony_sx.p7b b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaSetDisplayOrientation.test.ets b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaSetDisplayOrientation.test.ets index ee6a8cd3aca8a465ebc319f06b847a29232ec060..c3ce871f466e59b661be8eccf92fb85eb0c1785f 100644 --- a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaSetDisplayOrientation.test.ets +++ b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaSetDisplayOrientation.test.ets @@ -22,7 +22,7 @@ export default function FaSetDisplayOrientationTest() { describe('FaSetDisplayOrientationTest', function () { let TAG = ""; - let TAG1 = "SUB_AA_OpenHarmony == "; + let TAG1 = "SUB_AA_OpenHarmony == FaSetDisplayOrientationTest : "; let sleepTimeOne = 1000; let sleepTimeTwo = 2000; let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); @@ -67,12 +67,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0200 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0500 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : Set the horizontal and vertical screen status of ability to UNSPECIFIED. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0200', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0200 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_0500', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0500 == '; console.log(TAG + "begin"); let displayOrientationBefore = undefined; @@ -131,12 +131,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0300 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0600 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : Set the horizontal and vertical screen status of ability to LANDSCAPE. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0300', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0300 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_0600', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0600 == '; console.log(TAG + "begin"); let displayOrientationBefore = undefined; @@ -198,12 +198,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0400 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0700 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : Set the horizontal and vertical screen status of ability to PORTRAIT. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0400', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0400 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_0700', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0700 == '; console.log(TAG + "begin"); let displayOrientationBefore = undefined; @@ -265,13 +265,13 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0500 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0800 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : The same applies to setting ability1 to LANDSCAPE, and ability1 starts ability2 and sets the status of ability2 to FOLLOW_RECENT. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0500', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0500 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_0800', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0800 == '; console.log(TAG + "begin"); let displayOrientationBefore1 = undefined; @@ -349,13 +349,13 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0600 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0900 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : The same applies to setting ability1 to PORTRAIT, and ability1 starts ability2 and sets the status of ability2 to FOLLOW_RECENT. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0600', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0600 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_0900', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0900 == '; console.log(TAG + "begin"); let displayOrientationBefore1 = undefined; @@ -433,13 +433,13 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0700 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1000 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : Different haps set ability1 to LANDSCAPE, and ability1 starts ability2 and sets the status of ability2 to FOLLOW_RECENT. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0700', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0700 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1000', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1000 == '; console.log(TAG + "begin"); let displayOrientationBefore1 = undefined; @@ -517,13 +517,13 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0800 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1100 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : Different haps set ability1 to PORTRAIT, and ability1 starts ability2 and sets the status of ability2 to FOLLOW_RECENT. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0800', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0800 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1100', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1100 == '; console.log(TAG + "begin"); let displayOrientationBefore1 = undefined; @@ -601,13 +601,13 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0900 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1200 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : Different applications set ability1 to LANDSCAPE, and ability1 starts ability2 and sets the status of ability2 to FOLLOW_RECENT. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0900', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0900 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1200', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1200 == '; console.log(TAG + "begin"); let displayOrientationBefore1 = undefined; @@ -685,13 +685,13 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1000 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1300 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : Different applications set ability1 to PORTRAIT, and ability1 starts ability2 and sets the status of ability2 to FOLLOW_RECENT. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_1000', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1000 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1300', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1300 == '; console.log(TAG + "begin"); let displayOrientationBefore1 = undefined; @@ -773,12 +773,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1100 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1400 * @tc.name : Verify setDisplayOrientation interfaces * @tc.desc : SetDisplayOrientation input parameter is undefined. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_1100', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1100 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1400', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1400 == '; console.log(TAG + "begin"); let status1 = undefined; @@ -837,12 +837,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1200 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1500 * @tc.name : Verify setDisplayOrientation interfaces * @tc.desc : SetDisplayOrientation input parameter is -1. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_1200', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1200 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1500', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1500 == '; console.log(TAG + "begin"); let status1 = undefined; @@ -901,12 +901,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1300 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1600 * @tc.name : Verify setDisplayOrientation interfaces * @tc.desc : SetDisplayOrientation input parameter is a nonexistent enumeration value. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_1300', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1300 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1600', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1600 == '; console.log(TAG + "begin"); let status1 = undefined; @@ -965,12 +965,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1400 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1700 * @tc.name : Verify setDisplayOrientation interfaces * @tc.desc : SetDisplayOrientation input parameter is a value of string type. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_1400', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1400 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1700', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1700 == '; console.log(TAG + "begin"); let status1 = undefined; @@ -1029,12 +1029,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1500 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1800 * @tc.name : Verify setDisplayOrientation interfaces * @tc.desc : SetDisplayOrientation input parameter is of type array. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_1500', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1500 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1800', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1800 == '; console.log(TAG + "begin"); let status1 = undefined; @@ -1093,12 +1093,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1600 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1900 * @tc.name : Verify setDisplayOrientation interfaces * @tc.desc : SetDisplayOrientation input parameter is of type json. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_1600', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1600 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1900', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1900 == '; console.log(TAG + "begin"); let status1 = undefined; 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 ddc89ff2a4d415771544ae7e5a8a4f44b293a0d5..84203ede6f7b8c265c7c1127cccbeec0cd917c6c 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 @@ -22,7 +22,7 @@ export default function FaShowOnLockTest() { describe('FaShowOnLockTest', function () { let TAG = ""; - let TAG1 = "SUB_AA_OpenHarmony == "; + let TAG1 = "SUB_AA_OpenHarmony == FaShowOnLockTest : "; let sleepTimeOne = 1000; let sleepTimeTwo = 2000; let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); diff --git a/ability/ability_runtime/actssupportfunction/faonandoffscreen/BUILD.gn b/ability/ability_runtime/actssupportfunction/faonandoffscreen/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..92b737754ad8f52a862fa0cfb471e75a83fc3be1 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/faonandoffscreen/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("FaOnAndOffScreen") { + hap_name = "FaOnAndOffScreen" + hap_profile = "./entry/src/main/config.json" + testonly = true + deps = [ + ":faonandoffscreen_resources", + ":faonandoffscreen_ts_assets", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_js_assets("faonandoffscreen_ts_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} + +ohos_resources("faonandoffscreen_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/config.json b/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..c12007742965d221626122995ecb284c6dc2b0f2 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/config.json @@ -0,0 +1,70 @@ +{ + "app": { + "bundleName": "ohos.acts.aafwk.test.faonandoffscreen", + "vendor": "huawei", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 9, + "target": 9 + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.acts.aafwk.test.faonandoffscreen", + "name": ".entry", + "mainAbility": ".MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "ets", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..68128296754ce97582de6eda9e6401e215debea7 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ability_featureAbility from '@ohos.ability.featureAbility'; +import commonEvent from '@ohos.commonEvent'; + +var TAG1 = "Fa:FaOnAndOffScreen:MainAbility:"; +var listPush1 = "FaOnAndOffScreen_MainAbility_"; +var lifeList = []; +export default { + onCreate() { + console.log(TAG1 + 'onCreate'); + lifeList.push('onCreate'); + }, + onDestroy() { + console.log(TAG1 + 'onDestroy'); + }, + onActive() { + console.log(TAG1 + 'onActive'); + lifeList.push('onActive'); + + commonEvent.publish(listPush1 + "onActive", (err) => { + console.log(TAG1 + listPush1 + "onActive"); + }); + }, + onInactive() { + console.log(TAG1 + 'onInactive'); + lifeList.push('onInactive'); + }, + onShow() { + console.log(TAG1 + 'onShow'); + lifeList.push('onShow'); + + let options = { + parameters: { + lifeList: lifeList + } + } + commonEvent.publish(listPush1 + "onShow", options, (err) => { + console.log(TAG1 + listPush1 + "onShow"); + }); + }, + onHide() { + console.log(TAG1 + 'onHide'); + lifeList.push('onHide'); + + let options = { + parameters: { + lifeList: lifeList + } + } + commonEvent.publish(listPush1 + "onHide", options, (err) => { + console.log(TAG1 + listPush1 + "onHide"); + }); + }, + onNewWant(want) { + console.log(TAG1 + 'onNewWant'); + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..5825e1bcfeb46730b92f5656cd20ca453a845240 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'Hello World FaOnAndOffScreen 1' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Row() { + Button() { + Text('FaOnAndOffScreen_MainAbility1') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('30%') + .height('5%') + .onClick(()=>{ + }) + } + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbc9aa9617e97c45440e1d3d66afc1154837012 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..45350f9eeb5051ad0a0817bbc0c31c29ae8a09f8 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "FaOnAndOffScreen" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actssupportfunction/faonandoffscreen/signature/openharmony_sx.p7b b/ability/ability_runtime/actssupportfunction/faonandoffscreen/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actssupportfunction/faonandoffscreen/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/app.json b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..dddef587148d0fb0f4d37426fb47f58a265bd395 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "ohos.acts.aafwk.test.stageonandoffscreen", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "debug": false, + "description" : "$string:app_name", + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/resources/base/element/string.json b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..03adf77b410fa7ae816fc04774b4398a9fd43077 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsfstageonandoffscreen" + } + ] +} diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/BUILD.gn b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..da661082bbd8cd7c7e0055af8cc73fbfdea9fc3b --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("StageOnAndOffScreen") { + hap_name = "StageOnAndOffScreen" + hap_profile = "entry/src/main/module.json" + testonly = true + deps = [ + ":stageonandoffscreen_js_assets", + ":stageonandoffscreen_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("stageonandoffscreen_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("stageonandoffscreen_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("stageonandoffscreen_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":stageonandoffscreen_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b26de8acd3a42978865785fcd735eb45e694a65 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/Application/MyAbilityStage.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityStage from "@ohos.application.AbilityStage"; + +var TAG0 = 'StageOnAndOffScreen:AbilityStage:'; +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log(TAG0 + "onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..9b624c7538cc130a0cd2f7bd5a1e58b418bb1236 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability'; +import commonEvent from '@ohos.commonEvent'; + +var TAG1 = 'StageOnAndOffScreen:MainAbility:'; +var listPush1 = "StageOnAndOffScreen_MainAbility_"; +var lifeList = []; +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + console.log(TAG1 + 'onCreate'); + lifeList.push('onCreate'); + } + + onDestroy() { + console.log(TAG1 + 'onDestroy'); + } + + onWindowStageCreate(windowStage) { + console.log(TAG1 + 'onWindowStageCreate'); + + windowStage.loadContent("pages/index", (err, data) => { + if (err.code) { + console.log(TAG1 + 'Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.log(TAG1 + 'Succeeded in loading the content. Data: ' + JSON.stringify(data)); + }); + } + + onWindowStageDestroy() { + console.log(TAG1 + 'onWindowStageDestroy'); + } + + onForeground() { + console.log(TAG1 + 'onForeground'); + lifeList.push('onForeground'); + + let options = { + parameters: { + lifeList: lifeList + } + } + commonEvent.publish(listPush1 + "onForeground", options, (err) => { + console.log(TAG1 + listPush1 + "onForeground"); + }); + } + + onBackground() { + console.log(TAG1 + 'onBackground'); + lifeList.push('onBackground'); + + let options = { + parameters: { + lifeList: lifeList + } + } + commonEvent.publish(listPush1 + "onBackground", options, (err) => { + console.log(TAG1 + listPush1 + "onBackground"); + }); + } +}; diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..27cb2995e9936e436ed27c6a0159aeac0138ea78 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability'; +import commonEvent from '@ohos.commonEvent'; + +var TAG2 = 'StageOnAndOffScreen:MainAbility2:'; +var listPush2 = "StageOnAndOffScreen_MainAbility2_"; +export default class MainAbility2 extends Ability { + + onCreate(want, launchParam) { + console.log(TAG2 + 'onCreate'); + + commonEvent.publish(listPush2 + "onCreate", (err) => { + console.log(TAG2 + listPush2 + "onCreate"); + }); + } + + onDestroy() { + console.log(TAG2 + 'onDestroy'); + + commonEvent.publish(listPush2 + "onDestroy", (err) => { + console.log(TAG2 + listPush2 + "onDestroy"); + }); + } + + onWindowStageCreate(windowStage) { + console.log(TAG2 + 'onWindowStageCreate'); + + commonEvent.publish(listPush2 + "onWindowStageCreate", (err) => { + console.log(TAG2 + listPush2 + "onWindowStageCreate"); + }); + + windowStage.loadContent("pages/second", (err, data) => { + if (err.code) { + console.log(TAG2 + 'Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.log(TAG2 + 'Succeeded in loading the content. Data: ' + JSON.stringify(data)); + }); + } + + onWindowStageDestroy() { + console.log(TAG2 + 'onWindowStageDestroy'); + + commonEvent.publish(listPush2 + "onWindowStageDestroy", (err) => { + console.log(TAG2 + listPush2 + "onWindowStageDestroy"); + }); + } + + onForeground() { + console.log(TAG2 + 'onForeground'); + + commonEvent.publish(listPush2 + "onForeground", (err) => { + console.log(TAG2 + listPush2 + "onForeground"); + }); + + setTimeout(async () => { + let wantNum = { + bundleName: "ohos.acts.aafwk.test.stageonandoffscreen", + abilityName: "MainAbility3" + } + this.context.startAbility(wantNum).then((data) => { + console.log(TAG2 + "startAbility data = " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG2 + "startAbility error = " + JSON.stringify(error)); + }) + }, 1000); + } + + onBackground() { + console.log(TAG2 + 'onBackground'); + + commonEvent.publish(listPush2 + "onBackground", (err) => { + console.log(TAG2 + listPush2 + "onBackground"); + }); + } +}; diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility3/MainAbility3.ts b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility3/MainAbility3.ts new file mode 100644 index 0000000000000000000000000000000000000000..ff4a433b66f5f89577d71552b50196329b44aab3 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/MainAbility3/MainAbility3.ts @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability'; +import commonEvent from '@ohos.commonEvent'; + +var TAG3 = 'StageOnAndOffScreen:MainAbility3:'; +var listPush3 = "StageOnAndOffScreen_MainAbility3_"; +export default class MainAbility3 extends Ability { + + onCreate(want, launchParam) { + console.log(TAG3 + 'onCreate'); + } + + onDestroy() { + console.log(TAG3 + 'onDestroy'); + } + + onWindowStageCreate(windowStage) { + console.log(TAG3 + 'onWindowStageCreate'); + + windowStage.loadContent("pages/third", (err, data) => { + if (err.code) { + console.log(TAG3 + 'Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.log(TAG3 + 'Succeeded in loading the content. Data: ' + JSON.stringify(data)); + }); + } + + onWindowStageDestroy() { + console.log(TAG3 + 'onWindowStageDestroy'); + } + + onForeground() { + console.log(TAG3 + 'onForeground'); + + commonEvent.publish(listPush3 + "onForeground", (err) => { + console.log(TAG3 + listPush3 + "onForeground"); + }); + } + + onBackground() { + console.log(TAG3 + 'onBackground'); + + commonEvent.publish(listPush3 + "onBackground", (err) => { + console.log(TAG3 + listPush3 + "onBackground"); + }); + } +}; diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..813a7ce06165498c5d3928f97deb4a9e0235d7bb --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/index.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'Hello World StageOnAndOffScreen 1' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Row() { + Button() { + Text('StageOnAndOffScreen_MainAbility1') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('30%') + .height('5%') + .onClick(()=>{ + }) + } + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/second.ets b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/second.ets new file mode 100644 index 0000000000000000000000000000000000000000..12d96fd6ebced192473c0f339ca4977d9b9a87cd --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/second.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Second { + @State message: string = 'Hello World StageOnAndOffScreen 2' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Row() { + Button() { + Text('StageOnAndOffScreen_MainAbility2') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('30%') + .height('5%') + .onClick(()=>{ + }) + } + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/third.ets b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/third.ets new file mode 100644 index 0000000000000000000000000000000000000000..888e187a84ec5c429fed6a7a7665d0a620ebd986 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/ets/pages/third.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Third { + @State message: string = 'Hello World StageOnAndOffScreen 3' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Row() { + Button() { + Text('StageOnAndOffScreen_MainAbility3') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('30%') + .height('5%') + .onClick(()=>{ + }) + } + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/module.json b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..21fad3b21d24ad38b0d5b80defdb8b450361ba7a --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/module.json @@ -0,0 +1,61 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "visible": true, + "launchType": "singleton", + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:MainAbility2_desc", + "icon": "$media:icon", + "label": "$string:MainAbility2_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "visible": true, + "launchType": "singleton" + }, + { + "name": "MainAbility3", + "srcEntrance": "./ets/MainAbility3/MainAbility3.ts", + "description": "$string:MainAbility3_desc", + "icon": "$media:icon", + "label": "$string:MainAbility3_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "visible": true, + "launchType": "singleton" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbc9aa9617e97c45440e1d3d66afc1154837012 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..30b3a0b2084824c290ee8198e3f4000a88802aa0 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "StageOnAndOffScreen" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..cfd6f01d1f75bd7cfc53de769e5288d7792af37b --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,7 @@ +{ + "src": [ + "pages/index", + "pages/second", + "pages/third" + ] +} diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/signature/openharmony_sx.p7b b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/MainAbility2.ts index c47793cc75426eb2dd74eeb659dd757468ac50ab..e67d5ef1ae1362462abe3dbf080e06930cb6a064 100644 --- a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -16,12 +16,12 @@ import Ability from '@ohos.application.Ability' import commonEvent from '@ohos.commonEvent' async function onShowProcess() { - var abilityWant = globalThis.abilityWant; + var abilityWant = globalThis.abilityWant2; var commonEventPublishData = { parameters: { - displayId: globalThis.abilityWant.parameters['ohos.aafwk.param.displayId'], - windowMode: globalThis.abilityWant.parameters['ohos.aafwk.param.windowMode'], + displayId: abilityWant.parameters['ohos.aafwk.param.displayId'], + windowMode: abilityWant.parameters['ohos.aafwk.param.windowMode'], } }; @@ -29,7 +29,7 @@ async function onShowProcess() { commonEvent.publish("ACTS_TerminateSelf_CommonEvent", commonEventPublishData, () => { console.log('============>querytestsecond success==========>>') - globalThis.abilityContext.terminateSelf(); + globalThis.abilityContext2.terminateSelf(); }); } @@ -38,8 +38,8 @@ export default class MainAbility extends Ability { onCreate(want, launchParam) { // Ability is creating, initialize resources for this ability console.log("MainAbility2 onCreate") - globalThis.abilityWant = want; - console.log("AbilityMultiInstanceAppA abilityWant = " + JSON.stringify( globalThis.abilityWant)); + globalThis.abilityWant2 = want; + console.log("AbilityMultiInstanceAppA abilityWant = " + JSON.stringify( globalThis.abilityWant2)); } onDestroy() { @@ -50,7 +50,7 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { // Main window is created, set main page for this ability console.log("MainAbility2 onWindowStageCreate") - globalThis.abilityContext = this.context + globalThis.abilityContext2 = this.context windowStage.setUIContent(this.context, "MainAbility/pages/second/second", null) } diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts index 025b140b8c7979a68f2cedceec293ce6683fe0f2..8b29a6c2db891cca32cee4c3d736d081586950af 100644 --- a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -38,7 +38,7 @@ export default class ServiceAbility extends ServiceExtension { abilityName: 'com.example.startabilityforresult.MainAbility2' }, { - windowMode: 2, + windowMode: 0, displayId: 10, }).then(() => { console.log("====>end startAbility====>success!") diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/Ability.test.ets index 6b0bb23c9d513aff487f19f028cfea3681f47cc8..dcdfe4b665ce0596f6c487d33828c64d1640029a 100644 --- a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/Ability.test.ets @@ -225,7 +225,7 @@ export default function abilityTest() { if (data.event == "ACTS_TerminateSelf_CommonEvent") { clearTimeout(id); expect(data.parameters['displayId']).assertEqual(10); - expect(data.parameters['windowMode']).assertEqual(2); + expect(data.parameters['windowMode']).assertEqual(0); commonEvent.unsubscribe(subscriber, unSubscribeCallback) expect(data.event).assertEqual("ACTS_TerminateSelf_CommonEvent"); diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/signature/openharmony_sx.p7b b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/signature/openharmony_sx.p7b index cc53179a48f88f20acc379c138a001e9a15838f6..dcec6c9615032c1b48bf185e839d9720dd68aab0 100644 Binary files a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/signature/openharmony_sx.p7b and b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/signature/openharmony_sx.p7b differ