diff --git a/ability/ability_runtime/BUILD.gn b/ability/ability_runtime/BUILD.gn index c94523228f9517d53caaba0031c3d36b439f4987..fbec55dd7f40a66caefae2c50362fb39fc8541e9 100644 --- a/ability/ability_runtime/BUILD.gn +++ b/ability/ability_runtime/BUILD.gn @@ -21,6 +21,7 @@ group("ability_runtime") { "abilitymanager:actsabilitymanagertest", "abilitymontior:ActsAbilityMonitorTest", "abilitymultiinstance:abilitymultiinstance", + "abilitystagemonitor:abilitystagemonitor", "actsabilitydelegatorcase:ActsAbilityDelegatorCaseTest", "actsabilitymanageretstest:ActsAbilityManagerEtsTest", "actsabilityusertest:ActsAbilityuserTest", diff --git a/ability/ability_runtime/abilitystagemonitor/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a3cb09af44ae1687ea14e4c117a42a2aeddb232e --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/BUILD.gn @@ -0,0 +1,30 @@ +# Copyright (c) 2021 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") + +group("abilitystagemonitor") { + testonly = true + if (is_standard_system) { + deps = [ + "abilitystagemonitorassista:AbilityStageMonitorAssistA", + "abilitystagemonitorassistc:AbilityStageMonitorAssistC", + "abilitystagemonitorassistd:AbilityStageMonitorAssistD", + "abilitystagemonitorassiste:AbilityStageMonitorAssistE", + "abilitystagemonitorassistf:AbilityStageMonitorAssistF", + "abilitystagemonitorassistg:AbilityStageMonitorAssistG", + "abilitystagemonitorassisth:AbilityStageMonitorAssistH", + "abilitystagemonitortest:ActsAbilityStageMonitorTest" + ] + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon" : "$media:icon", + "label" : "$string:app_name", + "description" : "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ff75a604c8fed2e35097584d0509abeec9e26a0a --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/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("AbilityStageMonitorAssistA") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitorassista_js_assets", + ":abilitystagemonitorassista_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityStageMonitorAssistA" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitorassista_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitorassista_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitorassista_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitorassista_app_profile" ] + hap_profile = "entry/src/main/module.json" +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/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" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..1c0b9c74e71d497764f791d25187cd511ca8d64a --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,45 @@ +/* +* 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' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.info('MainAbilityMonitor onCreate') + } + + onDestroy() { + console.info('MainAbilityMonitor onDestroy') + } + + onWindowStageCreate(windowStage) { + console.info('MainAbilityMonitor onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.info('MainAbilityMonitor onWindowStageDestroy') + } + + onForeground() { + console.info('MainAbilityMonitor onForeground') + } + + onBackground() { + console.info('MainAbilityMonitor onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..2061615571be9e4e28c4f2c1ea5b231b4a063681 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* +* 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.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + } + + @State message: string = 'MainAbility Hello' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(() => { + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..93143a0024bb7767f11adfbf9575037061e2a68d --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "feature_assista", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "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", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..127ea0d94555366c6888ac530babae4bf4cc1299 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "assista" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..951f0a2b8d54f94311cb88cbedae68c9d56fcb49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon" : "$media:icon", + "label" : "$string:app_name", + "description" : "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ed28ca10d03f2744b5130a0d491da4feffb80d9e --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/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("AbilityStageMonitorAssistC") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitorassistc_js_assets", + ":abilitystagemonitorassistc_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityStageMonitorAssistC" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitorassistc_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitorassistc_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitorassistc_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitorassistc_app_profile" ] + hap_profile = "entry/src/main/module.json" +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/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" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..54fb016cfb5876920e658414ee16d35ba6869df9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/MainAbility/MainAbility.ts @@ -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. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.info('MainAbilityMonitor onCreate') + } + + + onDestroy() { + console.info('MainAbilityMonitor onDestroy') + } + + onWindowStageCreate(windowStage) { + console.info('MainAbilityMonitor onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.info('MainAbilityMonitor onWindowStageDestroy') + } + + onForeground() { + console.info('MainAbilityMonitor onForeground') + } + + onBackground() { + console.info('MainAbilityMonitor onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e23418836be1e36fc7823c36138cc343029122f --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* +* 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.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + } + + @State message: string = 'MainAbility2 Hello' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(() => { + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..26dda370055f05b273c9d406c4ec0fd21181470f --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "feature_assistc", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility2", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility2", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..164db31071950c97cb9a00f325391560598c9d08 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "assistc" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..951f0a2b8d54f94311cb88cbedae68c9d56fcb49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon" : "$media:icon", + "label" : "$string:app_name", + "description" : "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..6a1e17a93921ecfd530dd886e0ffa11fb1316f9d --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/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("AbilityStageMonitorAssistD") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitorassistd_js_assets", + ":abilitystagemonitorassistd_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityStageMonitorAssistD" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitorassistd_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitorassistd_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitorassistd_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitorassistd_app_profile" ] + hap_profile = "entry/src/main/module.json" +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/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" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..54fb016cfb5876920e658414ee16d35ba6869df9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/MainAbility/MainAbility.ts @@ -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. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.info('MainAbilityMonitor onCreate') + } + + + onDestroy() { + console.info('MainAbilityMonitor onDestroy') + } + + onWindowStageCreate(windowStage) { + console.info('MainAbilityMonitor onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.info('MainAbilityMonitor onWindowStageDestroy') + } + + onForeground() { + console.info('MainAbilityMonitor onForeground') + } + + onBackground() { + console.info('MainAbilityMonitor onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..46cbf8478ea057c90ac54be87cc5db177cbe3277 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* +* 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.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + } + + @State message: string = 'MainAbility3 Hello' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(() => { + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d56c00e8028447e50b51610126077d87dfcd3df8 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "feature_assistd", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility3", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility3", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d43bdd43148a9f58f156952ae728af724fc08507 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "assistd" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..951f0a2b8d54f94311cb88cbedae68c9d56fcb49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon" : "$media:icon", + "label" : "$string:app_name", + "description" : "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..32fd3f797a71c3edd5c3a4f041f08414029b06a9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/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("AbilityStageMonitorAssistE") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitorassiste_js_assets", + ":abilitystagemonitorassiste_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityStageMonitorAssistE" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitorassiste_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitorassiste_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitorassiste_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitorassiste_app_profile" ] + hap_profile = "entry/src/main/module.json" +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/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" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..54fb016cfb5876920e658414ee16d35ba6869df9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/MainAbility/MainAbility.ts @@ -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. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.info('MainAbilityMonitor onCreate') + } + + + onDestroy() { + console.info('MainAbilityMonitor onDestroy') + } + + onWindowStageCreate(windowStage) { + console.info('MainAbilityMonitor onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.info('MainAbilityMonitor onWindowStageDestroy') + } + + onForeground() { + console.info('MainAbilityMonitor onForeground') + } + + onBackground() { + console.info('MainAbilityMonitor onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1c0f2c9122aa6dcf2ae920ad25df61d783654ea --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* +* 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.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + } + + @State message: string = 'MainAbility4 Hello' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(() => { + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..eb086a76bc5c723957bb20f3522023a64678fa94 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "feature_assiste", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility4", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility4", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4590c7b559ea45c68c440646e0057ea2785737e9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "assiste" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..951f0a2b8d54f94311cb88cbedae68c9d56fcb49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon" : "$media:icon", + "label" : "$string:app_name", + "description" : "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a039d36d3eb1ebe7d6e690ca5e7b01f2416f1f3e --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/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("AbilityStageMonitorAssistF") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitorassistf_js_assets", + ":abilitystagemonitorassistf_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityStageMonitorAssistF" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitorassistf_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitorassistf_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitorassistf_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitorassistf_app_profile" ] + hap_profile = "entry/src/main/module.json" +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/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" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..54fb016cfb5876920e658414ee16d35ba6869df9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/MainAbility/MainAbility.ts @@ -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. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.info('MainAbilityMonitor onCreate') + } + + + onDestroy() { + console.info('MainAbilityMonitor onDestroy') + } + + onWindowStageCreate(windowStage) { + console.info('MainAbilityMonitor onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.info('MainAbilityMonitor onWindowStageDestroy') + } + + onForeground() { + console.info('MainAbilityMonitor onForeground') + } + + onBackground() { + console.info('MainAbilityMonitor onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..cfe56a48a83be655cb302d0fdc1abb6c2d28587b --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* +* 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.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + } + + @State message: string = 'MainAbilityf5 Hello' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(() => { + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..2ac7cf3b213af8d7a5493ee82fb310718c21c62c --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "feature_assistf", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbilityf5", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbilityf5", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..917bbd6315734ee7f1795e4dcb90b91a2a92a4a3 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "assistf" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..951f0a2b8d54f94311cb88cbedae68c9d56fcb49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon" : "$media:icon", + "label" : "$string:app_name", + "description" : "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f568bc27e83c057226292132301315de6ff557df --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/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("AbilityStageMonitorAssistG") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitorassistg_js_assets", + ":abilitystagemonitorassistg_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityStageMonitorAssistG" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitorassistg_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitorassistg_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitorassistg_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitorassistg_app_profile" ] + hap_profile = "entry/src/main/module.json" +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/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" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..54fb016cfb5876920e658414ee16d35ba6869df9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/MainAbility/MainAbility.ts @@ -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. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.info('MainAbilityMonitor onCreate') + } + + + onDestroy() { + console.info('MainAbilityMonitor onDestroy') + } + + onWindowStageCreate(windowStage) { + console.info('MainAbilityMonitor onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.info('MainAbilityMonitor onWindowStageDestroy') + } + + onForeground() { + console.info('MainAbilityMonitor onForeground') + } + + onBackground() { + console.info('MainAbilityMonitor onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..0aeb88ca7ed660425c541ce8b0ede058251520c6 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* +* 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.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + } + + @State message: string = 'MainAbility6 Hello' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(() => { + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..812aba00fa5cc1e52bf6b17c100733e5e9d17ec2 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "feature_assistg", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility6", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility6", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d256cdf5bc0751684f2a4f8ef597249ed07d3327 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "assistg" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..951f0a2b8d54f94311cb88cbedae68c9d56fcb49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon" : "$media:icon", + "label" : "$string:app_name", + "description" : "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..00a47a8146a1ec8abf0c078bf4388552056fb4b3 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/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("AbilityStageMonitorAssistH") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitorassisth_js_assets", + ":abilitystagemonitorassisth_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityStageMonitorAssistH" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitorassisth_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitorassisth_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitorassisth_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitorassisth_app_profile" ] + hap_profile = "entry/src/main/module.json" +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/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" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..54fb016cfb5876920e658414ee16d35ba6869df9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/MainAbility/MainAbility.ts @@ -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. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.info('MainAbilityMonitor onCreate') + } + + + onDestroy() { + console.info('MainAbilityMonitor onDestroy') + } + + onWindowStageCreate(windowStage) { + console.info('MainAbilityMonitor onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.info('MainAbilityMonitor onWindowStageDestroy') + } + + onForeground() { + console.info('MainAbilityMonitor onForeground') + } + + onBackground() { + console.info('MainAbilityMonitor onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f156d9ceff6824421a7bd4ce79522ac64b61f1c0 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* +* 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.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + } + + @State message: string = 'MainAbility7 Hello' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(() => { + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..1579eaccb830908acd1a82bf3a5042f4252a568a --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "feature_assistg", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility7", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility7", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b5cafcc1c21c8e487c4b840c9506186455d87ed1 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "assisth" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..951f0a2b8d54f94311cb88cbedae68c9d56fcb49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon" : "$media:icon", + "label" : "$string:app_name", + "description" : "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..90f1d5de6f3f4f36024e8b05f4e48aa18036b4ee --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/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_js_hap_suite("ActsAbilityStageMonitorTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitor_js_assets", + ":abilitystagemonitor_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAbilityStageMonitorTest" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitor_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitor_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitor_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitor_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/Test.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..ff08c69acc928df79c4b2de908d40c6451b56c36 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/Test.json @@ -0,0 +1,28 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.abilitystagemonitortest", + "module-name": "entry_test", + "shell-timeout": "600000", + "testcase-timeout": "7000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAbilityStageMonitorTest.hap", + "AbilityStageMonitorAssistA.hap", + "AbilityStageMonitorAssistC.hap", + "AbilityStageMonitorAssistD.hap", + "AbilityStageMonitorAssistE.hap", + "AbilityStageMonitorAssistF.hap", + "AbilityStageMonitorAssistG.hap", + "AbilityStageMonitorAssistH.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/Application/TestAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/Application/TestAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/Application/TestAbilityStage.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" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestAbility/TestAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..aed2de2649e977a9671509848a1ed4674cf41c18 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,51 @@ +/* + * 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' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.info('TestAbility onCreate') + let abilityDelegatorArguments: any + let abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'TestAbility/pages/index', null) + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c6e79e8ce9ce787c085cf32507c73a4d2a63a42c --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,47 @@ +/* + * 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.info('TestAbility index aboutToAppear') + } + @State message: string = 'TestAbility Hello' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9555725ac68e84cbe76bdac9294719a0ecfc3f4 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.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 TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +let abilityDelegator = undefined +let abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + globalThis.abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + let testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + let cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/test/AbilityStageMonitor.test.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/test/AbilityStageMonitor.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9eedc04213259c5b6dbe047fe03cbedac95aa6f9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/test/AbilityStageMonitor.test.ets @@ -0,0 +1,510 @@ +/* + * 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, it, expect } from '@ohos/hypium' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +let moduleName1: any +let monitor: any +let want: any +let timeout = 3000; + +function sleep(delay) { + let start = (new Date()).getTime(); + while ((new Date()).getTime() - start < delay) { + continue; + } +} +function test(time) { + sleep(time); +} + +export default function abilityStageMonitorTest() { + describe('ActsAbilityTest', function () { + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0100 + * @tc.name: Call waitAbilityStageMonitor in the form of callback, and enter the monitor + * @tc.desc: Verify that the callback form of waitAbilityStageMonitor can get the abilityStage instance + * @tc.level: 1 + */ + it('SUB_AA_AbilityStageMonitor_0100', 0, async function (done) { + console.info("SUB_AA_AbilityStage_0100 begin") + + monitor = { + moduleName: "feature_assista", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + try { + console.info("SUB_AA_AbilityStage_0100 wait abilityStage"); + abilityDelegator.waitAbilityStageMonitor(monitor, (err, data) => { + console.log("SUB_AA_AbilityStage_0100 waitAbilityStageMonitor callback " + + "err = " + err + ", data = " + JSON.stringify(data)); + moduleName1 = data.context.currentHapModuleInfo.name; + expect(moduleName1).assertEqual(monitor.moduleName) + done(); + }); + } catch (error) { + console.info("SUB_AA_AbilityStage_0100 waitAbilityStageMonitor callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + + console.info("SUB_AA_AbilityStage_0100 start ability"); + + want = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "MainAbility" + }; + + try { + abilityDelegator.startAbility(want, (err, data) => { + console.info("SUB_AA_AbilityStage_0100 startAbility callback err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + }); + } catch (error) { + console.info("SUB_AA_AbilityStage_0100 startAbility callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0200 + * @tc.name: Call waitAbilityStageMonitor in the form of a promise, and enter the monitor + * @tc.desc: Verify that the promise form of waitAbilityStageMonitor can get the abilityStage instance + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0200', 0, async function (done) { + console.log("SUB_AA_AbilityStage_0100 begin") + + monitor = { + moduleName: "feature_assistd", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + console.log("SUB_AA_AbilityStageMonitor_0200 wait abilityStage"); + + abilityDelegator.waitAbilityStageMonitor(monitor).then((abilityStage) => { + console.log("SUB_AA_AbilityStageMonitor_0200 waitAbilityStageMonitor promise " + + "abilityStage: " + JSON.stringify(abilityStage)); + moduleName1 = abilityStage.context.currentHapModuleInfo.name; + expect(moduleName1).assertEqual(monitor.moduleName) + done(); + }).catch((err) => { + console.log("SUB_AA_AbilityStageMonitor_0200 waitAbilityStageMonitor err: " + JSON.stringify(err)); + expect().assertFail() + done() + }) + + console.log("SUB_AA_AbilityStageMonitor_0200 start ability"); + + want = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "MainAbility3" + }; + + try { + abilityDelegator.startAbility(want, (err, data) => { + console.log("SUB_AA_AbilityStageMonitor_0200 startAbility callback err: " + + JSON.stringify(err) + "data: " + JSON.stringify(data)); + }); + } catch (error) { + console.log("SUB_AA_AbilityStageMonitor_0200 startAbility callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0300 + * @tc.name: Call waitAbilityStageMonitor in the form of callBack, enter the monitor, timeout + * @tc.desc: Verify that the callback form of waitAbilityStageMonitor can get the abilityStage instance + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0300', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_0300 begin") + + monitor = { + moduleName: "feature_assistf", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + try { + console.info("SUB_AA_AbilityStageMonitor_0300 wait abilityStage"); + abilityDelegator.waitAbilityStageMonitor(monitor, timeout, (err, data) => { + moduleName1 = data.context.currentHapModuleInfo.name; + console.info("SUB_AA_AbilityStageMonitor_0300 waitAbilityStageMonitor callback, err: " + + err + ", data =" + JSON.stringify(data)); + expect(moduleName1).assertEqual(monitor.moduleName) + done(); + }); + } catch (error) { + console.info("SUB_AA_AbilityStageMonitor_0300 waitAbilityStageMonitor callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + + console.info("SUB_AA_AbilityStageMonitor_0300 start ability"); + + want = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "MainAbilityf5" + }; + + try { + abilityDelegator.startAbility(want, (err, data) => { + console.info("SUB_AA_AbilityStageMonitor_0300 startAbility callback err: " + + JSON.stringify(err) + "data: " + JSON.stringify(data)); + }); + } catch (error) { + console.info("SUB_AA_AbilityStageMonitor_0300 startAbility callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0400 + * @tc.name: Call waitAbilityStageMonitor in the form of promise, input monitor, timeout + * @tc.desc: Verify that the promise form of waitAbilityStageMonitor can get the abilityStage instance + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0400', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_0400 begin") + + monitor = { + moduleName: "feature_assistc", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + console.info("SUB_AA_AbilityStageMonitor_0400 wait abilityStage"); + + await abilityDelegator.waitAbilityStageMonitor(monitor, timeout).then((abilityStage) => { + moduleName1 = abilityStage.context.currentHapModuleInfo.name; + console.info("stageMonitor waitAbilityStageMonitor callback, abilityStage: " + + JSON.stringify(abilityStage)); + expect(moduleName1).assertEqual(monitor.moduleName) + done(); + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_0400 waitAbilityStageMonitor err: " + JSON.stringify(err)); + expect().assertFail() + done() + }) + + console.info("SUB_AA_AbilityStageMonitor_0400 start ability"); + + test(1000) + + want = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "MainAbility2" + }; + + try { + abilityDelegator.startAbility(want, (err, data) => { + console.info("SUB_AA_AbilityStageMonitor_0400 startAbility callback err: " + + JSON.stringify(err) + "data: " + JSON.stringify(data)); + }); + } catch (error) { + console.info("SUB_AA_AbilityStageMonitor_0400 startAbility callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0500 + * @tc.name: Call waitAbilityStageMonitor, the moduleName in the parameter monitor does not exist + * @tc.desc: Verify that the moduleName passed in by waitAbilityStageMonitor + * does not exist and throw an exception + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0500', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_0500 begin") + + monitor = { + moduleName: "feature_as1", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + console.info("SUB_AA_AbilityStageMonitor_0500 wait abilityStage"); + + await abilityDelegator.waitAbilityStageMonitor(monitor).then((abilityStage) => { + console.info("stageMonitor waitAbilityStageMonitor callback, abilityStage = " + JSON.stringify(abilityStage)); + expect().assertFail() + done() + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_0500 waitAbilityStageMonitor err: " + JSON.stringify(err)); + expect(err.code).assertEqual(-1) + done() + }) + + console.info("SUB_AA_AbilityStageMonitor_0500 start ability"); + + want = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "MainAbility4" + }; + + try { + abilityDelegator.startAbility(want, (err, data) => { + console.info("SUB_AA_AbilityStageMonitor_0500 startAbility callback err: " + + JSON.stringify(err) + "data: " + JSON.stringify(data)); + }); + } catch (error) { + console.info("SUB_AA_AbilityStageMonitor_0500 startAbility callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0600 + * @tc.name: Call waitAbilityStageMonitor, the srcEntrance in the parameter monitor does not exist + * @tc.desc: Verify that the srcEntrance passed in by waitAbilityStageMonitor + * does not exist and throw an exception + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0600', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_0600 begin") + + monitor = { + moduleName: "feature_assistg", + srcEntrance: "./ets/Application/AbilityStageA.ts", + } + + console.info("SUB_AA_AbilityStageMonitor_0600 wait abilityStage"); + + await abilityDelegator.waitAbilityStageMonitor(monitor).then((abilityStage) => { + console.info("stageMonitor waitAbilityStageMonitor callback, abilityStage: " + JSON.stringify(abilityStage)); + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_0600 waitAbilityStageMonitor err: " + JSON.stringify(err)); + expect(err.code).assertEqual(-1) + done() + }) + + console.info("SUB_AA_AbilityStageMonitor_0600 start ability"); + + want = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "MainAbility6" + }; + + try { + abilityDelegator.startAbility(want, (err, data) => { + console.info("SUB_AA_AbilityStageMonitor_0600 startAbility callback err: " + + JSON.stringify(err) + "data: " + JSON.stringify(data)); + }); + } catch (error) { + console.info("SUB_AA_AbilityStageMonitor_0600 startAbility callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0700 + * @tc.name: Call the promise form of addAbilityStageMonitor to add monitoring, + * and call the promise form of removeAbilityStageMonitor to cancel monitoring + * @tc.desc: Verify that addAbilityStageMonitor can add monitoring, + * verify that removeAbilityStageMonitor can cancel monitoring + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0700', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_0700 begin") + + monitor = { + moduleName: "feature_assisth", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + console.info("SUB_AA_AbilityStageMonitor_0700 wait abilityStage"); + + await abilityDelegator.addAbilityStageMonitor(monitor).then((data) => { + console.info("stageMonitor addAbilityStageMonitor promise, data = " + data); + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_0700 addAbilityStageMonitor err: " + JSON.stringify(err)); + expect().assertFail() + done() + }); + + await abilityDelegator.waitAbilityStageMonitor(monitor).then((abilityStage) => { + console.info("stageMonitor waitAbilityStageMonitor callback, abilityStage: " + JSON.stringify(abilityStage)); + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_0600 waitAbilityStageMonitor err: " + JSON.stringify(err)); + expect(err.code).assertEqual(-1) + done() + }) + + console.info("SUB_AA_AbilityStageMonitor_0700 removeAbilityStageMonitor"); + + await abilityDelegator.removeAbilityStageMonitor(monitor).then((data) => { + console.info("stageMonitor addAbilityStageMonitor promise, data = " + data); + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_0700 removeAbilityStageMonitor err: " + JSON.stringify(err)); + expect().assertFail() + done() + }); + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0800 + * @tc.name: Call the callback form of addAbilityStageMonitor to add monitoring, + * and call the callback form of removeAbilityStageMonitor to cancel monitoring + * @tc.desc: Verify that addAbilityStageMonitor can add monitoring, + * verify that removeAbilityStageMonitor can cancel monitoring + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0800', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_0800 begin") + + monitor = { + moduleName: "feature_assisti", + srcEntrance: "./ets/Application/AbilityStage.ts", + } + + console.info("SUB_AA_AbilityStageMonitor_0800 wait abilityStage"); + + try { + abilityDelegator.addAbilityStageMonitor(monitor, (err, data) => { + console.info("SUB_AA_AbilityStageMonitor_0800 addAbilityStageMonitor callback, data = " + data + + "err: " + err); + }) + } catch (error) { + console.log("SUB_AA_AbilityStageMonitor_0800 addAbilityStageMonitor callback err: " + error); + expect().assertFail() + done() + } + + await abilityDelegator.waitAbilityStageMonitor(monitor).then((abilityStage) => { + console.info("stageMonitor waitAbilityStageMonitor callback, abilityStage: " + JSON.stringify(abilityStage)); + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_0600 waitAbilityStageMonitor err: " + JSON.stringify(err)); + expect(err.code).assertEqual(-1) + done() + }) + + try { + console.info("SUB_AA_AbilityStageMonitor_0800 removeAbilityStageMonitor"); + abilityDelegator.removeAbilityStageMonitor(monitor, (err, data) => { + console.info("SUB_AA_AbilityStageMonitor_0800 removeAbilityStageMonitor callback, data = " + + data + "err: " + err); + }) + } catch (error) { + console.log("SUB_AA_AbilityStageMonitor_0800 removeAbilityStageMonitor callback err: " + error); + expect().assertFail() + done() + } + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0900 + * @tc.name: Call waitAbilityStageMonitor, input monitor, timeout is 3 seconds + * @tc.desc: Verify that waitAbilityStageMonitor is + * created after listening for less than 3 seconds + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0900', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_0900 begin") + + monitor = { + moduleName: "feature_assisth", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + console.info("SUB_AA_AbilityStageMonitor_0900 wait abilityStage"); + + await abilityDelegator.waitAbilityStageMonitor(monitor, timeout).then((abilityStage) => { + console.info("SUB_AA_AbilityStageMonitor_0900 waitAbilityStageMonitor promise, abilityStage: " + + JSON.stringify(abilityStage)); + expect().assertFail() + done(); + }).catch((err) => { + console.info("stageMonitor waitAbilityStageMonitor err = " + JSON.stringify(err)); + expect(err.code).assertEqual(-1) + done(); + }) + + test(3000) + + console.info("SUB_AA_AbilityStageMonitor_0900 start ability"); + + want = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "MainAbility7" + }; + + try { + abilityDelegator.startAbility(want, (err, data) => { + console.info("SUB_AA_AbilityStageMonitor_0900 startAbility callback err: " + + JSON.stringify(err) + "data: " + JSON.stringify(data)); + }); + } catch (error) { + console.info("SUB_AA_AbilityStageMonitor_0900 startAbility callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_1000 + * @tc.name: Call the promise form of addAbilityStageMonitor to add monitoring, + * call the promise form of removeAbilityStageMonitor to cancel monitoring, + * and the moduleName in the parameter monitor does not exist + * @tc.desc: Verify that addAbilityStageMonitor can add monitoring, + * verify that removeAbilityStageMonitor can cancel monitoring + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_1000', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_1000 begin") + + let addMonitor = false; + let removeMonitor = true; + monitor = { + moduleName: "feature_assa", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + console.info("SUB_AA_AbilityStageMonitor_1000 wait abilityStage"); + + await abilityDelegator.addAbilityStageMonitor(monitor).then((data) => { + console.info("SUB_AA_AbilityStageMonitor_1000 addAbilityStageMonitor promise, data = " + data); + addMonitor = true; + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_1000 removeAbilityStageMonitor err: " + JSON.stringify(err)); + expect().assertFail() + done() + }); + + console.info("stageMonitor removeAbilityStageMonitor"); + + await abilityDelegator.removeAbilityStageMonitor(monitor).then((data) => { + console.info("SUB_AA_AbilityStageMonitor_1000 addAbilityStageMonitor promise, data = " + data); + removeMonitor = true; + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_1000 removeAbilityStageMonitor err: " + JSON.stringify(err)); + expect().assertFail() + done() + }); + expect(addMonitor).assertTrue(); + expect(removeMonitor).assertTrue(); + done() + }) + }) +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3943e83bbd25fed4bfb15abdf49c48404d1e0c50 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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 abilityStageMonitorTest from './AbilityStageMonitor.test' + +export default function testsuite() { + abilityStageMonitorTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..5e9abedf01ea4a4c08b89360331589537cc91946 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry_test", + "type": "entry", + "srcEntrance": "./ets/Application/TestAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "TestAbility", + "srcEntrance": "./ets/TestAbility/TestAbility.ts", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..994bf08e00f269257844e6b9ecb091ea785de23c --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..f1395d5d9958beba9c08629a18e47e4d10de9f49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "TestAbility/pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/signature/openharmony_sx.p7b differ