diff --git a/ability/ability_runtime/BUILD.gn b/ability/ability_runtime/BUILD.gn index 80824234f356b83924779c2cb2789f41f45fc2db..725ab1b1fddb72e6ded42245a56c99414abc3e9a 100644 --- a/ability/ability_runtime/BUILD.gn +++ b/ability/ability_runtime/BUILD.gn @@ -25,6 +25,7 @@ group("ability_runtime") { "actsabilitydelegatorcase:ActsAbilityDelegatorCaseTest", "actsabilitymanageretstest:ActsAbilityManagerEtsTest", "actsabilityusertest:ActsAbilityuserTest", + "actsappselector:actsappselector", "actscalldataabilitytest:ActsCallDataAbilityTest", "actscalldataabilitytest:ActsCallDataAbilityTest", "actscalltest:actscalltest", diff --git a/ability/ability_runtime/actsappselector/BUILD.gn b/ability/ability_runtime/actsappselector/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..94cec912f856013afd4333a39e63ecf1891d6cd1 --- /dev/null +++ b/ability/ability_runtime/actsappselector/BUILD.gn @@ -0,0 +1,52 @@ +# 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") + +group("actsappselector") { + testonly = true + if (is_standard_system) { + deps = [ + "actsappselectorpctest:ActsAppSelectorPCTest", + "actsappselectorrelyhap:ActsAppSelectorRelyHap", + "actsappselectortest:ActsAppSelectorTest", + "actsimageaentryrelyhap:ActsImageAEntryRelyHap", + "actsimageafeaturerelyhap:ActsImageAFeatureRelyHap", + "actsimagebentryrelyhap:ActsImageBEntryRelyHap", + "actsimagebfeaturerelyhap:ActsImageBFeatureRelyHap", + "actsimagecentryrelyhap:ActsImageCEntryRelyHap", + "actsimagecfeaturerelyhap:ActsImageCFeatureRelyHap", + "actsimagedrelyhap:ActsImageDRelyHap", + "actsimageerelyhap:ActsImageERelyHap", + "actsimagefrelyhap:ActsImageFRelyHap", + "actsimagegrelyhap:ActsImageGRelyHap", + "actsimagehrelyhap:ActsImageHRelyHap", + "actsimageirelyhap:ActsImageIRelyHap", + "actsimagejrelyhap:ActsImageJRelyHap", + "actsimagekrelyhap:ActsImageKRelyHap", + "actsserviceabilityarelyhap:ActsServiceAbilityARelyHap", + "actsserviceabilitybrelyhap:ActsServiceAbilityBRelyHap", + "actstextarelyhap:ActstextARelyHap", + "actstextbrelyhap:ActstextBRelyHap", + "actstextcrelyhap:ActstextCRelyHap", + "actstextdrelyhap:ActstextDRelyHap", + "actstexterelyhap:ActstextERelyHap", + "actstextfrelyhap:ActstextFRelyHap", + "actstextgrelyhap:ActstextGRelyHap", + "actstexthrelyhap:ActstextHRelyHap", + "actstextirelyhap:ActstextIRelyHap", + "actstextjrelyhap:ActstextJRelyHap", + "actstextkrelyhap:ActstextKRelyHap", + ] + } +} diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/app.json b/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a393ee0a845dfaf49ef5623216dc0eff22aab6ac --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.appselectorpctest", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "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/actsappselector/actsappselectorpctest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..983cb0514901934e3003f407acba6c78fa97b868 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AppSelectorTest" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/BUILD.gn b/ability/ability_runtime/actsappselector/actsappselectorpctest/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..050f6a8c2fee394a874d5ef305b5b539d1cd98ec --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/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("ActsAppSelectorPCTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsappselectorpctest_js_assets", + ":actsappselectorpctest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAppSelectorPCTest" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsappselectorpctest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsappselectorpctest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsappselectorpctest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsappselectorpctest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/Test.json b/ability/ability_runtime/actsappselector/actsappselectorpctest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..2545f010722811a683933cd24bdc0d25db9a55c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/Test.json @@ -0,0 +1,65 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.appselectorpctest", + "module-name": "entry", + "shell-timeout": "600000", + "testcase-timeout":"100000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "setenforce 0", + "power-shell setmode 602", + "param set persist.ace.testmode.enabled 1", + "hilog -Q pidoff", + "hilog -Q domainoff", + "hilog -b D" + ] + }, + { + "test-file-name": [ + "ActsAppSelectorPCTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "PushKit", + "push": [ + "ActsAppSelectorRelyHap.hap->/data/ActsAppSelectorRelyHap.hap", + "ActsServiceAbilityARelyHap.hap->/data/ActsServiceAbilityARelyHap.hap", + "ActsServiceAbilityBRelyHap.hap->/data/ActsServiceAbilityBRelyHap.hap", + "ActsImageAEntryRelyHap.hap->/data/ActsImageAEntryRelyHap.hap", + "ActsImageAFeatureRelyHap.hap->/data/ActsImageAFeatureRelyHap.hap", + "ActsImageBEntryRelyHap.hap->/data/ActsImageBEntryRelyHap.hap", + "ActsImageBFeatureRelyHap.hap->/data/ActsImageBFeatureRelyHap.hap", + "ActsImageCEntryRelyHap.hap->/data/ActsImageCEntryRelyHap.hap", + "ActsImageCFeatureRelyHap.hap->/data/ActsImageCFeatureRelyHap.hap", + "ActsImageDRelyHap.hap->/data/ActsImageDRelyHap.hap", + "ActsImageERelyHap.hap->/data/ActsImageERelyHap.hap", + "ActsImageFRelyHap.hap->/data/ActsImageFRelyHap.hap", + "ActsImageGRelyHap.hap->/data/ActsImageGRelyHap.hap", + "ActsImageHRelyHap.hap->/data/ActsImageHRelyHap.hap", + "ActsImageIRelyHap.hap->/data/ActsImageIRelyHap.hap", + "ActsImageJRelyHap.hap->/data/ActsImageJRelyHap.hap", + "ActsImageKRelyHap.hap->/data/ActsImageKRelyHap.hap", + "ActstextARelyHap.hap->/data/ActstextARelyHap.hap", + "ActstextBRelyHap.hap->/data/ActstextBRelyHap.hap", + "ActstextCRelyHap.hap->/data/ActstextCRelyHap.hap", + "ActstextDRelyHap.hap->/data/ActstextDRelyHap.hap", + "ActstextERelyHap.hap->/data/ActstextERelyHap.hap", + "ActstextFRelyHap.hap->/data/ActstextFRelyHap.hap", + "ActstextGRelyHap.hap->/data/ActstextGRelyHap.hap", + "ActstextHRelyHap.hap->/data/ActstextHRelyHap.hap", + "ActstextIRelyHap.hap->/data/ActstextIRelyHap.hap", + "ActstextJRelyHap.hap->/data/ActstextJRelyHap.hap", + "ActstextKRelyHap.hap->/data/ActstextKRelyHap.hap" + ] + } + ] +} + diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..41c2c986f8d126bc9fa12b16119184a13fca63d9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,54 @@ +/* + * 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 MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + globalThis.abilityWant = want; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } + +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1b4c5782a516e02419cea30fcbeb81283cb3f2cd --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("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() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.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/actsappselector/actsappselectorpctest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b6cdc6216cb015082cf70111d41384b3be07f0e --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + @Entry +@Component +struct Index { + @State message: string = 'AppSelectorPC' + + 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/actsappselector/actsappselectorpctest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ccd6043655e8f16aa8a0bcc7de5c98b7b849562 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,444 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import commonEvent from '@ohos.commonEvent' +import { BY, UiDriver, UiComponent, MatchPattern } from '@ohos.uitest' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined; +var driver; +var cmdInstall +var cmdUninstall; +var subscriberInfo = { + events: ['AppSelector'] +}; + +function sleep(time) { + return new Promise < void> ((resolve, reject) => { + setTimeout(() => { + resolve(); + }, time) + }) +} + +export default function abilityTest() { + describe('ActsAppSelectorPCTest', function () { + beforeAll(async (done) => { + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + driver = await UiDriver.create() + await sleep(2000); + done(); + }) + + afterEach(async (done) => { + abilityDelegator.executeShellCommand(cmdUninstall, + async (err: any, d: any) => { + console.log('ACTS_AppSelectorTest cmdUninstall executeShellCommand : err : ' + JSON.stringify(err)); + console.log('ACTS_AppSelectorTest cmdUninstall executeShellCommand : stdResult : ' + d.stdResult); + console.log('ACTS_AppSelectorTest cmdUninstall executeShellCommand : exitCode : ' + d.exitCode); + await sleep(4000); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1100 + * @tc.name: Install one image type matching app + * @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_1100', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1100 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActstextARelyHap.hap'; + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n textarelyhap.com.example"; + + console.log('ACTS_AppSelectorTest_1100 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.debug("ACTS_AppSelectorTest_1100 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1100 startAbility end"); + }) + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_1100 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_1100 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_1100 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_1100 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_1100 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_1100 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1200 + * @tc.name: Install one image type matching app + * @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_1200', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1200 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActstextARelyHap.hap'; + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + "bm uninstall -n textarelyhap.com.example"; + + console.log('ACTS_AppSelectorTest_1200 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + + console.debug("ACTS_AppSelectorTest_1200 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1200 startAbility end"); + + commonEvent.subscribe(subscriber, SubscribeCallBack) + + await sleep(2000); + console.log("ACTS_AppSelectorTest_1200 findComponent"); + let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_1200 button " + JSON.stringify(button)); + await button.click(); + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_1200 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_1200 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_1200 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_1200 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_1200 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_1200 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1300 + * @tc.name: Install one image type matching app + * @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_1300', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1300 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageDRelyHap.hap;' + + 'bm install -p /data/ActstextARelyHap.hap'; + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + "bm uninstall -n imagecrelyhap;bm uninstall -n imagedrelyhap;" + + "bm uninstall -n textarelyhap.com.example" + + console.log('ACTS_AppSelectorTest_1300 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_1300 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1300 startAbility end"); + + commonEvent.subscribe(subscriber, SubscribeCallBack) + + await sleep(2000); + console.log("ACTS_AppSelectorTest_1300 findComponent"); + let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_1300 button " + JSON.stringify(button)); + await button.click(); + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_1300 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_1300 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_1300 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_1300 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_1300 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_1300 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1400 + * @tc.name: Install one image type matching app + * @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_1400', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1400 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageDRelyHap.hap;' + + 'bm install -p /data/ActsImageERelyHap.hap;bm install -p /data/ActsImageGRelyHap.hap;' + + 'bm install -p /data/ActsImageHRelyHap.hap;bm install -p /data/ActsImageIRelyHap.hap;' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;bm uninstall -n imagecrelyhap;" + + "bm uninstall -n imagedrelyhap;bm uninstall -n imageerelyhap;bm uninstall -n imagegrelyhap;" + + "bm uninstall -n imagehrelyhap;bm uninstall -n imageirelyhap;" + + console.log('ACTS_AppSelectorTest_1400 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_1400 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1400 startAbility end"); + + await sleep(2000); + let component = await driver.findComponent(BY.text("imagedrelyhap")) + let rectSerial = await component.getBounds() + component = await driver.findComponent(BY.text("imagearelyhap")) + let rectAlias = await component.getBounds() + console.log("ACTS_AppSelectorTest_1400 rectSerial " + JSON.stringify(rectSerial)); + console.log("ACTS_AppSelectorTest_1400 rectAlias " + JSON.stringify(rectAlias)); + + await driver.swipe(rectSerial.leftX, rectSerial.topY, rectAlias.leftX, rectAlias.topY) + await sleep(3000); + console.log("ACTS_AppSelectorTest_1400 findComponent"); + let button = await driver.findComponent(BY.text('imagegrelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_1400 button " + JSON.stringify(button)); + await button.click(); + commonEvent.subscribe(subscriber, SubscribeCallBack) + }) + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_1400 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_1400 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_1400 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_1400 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_1400 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagegrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_1400 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1500 + * @tc.name: Install one image type matching app + * @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_1500', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1500 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + console.log('ACTS_AppSelectorTest_1500 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_1500 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1500 startAbility end"); + await sleep(2000); + commonEvent.subscribe(subscriber, SubscribeCallBack) + let component1 = await driver.findComponent(BY.text("使用以下方式打开")) + let text = await component1.getBounds() + console.log("ACTS_AppSelectorTest_1500 rectSerial " + JSON.stringify(text)); + + + let component2 = await driver.findComponent(BY.text("imagebrelyhap")) + let button = await component2.getBounds() + console.log("ACTS_AppSelectorTest_1500 rectSerial " + JSON.stringify(button)); + + await sleep(2000); + await driver.click(text.leftX, text.topY); + await sleep(2000); + await driver.click(button.leftX, button.topY); + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_1500 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_1500 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_1500 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_1500 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_1500 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility1"); + expect(data.parameters.bundleName).assertEqual("imagebrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_1500 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1600 + * @tc.name: Install one image type matching app + * @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_1600', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1600 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + console.log('ACTS_AppSelectorTest_1600 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_1600 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1600 startAbility end"); + + await sleep(2000); + console.log("ACTS_AppSelectorTest_1600 findComponent"); + let button = await driver.findComponent(BY.text('取消').enabled(true)) + console.log("ACTS_AppSelectorTest_1600 button " + JSON.stringify(button)); + await button.click(); + + try { + await sleep(2000); + let close = await driver.findComponent(BY.text('取消').enabled(true)) + console.log("ACTS_AppSelectorTest_1600 close " + JSON.stringify(close)); + expect(close == null).assertTrue(); + done(); + } catch (err) { + console.debug("ACTS_AppSelectorTest_1600 catch err: " + JSON.stringify(err)); + console.debug("ACTS_AppSelectorTest_1600 catch err: " + err); + expect(err.code).assertEqual("INTERNAL_ERROR"); + done(); + } + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1700 + * @tc.name: Do not install matching apps + * @tc.desc: Do not install matching apps,"can't open this file" popup + */ + it('ACTS_AppSelectorTest_1700', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1700 --- start") + await sleep(2000); + cmdInstall = 'bm install -p /data/ActsImageJRelyHap.hap' + cmdUninstall = "bm uninstall -n imagejrelyhap"; + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_1700 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1700 startAbility end"); + + try { + await sleep(2000); + console.log("ACTS_AppSelectorTest_1700 findComponent"); + let cantOpen1 = await driver.findComponent(BY.text('无法打开此文件').enabled(true)) + console.log("ACTS_AppSelectorTest_1700 cantOpen1 " + JSON.stringify(cantOpen1)); + expect(cantOpen1 != null).assertTrue(); + let button = await driver.findComponent(BY.text('知道了').enabled(true)) + console.debug("ACTS_AppSelectorTest_1700 button: " + JSON.stringify(button)) + await button.click(); + + await sleep(1000); + console.debug("ACTS_AppSelectorTest_1700 findComponent"); + let cantOpen2 = await driver.findComponent(BY.text('无法打开此文件').enabled(true)) + console.log("ACTS_AppSelectorTest_1700 cantOpen2 " + JSON.stringify(cantOpen2)); + expect(cantOpen2 == null).assertTrue(); + done(); + } catch (err) { + console.debug("ACTS_AppSelectorTest_1700 catch err: " + JSON.stringify(err)); + console.debug("ACTS_AppSelectorTest_1700 catch err: " + err); + expect(err.code).assertEqual("INTERNAL_ERROR"); + done(); + } + }) + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8828f3c461f6224c1f8532e6e299c7b1facc2824 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d4759b77fa44488ac09e4ce59469ef7f0367c8f9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_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/actsappselector/actsappselectorpctest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2b8c72be1fb5a552cd53c1fbc08aec477819ea5a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/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/actsappselector/actsappselectorpctest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsappselectorpctest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsappselectorpctest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..8043b5a0cc673dddfa054f7bae0c8e555fc543ef --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.appselectorrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..62800de69e1b240ca8f3a77234cbb12682a38ad2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsstartrunnertest" + } + ] +} diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..11839cba8c55a2f7ca8ea7a7df40860c5f37aa28 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/BUILD.gn @@ -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("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsAppSelectorRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsAppSelectorRelyHap" + + testonly = true + deps = [ + ":actsappselectorrelyhap_js_assets", + ":actsappselectorrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsappselectorrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsappselectorrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsappselectorrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsappselectorrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..633ebb3f2e880b9c86212fd2c378d5e7a14feadc --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,62 @@ +/* + * 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.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + globalThis.abilityContext = this.context; + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.log("ACTS_AppSelectorTest_3700 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f65697aec97cd488048ce4ecc3917b541631c0eb --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + @Entry +@Component +struct Index { + @State message: string = 'Hello World1' + + 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/actsappselector/actsappselectorrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d4759b77fa44488ac09e4ce59469ef7f0367c8f9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_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/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2b8c72be1fb5a552cd53c1fbc08aec477819ea5a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/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/actsappselector/actsappselectorrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/app.json b/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..6ebe8e35024953ae383bdef858249de07e5dce44 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.appselectortest", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "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/actsappselector/actsappselectortest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..983cb0514901934e3003f407acba6c78fa97b868 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AppSelectorTest" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/BUILD.gn b/ability/ability_runtime/actsappselector/actsappselectortest/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..08278d994257a88b101bdf868ad26507726bc5fa --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/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("ActsAppSelectorTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsappselectortest_js_assets", + ":actsappselectortest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAppSelectorTest" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsappselectortest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsappselectortest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsappselectortest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsappselectortest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/Test.json b/ability/ability_runtime/actsappselector/actsappselectortest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..dcac3574879dbac24ab26e74088dd2305ebfc6b3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/Test.json @@ -0,0 +1,65 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.appselectortest", + "module-name": "entry", + "shell-timeout": "600000", + "testcase-timeout":"300000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "setenforce 0", + "power-shell setmode 602", + "param set persist.ace.testmode.enabled 1", + "hilog -Q pidoff", + "hilog -Q domainoff", + "hilog -b D" + ] + }, + { + "test-file-name": [ + "ActsAppSelectorTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "PushKit", + "push": [ + "ActsAppSelectorRelyHap.hap->/data/ActsAppSelectorRelyHap.hap", + "ActsServiceAbilityARelyHap.hap->/data/ActsServiceAbilityARelyHap.hap", + "ActsServiceAbilityBRelyHap.hap->/data/ActsServiceAbilityBRelyHap.hap", + "ActsImageAEntryRelyHap.hap->/data/ActsImageAEntryRelyHap.hap", + "ActsImageAFeatureRelyHap.hap->/data/ActsImageAFeatureRelyHap.hap", + "ActsImageBEntryRelyHap.hap->/data/ActsImageBEntryRelyHap.hap", + "ActsImageBFeatureRelyHap.hap->/data/ActsImageBFeatureRelyHap.hap", + "ActsImageCEntryRelyHap.hap->/data/ActsImageCEntryRelyHap.hap", + "ActsImageCFeatureRelyHap.hap->/data/ActsImageCFeatureRelyHap.hap", + "ActsImageDRelyHap.hap->/data/ActsImageDRelyHap.hap", + "ActsImageERelyHap.hap->/data/ActsImageERelyHap.hap", + "ActsImageFRelyHap.hap->/data/ActsImageFRelyHap.hap", + "ActsImageGRelyHap.hap->/data/ActsImageGRelyHap.hap", + "ActsImageHRelyHap.hap->/data/ActsImageHRelyHap.hap", + "ActsImageIRelyHap.hap->/data/ActsImageIRelyHap.hap", + "ActsImageJRelyHap.hap->/data/ActsImageJRelyHap.hap", + "ActsImageKRelyHap.hap->/data/ActsImageKRelyHap.hap", + "ActstextARelyHap.hap->/data/ActstextARelyHap.hap", + "ActstextBRelyHap.hap->/data/ActstextBRelyHap.hap", + "ActstextCRelyHap.hap->/data/ActstextCRelyHap.hap", + "ActstextDRelyHap.hap->/data/ActstextDRelyHap.hap", + "ActstextERelyHap.hap->/data/ActstextERelyHap.hap", + "ActstextFRelyHap.hap->/data/ActstextFRelyHap.hap", + "ActstextGRelyHap.hap->/data/ActstextGRelyHap.hap", + "ActstextHRelyHap.hap->/data/ActstextHRelyHap.hap", + "ActstextIRelyHap.hap->/data/ActstextIRelyHap.hap", + "ActstextJRelyHap.hap->/data/ActstextJRelyHap.hap", + "ActstextKRelyHap.hap->/data/ActstextKRelyHap.hap" + ] + } + ] +} + diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c546e58c88a3a4ba91d9388cce5752a38cc4069b --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,54 @@ +/* + * 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 MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + globalThis.abilityWant = want; + globalThis.abilityContext = this.context; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } + +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1b4c5782a516e02419cea30fcbeb81283cb3f2cd --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("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() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.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/actsappselector/actsappselectortest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b136fb5291be2733cdd073b53d6deecb33545f7c --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'AppSelector' + + 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/actsappselector/actsappselectortest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fa2c8ed3ad3af124347705258e21d3ec403ba7d6 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,1494 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import commonEvent from '@ohos.commonEvent' +import { BY, UiDriver, UiComponent, MatchPattern } from '@ohos.uitest' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined; +var driver; +var cmdInstall +var cmdUninstall; +var subscriberInfo = { + events: ['AppSelector'] +}; + +let paConnect = { + onConnect: function (elementName, proxy) { + console.info("AppSelector Service onConnect called."); + }, + onDisconnect: function (elementName) { + console.info("AppSelector Service onDisconnect"); + }, + onFailed: function (code) { + console.info("AppSelector Service onFailed"); + } +}; + +function sleep(time) { + return new Promise < void> ((resolve, reject) => { + setTimeout(() => { + resolve(); + }, time) + }) +} + + +export default function abilityTest() { + describe('ActsAppSelectorTest', function () { + beforeAll(async (done) => { + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + driver = await UiDriver.create() + await sleep(1000); + done(); + }) + + afterEach(async (done) => { + abilityDelegator.executeShellCommand(cmdUninstall, + async (err: any, d: any) => { + console.info('ACTS_AppSelectorTest cmdUninstall executeShellCommand : err : ' + JSON.stringify(err)); + console.info('ACTS_AppSelectorTest cmdUninstall executeShellCommand : data : ' + d.stdResult); + console.info('ACTS_AppSelectorTest cmdUninstall executeShellCommand : data : ' + d.exitCode); + await sleep(6000); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3200 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_3200', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3200 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActsImageJRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;bm uninstall -n imagejrelyhap" + + console.log('ACTS_AppSelectorTest_3200 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_3200 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_3200 startAbility end"); + + let component = await driver.findComponent(BY.text('imagearelyhap')) + let button = await component.getBounds() + console.log("ACTS_AppSelectorTest_3200 button " + JSON.stringify(button)); + + await sleep(1000); + globalThis.abilityContext.startAbility( + { + bundleName: "imagejrelyhap", + abilityName: "MainAbility", + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_3200 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_3200 startAbility end"); + + await sleep(5000); + commonEvent.subscribe(subscriber, SubscribeCallBack) + await driver.click(button.leftX, button.topY); + }) + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_3200 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_3200 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_3200 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_3200 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_3200 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_3200 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0100 + * @tc.name: Install one image type matching app + * @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0100', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0100 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageJRelyHap.hap;' + + 'bm install -p /data/ActstextARelyHap.hap'; + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagejrelyhap;" + + "bm uninstall -n textarelyhap.com.example"; + + console.log('ACTS_AppSelectorTest_0100 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.log("ACTS_AppSelectorTest_0100 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.log("ACTS_AppSelectorTest_0100 startAbility end"); + }) + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0100 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0100 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0100 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0100 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0100 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0100 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0200 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0200', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0200 --- start") + cmdInstall = 'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextJRelyHap.hap;' + + 'bm install -p /data/ActsImageAEntryRelyHap.hap '; + cmdUninstall = "bm uninstall -n textarelyhap.com.example;bm uninstall -n textjrelyhap.com.example;" + + "bm uninstall -n imagearelyhap"; + + console.log('ACTS_AppSelectorTest_0200 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "text/txt", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.debug("ACTS_AppSelectorTest_0200 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_0200 startAbility end"); + }) + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0200 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0200 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0200 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0200 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0200 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility"); + expect(data.parameters.bundleName).assertEqual("textarelyhap.com.example"); + expect(data.parameters.type).assertEqual("text/txt"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0200 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0300 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0300', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0300 --- start") + let subscriber; + cmdInstall = 'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextBRelyHap.hap;' + + 'bm install -p /data/ActstextJRelyHap.hap;bm install -p /data/ActsImageAEntryRelyHap.hap '; + cmdUninstall = "bm uninstall -n textarelyhap.com.example;bm uninstall -n textbrelyhap.com.example;" + + "bm uninstall -n textjrelyhap.com.example;bm uninstall -n imagearelyhap"; + + console.log('ACTS_AppSelectorTest_0300 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "text/txt", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_0300 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_0300 startAbility end"); + }) + await sleep(2000); + console.log("ACTS_AppSelectorTest_0300 findComponent"); + let button = await driver.findComponent(BY.text('textbrelyhap.com.example').enabled(true)) + console.log("ACTS_AppSelectorTest_0300 button " + JSON.stringify(button)); + subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + await button.click(); + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0300 SubscribeCallBack'); + console.log('ACTS_AppSelectorTest_0300 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0300 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0300 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0300 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0300 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility"); + expect(data.parameters.bundleName).assertEqual("textbrelyhap.com.example"); + expect(data.parameters.type).assertEqual("text/txt"); + expect(data.parameters.uri).assertEqual("filePath"); + + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0300 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0400 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0400', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0400 --- start") + let subscriber; + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageDRelyHap.hap;' + + 'bm install -p /data/ActsImageJRelyHap.hap;bm install -p /data/ActstextARelyHap.hap'; + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + "bm uninstall -n imagecrelyhap;bm uninstall -n imagedrelyhap;" + + "bm uninstall -n imagejrelyhap;bm uninstall -n textarelyhap.com.example" + + console.log('ACTS_AppSelectorTest_0400 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_0400 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_0400 startAbility end"); + + subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + await sleep(1000); + console.log("ACTS_AppSelectorTest_0400 findComponent"); + let button = await driver.findComponent(BY.text('imagebrelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_0400 button " + JSON.stringify(button)); + await button.click(); + }) + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0400 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0400 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0400 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0400 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0400 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility1"); + expect(data.parameters.bundleName).assertEqual("imagebrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0400 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0500 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0500', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0500 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageDRelyHap.hap;' + + 'bm install -p /data/ActsImageERelyHap.hap;bm install -p /data/ActsImageGRelyHap.hap;' + + 'bm install -p /data/ActsImageHRelyHap.hap;bm install -p /data/ActsImageIRelyHap.hap;' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;bm uninstall -n imagecrelyhap;" + + "bm uninstall -n imagedrelyhap;bm uninstall -n imageerelyhap;bm uninstall -n imagegrelyhap;" + + "bm uninstall -n imagehrelyhap;bm uninstall -n imageirelyhap;" + + console.log('ACTS_AppSelectorTest_0500 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_0500 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_0500 startAbility end"); + + commonEvent.subscribe(subscriber, SubscribeCallBack) + await sleep(1000); + console.log("ACTS_AppSelectorTest_0500 findComponent"); + let button = await driver.findComponent(BY.text('imagegrelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_0500 button " + JSON.stringify(button)); + await button.click(); + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0500 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0500 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0500 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0500 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0500 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagegrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0500 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0600 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0600', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0600 --- start") + cmdInstall = 'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextBRelyHap.hap;' + + 'bm install -p /data/ActstextCRelyHap.hap;bm install -p /data/ActstextDRelyHap.hap;' + + 'bm install -p /data/ActstextERelyHap.hap;bm install -p /data/ActstextFRelyHap.hap;' + + 'bm install -p /data/ActstextGRelyHap.hap;bm install -p /data/ActstextHRelyHap.hap;' + + 'bm install -p /data/ActstextIRelyHap.hap;' + cmdUninstall = "bm uninstall -n textarelyhap.com.example;bm uninstall -n textbrelyhap.com.example;" + + "bm uninstall -n textcrelyhap.com.example;bm uninstall -n textdrelyhap.com.example;" + + "bm uninstall -n texterelyhap.com.example;bm uninstall -n textfrelyhap.com.example;" + + "bm uninstall -n textgrelyhap.com.example;bm uninstall -n texthrelyhap.com.example;" + + "bm uninstall -n textirelyhap.com.example;" + + console.log('ACTS_AppSelectorTest_0600 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "text/txt", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_0600 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_0600 startAbility end"); + + commonEvent.subscribe(subscriber, SubscribeCallBack) + await sleep(2000); + let component = await driver.findComponent(BY.text("texthrelyhap.com.example")) + let rectSerial = await component.getBounds() + component = await driver.findComponent(BY.text("texterelyhap.com.example")) + let rectAlias = await component.getBounds() + console.log("ACTS_AppSelectorTest_0600 rectSerial " + JSON.stringify(rectSerial)); + console.log("ACTS_AppSelectorTest_0600 rectAlias " + JSON.stringify(rectAlias)); + + await driver.swipe(rectSerial.leftX, rectSerial.topY, rectAlias.leftX, rectAlias.topY) + console.log("ACTS_AppSelectorTest_0600 findComponent"); + let button = await driver.findComponent(BY.text('textirelyhap.com.example').enabled(true)) + console.log("ACTS_AppSelectorTest_0600 button " + JSON.stringify(button)); + await button.click(); + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0600 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0600 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0600 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0600 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0600 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility"); + expect(data.parameters.bundleName).assertEqual("textirelyhap.com.example"); + expect(data.parameters.type).assertEqual("text/txt"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0600 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0700 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0700', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0700 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + console.log('ACTS_AppSelectorTest_0700 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_0700 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_0700 startAbility end"); + await sleep(2000); + let button = await driver.findComponent(BY.text('imagebrelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_0700 button " + JSON.stringify(button)); + let component = await driver.findComponent(BY.text("使用以下方式打开")) + let rectSerial = await component.getBounds() + console.log("ACTS_AppSelectorTest_0700 rectSerial " + JSON.stringify(rectSerial)); + await driver.click(rectSerial.leftX, rectSerial.topY); + await sleep(2000); + console.log("ACTS_AppSelectorTest_0700 findComponent"); + + await button.click(); + commonEvent.subscribe(subscriber, SubscribeCallBack) + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0700 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0700 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0700 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0700 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0700 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility1"); + expect(data.parameters.bundleName).assertEqual("imagebrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0700 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0800 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0800', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0800 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + console.log('ACTS_AppSelectorTest_0800 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_0800 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_0800 startAbility end"); + await sleep(2000); + console.log("ACTS_AppSelectorTest_0800 findComponent"); + let button = await driver.findComponent(BY.text('取消').enabled(true)) + console.log("ACTS_AppSelectorTest_0800 button " + JSON.stringify(button)); + await button.click(); + done(); + + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0900 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0900', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0900 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextBRelyHap.hap;' + + 'bm install -p /data/ActsServiceAbilityARelyHap.hap;' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + "bm uninstall -n textarelyhap.com.example;bm uninstall -n textbrelyhap.com.example;" + + "bm uninstall -n aserviceabilityrelyhap;" + + console.log('ACTS_AppSelectorTest_0900 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + + console.info("ACTS_AppSelectorTest_0900 Service servStart"); + let connectionId; + let want = { + "bundleName": "aserviceabilityrelyhap", + "abilityName": "ServiceAbility" + }; + + connectionId = globalThis.abilityContext.connectAbility(want, paConnect) + console.info('ACTS_AppSelectorTest_0900 Service connectionId ' + connectionId); + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + await sleep(2000); + console.log("ACTS_AppSelectorTest_0900 findComponent"); + let button = await driver.findComponent(BY.text('textbrelyhap.com.example').enabled(true)) + console.log("ACTS_AppSelectorTest_0900 button " + JSON.stringify(button)); + await button.click(); + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0900 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0900 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0900 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0900 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0900 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility"); + expect(data.parameters.bundleName).assertEqual("textbrelyhap.com.example"); + expect(data.parameters.type).assertEqual("text/txt"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0900 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1000 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_1000', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1000 --- start") + cmdInstall = 'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextBRelyHap.hap;' + cmdUninstall = "bm uninstall -n textarelyhap.com.example;bm uninstall -n textbrelyhap.com.example;" + + console.log('ACTS_AppSelectorTest_1000 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbilityForResult( + { + action: "ohos.want.action.viewData", + type: "text/txt", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.log("ACTS_AppSelectorTest_1000 startAbilityForResult " + + JSON.stringify(error) + "," + JSON.stringify(data)); + }) + await sleep(2000); + console.log("ACTS_AppSelectorTest_1000 findComponent"); + let button = await driver.findComponent(BY.text('textbrelyhap.com.example').enabled(true)) + console.log("ACTS_AppSelectorTest_1000 button " + JSON.stringify(button)); + await button.click(); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_1000 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_1000 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_1000 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_1000 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_1000 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility"); + expect(data.parameters.bundleName).assertEqual("textbrelyhap.com.example"); + expect(data.parameters.type).assertEqual("text/txt"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + async function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_1000 UnSubscribeCallBack"); + try { + let close = await driver.findComponent(BY.text('取消').enabled(true)) + console.log("ACTS_AppSelectorTest_1000 cantOpen2 " + JSON.stringify(close)); + expect(close == null).assertTrue(); + done(); + } catch (err) { + console.debug("ACTS_AppSelectorTest_1000 catch err: " + JSON.stringify(err)); + console.debug("ACTS_AppSelectorTest_1000 catch err: " + err); + expect("").assertFail(); + done(); + } + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1800 + * @tc.name: Install action matches but type does not match app + * @tc.desc: Install action matches but type does not match app,"can't open this file" popup + */ + it('ACTS_AppSelectorTest_1800', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1800 --- start") + cmdInstall = 'bm install -p /data/ActstextARelyHap.hap' + cmdUninstall = "bm uninstall -n textarelyhap.com.example" + + console.log('ACTS_AppSelectorTest_1800 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_1800 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1800 startAbility end"); + + + await sleep(2000); + console.log("ACTS_AppSelectorTest_1800 findComponent"); + let cantOpen1 = await driver.findComponent(BY.text('无法打开此文件').enabled(true)) + console.log("ACTS_AppSelectorTest_1800 cantOpen1 " + JSON.stringify(cantOpen1)); + expect(cantOpen1 != null).assertTrue(); + let button = await driver.findComponent(BY.text('知道了').enabled(true)) + console.debug("ACTS_ANROptimization_1800 button: " + JSON.stringify(button)) + await button.click(); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1900 + * @tc.name: Install action does not match but type matches app + * @tc.desc: Install action does not match but type matches app,"can't open this file" popup + */ + it('ACTS_AppSelectorTest_1900', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1900 --- start") + cmdInstall = 'bm install -p /data/ActstextKRelyHap.hap' + cmdUninstall = "bm uninstall -n textkrelyhap.com.example" + + console.log('ACTS_AppSelectorTest_1900 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "text/txt", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_1900 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1900 startAbility end"); + await sleep(2000); + console.log("ACTS_AppSelectorTest_1900 findComponent"); + let cantOpen1 = await driver.findComponent(BY.text('无法打开此文件').enabled(true)) + console.log("ACTS_AppSelectorTest_1900 cantOpen1 " + JSON.stringify(cantOpen1)); + expect(cantOpen1 != null).assertTrue(); + let button = await driver.findComponent(BY.text('知道了').enabled(true)) + console.debug("ACTS_AppSelectorTest_1900 button: " + JSON.stringify(button)) + await button.click(); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2000 + * @tc.name: Implicitly start the interface action and pass in an empty string + * @tc.desc: Implicitly start the interface action and pass in an empty string,return success + */ + it('ACTS_AppSelectorTest_2000', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2000 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap" + + console.log('ACTS_AppSelectorTest_2000 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + globalThis.abilityContext.startAbility( + { + action: "", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.log("ACTS_AppSelectorTest_2000 startAbility " + JSON.stringify(error)); + expect(error.code).assertEqual(0); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2100 + * @tc.name: Implicitly start the interface action and pass in null + * @tc.desc: Implicitly start the interface action and pass in null,return failure + */ + it('ACTS_AppSelectorTest_2100', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2100 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap" + + console.log('ACTS_AppSelectorTest_2100 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + globalThis.abilityContext.startAbility( + { + action: null, + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.log("ACTS_AppSelectorTest_2100 startAbility " + JSON.stringify(error)); + expect(error.code).assertEqual(0); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelector_2200 + * @tc.name: Implicitly start the interface action and pass in undefined + * @tc.desc: Implicitly start the interface action and pass in undefined,return success + */ + it('ACTS_AppSelectorTest_2200', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2200 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap" + + console.log('ACTS_AppSelectorTest_2200 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: undefined, + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.log("ACTS_AppSelectorTest_2200 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + expect(error.code).assertEqual(0); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2300 + * @tc.name: Implicitly start the interface type and pass in an empty string + * @tc.desc: Implicitly start the interface type and pass in an empty string,return failure + */ + it('ACTS_AppSelectorTest_2300', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2300 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap" + + console.log('ACTS_AppSelectorTest_2300 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.log("ACTS_AppSelectorTest_2300 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + expect(error.code).assertEqual(1); + await sleep(2000); + let button = await driver.findComponent(BY.text('知道了').enabled(true)) + console.debug("ACTS_AppSelectorTest_2300 button: " + JSON.stringify(button)) + console.debug("ACTS_AppSelectorTest_2300 click"); + await button.click(); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2400 + * @tc.name: Implicitly start the interface type and pass in null + * @tc.desc: Implicitly start the interface type and pass in null,return failure + */ + it('ACTS_AppSelectorTest_2400', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2400 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap" + + console.log('ACTS_AppSelectorTest_2400 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: null, + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.log("ACTS_AppSelectorTest_2400 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + expect(error.code).assertEqual(1); + await sleep(2000); + let button = await driver.findComponent(BY.text('知道了').enabled(true)) + console.debug("ACTS_AppSelectorTest_2400 button: " + JSON.stringify(button)) + console.debug("ACTS_AppSelectorTest_2400 click"); + await button.click(); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2500 + * @tc.name: Implicitly start the interface type and pass in undefined + * @tc.desc: Implicitly start the interface type and pass in undefined,return failure + */ + it('ACTS_AppSelectorTest_2500', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2500 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap" + + console.log('ACTS_AppSelectorTest_2500 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: undefined, + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.log("ACTS_AppSelectorTest_2500 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + expect(error.code).assertEqual(1); + await sleep(2000); + let button = await driver.findComponent(BY.text('知道了').enabled(true)) + console.debug("ACTS_AppSelectorTest_2500 button: " + JSON.stringify(button)) + console.debug("ACTS_AppSelectorTest_2500 click"); + await button.click(); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2600 + * @tc.name: Multi-hap application with action and type configured in entry + * @tc.desc: Multi-hap application with action and type configured in entry,MainAbility is pulled up in entry + */ + it('ACTS_AppSelectorTest_2600', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2600 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageAFeatureRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap" + + console.log('ACTS_AppSelectorTest_2600 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.debug("ACTS_AppSelectorTest_2600 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_2600 startAbility end"); + }) + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_2600 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_2600 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_2600 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_2600 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_2600 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_2600 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2700 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_2700', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2700 --- start") + cmdInstall = 'bm install -p /data/ActsImageBFeatureRelyHap.hap;bm install -p /data/ActsImageBEntryRelyHap.hap' + cmdUninstall = "bm uninstall -n imagebrelyhap" + + console.log('ACTS_AppSelectorTest_2700 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.debug("ACTS_AppSelectorTest_2700 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_2700 startAbility end"); + }) + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_2700 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_2700 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_2700 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_2700 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_2700 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility1"); + expect(data.parameters.bundleName).assertEqual("imagebrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_2700 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2800 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_2800', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2800 --- start") + cmdInstall = 'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageCFeatureRelyHap.hap' + cmdUninstall = "bm uninstall -n imagecrelyhap" + + console.log('ACTS_AppSelectorTest_2800 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_2800 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_2800 startAbility end"); + await sleep(2000); + console.log("ACTS_AppSelectorTest_2800 findComponent"); + let button = await driver.findComponent(BY.text('imagecrelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_2800 button " + JSON.stringify(button)); + await button.click(); + commonEvent.subscribe(subscriber, SubscribeCallBack) + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_2800 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_2800 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_2800 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_2800 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_2800 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagecrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_2800 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2900 + * @tc.name: MainAbility configures multi-ability applications of actions and types + * @tc.desc: MainAbility configures multi-ability applications of actions and types,mainAbility is pulled up + */ + it('ACTS_AppSelectorTest_2900', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2900 --- start") + cmdInstall = 'bm install -p /data/ActsImageDRelyHap.hap' + cmdUninstall = "bm uninstall -n imagedrelyhap" + + console.log('ACTS_AppSelectorTest_2900 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.debug("ACTS_AppSelectorTest_2900 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_2900 startAbility end"); + }) + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_2900 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_2900 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_2900 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_2900 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_2900 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagedrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_2900 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3000 + * @tc.name: SecondAbility configures multi-ability applications of actions and types + * @tc.desc: SecondAbility configures multi-ability applications of actions and types,secondAbility is pulled up + */ + it('ACTS_AppSelectorTest_3000', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3000 --- start") + cmdInstall = 'bm install -p /data/ActsImageERelyHap.hap' + cmdUninstall = "bm uninstall -n imageerelyhap" + + console.log('ACTS_AppSelectorTest_3000 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.debug("ACTS_AppSelectorTest_3000 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_3000 startAbility end"); + }) + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_3000 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_3000 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_3000 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_3000 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_3000 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("SecondAbility"); + expect(data.parameters.bundleName).assertEqual("imageerelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_3000 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3100 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_3100', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3100 --- start") + cmdInstall = 'bm install -p /data/ActsImageFRelyHap.hap' + cmdUninstall = "bm uninstall -n imagefrelyhap" + + console.log('ACTS_AppSelectorTest_3100 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_3100 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_3100 startAbility end"); + await sleep(2000); + console.log("ACTS_AppSelectorTest_3100 findComponent"); + let button = await driver.findComponent(BY.text('imagefrelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_3100 button " + JSON.stringify(button)); + await button.click(); + commonEvent.subscribe(subscriber, SubscribeCallBack) + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_3100 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_3100 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_3100 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_3100 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_3100 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagefrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_3100 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3400 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_3400', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3400 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap" + + console.log('ACTS_AppSelectorTest_3400 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + globalThis.abilityContext.startAbilityWithAccount( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, 100, (error, data) => { + console.log("ACTS_AppSelectorManual startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + }) + await sleep(2000); + console.log("ACTS_AppSelectorTest_3400 findComponent"); + let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_3400 button " + JSON.stringify(button)); + await button.click(); + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_3400 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_3400 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_3400 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_3400 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_3400 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_3400 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3500 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_3500', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3500 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap" + + console.log('ACTS_AppSelectorTest_3500 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + globalThis.abilityContext.startAbilityForResultWithAccount( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, 100, (error, data) => { + console.log("ACTS_AppSelectorManual startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + }) + await sleep(2000); + console.log("ACTS_AppSelectorTest_3500 findComponent"); + let button = await driver.findComponent(BY.text('imagebrelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_3500 button " + JSON.stringify(button)); + await button.click(); + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_3500 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_3500 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_3500 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_3500 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_3500 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility1"); + expect(data.parameters.bundleName).assertEqual("imagebrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_3500 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3600 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_3600', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3600 --- start") + cmdInstall = 'bm install -p /data/ActsServiceAbilityBRelyHap.hap;bm install -p /data/ActsImageKRelyHap.hap' + cmdUninstall = "bm uninstall -n bserviceabilityrelyhap;bm uninstall -n imagekrelyhap" + + console.log('ACTS_AppSelectorTest_3600 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + console.log("ACTS_AppSelectorTest_3600 connectservice") + + let connectionId; + let want = { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + }, + }; + + connectionId = globalThis.abilityContext.connectAbility(want, paConnect) + console.info('ACTS_AppSelectorTest_3600 Service connectionId ' + connectionId); + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_3600 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_3600 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_3600 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_3600 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_3600 event = ' + data.event); + console.log('ACTS_AppSelectorTest_3600 startByService = ' + data.parameters.startByService); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.startByService).assertEqual(true); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_3600 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3700 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_3700', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3700 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActsAppSelectorRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + "bm uninstall -n com.example.appselectorrelyhap" + + console.log('ACTS_AppSelectorTest_3700 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + globalThis.abilityContext.startAbility( + { + bundleName: "com.example.appselectorrelyhap", + abilityName: "MainAbility", + }, (error, data) => { + console.log("ACTS_AppSelectorTest_3700 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + }) + await sleep(2000); + let component = await driver.findComponent(BY.text('imagearelyhap')) + let button = await component.getBounds() + console.log("ACTS_AppSelectorTest_3700 button " + JSON.stringify(button)); + + var cmd = 'bm uninstall -n com.example.appselectorrelyhap '; + console.log('ACTS_AppSelectorTest_3700 cmd = ' + cmd); + abilityDelegator.executeShellCommand(cmd, + async (err: any, d: any) => { + console.info('ACTS_AppSelectorTest_3700 executeShellCommand : err : ' + JSON.stringify(err)); + console.info('ACTS_AppSelectorTest_3700 executeShellCommand : stdResult : ' + d.stdResult); + console.info('ACTS_AppSelectorTest_3700 executeShellCommand : exitCode : ' + d.exitCode); + await sleep(2000); + await driver.click(button.leftX, button.topY); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3300 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_3300', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3300 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap" + let subscriber; + console.log('ACTS_AppSelectorTest_3300 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + + for (var i = 0; i < 10; i++) { + await sleep(2000); + subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.log("ACTS_AppSelectorTest_3300 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + }) + + commonEvent.subscribe(subscriber, SubscribeCallBack); + await sleep(3000); + console.log("ACTS_AppSelectorTest_3300 findComponent"); + let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_3300 button " + JSON.stringify(button)); + await button.click(); + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_3300 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_3300 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_3300 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_3300 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_3300 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + } + } + await sleep(2000); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_3300 UnSubscribeCallBack"); + done(); + } + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8828f3c461f6224c1f8532e6e299c7b1facc2824 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..63433eb8d6b9487794cb12a568e2b0f733abdad3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/module.json @@ -0,0 +1,36 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a042229a98e83f0fecd6510b9240aa0e6b18e3d6 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "AppSelectorTest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/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/actsappselector/actsappselectortest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsappselectortest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsappselectortest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..acb9d83ec9c7c15b36d1656d0f67135832ee207d --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagearelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f5a41012f62766f497f607db33d0a34c69f32dd3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageARelyHap" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..d82bab124d4f2306b6fa81810fdf3b75924453bd --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsImageAEntryRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageAEntryRelyHap" + + testonly = true + deps = [ + ":actsimageaentryrelyhap_js_assets", + ":actsimageaentryrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimageaentryrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimageaentryrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimageaentryrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimageaentryrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..76c42708a682982115e9e63459c1e5157eaefe59 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b821e0762b0ce1f49b14c6af2d2ef24927e5ec39 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/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 { + @State message: string = 'imageAEntryRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9f0588e2b01de5e7be32dfad152eee0c3097c594 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_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": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/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/actsappselector/actsimageaentryrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..acb9d83ec9c7c15b36d1656d0f67135832ee207d --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagearelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f5a41012f62766f497f607db33d0a34c69f32dd3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageARelyHap" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..f7f1783bffade24d6d73f90b6000de457e6bcf1b --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsImageAFeatureRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageAFeatureRelyHap" + + testonly = true + deps = [ + ":actsimageafeaturerelyhap_js_assets", + ":actsimageafeaturerelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimageafeaturerelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimageafeaturerelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimageafeaturerelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimageafeaturerelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..76c42708a682982115e9e63459c1e5157eaefe59 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..5156aee2af84b888660cd3cc28d333098c0ded6e --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/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 { + @State message: string = 'imageAFeatureRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..cdf0c7dd43e3f837aa98eef7aaca99a153efe00f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "feature", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:feature_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility1", + "srcEntrance": "./ets/MainAbility1/MainAbility1.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/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4d1ba2b5ec9e5f5215bbb05f4b2eda6660424843 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "feature_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/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/actsappselector/actsimageafeaturerelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..3756872988b7a78687c16d798c72fb8048659288 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagebrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2a5a20b619bd79751438a2ca9f2ab3e9392745b9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageBRelyHap" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..2944cbcf208f0496714a2f69a5c2f906d3fcecf4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsImageBEntryRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageBEntryRelyHap" + + testonly = true + deps = [ + ":actsimagebentryrelyhap_js_assets", + ":actsimagebentryrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagebentryrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagebentryrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagebentryrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagebentryrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c96f3dd3cedffdd357d535fb84eb81e5cf7a4341 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagebrelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>ACTS_AppSelectorTest imagebrelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9b0661e21deae5ad7dd4088becd0c8259a2747ce --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/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 { + @State message: string = 'imageBEntryRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d4759b77fa44488ac09e4ce59469ef7f0367c8f9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_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/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/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/actsappselector/actsimagebentryrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..3756872988b7a78687c16d798c72fb8048659288 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagebrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2a5a20b619bd79751438a2ca9f2ab3e9392745b9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageBRelyHap" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..6708e0097b9e78a250def0dc9c5f674b506ce953 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsImageBFeatureRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageBFeatureRelyHap" + + testonly = true + deps = [ + ":actsimagebfeaturerelyhap_js_assets", + ":actsimagebfeaturerelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagebfeaturerelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagebfeaturerelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagebfeaturerelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagebfeaturerelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..c96f3dd3cedffdd357d535fb84eb81e5cf7a4341 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagebrelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>ACTS_AppSelectorTest imagebrelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..a674f001c62661447573261aa7bd2c9841b2f675 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/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 { + @State message: string = 'imageBFeatureRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9c5991c31d2ebedc37f3df222ee647e4e17ce60f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "feature", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:feature_desc", + "mainElement": "MainAbility1", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility1", + "srcEntrance": "./ets/MainAbility1/MainAbility1.ts", + "description": "$string:MainAbility1_desc", + "icon": "$media:icon", + "label": "$string:MainAbility1_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f9bf22447345a31bb6c59261fb1e4408ee9ed80f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "feature_desc", + "value": "description" + }, + { + "name": "MainAbility1_desc", + "value": "description" + }, + { + "name": "MainAbility1_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/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/actsappselector/actsimagebfeaturerelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..03c6abdacceab3ebe42a6b273981630443234a12 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagecrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c9a066960309d4f715524a76b860f773d69204d5 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageCRelyHap" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..6223a6db9574fb6559dff36ce8c41f62fd1f4e27 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsImageCEntryRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageCEntryRelyHap" + + testonly = true + deps = [ + ":actsimagecentryrelyhap_js_assets", + ":actsimagecentryrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagecentryrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagecentryrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagecentryrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagecentryrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..7290324cec34b10c9c16b1627996902c767b61a3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/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 { + @State message: string = 'imageCEntryRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9f0588e2b01de5e7be32dfad152eee0c3097c594 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_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": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/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/actsappselector/actsimagecentryrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..03c6abdacceab3ebe42a6b273981630443234a12 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagecrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c9a066960309d4f715524a76b860f773d69204d5 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageCRelyHap" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..439aed5911aca9909a6db1f2dc8fd3393df2d15d --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsImageCFeatureRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageCFeatureRelyHap" + + testonly = true + deps = [ + ":actsimagecfeaturerelyhap_js_assets", + ":actsimagecfeaturerelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagecfeaturerelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagecfeaturerelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagecfeaturerelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagecfeaturerelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b23af53b55141998878348ccef5af0069dea1651 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/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 { + @State message: string = 'imageCFeatureRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9c5991c31d2ebedc37f3df222ee647e4e17ce60f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "feature", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:feature_desc", + "mainElement": "MainAbility1", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility1", + "srcEntrance": "./ets/MainAbility1/MainAbility1.ts", + "description": "$string:MainAbility1_desc", + "icon": "$media:icon", + "label": "$string:MainAbility1_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f9bf22447345a31bb6c59261fb1e4408ee9ed80f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "feature_desc", + "value": "description" + }, + { + "name": "MainAbility1_desc", + "value": "description" + }, + { + "name": "MainAbility1_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/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/actsappselector/actsimagecfeaturerelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..da43eefaab4029493a13cac52cf45bb6ec81a03f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagedrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..31f2f8582d9dc30cae94c460cddeb40c4b6f48e3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageDRelyHap" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagedrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..8dcad72e371dbc361565edc3e0a787e84bc7ec6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsImageDRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageDRelyHap" + + testonly = true + deps = [ + ":actsimagedrelyhap_js_assets", + ":actsimagedrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagedrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagedrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagedrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagedrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..8b0e4d5690e998c9672c7ff9cab09a0dadfe596a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class SecondAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..13ab1f39b0dd02c4b7c0cbc1faed42c67b9df424 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/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 { + @State message: string = 'imageDRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..813610967ecfbd698d1bbf0bc8b4d29c18904262 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/module.json @@ -0,0 +1,57 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_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": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + }, + { + "name": "SecondAbility", + "srcEntrance": "./ets/SecondAbility/SecondAbility.ts", + "description": "$string:SecondAbility_desc", + "icon": "$media:icon", + "label": "$string:SecondAbility_label", + "visible": true, + "skills": [ + { + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..61009f0568889992994409f98d5fe3964976a381 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "SecondAbility_desc", + "value": "description" + }, + { + "name": "SecondAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/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/actsappselector/actsimagedrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagedrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagedrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..4489cddd78fca4c8d9fffc8be1222295a239c01e --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imageerelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0878ae980505e0a7d84fe04f75e4321b45cc47aa --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageERelyHap" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimageerelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..d15a05756ae5a2c90cff97bcdc11aabc0fa39330 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsImageERelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageERelyHap" + + testonly = true + deps = [ + ":actsimageerelyhap_js_assets", + ":actsimageerelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimageerelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimageerelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimageerelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimageerelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..650c7d6d0ac41b1f69e0973cfe540e36cb723481 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class SecondAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] SecondAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] SecondAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] SecondAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] SecondAbility onWindowStageDestroy") + + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] SecondAbility onForeground") + console.log("[Demo] SecondAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imageerelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imageerelyhap SecondAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] SecondAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..2bf5dfc120e669e90836f59e59f15aec8c7e2492 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/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 { + @State message: string = 'imageERelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..08f74bf6254b16c01eeee6416d6958022d828e1c --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/module.json @@ -0,0 +1,57 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_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" + ] + } + ] + }, + { + "name": "SecondAbility", + "srcEntrance": "./ets/SecondAbility/SecondAbility.ts", + "description": "$string:SecondAbility_desc", + "icon": "$media:icon", + "visible": true, + "label": "$string:SecondAbility_label", + "skills": [ + { + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..61009f0568889992994409f98d5fe3964976a381 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "SecondAbility_desc", + "value": "description" + }, + { + "name": "SecondAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/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/actsappselector/actsimageerelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimageerelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageerelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..daf090d19e0073910c3fb9a90d11e21bddddaa69 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagefrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bf92305ade6d8307163cdcfc15ce4145a8a14281 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageFRelyHap" + } + ] +} diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagefrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..9eb9d019f758a95f451e526418c67d3a9a098970 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsImageFRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageFRelyHap" + + testonly = true + deps = [ + ":actsimagefrelyhap_js_assets", + ":actsimagefrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagefrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagefrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagefrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagefrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b92beea4500936fc2b1121af5b5677c0b705b002 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class SecondAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..1f19a1da4cd8fe10ba7ce872f6138fc5bcf520ee --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/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 { + @State message: string = 'imageFRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..8c94ac7bfb74af1d6c878b86df1bd7be99b49992 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/module.json @@ -0,0 +1,62 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_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": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + }, + { + "name": "SecondAbility", + "srcEntrance": "./ets/SecondAbility/SecondAbility.ts", + "description": "$string:SecondAbility_desc", + "icon": "$media:icon", + "label": "$string:SecondAbility_label", + "visible": true, + "skills": [ + { + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..61009f0568889992994409f98d5fe3964976a381 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "SecondAbility_desc", + "value": "description" + }, + { + "name": "SecondAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/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/actsappselector/actsimagefrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagefrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagefrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..8cd8e57fb555c6c35432eff0367f3e04355ad412 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagegrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1e32c2ed17093310924304748a2eba36391f4c83 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageGRelyHap" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagegrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..6743221be79cbb9563c3e82c74b1152f74dcb59c --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsImageGRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageGRelyHap" + + testonly = true + deps = [ + ":actsimagegrelyhap_js_assets", + ":actsimagegrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagegrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagegrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagegrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagegrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..184d752c47544da3d049cfc5811251a5ec0a2350 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -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 router from '@system.router'; +import file from '@system.file'; +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + + @State message: string = 'MainAbility' + + 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/actsappselector/actsimagegrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ef538001795a4630d04727ca36007f19b1ffdcb --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/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 { + @State message: string = 'imageGRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9f0588e2b01de5e7be32dfad152eee0c3097c594 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_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": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/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/actsappselector/actsimagegrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagegrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagegrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..e16e3c3d3b8fab173c092ba7aa82a3fea108ee5b --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagehrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f2c355baaa7bd6052f161bd6d2dccfe258e740ac --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageHRelyHap" + } + ] +} diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagehrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..134c1c11e33cdbe7fe7695dc3b126e147047a215 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsImageHRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageHRelyHap" + + testonly = true + deps = [ + ":actsimagehrelyhap_js_assets", + ":actsimagehrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagehrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagehrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagehrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagehrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..184d752c47544da3d049cfc5811251a5ec0a2350 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -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 router from '@system.router'; +import file from '@system.file'; +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + + @State message: string = 'MainAbility' + + 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/actsappselector/actsimagehrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..cf55418401cd0d4397d281037b90a7758321b005 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/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 { + @State message: string = 'imageHRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9f0588e2b01de5e7be32dfad152eee0c3097c594 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_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": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/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/actsappselector/actsimagehrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagehrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagehrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..2d2d77b8d712dd2a7d0729dfb26384de19912da1 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imageirelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..90d258ec6679699ca1dd21aca46459848b95a15f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageIRelyHap" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimageirelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..413afe705c35a288c4d4ba94ec6475f1bda9744f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsImageIRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageIRelyHap" + + testonly = true + deps = [ + ":actsimageirelyhap_js_assets", + ":actsimageirelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimageirelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimageirelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimageirelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimageirelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..184d752c47544da3d049cfc5811251a5ec0a2350 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -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 router from '@system.router'; +import file from '@system.file'; +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + + @State message: string = 'MainAbility' + + 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/actsappselector/actsimageirelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..e904e3bb73f7f95a6dc0dccada2c614908c616be --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/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 { + @State message: string = 'imageIRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9f0588e2b01de5e7be32dfad152eee0c3097c594 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_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": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/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/actsappselector/actsimageirelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimageirelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageirelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..4b6ade9e393a72acfd04c1ba8283bfa666da7a8a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagejrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d9bd9cdbd32547c15bb8b57444b4cf8be0e54927 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageJRelyHap" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagejrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..2a8343798d525211b72dc8f74cab7a1acabc6e5d --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/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("ActsImageJRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageJRelyHap" + + deps = [ + ":actsimagejrelyhap_js_assets", + ":actsimagejrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagejrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagejrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagejrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagejrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..5eccf4c7828dd8d34e6a327910ee1358a56c5833 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -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. + */ +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + // windowStage.setUIContent(this.context, "pages/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/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..184d752c47544da3d049cfc5811251a5ec0a2350 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -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 router from '@system.router'; +import file from '@system.file'; +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + + @State message: string = 'MainAbility' + + 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/actsappselector/actsimagejrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..30c9b862cdb3b656d310d90614387b6f5928bef5 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/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 { + @State message: string = 'imageJRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d6d2ca5d59ade7344363c49384aeda2e12280916 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_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": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/jpeg" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/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/actsappselector/actsimagejrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagejrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagejrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..70d6774d44f0b1d3e13dc9a07d181ce50c44d419 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagekrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..71e244d1382c49873d6d6b031bd47ce57abc1d75 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageKRelyHap" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagekrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..78c47bd116ccd106e4953f9646c05d09f42561b1 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsImageKRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageKRelyHap" + + testonly = true + deps = [ + ":actsimagekrelyhap_js_assets", + ":actsimagekrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagekrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagekrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagekrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagekrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..48603c3f1882e3fee65d6e0967ec1aac963ff8ef --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + if (want.parameters.startByService) { + AppStorage.SetOrCreate('startByService', want.parameters.startByService); + } + + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagekrelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri, + startByService:globalThis.abilityWant.parameters.startByService + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagekrelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f1865cb187f944195a866cd23584a5b165a54bf3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageKRelyHap' + @StorageLink('startByService') startByService: boolean = false; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + + Text("startByService: " + this.startByService) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..647f63e74c2c3445054c8860ac412a796f89ae0e --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageKRelyHap' + @StorageLink('startByService') startByService: boolean = false; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + + Text("startByService: " + this.startByService) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d4759b77fa44488ac09e4ce59469ef7f0367c8f9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_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/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/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/actsappselector/actsimagekrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagekrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagekrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c3256a90083abadcdf7244149dc5c7898d255130 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "aserviceabilityrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6683e32c2794d4749b23c82d7fe673f83c1066d1 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsserviceabilityarelyhap" + } + ] +} diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..c55e4970cdb7822329aca1a97c7e6b5fe7eaeba3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsServiceAbilityARelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsServiceAbilityARelyHap" + + testonly = true + deps = [ + ":actsserviceabilityarelyhap_js_assets", + ":actsserviceabilityarelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsserviceabilityarelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsserviceabilityarelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsserviceabilityarelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsserviceabilityarelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..260e7891fe9921853f1d5fdf6640818e4f636d41 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -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 Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + globalThis.abilityWant = want; + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c40096dc19e6372101d540684b500456f5f739c3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/MainAbility/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 { + @State message: string = 'imageAEntryRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..210dc7900f7a34e309d9e6eac96191206e624fdf --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -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. + */ + +import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import rpc from "@ohos.rpc"; +import Want from '@ohos.application.Want'; + +export default class ServiceAbility extends ServiceExtensionAbility { + onCreate(want) { + console.log('AppSelector ServiceAbility onCreate, want: ' + want.abilityName); + } + + onConnect(want: Want) { + console.log('AppSelector ServiceAbility onConnect, want:' + want.abilityName); + this.context.startAbility( + { + action: "ohos.want.action.viewData", + type: "text/txt", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.info("ACTS_AppSelector_0900 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.info("ACTS_AppSelector_0900 startAbility end"); + }) + return new rpc.RemoteObject('connect'); + } + + onDisconnect(want) { + console.log('AppSelector ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/ServiceAbility/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f18a61d57fe4cc71cd70bae4d9378d284df0e2c --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/ServiceAbility/service.ts @@ -0,0 +1,26 @@ +/* + * 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. + */ + +export default { + onStart() { + console.info('ServiceAbility onStart'); + }, + onStop() { + console.info('ServiceAbility onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility onCommand'); + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b821e0762b0ce1f49b14c6af2d2ef24927e5ec39 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/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 { + @State message: string = 'imageAEntryRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d5ff071453789a78c54e1b90a1d323294996502b --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/module.json @@ -0,0 +1,46 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "ServiceAbility", + "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", + "label": "$string:service_ServiceAbility_desc", + "description": "$string:service_ServiceAbility_desc", + "type": "service|dataShare", + "visible": true + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..24e76e8b8cf82af6c7c52c48bbf354c2c5b35173 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsserviceabilityarelyhap" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "service_ServiceAbility_desc", + "value": "service_description" + }, + { + "name": "service_ServiceAbility_label", + "value": "service_label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/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/actsappselector/actsserviceabilityarelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..38b25d33adb4e6c768412172077803e704df9c52 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "bserviceabilityrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6792c02963a3e29c0f34e365874200241b0f72c7 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsserviceabilitybrelyhap" + } + ] +} diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..ddbe2a0f7c6010a71d9a68301c258ca04c7aebd4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/BUILD.gn @@ -0,0 +1,44 @@ +# 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("ActsServiceAbilityBRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsServiceAbilityBRelyHap" + + testonly = true + deps = [ + ":actsserviceabilitybrelyhap_js_assets", + ":actsserviceabilitybrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsserviceabilitybrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsserviceabilitybrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsserviceabilitybrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsserviceabilitybrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..d22a1bf6db6d710e0e88072be63c9b519414d31f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/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.log('MainAbility onCreate') + globalThis.abilityWant = want; + globalThis.abilityContext = this.context; + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..ffa2c85dbe70cacfc662ba9cc0c346e7f6034707 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,66 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import rpc from "@ohos.rpc"; +import Want from '@ohos.application.Want'; +// import commonEvent from '@ohos.commonEvent' + +export default class ServiceAbility extends ServiceExtensionAbility { + onCreate(want) { + console.log('AppSelector ServiceAbility onCreate, want: ' + want.abilityName); + } + + onConnect(want: Want) { + console.log('AppSelector ServiceAbility onConnect, want:' + want.abilityName); + this.context.startAbility( + { + "bundleName": "imagekrelyhap", + "abilityName": "MainAbility", + parameters: { + startByService: true + } + }, (error, data) => { + console.info("ACTS_AppSelector_3600 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.info("ACTS_AppSelector_3600 startAbility end"); + }) + // console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + // let commonEventData = { + // code: 0, + // data: 'imagekrelyhap', + // parameters: { + // abilityName: want.abilityName, + // bundleName: want.bundleName, + // type: want.type, + // uri: want.parameters.uri, + // startByService:want.parameters.startByService + // } + // } + // commonEvent.publish('AppSelector', commonEventData, (err) => { + // console.log('======>imagekrelyhap MainAbility published<======') + // }) + + return new rpc.RemoteObject('connect'); + } + + onDisconnect(want) { + console.log('AppSelector ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/ServiceAbility/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f18a61d57fe4cc71cd70bae4d9378d284df0e2c --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/ServiceAbility/service.ts @@ -0,0 +1,26 @@ +/* + * 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. + */ + +export default { + onStart() { + console.info('ServiceAbility onStart'); + }, + onStop() { + console.info('ServiceAbility onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility onCommand'); + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b821e0762b0ce1f49b14c6af2d2ef24927e5ec39 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/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 { + @State message: string = 'imageAEntryRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..96165322cba1e22a7cff03ceee3c96d83099f0c4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/module.json @@ -0,0 +1,58 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "ServiceAbility", + "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", + "label": "$string:service_ServiceAbility_label", + "description": "$string:service_ServiceAbility_desc", + "type": "service|dataShare", + "visible": true, + "skills": [ + { + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8c7ec91f5a16fe583414ee4fea0c5e1e2316bc5e --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsserviceabilitybrelyhap" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "service_ServiceAbility_desc", + "value": "service_description" + }, + { + "name": "service_ServiceAbility_label", + "value": "service_label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/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/actsappselector/actsserviceabilitybrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextarelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextarelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..2f129f022f222699c3560180c4e9155683691d11 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextarelyhap/BUILD.gn @@ -0,0 +1,36 @@ +# 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("ActstextARelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextARelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..66926bfc494ab0189e6b0454ff3cd8ef72c4ae5b --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textarelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..451daa2fe41cc40b0bf6a9be4ef9f168956b3504 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,60 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + var want; + console.info('Application onCreate') + + try{ + featureAbility.getWant((err, data) => { + want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textarelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textarelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b9b91905974490cf08585eef34ac6a0675f2085a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textARelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..655a94a9ab09856c1bc6c1849cd0666967a32f2d --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actstextarelyhap" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actstextarelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextarelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextarelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextbrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextbrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..e6f561f8416e77edc4bcc45a1da5a5b610e2d7cc --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextbrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextBRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextBRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..3ebcb6f57be19a4c62316c673c38d5dea29854e8 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textbrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e13f77c871ddc8b35be79f4eb78def7c05d2cea --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textbrelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textbrelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..76560040dc7d3887599a9d96b06988dbbe6c3608 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textBRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actstextbrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextbrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextbrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextcrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextcrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..cbe03c77df9ef29efea652d39fd7a33f59f22e01 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextcrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextCRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextCRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..36ef410d47779a929811b346e1577e79ca9bf391 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textcrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..83427442c5d81beec585d422c5aa320922fd4296 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textcrelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textcrelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c012201e82452697bd99e0f55fcf92f879c11a34 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textCRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actstextcrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextcrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextcrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextdrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextdrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..7e5520c648653b836c1459bf38c83eaf1e902472 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextdrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextDRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextDRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a498525b79d1143cae6ff154b57786b740851f3a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textdrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..64bfc183bf50af03cd43910909a9a563416f88f2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textdrelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textdrelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..8bc776ed3ebb8f39735a21ebb42a7deb5b063392 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textDRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actstextdrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextdrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextdrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstexterelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstexterelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..83376d2cd74b881abd4fd171ad2d14fc21978550 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexterelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextERelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextERelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..0972283a3ac4c14935f38555fd8c0790f42d20c6 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "texterelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..95daf966045a694f936a1de7cd5874c1606f2d85 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'texterelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>texterelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..8cebb723863a85d1abe2f4eb618dfa0979271817 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textERelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actstexterelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstexterelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstexterelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextfrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextfrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..08ba99bb2f589969b0eb3c1001ff788acc1f124b --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextfrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextFRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextFRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..189a522070726cce363635438b6d7bbd05613b5a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textfrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a21fb5443dc7f3fb21819568aa988da80308cae --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textfrelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textfrelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..76d6ac147b0f2509b1685ddaa3db90ff3b03da17 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textFRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actstextfrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextfrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextfrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextgrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextgrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..1fba8dbe9aa828e46bda739a0b0ed77f21226724 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextgrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextGRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextGRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..d0dafedf8ddd0cd680f92767f23668249b0dc3f3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textgrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..92fed374e5d5a2c5cfb64662fd3f85f9aea56ab8 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textgrelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textgrelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e385b74990affd8e27f6067a7d7d6e828464c6f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textGRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actstextgrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextgrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextgrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstexthrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstexthrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..fdc6f6595207c7d5289059c40053f5df2c31a5d1 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexthrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextHRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextHRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..aa060703b712204544fbc467b9c83e6226a2a961 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "texthrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..723dfab3fce9064772189d623fe10fc01e7d1711 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'texthrelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>texthrelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d2c9e3502b1938592fe171de0e589db191cab6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textHRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actstexthrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstexthrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstexthrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextirelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextirelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..40414a02c2a00198e20b8944d7722bcaef3ae6b8 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextirelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextIRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextIRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..7dfa59339f0cb0128e1bae3b688a537058a568a6 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textirelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..697c9217409692a5c4e108a830cce9bbd7219ce2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textirelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textirelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..03705059201f9ae73b90dfbb6632100be8d829b4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textIRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actstextirelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextirelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextirelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextjrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextjrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..d940b30119fd72a14b5c10e67bb288ef5a013965 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextjrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextJRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextJRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..b68cd0930f90833c134f1247167afa69f3d0eca1 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textjrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/md" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..487fafac7cc9fa524b919b440eb1244df9a6732d --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,59 @@ +/** + * 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. + */ +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textarelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textarelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..bcfc2c61bc6969a4d19365aa7f21643697dd0067 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textJRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actstextjrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextjrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextjrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextkrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextkrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..f34f30ad8eb2548e02d5f23439cc3c272b3f2674 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextkrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextKRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextKRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..57885f72d00f6cd1f32f49f8b694cd21a80bd10e --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textkrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.getData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..a877ff7a9af570e2e6dec2ea7377f0a036c0bd74 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textkrelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textkrelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..06647c0ca6bbd594796c1a89ec68f00a7b3507e9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textKRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..df18caae3bd9df85b56116a0e5e39c02dc9ef250 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsappselector/actstextkrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextkrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextkrelyhap/signature/openharmony_sx.p7b differ