diff --git a/aafwk/aafwk_standard/BUILD.gn b/aafwk/aafwk_standard/BUILD.gn index ac351e87265257865b3be3beca743a0ae5e89d52..c0764c8bcb36b2aa2f6bc1f9fd588d9c0fc87269 100755 --- a/aafwk/aafwk_standard/BUILD.gn +++ b/aafwk/aafwk_standard/BUILD.gn @@ -51,6 +51,7 @@ group("aafwk_standard") { "serviceability/stserviceabilityserver:amsStServiceAilityServer", "serviceability/stserviceabilityserversecond:ActsAmsStServiceAilityServerSecondTest", "setshowonlockscreen:setshowonlockscreen", + "stage:stage", "want:want", ] } diff --git a/aafwk/aafwk_standard/stage/BUILD.gn b/aafwk/aafwk_standard/stage/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..b6f0b4519e4f797ae5e075d5ccf31c21c9463024 --- /dev/null +++ b/aafwk/aafwk_standard/stage/BUILD.gn @@ -0,0 +1,21 @@ +# 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("stage") { + testonly = true + if (is_standard_system) { + deps = [ "actsamscontexttest:ActsAmsContextTest" ] + } +} diff --git a/aafwk/aafwk_standard/stage/actsamscontexttest/AppScope/app.json b/aafwk/aafwk_standard/stage/actsamscontexttest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..b0decfe1f4e51a3d51438f1f96112534f46c5f15 --- /dev/null +++ b/aafwk/aafwk_standard/stage/actsamscontexttest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app":{ + "bundleName":"ohos.acts.aafwk.pldtest.myapplication", + "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":8, + "targetAPIVersion":8, + "car":{ + "apiCompatibleVersion":8, + "singleUser":false + } + } +} diff --git a/aafwk/aafwk_standard/stage/actsamscontexttest/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/stage/actsamscontexttest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ee69f9a861d9dc269ed6638735d52674583498e1 --- /dev/null +++ b/aafwk/aafwk_standard/stage/actsamscontexttest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ohosProject" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actsamscontexttest/AppScope/resources/base/media/app_icon.png b/aafwk/aafwk_standard/stage/actsamscontexttest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/aafwk/aafwk_standard/stage/actsamscontexttest/AppScope/resources/base/media/app_icon.png differ diff --git a/aafwk/aafwk_standard/stage/actsamscontexttest/BUILD.gn b/aafwk/aafwk_standard/stage/actsamscontexttest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..be1de458fab7c91ce9df37fb1556bf141a16fabe --- /dev/null +++ b/aafwk/aafwk_standard/stage/actsamscontexttest/BUILD.gn @@ -0,0 +1,40 @@ +# 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") + +ohos_js_hap_suite("ActsAmsContextTest") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":actsamscontexttest_js_assets", + ":actsamscontexttest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAmsContextTest" +} + +ohos_app_scope("actsamscontexttest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsamscontexttest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsamscontexttest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsamscontexttest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/aafwk/aafwk_standard/stage/actsamscontexttest/Test.json b/aafwk/aafwk_standard/stage/actsamscontexttest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..b1a15957aced765d7ff6e7c14512b26daaf3f7d9 --- /dev/null +++ b/aafwk/aafwk_standard/stage/actsamscontexttest/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "180000", + "package": "ohos.acts.aafwk.pldtest.myapplication", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAmsContextTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/stage/actsamscontexttest/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/stage/actsamscontexttest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..51cb02ba3f5c7011c1cd433d07deebd47a195704 --- /dev/null +++ b/aafwk/aafwk_standard/stage/actsamscontexttest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,9 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} diff --git a/aafwk/aafwk_standard/stage/actsamscontexttest/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/stage/actsamscontexttest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..2f9d6d1f23f95d9fc891fbc550cd5a589cfb6c89 --- /dev/null +++ b/aafwk/aafwk_standard/stage/actsamscontexttest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,36 @@ +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want,launchParam){ + // Ability is creating, initialize resources for this ability + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + onWindowStageDestroy() { + //Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/stage/actsamscontexttest/entry/src/main/ets/pages/index/.idea/workspace.xml b/aafwk/aafwk_standard/stage/actsamscontexttest/entry/src/main/ets/pages/index/.idea/workspace.xml new file mode 100644 index 0000000000000000000000000000000000000000..6f7f3e9b4f0f636d50ba8261d6f055c928308544 --- /dev/null +++ b/aafwk/aafwk_standard/stage/actsamscontexttest/entry/src/main/ets/pages/index/.idea/workspace.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + +