diff --git a/ability/ability_runtime/BUILD.gn b/ability/ability_runtime/BUILD.gn index e9a07ecd1c588b8bdb9d103f825f8a52bf0a34b0..f78db54130ed583869f6a89854755a0071213beb 100644 --- a/ability/ability_runtime/BUILD.gn +++ b/ability/ability_runtime/BUILD.gn @@ -31,6 +31,7 @@ group("ability_runtime") { "actsdataabilityaccessdatasharetest:dataabilityaccessdatashare", "actsfwkdataaccessortest:dataability", "actsmultiplecall:actsmultiplecall", + "actsnfcselecttypes:actsnfcselecttypes", "actsqueryfunctiontest:actsqueryfunctiontest", "actsrequestdialogtest:actsrequestdialogtest", "actsrevokequickfixtest:ActsRevokeQuickFixApp", diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/AppScope/app.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..d5c37411590114136d299ee304866341f245bf20 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.myapplication", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d71e5ead1ce20b4ac3384d18e6d104f1ea4d83b4 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + } + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/BUILD.gn b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..62967fa655a55a999c9aa0c9a9475a1044ab834a --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsNFCSelectTypesTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsnfcselecttypestest_js_assets", + ":actsnfcselecttypestest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsNFCSelectTypesTest" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsnfcselecttypestest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsnfcselecttypestest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsnfcselecttypestest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsnfcselecttypestest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/Test.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..c72c2c6c86587c7e6784997a031ecbf55b63b40a --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/Test.json @@ -0,0 +1,39 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.myapplication", + "module-name": "entry_test", + "shell-timeout": "600000", + "testcase-timeout": 20000 + }, + "kits": [ + { + "test-file-name": [ + "ActsNFCSelectTypesTest.hap", + "ActsNFCSelectTypesTestRelyFirst.hap", + "ActsNFCSelectTypesTestRelyFourth.hap", + "ActsNFCSelectTypesTestRelyMultiAbility.hap", + "ActsNFCSelectTypesTestRelyMultiHapFirst.hap", + "ActsNFCSelectTypesTestRelyMultiHapSecond.hap", + "ActsNFCSelectTypesTestRelyMultiHapThird.hap", + "ActsNFCSelectTypesTestRelySecond.hap", + "ActsNFCSelectTypesTestRelyThird.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "power-shell wakeup", + "power-shell setmode 602", + "hilog -Q pidoff", + "hilog -Q domainoff", + "hilog -b D", + "setenforce 0" + ] + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..7710d5e8c3ef96cf207fcd9ef0e61798b7171e13 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; + +let abilityDelegator = undefined; +let abilityDelegatorArguments = undefined; + +async function onAbilityCreateCallback() { + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + let testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'; + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + let cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName; + let debug = abilityDelegatorArguments.parameters['-D']; + if (debug == 'true') + { + cmd += ' -D' + } + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..16977229351a880918df3f552fd0577ea5070e32 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,583 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import { Driver, ON } from '@ohos.UiTest'; +import commonEvent from '@ohos.commonEventManager'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; + +let ACTS_CrossCallFunction = { + events: ['ACTS_CROSS_CALL_EVENT'] +}; + +const CASE_TIME_OUT = 5000; +let driver = Driver.create(); +const BUNDLE = 'MyApp_'; +const TAG = '[Sample_MyApp]'; +const DOMAIN = 0xF811; +let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + +function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(); + }, time) + }); +} + +export default function abilityTest() { + describe('ActsAppTest', function () { + afterEach(async (done) => { + setTimeout(function () { + console.info('====>afterEach called'); + done(); + }, 1000); + }) + + /* + * @tc.number: ACTS_NFC_SelectTypes_0100 + * @tc.name: NFC supports application selection box display and user click application + * @tc.desc: Set the Want parameter, test the specified Types type, and match the corresponding application + */ + it('ACTS_NFC_SelectTypes_0100', 0, async (done) => { + let want = { + action: 'ohos.nfc.tag.action.TAG_FOUND', + type: '', + parameters: { + 'ohos.ability.params.uriTypes': [ + 'tag-tech/NFcA', + 'tag-tech/IsoDep' + ] + } + }; + globalThis.abilitycontext.startAbility( + want, (err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('startAbility succeed'); + } + ); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text("apptest1")); + await driver.assertComponentExist(ON.text("apptest2")); + await driver.assertComponentExist(ON.text("apptest3")); + let app4 = await driver.findComponent(ON.text("apptest4")); + expect(app4 === null).assertTrue(); + let cancel = await driver.findComponent(ON.text("取消")); + await cancel.click(); + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0100 end'); + done(); + }) + + + + /* + * @tc.number: ACTS_NFC_SelectTypes_0200 + * @tc.name: NFC supports application selection box display and user click application + * @tc.desc: Set the Want parameter, test the specified Types type, and match the corresponding application + */ + it('ACTS_NFC_SelectTypes_0200', 0, async (done) => { + let want = { + action: 'ohos.nfc.tag.action.TAG_FOUND', + type: 'tag-tech/NFcA', + parameters: { + 'ohos.ability.params.uriTypes': [ + 'tag-tech/IsoDep' + ] + } + }; + globalThis.abilitycontext.startAbility( + want, (err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('startAbility succeed'); + } + ); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text("apptest2")); + await driver.assertComponentExist(ON.text("apptest3")); + let app1 = await driver.findComponent(ON.text("apptest1")); + expect(app1 === null).assertTrue(); + let app4 = await driver.findComponent(ON.text("apptest4")); + expect(app4 === null).assertTrue(); + let cancel = await driver.findComponent(ON.text("取消")); + await cancel.click(); + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0200 end'); + done(); + }) + + /* + * @tc.number: ACTS_NFC_SelectTypes_0300 + * @tc.name: NFC supports application selection box display and user click application + * @tc.desc: Set the Want parameter, test the specified Types type, and match the corresponding application + */ + it('ACTS_NFC_SelectTypes_0300', 0, async (done) => { + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0300 begin'); + let want = { + action: 'ohos.nfc.tag.action.TAG_FOUND', + type: '', + parameters: { + 'ohos.ability.params.uriTypes': [ + ] + } + }; + globalThis.abilitycontext.startAbility( + want, (err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('startAbility succeed'); + } + ); + await driver.delayMs(1000); + let cancel = await driver.findComponent(ON.text("知道了")); + await cancel.click(); + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0300 end'); + done(); + }) + + /* + * @tc.number: ACTS_NFC_SelectTypes_0400 + * @tc.name: NFC supports application selection box display and user click application + * @tc.desc: Set the Want parameter, test the specified Types type, and match the corresponding application + */ + it('ACTS_NFC_SelectTypes_0400', 0, async (done) => { + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0400 begin'); + let want = { + action: 'ohos.nfc.tag.action.TAG_FOUND', + type: 'tag-tech/NFcA', + parameters: { + 'ohos.ability.params.uriTypes': [ + ] + } + }; + globalThis.abilitycontext.startAbility( + want, (err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`) + return; + } + console.info('startAbility succeed') + } + ); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text("apptest1")); + await driver.assertComponentExist(ON.text("apptest3")); + let app2 = await driver.findComponent(ON.text("apptest2")); + let app4 = await driver.findComponent(ON.text("apptest4")); + expect(app2 === null).assertTrue(); + expect(app4 === null).assertTrue(); + let cancel = await driver.findComponent(ON.text("取消")); + await cancel.click(); + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0400 end'); + done(); + }) + + /* + * @tc.number: ACTS_NFC_SelectTypes_0500 + * @tc.name: NFC supports application selection box display and user click application + * @tc.desc: Set the Want parameter, test the specified Types type, and match the corresponding application + */ + it('ACTS_NFC_SelectTypes_0500', 0, async (done) => { + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0500 begin'); + let want = { + action: 'ohos.nfc.tag.action.TAG', + type: '', + parameters: { + 'ohos.ability.params.uriTypes': [ + 'tag-tech/NFcA', + 'tag-tech/IsoDep' + ] + } + }; + globalThis.abilitycontext.startAbility( + want, (err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('startAbility succeed'); + } + ); + await driver.delayMs(1000); + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0500: apptest1,apptest2,apptest3,apptest4 notExist'); + let app1 = await driver.findComponent(ON.text("apptest1")); + let app2 = await driver.findComponent(ON.text("apptest2")); + let app3 = await driver.findComponent(ON.text("apptest3")); + let app4 = await driver.findComponent(ON.text("apptest4")); + expect(app1 === null).assertTrue(); + expect(app2 === null).assertTrue(); + expect(app3 === null).assertTrue(); + expect(app4 === null).assertTrue(); + let cancel = await driver.findComponent(ON.text("知道了")); + await cancel.click(); + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0500 end'); + done(); + }) + + /* + * @tc.number: ACTS_NFC_SelectTypes_0600 + * @tc.name: NFC supports application selection box display and user click application + * @tc.desc: Set the Want parameter, test the specified Types type, and match the corresponding application + */ + it('ACTS_NFC_SelectTypes_0600', 0, async (done) => { + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0600 begin'); + let want = { + action: 'ohos.nfc.tag.action.TAG', + type: 'tag-tech/NFcA', + parameters: { + 'ohos.ability.params.uriTypes': [ + ] + } + }; + globalThis.abilitycontext.startAbility( + want, (err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('startAbility succeed'); + } + ); + await driver.delayMs(1000); + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0600: apptest1,apptest2,apptest3,apptest4 notExist'); + let app1 = await driver.findComponent(ON.text("apptest1")); + let app2 = await driver.findComponent(ON.text("apptest2")); + let app3 = await driver.findComponent(ON.text("apptest3")); + let app4 = await driver.findComponent(ON.text("apptest4")); + expect(app1 === null).assertTrue(); + expect(app2 === null).assertTrue(); + expect(app3 === null).assertTrue(); + expect(app4 === null).assertTrue(); + let cancel = await driver.findComponent(ON.text("知道了")); + await cancel.click(); + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0600 end'); + done(); + }) + + /* + * @tc.number: ACTS_NFC_SelectTypes_0700 + * @tc.name: NFC supports application selection box display and user click application + * @tc.desc: Set the Want parameter, test the specified Types type, and match the corresponding application + */ + it('ACTS_NFC_SelectTypes_0700', 0, async (done) => { + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0700 begin'); + let want = { + action: 'ohos.nfc.tag.action.TAG_FOUND', + type: 'tag-tech/NFcA', + parameters: { + 'ohos.ability.params.uriTypes': [ + 'tag-tech/MultiAbilityNFCA', + 'tag-tech/MultiAbilityNFCB' + ] + } + }; + globalThis.abilitycontext.startAbility( + want, (err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('startAbility succeed'); + } + ); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text("MulAbFirst")); + await driver.assertComponentExist(ON.text("MulAbSecond")); + let AblityThird = await driver.findComponent(ON.text("MulAbThird")); + expect(AblityThird === null).assertTrue(); + let cancel = await driver.findComponent(ON.text("取消")); + await cancel.click(); + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0700 end'); + done(); + }) + + /* + * @tc.number: ACTS_NFC_SelectTypes_0800 + * @tc.name: NFC supports application selection box display and user click application + * @tc.desc: Set the Want parameter, test the specified Types type, and match the corresponding application + */ + it('ACTS_NFC_SelectTypes_0800' ,0, async (done) => { + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0800 begin'); + let want = { + action: 'ohos.nfc.tag.action.TAG_FOUND', + type:'tag-tech/NFcA', + parameters: { + 'ohos.ability.params.uriTypes': [ + 'tag-tech/MultiHapNFCA', + 'tag-tech/MultiHapNFCB' + ] + } + }; + globalThis.abilitycontext.startAbility( + want,(err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('startAbility succeed'); + } + ); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text("MulHapFirst")); + console.info('startAbility MulHapFirst exist'); + await driver.assertComponentExist(ON.text("MulHapSecond")); + console.info('startAbility MulHapSecond exist'); + let HapThird = await driver.findComponent(ON.text("MulHapThird")); + expect(HapThird === null).assertTrue(); + let cancel = await driver.findComponent(ON.text("取消")); + await cancel.click(); + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0800 end'); + done(); + }) + + /* + * @tc.number: ACTS_NFC_SelectTypes_0900 + * @tc.name: NFC supports application selection box display and user click application + * @tc.desc: Set the Want parameter, test the specified Types type, and match the corresponding application + */ + it('ACTS_NFC_SelectTypes_0900', 0, async (done) => { + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0900 begin'); + let want = { + action: 'ohos.want.action.select', + type: 'tag-tech/NFcA', + parameters: { + 'ohos.ability.params.uriTypes': [ + 'tag-tech/NFcA', + 'tag-tech/IsoDep' + ] + } + }; + globalThis.abilitycontext.startAbility( + want, (err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('startAbility succeed'); + } + ); + await driver.delayMs(1000); + let app1 = await driver.findComponent(ON.text("apptest1")); + let app2 = await driver.findComponent(ON.text("apptest2")); + let app3 = await driver.findComponent(ON.text("apptest3")); + let app4 = await driver.findComponent(ON.text("apptest4")); + expect(app1 === null).assertTrue(); + expect(app2 === null).assertTrue(); + expect(app3 === null).assertTrue(); + expect(app4 === null).assertTrue(); + let cancel = await driver.findComponents(ON.clickable(true)); + await cancel[0].click(); + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_0900 end'); + done(); + }) + + /* + * @tc.number: ACTS_NFC_SelectTypes_1000 + * @tc.name: NFC supports application selection box display and user click application + * @tc.desc: Set the Want parameter, test the specified Types type, and match the corresponding application + */ + it('ACTS_NFC_SelectTypes_1000', 0, async (done) => { + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_1000 begin'); + let want = { + action: 'ohos.nfc.tag.action.TAG_FOUND', + type: '', + parameters: { + 'ohos.ability.params.uriTypes': [ + 'tag-tech/Single' + ] + } + }; + let subscriber; + commonEvent.createSubscriber(ACTS_CrossCallFunction).then(async (data) => { + subscriber = data; + commonEvent.subscribe(subscriber, subscribeCallBack); + globalThis.abilitycontext.startAbility( + want, (err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('startAbility succeed'); + } + ); + + }); + function subscribeCallBack(err, data) { + console.info('====>ACTS_NFC_SelectTypes_1000 subscribeCallBack data:' + JSON.stringify(data)); + if (data.event === 'ACTS_CROSS_CALL_EVENT') { + expect(data.parameters.message === 'select').assertTrue(); + commonEvent.unsubscribe(subscriber, async () => { + console.info('====>ACTS_NFC_SelectTypes_1200 unSubscribeCallback kill'); + let cmdkill = 'pkill -f com.example.mytest4'; + await abilityDelegator.executeShellCommand(cmdkill); + await driver.delayMs(1000); + done(); + }) + } + } + setTimeout(() => { + }, CASE_TIME_OUT); + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_1000 end'); + }) + + /* + * @tc.number: ACTS_NFC_SelectTypes_1100 + * @tc.name: NFC supports application selection box display and user click application + * @tc.desc: Set the Want parameter, test the specified Types type, and match the corresponding application + */ + it('ACTS_NFC_SelectTypes_1100', 0, async (done) => { + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_1100 begin'); + let want = { + action: 'ohos.nfc.tag.action.TAG_FOUND', + type: 'tag-tech/Single', + parameters: { + 'ohos.ability.params.uriTypes': [ + ] + } + }; + let subscriber; + commonEvent.createSubscriber(ACTS_CrossCallFunction).then(async (data) => { + subscriber = data; + commonEvent.subscribe(subscriber, subscribeCallBack); + globalThis.abilitycontext.startAbility( + want, (err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('startAbility succeed'); + } + ); + }) + function subscribeCallBack(err, data) { + console.info('====>ACTS_NFC_SelectTypes_1100 subscribeCallBack data:' + JSON.stringify(data)); + if (data.event === 'ACTS_CROSS_CALL_EVENT') { + expect(data.parameters.message === 'select').assertTrue(); + commonEvent.unsubscribe(subscriber, async () => { + console.info('====>ACTS_NFC_SelectTypes_1100 unSubscribeCallback kill'); + let cmdkill = 'pkill -f com.example.mytest4'; + await abilityDelegator.executeShellCommand(cmdkill); + await driver.delayMs(1000); + done(); + }) + } + } + setTimeout(() => { + }, CASE_TIME_OUT); + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_1100 end'); + }) + + /* + * @tc.number: ACTS_NFC_SelectTypes_1200 + * @tc.name: NFC supports application selection box display and user click application + * @tc.desc: Set the Want parameter, test the specified Types type, and match the corresponding application + */ + it('ACTS_NFC_SelectTypes_1200',0, async function (done) { + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_1200 begin'); + let want = { + action: "ohos.nfc.tag.action.TAG_FOUND", + type: '', + parameters: { + 'ohos.ability.params.uriTypes': [ + 'tag-tech/NFCstandard' + ] + } + }; + globalThis.abilitycontext.startAbility( + want, (err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + expect(true).assertFalse(); + return; + } + console.info('startAbility succeed'); + expect(true).assertTrue() + }); + await sleep(1000); + setTimeout(()=> { + abilityDelegator.executeShellCommand('pkill -f com.example.mytest4').then(data => { + console.log('pkill -f successful ' + JSON.stringify(data)) + }).catch(err => { + console.log('pkill -f err is ' + JSON.stringify(err)) + }); + },1000) + await sleep(1000); + setTimeout(()=> { + globalThis.abilitycontext.startAbility( + want, (err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + expect(true).assertFalse(); + } + console.info('startAbility succeed'); + expect(true).assertTrue() + }); + },1000) + done(); + }) + + /* + * @tc.number: ACTS_NFC_SelectTypes_1300 + * @tc.name: NFC supports application selection box display and user click application + * @tc.desc: Set the Want parameter, test the specified Types type, and match the corresponding application + */ + it('ACTS_NFC_SelectTypes_1300',0, async function (done) { + hilog.info(DOMAIN, TAG, '%{public}s', 'ACTS_NFC_SelectTypes_1300 begin'); + let want = { + action: "ohos.nfc.tag.action.TAG_FOUND", + type: '', + parameters: { + 'ohos.ability.params.uriTypes': [ + 'tag-tech/Single' + ] + } + }; + globalThis.abilitycontext.startAbility( + want, (err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + expect(true).assertFalse(); + return; + } + console.info('startAbility succeed'); + expect(true).assertTrue() + }); + setTimeout(()=> { + abilityDelegator.executeShellCommand('pkill -f com.example.mytest4').then(data => { + console.log('pkill -f successful ' + JSON.stringify(data)) + }).catch(err => { + console.log('pkill -f err is ' + JSON.stringify(err)) + }); + },1000) + globalThis.abilitycontext.startAbility( + want, (err) => { + if (err.code) { + console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + expect(true).assertFalse(); + } + console.info('startAbility succeed'); + expect(true).assertTrue() + }); + done(); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f133cdf57d2447ffd6d0adf3f0fefb11d8b87eed --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import abilityTest from './Ability.test'; + +export default function testsuite() { + abilityTest(); +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/testability/TestAbility.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/testability/TestAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..35d86ea4e2d97eae1dd4a11a760010f2777b9da6 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/testability/TestAbility.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import hilog from '@ohos.hilog'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import window from '@ohos.window'; + +export default class TestAbility extends UIAbility { + onCreate(want, launchParam) { + globalThis.abilitycontext = this.context; + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); + let abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + let abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('testability/pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/testability/pages/Index.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/testability/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..bc6b6a57c4013cc9ceb421eeee170bc2bc021ff4 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/ets/testability/pages/Index.ets @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import hilog from '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + + @State message: string = 'Hello World'; + + 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/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/module.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..e132e8898e90b467d3e64061441ab7cdd09e30be --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/module.json @@ -0,0 +1,36 @@ +{ + "module": { + "name": "entry_test", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "TestAbility", + "srcEntry": "./ets/testability/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "exported": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d295c42e484600113a39b1f0f9d2c2b87b04cfb9 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "ActsAppTest" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/resources/base/profile/test_pages.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..b7e7343cacb32ce982a45e76daad86e435e054fe --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/entry/src/main/resources/base/profile/test_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "testability/pages/Index" + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..1dc131a566d75f35b7f6eac286081805bec7fcba Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/AppScope/app.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..193a784352c6585a07dbfea04f6c2c587c7b64d8 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.mytest5", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..604f15761f8f1de7c41bc55eb0924804e3a3d419 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Mytest5" + } + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/BUILD.gn b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0a83cbf0d1c3ff23dae8f25943c1c2ec9f6f0958 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsNFCSelectTypesTestRelyFifth") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsnfcselecttypestestrelyfifth_js_assets", + ":actsnfcselecttypestestrelyfifth_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsNFCSelectTypesTestRelyFifth" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsnfcselecttypestestrelyfifth_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsnfcselecttypestestrelyfifth_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsnfcselecttypestestrelyfifth_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsnfcselecttypestestrelyfifth_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/ets/entryability/EntryAbility.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/ets/entryability/EntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..39e64d65bef0a920947e5fa217794c22e20e72dc --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/ets/entryability/EntryAbility.ts @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; +import commonEvent from '@ohos.commonEventManager'; + +let message; +let commonEventData = { + parameters:{ + message:message, + } +}; +let timeout = 50; + +export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Abilitytest4 onCreate'); + globalThis.terminate = () => { + setTimeout(() => { + this.context.terminateSelf().then(() => { + console.info('====>EntryAbility terminateSelf end'); + }).catch((err) => { + console.info('====>EntryAbility terminateSelf err:' + JSON.stringify(err)); + }); + }, timeout); + }; + console.info('Ability4 onCreate' + JSON.stringify(want)); + let actionStr = want.action; + if (actionStr === 'ohos.nfc.tag.action.TAG_FOUND') { + hilog.info(0x0000, 'testTag', '%{public}s', 'a4Ability ok'); + commonEventData.parameters.message = 'select'; + commonEvent.publish('ACTS_CROSS_CALL_EVENT', commonEventData, (err) => { + console.info('====>' + actionStr + ' apublish err:' + JSON.stringify(err)); + globalThis.terminate(); + }); + } + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability4 onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability4 onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability4 onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability4 onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability4 onBackground'); + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/ets/pages/Index.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ad7ec009d021f1ebecb5a816a69e3c80cf654b63 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/module.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..dacfc42e8591c0c88ee0acf654a4038460fe6cb2 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/module.json @@ -0,0 +1,43 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "launchType": "standard", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home", + "ohos.nfc.tag.action.TAG_FOUND" + ], + "uris": [ + { + "type":"tag-tech/NFCstandard" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..d66f9a7d4ac61fb8d215239ab3620b7bcd77bf33 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/en_US/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..07ac05298e03be044ae93e1d037ece1e4df2fa54 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "apptest4" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/zh_CN/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..5d67609cb8ea7cdcdd75d5f148eae5a5a15239f0 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "apptest4" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/signature/openharmony_sx.p7b b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66524753d49d4017fdf9c6fcb4d1fdf18bcfe33c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFifth/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/AppScope/app.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..16fda09df53b080dd6b30627f549341eaf35b17a --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.mytest1", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..567cc32a0468ee9d1892a252b78f7edc5e5a45c3 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Mytest1" + } + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/BUILD.gn b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..2d16044ca8ef54d504d6597a5b105ca4bb85474f --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsNFCSelectTypesTestRelyFirst") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsnfcselecttypestestrelyfirst_js_assets", + ":actsnfcselecttypestestrelyfirst_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsNFCSelectTypesTestRelyFirst" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsnfcselecttypestestrelyfirst_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsnfcselecttypestestrelyfirst_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsnfcselecttypestestrelyfirst_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsnfcselecttypestestrelyfirst_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/ets/entryability/EntryAbility.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/ets/entryability/EntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..202b948c9ed4dd76c512c9225e676899cb8907b8 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/ets/entryability/EntryAbility.ts @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; + +export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/ets/pages/Index.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f954a9d8d496fba8c3068910fc79482811f9986a --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'test1' + + 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/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/module.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..917e2a137b0bc40fa4d02fc18a58ce76d41f9a0a --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home", + "ohos.nfc.tag.action.TAG_FOUND" + ], + "uris": [ + { + "type":"tag-tech/NFcA" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..d66f9a7d4ac61fb8d215239ab3620b7bcd77bf33 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/en_US/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..3eef37e5a3a3f290114bec65ea74a6dbf307a43b --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "apptest1" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/zh_CN/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c9613d6764484608a211a1b92d4ba31107f9dfff --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "apptest1" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/signature/openharmony_sx.p7b b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..938a9848c102e1e47477b7a19011302cc7e129be Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFirst/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/AppScope/app.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c6d0f6900d1ca48c2760aac5ee0bf674b08096e7 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.mytest4", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c59de3ade2e7311ee33b0a96e728f71d1daf9f53 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Mytest4" + } + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/BUILD.gn b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..66e6a253457e8fe97bca194d638750b72d7e55cc --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsNFCSelectTypesTestRelyFourth") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsnfcselecttypestestrelyfourth_js_assets", + ":actsnfcselecttypestestrelyfourth_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsNFCSelectTypesTestRelyFourth" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsnfcselecttypestestrelyfourth_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsnfcselecttypestestrelyfourth_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsnfcselecttypestestrelyfourth_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsnfcselecttypestestrelyfourth_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/ets/entryability/EntryAbility.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/ets/entryability/EntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..39e64d65bef0a920947e5fa217794c22e20e72dc --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/ets/entryability/EntryAbility.ts @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; +import commonEvent from '@ohos.commonEventManager'; + +let message; +let commonEventData = { + parameters:{ + message:message, + } +}; +let timeout = 50; + +export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Abilitytest4 onCreate'); + globalThis.terminate = () => { + setTimeout(() => { + this.context.terminateSelf().then(() => { + console.info('====>EntryAbility terminateSelf end'); + }).catch((err) => { + console.info('====>EntryAbility terminateSelf err:' + JSON.stringify(err)); + }); + }, timeout); + }; + console.info('Ability4 onCreate' + JSON.stringify(want)); + let actionStr = want.action; + if (actionStr === 'ohos.nfc.tag.action.TAG_FOUND') { + hilog.info(0x0000, 'testTag', '%{public}s', 'a4Ability ok'); + commonEventData.parameters.message = 'select'; + commonEvent.publish('ACTS_CROSS_CALL_EVENT', commonEventData, (err) => { + console.info('====>' + actionStr + ' apublish err:' + JSON.stringify(err)); + globalThis.terminate(); + }); + } + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability4 onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability4 onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability4 onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability4 onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability4 onBackground'); + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/ets/pages/Index.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ad7ec009d021f1ebecb5a816a69e3c80cf654b63 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/module.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..1c034777131bebe61725b2da19023496a656912a --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home", + "ohos.nfc.tag.action.TAG_FOUND" + ], + "uris": [ + { + "type":"tag-tech/Single" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..d66f9a7d4ac61fb8d215239ab3620b7bcd77bf33 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/en_US/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..07ac05298e03be044ae93e1d037ece1e4df2fa54 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "apptest4" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/zh_CN/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..5d67609cb8ea7cdcdd75d5f148eae5a5a15239f0 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "apptest4" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/signature/openharmony_sx.p7b b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66524753d49d4017fdf9c6fcb4d1fdf18bcfe33c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyFourth/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/AppScope/app.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..83add15d48e4e61c41ad02bab7f5c28704cf87e9 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.multiabilitys", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6931ee0fe4723150fccf272ef1165402cf978fbb --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MultiAbilitys" + } + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/BUILD.gn b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..18a0e37abdf767f0401baad34b19c858b16ddb5d --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsNFCSelectTypesTestRelyMultiAbility") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsnfcselecttypestestrelymultiability_js_assets", + ":actsnfcselecttypestestrelymultiability_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsNFCSelectTypesTestRelyMultiAbility" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsnfcselecttypestestrelymultiability_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsnfcselecttypestestrelymultiability_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsnfcselecttypestestrelymultiability_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsnfcselecttypestestrelymultiability_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/entryability/EntryAbility.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/entryability/EntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..202b948c9ed4dd76c512c9225e676899cb8907b8 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/entryability/EntryAbility.ts @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; + +export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/fourthentryability/FourthEntryAbility.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/fourthentryability/FourthEntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..4fbc55b3204050efdaeb8370df00057b03d98267 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/fourthentryability/FourthEntryAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import hilog from '@ohos.hilog'; +import Ability from '@ohos.app.ability.UIAbility'; +import Window from '@ohos.window' + +export default class FourthEntryAbility extends Ability { + onCreate(want, launchParam) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); + } + + onDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: Window.WindowStage) { + // Main window is created, set main page for this ability + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/pages/Index.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..e52912b926975c85a31eb3e692e7ccf3d739dc68 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'Hello MulAbility' + + 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/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/secondentryability/SecondEntryAbility.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/secondentryability/SecondEntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..e2542bc9a5655c405c33d1c3756df639c99b2409 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/secondentryability/SecondEntryAbility.ts @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; + +export default class SecondEntryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/thirdentryability/ThirdEntryAbility.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/thirdentryability/ThirdEntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..eaf93a2b13f5046b865c2575d171ac8a0b5016f5 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/ets/thirdentryability/ThirdEntryAbility.ts @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; + +export default class ThirdEntryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/module.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..44e597d4378f38864656f6fe335cd5cb50245cf0 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/module.json @@ -0,0 +1,111 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home", + "ohos.nfc.tag.action.TAG_FOUND" + ], + "uris": [ + { + "type": "tag-tech/MultiAbilityNFCA" + } + ] + } + ] + }, + { + "name": "SecondEntryAbility", + "srcEntry": "./ets/secondentryability/SecondEntryAbility.ts", + "description": "$string:SecondEntryAbility_desc", + "icon": "$media:icon", + "label": "$string:SecondEntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "actions": [ + "action.system.home", + "ohos.nfc.tag.action.TAG_FOUND" + ], + "uris": [ + { + "type": "tag-tech/MultiAbilityNFCB" + } + ] + } + ] + }, + { + "name": "ThirdEntryAbility", + "srcEntry": "./ets/thirdentryability/ThirdEntryAbility.ts", + "description": "$string:ThirdEntryAbility_desc", + "icon": "$media:icon", + "label": "$string:ThirdEntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "actions": [ + "action.system.home", + "ohos.nfc.tag.action.TAG_FOUND" + ], + "uris": [ + { + "type": "tag-tech/MultiAbilityNFCC" + } + ] + } + ] + }, + { + "name": "FourthEntryAbility", + "srcEntry": "./ets/fourthentryability/FourthEntryAbility.ts", + "description": "$string:FourthEntryAbility_desc", + "icon": "$media:icon", + "label": "$string:FourthEntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "actions": [ + "action.system.home", + "ohos.nfc.tag.action.TAG_FOUND" + ], + "uris": [ + { + "type": "tag-tech/MultiAbilityNFCC" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..d66f9a7d4ac61fb8d215239ab3620b7bcd77bf33 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d9f3a19508767086281d8c606e362cff87d24af1 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + }, + { + "name": "SecondEntryAbility_desc", + "value": "description" + }, + { + "name": "SecondEntryAbility_label", + "value": "label" + }, + { + "name": "ThirdEntryAbility_desc", + "value": "description" + }, + { + "name": "ThirdEntryAbility_label", + "value": "label" + }, + { + "name": "FourthEntryAbility_desc", + "value": "description" + }, + { + "name": "FourthEntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/en_US/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..42786cc5af1b362e51dc8212fa7ce1aa837b07ba --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "MulAbFirst" + }, + { + "name": "SecondEntryAbility_desc", + "value": "description" + }, + { + "name": "SecondEntryAbility_label", + "value": "MulAbSecond" + }, + { + "name": "ThirdEntryAbility_desc", + "value": "description" + }, + { + "name": "ThirdEntryAbility_label", + "value": "MulAbThird" + }, + { + "name": "FourthEntryAbility_desc", + "value": "description" + }, + { + "name": "FourthEntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/zh_CN/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..95018a8e4df1df0ed648072ecd7efa2af91bc2a0 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "MulAbFirst" + }, + { + "name": "SecondEntryAbility_desc", + "value": "description" + }, + { + "name": "SecondEntryAbility_label", + "value": "MulAbSecond" + }, + { + "name": "ThirdEntryAbility_desc", + "value": "description" + }, + { + "name": "ThirdEntryAbility_label", + "value": "MulAbThird" + }, + { + "name": "FourthEntryAbility_desc", + "value": "description" + }, + { + "name": "FourthEntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/signature/openharmony_sx.p7b b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..ef25970bda75407c7e5b8493aa6a6b80ee22f464 Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiAbility/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/AppScope/app.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..7e4e3463ed84c612f1cc5c55175753485643650a --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.multihaps", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8cdf7170c7d40f69be0cea6ce71182a57209a67b --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MultiHaps" + } + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/BUILD.gn b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..58c3bdffdb432ff2f0a5a20e165589a46dd884e0 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsNFCSelectTypesTestRelyMultiHapFirst") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsnfcselecttypestestrelymultihapfirst_js_assets", + ":actsnfcselecttypestestrelymultihapfirst_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsNFCSelectTypesTestRelyMultiHapFirst" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsnfcselecttypestestrelymultihapfirst_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsnfcselecttypestestrelymultihapfirst_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsnfcselecttypestestrelymultihapfirst_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsnfcselecttypestestrelymultihapfirst_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/ets/entryability/EntryAbility.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/ets/entryability/EntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..202b948c9ed4dd76c512c9225e676899cb8907b8 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/ets/entryability/EntryAbility.ts @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; + +export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/ets/pages/Index.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9386d5348574bd9ff1a80423193c480011b1dab6 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'Hello MulHapFirst' + + 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/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/module.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..6888d6783961159ce94f91b4963f4af066c19497 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home", + "ohos.nfc.tag.action.TAG_FOUND" + ], + "uris": [ + { + "type":"tag-tech/MultiHapNFCA" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..d66f9a7d4ac61fb8d215239ab3620b7bcd77bf33 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/en_US/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..e268fb48d6543842b8f47dc852d321dd458817e5 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "MulHapFirst" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/zh_CN/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1e7357bb0cac441a65850328439b60885f205b4f --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "MulHapFirst" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/signature/openharmony_sx.p7b b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..6e5f0ced58b02ae5698ac6e02419d1ee459b1b5d Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFirst/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/AppScope/app.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..7e4e3463ed84c612f1cc5c55175753485643650a --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.multihaps", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8cdf7170c7d40f69be0cea6ce71182a57209a67b --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MultiHaps" + } + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/BUILD.gn b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d3c3471129bc6ae34d0d117058bebb0090eb9945 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsNFCSelectTypesTestRelyMultiHapFourth") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsnfcselecttypestestrelymultihapfourth_js_assets", + ":actsnfcselecttypestestrelymultihapfourth_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsNFCSelectTypesTestRelyMultiHapFourth" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsnfcselecttypestestrelymultihapfourth_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsnfcselecttypestestrelymultihapfourth_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsnfcselecttypestestrelymultihapfourth_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsnfcselecttypestestrelymultihapfourth_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/ets/fourthentryability/FourthentryAbility.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/ets/fourthentryability/FourthentryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..8909824a90e251bc17deb6100fe9ed5c615eca24 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/ets/fourthentryability/FourthentryAbility.ts @@ -0,0 +1,51 @@ +import hilog from '@ohos.hilog'; +import UIAbility from '@ohos.app.ability.UIAbility'; +import Window from '@ohos.window' + +export default class FourthentryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); + } + + onDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: Window.WindowStage) { + // Main window is created, set main page for this ability + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/ets/pages/Index.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..d6ca48cf43988cd6f270a026f0c1a88b7bc57123 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,17 @@ +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/module.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..35f951e851e94a3f2015b494cc4c1c5d422b7be7 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/module.json @@ -0,0 +1,40 @@ +{ + "module": { + "name": "Fourthentry", + "type": "feature", + "description": "$string:module_desc", + "mainElement": "FourthentryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "FourthentryAbility", + "srcEntry": "./ets/fourthentryability/FourthentryAbility.ts", + "description": "$string:FourthentryAbility_desc", + "icon": "$media:icon", + "label": "$string:FourthentryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "visible": true, + "exported": true, + "skills": [ + { + "actions": [ + "action.system.home", + "ohos.nfc.tag.action.TAG_FOUND" + ], + "uris": [ + { + "type":"tag-tech/MultiHapNFCB" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..d66f9a7d4ac61fb8d215239ab3620b7bcd77bf33 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..898afd4658d27baa44a66f60989361e3452f7ce5 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "FourthentryAbility_desc", + "value": "description" + }, + { + "name": "FourthentryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/en_US/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..898afd4658d27baa44a66f60989361e3452f7ce5 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "FourthentryAbility_desc", + "value": "description" + }, + { + "name": "FourthentryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/zh_CN/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d9a4b4c53ed6681e9c449be8903ce3bc141ab490 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "FourthentryAbility_desc", + "value": "description" + }, + { + "name": "FourthentryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/signature/openharmony_sx.p7b b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..6e5f0ced58b02ae5698ac6e02419d1ee459b1b5d Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapFourth/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/AppScope/app.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..7e4e3463ed84c612f1cc5c55175753485643650a --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.multihaps", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8cdf7170c7d40f69be0cea6ce71182a57209a67b --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MultiHaps" + } + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/BUILD.gn b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3932077ad14b51a89d31c0b3e2bcb63872acd3a3 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsNFCSelectTypesTestRelyMultiHapSecond") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsnfcselecttypestestrelymultihapsecond_js_assets", + ":actsnfcselecttypestestrelymultihapsecond_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsNFCSelectTypesTestRelyMultiHapSecond" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsnfcselecttypestestrelymultihapsecond_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsnfcselecttypestestrelymultihapsecond_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsnfcselecttypestestrelymultihapsecond_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsnfcselecttypestestrelymultihapsecond_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/ets/pages/Index.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c786bd042b23940234c9c8eb0de4e917c9ed4618 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello MulHapSecond' + + 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/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/ets/secondentryability/SecondentryAbility.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/ets/secondentryability/SecondentryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..f9cda4c0ad43f0a8d7b434320189f21161692931 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/ets/secondentryability/SecondentryAbility.ts @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; + +export default class SecondentryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/module.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..811127aa78c29269452b36f5661cb674305b0177 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/module.json @@ -0,0 +1,39 @@ +{ + "module": { + "name": "Secondentry", + "type": "feature", + "description": "$string:module_desc", + "mainElement": "SecondentryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "SecondentryAbility", + "srcEntry": "./ets/secondentryability/SecondentryAbility.ts", + "description": "$string:SecondentryAbility_desc", + "icon": "$media:icon", + "label": "$string:SecondentryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "actions": [ + "action.system.home", + "ohos.nfc.tag.action.TAG_FOUND" + ], + "uris": [ + { + "type":"tag-tech/MultiHapNFCB" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..d66f9a7d4ac61fb8d215239ab3620b7bcd77bf33 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..62559a0094dd1c263497ba633fff985a5dc1e070 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "SecondentryAbility_desc", + "value": "description" + }, + { + "name": "SecondentryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/en_US/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bbdfe3fc5edee997395abc3387e92bcb860529f0 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "SecondentryAbility_desc", + "value": "description" + }, + { + "name": "SecondentryAbility_label", + "value": "MulHapSecond" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/zh_CN/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..59719e4feebbbd73f5e8ce082aa5bd5687d7e47a --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "SecondentryAbility_desc", + "value": "description" + }, + { + "name": "SecondentryAbility_label", + "value": "MulHapSecond" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/signature/openharmony_sx.p7b b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..86a40cfcf019ee37a22b9d539d0da0dab35edb1a Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapSecond/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/AppScope/app.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..7e4e3463ed84c612f1cc5c55175753485643650a --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.multihaps", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8cdf7170c7d40f69be0cea6ce71182a57209a67b --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MultiHaps" + } + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/BUILD.gn b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..43e0118cfae874296dd8618e3bf4e74c9573e0f8 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsNFCSelectTypesTestRelyMultiHapThird") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsnfcselecttypestestrelymultihapthird_js_assets", + ":actsnfcselecttypestestrelymultihapthird_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsNFCSelectTypesTestRelyMultiHapThird" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsnfcselecttypestestrelymultihapthird_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsnfcselecttypestestrelymultihapthird_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsnfcselecttypestestrelymultihapthird_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsnfcselecttypestestrelymultihapthird_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/ets/pages/Index.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..da031ffb24706dc11de5a8edc0118bbfc1ed9856 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello MulHapThird' + + 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/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/ets/thirdentryability/ThirdentryAbility.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/ets/thirdentryability/ThirdentryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..8021c7c9bd7cf96571d9da490a74c21ae8eab7aa --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/ets/thirdentryability/ThirdentryAbility.ts @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; + +export default class ThirdentryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/module.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..09308dc4aa4b8a35a3d98531009887d966953dfe --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/module.json @@ -0,0 +1,39 @@ +{ + "module": { + "name": "Thirdentry", + "type": "feature", + "description": "$string:module_desc", + "mainElement": "ThirdentryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "ThirdentryAbility", + "srcEntry": "./ets/thirdentryability/ThirdentryAbility.ts", + "description": "$string:ThirdentryAbility_desc", + "icon": "$media:icon", + "label": "$string:ThirdentryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "actions": [ + "action.system.home", + "ohos.nfc.tag.action.TAG_FOUND" + ], + "uris": [ + { + "type":"tag-tech/MultiHapNFCC" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..d66f9a7d4ac61fb8d215239ab3620b7bcd77bf33 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..33c96b4dc574344998576c03e86c675aad602bc8 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "ThirdentryAbility_desc", + "value": "description" + }, + { + "name": "ThirdentryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/en_US/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2b36308214276159102252cf46573c9e9a72451d --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "ThirdentryAbility_desc", + "value": "description" + }, + { + "name": "ThirdentryAbility_label", + "value": "MulHapThird" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/zh_CN/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bddcc354d64f649cbd2b9cbe78477c467c6b4ca4 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "ThirdentryAbility_desc", + "value": "description" + }, + { + "name": "ThirdentryAbility_label", + "value": "MulHapThird" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/signature/openharmony_sx.p7b b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..36400bb7143d0d04c1941d0a7785758140d47578 Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyMultiHapThird/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/AppScope/app.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..8bcb807a72a267633ff03080262a2e82f1e725d4 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.mytest2", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..200d717f68e1a1b9fa98cdd996870ef664989faa --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Mytest2" + } + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/BUILD.gn b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f9100bc15522fbb2cb1e04315ce29df5d72c169d --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsNFCSelectTypesTestRelySecond") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsnfcselecttypestestrelysecond_js_assets", + ":actsnfcselecttypestestrelysecond_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsNFCSelectTypesTestRelySecond" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsnfcselecttypestestrelysecond_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsnfcselecttypestestrelysecond_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsnfcselecttypestestrelysecond_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsnfcselecttypestestrelysecond_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/ets/entryability/EntryAbility.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/ets/entryability/EntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..202b948c9ed4dd76c512c9225e676899cb8907b8 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/ets/entryability/EntryAbility.ts @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; + +export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/ets/pages/Index.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..a3ce661754c5517c89b8c1b85024c40b9db33aa6 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'test2' + + 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/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/module.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..021bf9c0aefb068609a1057fc5d889f5ba366465 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home", + "ohos.nfc.tag.action.TAG_FOUND" + ], + "uris": [ + { + "type":"tag-tech/IsoDep" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..d66f9a7d4ac61fb8d215239ab3620b7bcd77bf33 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/en_US/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..3c07b7c9e91b4a2e52bc8a416be6b0c29c9555c5 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "apptest2" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/zh_CN/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1f8ec2552b8584ebcdff40bd69da83a8f6021cf4 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "apptest2" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/signature/openharmony_sx.p7b b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..a5ddfb9a7e1767e11d07e1ad584d137dd89b9ea1 Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelySecond/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/AppScope/app.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..3827f18acc33d43e733eabfab4a7f73ae7870fd3 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/AppScope/app.json @@ -0,0 +1,18 @@ +{ + "app": { + "bundleName": "com.example.zhangyuenfcrely", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0c9dee9771ebe227e49677e722a8531e0560caf5 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "zhangyueNFCRely" + } + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/BUILD.gn b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..cc33abac628946a62cd8da043df84db88452b084 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsNFCSelectTypesTestRelyStandardAndSingleton") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsnfcselecttypestestrelystandardandsingleton_js_assets", + ":actsnfcselecttypestestrelystandardandsingleton_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsNFCSelectTypesTestRelyStandardAndSingleton" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsnfcselecttypestestrelystandardandsingleton_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsnfcselecttypestestrelystandardandsingleton_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsnfcselecttypestestrelystandardandsingleton_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsnfcselecttypestestrelystandardandsingleton_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/ets/entryability/EntryAbility.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/ets/entryability/EntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..57686050fee56d4ca2b7d073531f6a187cf0a95e --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/ets/entryability/EntryAbility.ts @@ -0,0 +1,51 @@ +import hilog from '@ohos.hilog'; +import Ability from '@ohos.app.ability.UIAbility' +import Window from '@ohos.window' + +export default class EntryAbility extends Ability { + onCreate(want, launchParam) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); + } + + onDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: Window.WindowStage) { + // Main window is created, set main page for this ability + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/ets/pages/Index.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..d6ca48cf43988cd6f270a026f0c1a88b7bc57123 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,17 @@ +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/module.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..e820aacd88df13ab87529d659b36690b8c2f8a57 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/module.json @@ -0,0 +1,45 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "launchType": "standard", + "visible": true, + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home", + "ohos.nfc.tag.action.TAG_STANDARD" + ], + "uris": [ + { + "type": "tag-tech/NFCA" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..d66f9a7d4ac61fb8d215239ab3620b7bcd77bf33 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bac9e2ecf71541cac36d1d5331341d26f94604aa --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + }, + { + "name": "EntryAbility1_desc", + "value": "description" + }, + { + "name": "EntryAbility1_label", + "value": "label" + }, + { + "name": "EntryAbility2_desc", + "value": "description" + }, + { + "name": "EntryAbility2_label", + "value": "label" + }, + { + "name": "EntryAbility3_desc", + "value": "description" + }, + { + "name": "EntryAbility3_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/en_US/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c17abc4768aa297edc1d016766459cc18c29bca4 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "standardTest" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/zh_CN/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..426f404010b6c1a3445fc1da023fe27af90e227b --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "standardTest" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/signature/openharmony_sx.p7b b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..98577af5b5dd7e853165347872861074feb817de Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyStandardAndSingleton/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/AppScope/app.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..ab45b0c323b4589479151fb5c65a7d3995c6387e --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.mytest3", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f45cf4f8c7510ea7db13a541e3fe587992d1809b --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Mytest3" + } + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/BUILD.gn b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..7934b54860a25cfc9e83c5559784248c2087f65e --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsNFCSelectTypesTestRelyThird") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsnfcselecttypestestrelythird_js_assets", + ":actsnfcselecttypestestrelythird_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsNFCSelectTypesTestRelyThird" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsnfcselecttypestestrelythird_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsnfcselecttypestestrelythird_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsnfcselecttypestestrelythird_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsnfcselecttypestestrelythird_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/ets/entryability/EntryAbility.ts b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/ets/entryability/EntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..202b948c9ed4dd76c512c9225e676899cb8907b8 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/ets/entryability/EntryAbility.ts @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; + +export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/ets/pages/Index.ets b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ad7ec009d021f1ebecb5a816a69e3c80cf654b63 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/module.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..a0f1c973c4c77054ef348c487a6679c11cff1f13 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/module.json @@ -0,0 +1,45 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home", + "ohos.nfc.tag.action.TAG_FOUND" + ], + "uris": [ + { + "type":"tag-tech/NFcA" + }, + { + "type":"tag-tech/IsoDep" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..d66f9a7d4ac61fb8d215239ab3620b7bcd77bf33 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/en_US/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..cc6409f225e5faa0f46615974c4fe5740039178f --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "apptest3" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/zh_CN/element/string.json b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c529f0654fa6c7ed0bdedd96d6f517504f1c76cd --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "apptest3" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/signature/openharmony_sx.p7b b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..e4832ce055299ddd5783ad5f49c50424fd700db3 Binary files /dev/null and b/ability/ability_runtime/actsnfcselecttypes/ActsNFCSelectTypesTestRelyThird/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsnfcselecttypes/BUILD.gn b/ability/ability_runtime/actsnfcselecttypes/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a710dfff410401e8b9415243c6e0a3aba09065cb --- /dev/null +++ b/ability/ability_runtime/actsnfcselecttypes/BUILD.gn @@ -0,0 +1,33 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +group("actsnfcselecttypes") { + testonly = true + if (is_standard_system) { + deps = [ + "ActsNFCSelectTypesTest:ActsNFCSelectTypesTest", + "ActsNFCSelectTypesTestRelyFirst:ActsNFCSelectTypesTestRelyFirst", + "ActsNFCSelectTypesTestRelyFourth:ActsNFCSelectTypesTestRelyFourth", + "ActsNFCSelectTypesTestRelyMultiAbility:ActsNFCSelectTypesTestRelyMultiAbility", + "ActsNFCSelectTypesTestRelyMultiHapFirst:ActsNFCSelectTypesTestRelyMultiHapFirst", + "ActsNFCSelectTypesTestRelyMultiHapSecond:ActsNFCSelectTypesTestRelyMultiHapSecond", + "ActsNFCSelectTypesTestRelyMultiHapThird:ActsNFCSelectTypesTestRelyMultiHapThird", + "ActsNFCSelectTypesTestRelySecond:ActsNFCSelectTypesTestRelySecond", + "ActsNFCSelectTypesTestRelyThird:ActsNFCSelectTypesTestRelyThird", + "ActsNFCSelectTypesTestRelyMultiHapFourth:ActsNFCSelectTypesTestRelyMultiHapFourth", + "ActsNFCSelectTypesTestRelyFifth:ActsNFCSelectTypesTestRelyFifth", + ] + } +}