diff --git a/ability/ability_runtime/context/actsstagecontext/BUILD.gn b/ability/ability_runtime/context/actsstagecontext/BUILD.gn index 47abc75e204b802b6e328ab426344dab339d8c80..25c3bd185d0e675d503a8e956d7e5db5fd502f51 100644 --- a/ability/ability_runtime/context/actsstagecontext/BUILD.gn +++ b/ability/ability_runtime/context/actsstagecontext/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021-2023 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 @@ -17,6 +17,8 @@ group("actsstagecontext") { testonly = true if (is_standard_system) { deps = [ + "ReportDrawnCompletedManualTestRely:ReportDrawnCompletedManualTestRely", + "ReportDrawnCompletedReply:ReportDrawnCompletedReply", "actsstagecontextassistone:ActsStageContextAssistOne", "actsstagecontextassisttwo:ActsStageContextAssistTwo", "actsstagecontextpropertiestest:ActsStageContextPropertiesTest", diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/AppScope/app.json b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..9caca201ca12f3c19b01839392e8d9ae62a11432 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.reportdrawncompletedmanualtest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/AppScope/resources/base/element/string.json b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6251b0e61933019457132997ffb4152620ec1562 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ReportDrawnCompletedManualTest" + } + ] +} diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/BUILD.gn b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f27b7366648e96149160c6b66724e2223c055ddb --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 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("ReportDrawnCompletedManualTestRely") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":reportdrawncompletedmanualtestrely_js_assets", + ":reportdrawncompletedmanualtestrely_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ReportDrawnCompletedManualTestRely" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("reportdrawncompletedmanualtestrely_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("reportdrawncompletedmanualtestrely_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("reportdrawncompletedmanualtestrely_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":reportdrawncompletedmanualtestrely_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/ets/entryability/EntryAbility.ts b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/ets/entryability/EntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..3c11a2e3a2014a34fd220cad7c3677a7b2dfcb49 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/ets/entryability/EntryAbility.ts @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import Ability from '@ohos.app.ability.UIAbility'; +import Window from '@ohos.window'; + +export default class EntryAbility extends Ability { + onCreate(want, launchParam) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + globalThis.context = this.context; + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); + this.context.reportDrawnCompleted(() => { + console.info('The call to the reportDrawnCompleted interface succeeded'); + }); + } + + onDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: Window.WindowStage) { + // Main window is created, set main page for this ability + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/ets/pages/Index.ets b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..96c5e32af46c5f2220202a8668f3bba13f541400 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'Hello World'; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/ets/pages/Index2.ets b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/ets/pages/Index2.ets new file mode 100644 index 0000000000000000000000000000000000000000..0adf9b0f0a66b587ae3d5bc74eeb5fc85ca81d7a --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/ets/pages/Index2.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 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 Index2 { + @State message: string = 'Hello World'; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/module.json b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..432d0540e276c68b873a60e1a82d3c512f70f54c --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntrance": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "launchType": "standard", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..d66f9a7d4ac61fb8d215239ab3620b7bcd77bf33 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..e8e9bfe327753f038d6b96eee671553a6982b129 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + }, + { + "name": "UIAbility2_desc", + "value": "description" + }, + { + "name": "UIAbility2_label", + "value": "label" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..40070c932db678992994e015884daaf1e4ab7b0f --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,8 @@ +{ + "src": [ + "pages/Index", + "pages/Index", + "pages/Index2", + "pages/Index2" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/en_US/element/string.json b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..e8e9bfe327753f038d6b96eee671553a6982b129 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + }, + { + "name": "UIAbility2_desc", + "value": "description" + }, + { + "name": "UIAbility2_label", + "value": "label" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/zh_CN/element/string.json b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1cda06c3aa0057cff449338996adfdda120113f3 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + }, + { + "name": "UIAbility2_desc", + "value": "description" + }, + { + "name": "UIAbility2_label", + "value": "label" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/signature/openharmony_sx.p7b b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..0916b0608e733b4d003698d59170db2165740e67 Binary files /dev/null and b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedManualTestRely/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/AppScope/app.json b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..3eedf8c9dfc3d266698afb8045d7f0eb8c1f96e4 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.stagecontextpropertiestest", + "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 + } + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/AppScope/resources/base/element/string.json b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0341464a8de631a34787cb15a9d9266b29847a73 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsStageContextAssistOne" + } + ] +} diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/BUILD.gn b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..bd29c22ccd361d6ac816d393b4e86c78eb64a8db --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 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("ReportDrawnCompletedReply") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":reportdrawncompletedreply_js_assets", + ":reportdrawncompletedreply_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ReportDrawnCompletedReply" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("reportdrawncompletedreply_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("reportdrawncompletedreply_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("reportdrawncompletedreply_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":reportdrawncompletedreply_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..1f5a866aacf768d27474c722ece94c7f494aa25a --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/ets/Application/MyAbilityStage.ts @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2023 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.app.ability.AbilityStage'; + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info('ActsStageContextAssistOne StageAbility onCreate'); + globalThis.abilityStageContextA = this.context; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/ets/MainAbility/DrawnAbility.ts b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/ets/MainAbility/DrawnAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..614a35a7941d620dd6a080b4434306c06d97cc81 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/ets/MainAbility/DrawnAbility.ts @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2023 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.app.ability.UIAbility'; +import commonEvent from '@ohos.commonEvent'; + +export default class DrawnAbility extends Ability { + onCreate(want, launchParam) { + console.info('ActsStageContextAssistOne DrawnAbility onCreate'); + this.context.reportDrawnCompleted(() => { + console.info('The call to the reportDrawnCompleted interface succeeded'); + }); + } + + onDestroy() { + console.info('ActsStageContextAssistOne DrawnAbility onDestroy'); + } + + onWindowStageCreate(windowStage) { + console.info('ActsStageContextAssistOne DrawnAbility onWindowStageCreate'); + windowStage.setUIContent(this.context, 'pages/index', null); + } + + onWindowStageDestroy() { + console.info('ActsStageContextAssistOne DrawnAbility onWindowStageDestroy'); + } + + onForeground() { + console.info('ActsStageContextAssistOne DrawnAbility onForeground'); + globalThis.abilityContextA = this.context; + commonEvent.publish('StartDrawnAbility_CommonEvent_ContextOne', () => { + console.log('Publish StartDrawnAbility_CommonEvent_ContextOne callback'); + }); + } + + onBackground() { + console.info('ActsStageContextAssistOne DrawnAbility onBackground'); + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..7749347641e437a4772a9945631deb7918a70d80 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/ets/pages/index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2023 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/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/module.json b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..824aa13e66f51f1dd34d7a7335e002f9470d8ac8 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "drawn", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "DrawnAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "DrawnAbility", + "srcEntrance": "./ets/MainAbility/DrawnAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "launchType": "specified", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..605115b2e7fe98cb36a1a5ec19594e215131a908 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/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": "feature_MainAbility" + }, + { + "name": "app_name", + "value": "ActsStageContextAssistOne" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/signature/openharmony_sx.p7b b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7b6a850f2477c6046b6987ba34ad0d002fb027af Binary files /dev/null and b/ability/ability_runtime/context/actsstagecontext/ReportDrawnCompletedReply/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/context/actsstagecontext/actsstagecontextpropertiestest/Test.json b/ability/ability_runtime/context/actsstagecontext/actsstagecontextpropertiestest/Test.json index 9595408064924e7b01b338ad084a4b7b49a9d65f..11f616f49f3f5b4d6f3bf19033fd8aef9dd739b6 100644 --- a/ability/ability_runtime/context/actsstagecontext/actsstagecontextpropertiestest/Test.json +++ b/ability/ability_runtime/context/actsstagecontext/actsstagecontextpropertiestest/Test.json @@ -13,7 +13,9 @@ "test-file-name": [ "ActsStageContextPropertiesTest.hap", "ActsStageContextAssistOne.hap", - "ActsStageContextAssistTwo.hap" + "ActsStageContextAssistTwo.hap", + "ReportDrawnCompletedManualTestRely.hap", + "ReportDrawnCompletedReply.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/ability/ability_runtime/context/actsstagecontext/actsstagecontextpropertiestest/entry/src/main/ets/test/StageContextProperties.test.ets b/ability/ability_runtime/context/actsstagecontext/actsstagecontextpropertiestest/entry/src/main/ets/test/StageContextProperties.test.ets index e5854cc0e86b25846a77cde0e900beccbeef9eb6..68b721e1f2a8b6e1518f6d130b860b3f7972f98b 100644 --- a/ability/ability_runtime/context/actsstagecontext/actsstagecontextpropertiestest/entry/src/main/ets/test/StageContextProperties.test.ets +++ b/ability/ability_runtime/context/actsstagecontext/actsstagecontextpropertiestest/entry/src/main/ets/test/StageContextProperties.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -15,6 +15,7 @@ import { describe, it, expect, afterEach, beforeAll } from '@ohos/hypium' import commonEvent from '@ohos.commonEvent' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' let Subscriber; let TAG; @@ -64,6 +65,15 @@ export default function stageContextPropertiesTest(abilityContext) { }, 1500); }) + function beforeEachLoadmanagement() { + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + abilityDelegator.executeShellCommand("hilog -r", async (err, data) => {}); + abilityDelegator.executeShellCommand("hilog -Q pidoff", async (err, data) => {}); + abilityDelegator.executeShellCommand("hilog -Q domainoff", async (err, data) => {}); + abilityDelegator.executeShellCommand("hilog -b D", async (err, data) => {}); + abilityDelegator.executeShellCommand("hilog -G 20M", async (err, data) => {}); + } + /** * @tc.number: SUB_AA_OpenHarmony_Context_0100 * @tc.name: Check that context paths of different Ability in the same hap are the same. @@ -498,6 +508,105 @@ export default function stageContextPropertiesTest(abilityContext) { } }); + /** + * @tc.number: Acts_ReportDrawnCompleted_AsyncCallback_1400 + * @tc.name: Load management + * @tc.desc: The uiability of this application use asyncCallback way call reportDrawnCompleted interface + * viewing console output information. + * @tc.level 1 + */ + it('Acts_ReportDrawnCompleted_AsyncCallback_1400', 0, function (done) { + beforeEachLoadmanagement(); + setTimeout(function () { + let want = { + "deviceId": "", + "bundleName": "com.example.stagecontextpropertiestest", + "abilityName": "DrawnAbility", + "moduleName": "drawn", + }; + globalThis.abilityContext.startAbility(want, () => {}); + + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + setTimeout(function () { + console.log('====>ReportDrawnCompleted_1400 expect start '); + let grepLog = "'\"name_\":\"DRAWN_COMPLETED\"'"; + let cmd = "hilog -x | grep " + grepLog; + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('====>ReportDrawnCompleted_0100 executeShellCommand err : ' + JSON.stringify(err)); + if (data.stdResult) { + console.log('====>ReportDrawnCompleted_1400 data.stdResult : ' + JSON.stringify(data.stdResult)); + try { + expect(data.stdResult).assertContain("\"domain_\":\"AAFWK\""); + expect(data.stdResult).assertContain("\"name_\":\"DRAWN_COMPLETED\""); + expect(data.stdResult).assertContain("\"type_\":4"); + expect(data.stdResult).assertContain("\"tz_\":\"+0800\""); + expect(data.stdResult).assertContain( + "\"BUNDLE_NAME\":\"com.example.stagecontextpropertiestest\""); + expect(data.stdResult).assertContain("\"MODULE_NAME\":\"drawn\""); + expect(data.stdResult).assertContain("\"ABILITY_NAME\":\"DrawnAbility\""); + } catch { + expect().assertFail(); + done(); + } + done(); + } else { + expect().assertFail(); + done(); + } + }); + }, 200); + }, 4000); + }) + + /* + * @tc.number: Acts_ReportDrawnCompleted_AsyncCallback_1500 + * @tc.name: Load management + * @tc.desc: The uiAbility of this external application use asyncCallback way call reportDrawnCompleted interface + * viewing console output information. + * @tc.level 1 + */ + it('Acts_ReportDrawnCompleted_AsyncCallback_1500', 0, function (done) { + beforeEachLoadmanagement(); + setTimeout(function () { + let want = { + "deviceId": "", + "bundleName": "com.example.reportdrawncompletedmanualtest", + "abilityName": "EntryAbility" + }; + globalThis.abilityContext.startAbility(want, () => {}); + + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + setTimeout(function () { + console.log('====>ReportDrawnCompleted_1500 expect start '); + let grepLog = "'\"name_\":\"DRAWN_COMPLETED\"'"; + let cmd = "hilog -x | grep " + grepLog; + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('====>ReportDrawnCompleted_1500 executeShellCommand err : ' + JSON.stringify(err)); + if (data.stdResult) { + console.log('====>ReportDrawnCompleted_1500 data.stdResult : ' + JSON.stringify(data.stdResult)); + try { + expect(data.stdResult).assertContain("\"domain_\":\"AAFWK\""); + expect(data.stdResult).assertContain("\"name_\":\"DRAWN_COMPLETED\""); + expect(data.stdResult).assertContain("\"type_\":4"); + expect(data.stdResult).assertContain("\"tz_\":\"+0800\""); + expect(data.stdResult).assertContain( + "\"BUNDLE_NAME\":\"com.example.reportdrawncompletedmanualtest\""); + expect(data.stdResult).assertContain("\"MODULE_NAME\":\"entry\""); + expect(data.stdResult).assertContain("\"ABILITY_NAME\":\"EntryAbility\""); + } catch { + expect().assertFail(); + done(); + } + done(); + } else { + expect().assertFail(); + done(); + } + }); + }, 1000); + }, 4000); + }) + function checkApplicationContextDir(applicationContext) { expect(applicationContext.cacheDir).assertEqual("/data/storage/el2/base/cache"); expect(applicationContext.tempDir).assertEqual("/data/storage/el2/base/temp");