提交 6526f79e 编写于 作者: C chengxingzhen

xts签名文件整改

Signed-off-by: Nchengxingzhen <chengxingzhen@huawei.com>
上级 ca41e2a9
......@@ -29,30 +29,13 @@ group("freeinstalltest") {
"connectabilityfatest/connectfamyapplication7:ConnectFaMyApplication7",
"connectabilityfatest/connectfamyapplication8:ConnectFaMyApplication8",
"connectabilityfatest/connectfamyapplication9:ConnectFaMyApplication9",
"connectabilitystagetest/actsfreeinstallconnectabilitystagetest:ActsFreeInstallConnectAbilityStageTest",
"connectabilitystagetest/connectstagemyapplication0:ConnectStageMyApplication0",
"connectabilitystagetest/connectstagemyapplication1:ConnectStageMyApplication1",
"connectabilitystagetest/connectstagemyapplication2:ConnectStageMyApplication2",
"connectabilitystagetest/connectstagemyapplication3:ConnectStageMyApplication3",
"connectabilitystagetest/connectstagemyapplication4:ConnectStageMyApplication4",
"connectabilitystagetest/connectstagemyapplication5:ConnectStageMyApplication5",
"connectabilitystagetest/connectstagemyapplication6:ConnectStageMyApplication6",
"connectabilitystagetest/connectstagemyapplication7:ConnectStageMyApplication7",
"connectabilitystagetest/connectstagemyapplication8:ConnectStageMyApplication8",
"mockservice:MockService",
"mockservicetimeout:MockServiceTimeout",
"startabilityfatest/actsfreeinstallstartabilityfatest:ActsFreeInstallStartAbilityFaTest",
"startabilityfatest/actsstartabilitynotargetbundlelistfatest:ActsStartAbilityNoTargetBundleListFaTest",
"startabilityfatest/atomizationfaentry:AtomizationFaEntry",
"startabilityfatest/atomizationfahm2:AtomizationFaHm2",
"startabilityfatest/atomizationfahm4:AtomizationFaHm4",
"startabilityfatest/famyapplication1:FaMyApplication1",
"startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest:ActsFreeInstallStartAbilityForResultFaTest",
"startabilityforresultfatest/actsstartabilityforresultnotargetfatest:ActsStartAbilityForResultNoTargetFaTest",
"startabilityforresultfatest/atomizationresulta:AtomizationResultA",
"startabilityforresultfatest/atomizationresultfaentry:AtomizationResultFaEntry",
"startabilityforresultfatest/atomizationresultfahm1:AtomizationResultFaHm1",
"startabilityforresultfatest/atomizationresultfahm2:AtomizationResultFaHm2",
"startabilityforresultfatest/faresultmyapplication1:FaResultMyApplication1",
"startabilityforresultstagetest/actsfreeinstallstartabilityforresultstagetest:ActsFreeInstallStartAbilityForResultStageTest",
"startabilityforresultstagetest/actsstartabilityforresultnotargetbundleliststagetest:ActsStartAbilityForResultNoTargetBundleListStageTest",
......
// @ts-nocheck
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......
// @ts-nocheck
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -13,7 +15,7 @@
* limitations under the License.
*/
import { describe, beforeAll, afterEach, it, expect } from "@ohos/hypium"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
import rpc from '@ohos.rpc';
import featureAbility from '@ohos.ability.featureAbility';
import wantConstant from '@ohos.ability.wantConstant'
......@@ -22,9 +24,9 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry
export default function ConnectAbilityTest1() {
let TAG = "";
let Tempassert = "";
let abilityDelegator = undefined
var TAG = "";
var Tempassert = "";
var abilityDelegator = undefined
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time))
......@@ -34,19 +36,17 @@ export default function ConnectAbilityTest1() {
beforeAll(async function (done) {
console.info("FreeInstall_FA_ConnectAbility before all called");
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let cmd = "bm install -p data/test/MockService.hap";
var cmd = "bm install -p data/test/MockService.hap";
console.info("cmd : " + cmd)
console.info(TAG + " abilityDelegator : " + JSON.stringify(abilityDelegator));
abilityDelegator.executeShellCommand(cmd, (err: any, d: any) => {
console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
let cmd1 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry";
var cmd1 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry";
abilityDelegator.executeShellCommand(cmd1, (err: any, d: any) => {
console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
let cmd2 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files";
var cmd2 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files";
abilityDelegator.executeShellCommand(cmd2, (err: any, d: any) => {
console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
done();
......@@ -56,12 +56,11 @@ export default function ConnectAbilityTest1() {
afterEach(async function (done) {
console.info("FreeInstall_FA_ConnectAbility after each called");
Tempassert = ""
if ("FreeInstall_FA_ConnectAbility_2000" === TAG) {
let cmd14 = "bm uninstall -n com.ohos.hag.famanager";
if ("FreeInstall_FA_ConnectAbility_1600" === TAG) {
var cmd14 = "bm uninstall -n com.ohos.hag.famanager";
abilityDelegator.executeShellCommand(cmd14, (err: any, d: any) => {
console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(2000)
}
done();
});
......@@ -116,6 +115,8 @@ export default function ConnectAbilityTest1() {
console.info(msg + "END");
}
/*
* @tc.number FreeInstall_FA_ConnectAbility_1500
* @tc.name The application is not in the foreground,
......@@ -126,12 +127,11 @@ export default function ConnectAbilityTest1() {
it("FreeInstall_FA_ConnectAbility_1500", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1500-------------");
TAG = "FreeInstall_FA_ConnectAbility_1500";
let cmddif = "bm install -p data/test/ConnectDifferentApplication.hap";
var cmddif = "bm install -p data/test/ConnectDifferentApplication.hap";
abilityDelegator.executeShellCommand(cmddif, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(2000)
let str = {
var str = {
"want": {
"bundleName": "com.example.different.hmservice",
"abilityName": "MainAbility",
......@@ -143,18 +143,20 @@ export default function ConnectAbilityTest1() {
}).catch((error) => {
console.error(TAG + " startother failed. Cause: " + JSON.stringify(error));
})
let request15 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication5.ServiceAbility5",
"moduleName": "myapplication5",
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
connectabillity(TAG, request15);
setTimeout(() => {
expect(Tempassert).assertEqual("onFailed");
console.log("------------end FreeInstall_FA_ConnectAbility_1500-------------");
done();
setTimeout(async () => {
var request15 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication5.ServiceAbility5",
"moduleName": "myapplication5",
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
connectabillity(TAG, request15);
setTimeout(() => {
expect(Tempassert).assertEqual("onFailed");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_1500-------------");
done();
});
/*
......@@ -167,12 +169,11 @@ export default function ConnectAbilityTest1() {
it("FreeInstall_FA_ConnectAbility_1600", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1600-------------");
TAG = "FreeInstall_FA_ConnectAbility_1600";
let cmdmyapp4 = "bm install -p data/test/ConnectFaMyApplication4.hap";
var cmdmyapp4 = "bm install -p data/test/ConnectFaMyApplication4.hap";
abilityDelegator.executeShellCommand(cmdmyapp4, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(2000)
let str = {
var str = {
"want": {
"bundleName": "com.example.different.hmservice",
"abilityName": "MainAbility",
......@@ -185,18 +186,20 @@ export default function ConnectAbilityTest1() {
console.error(TAG + " startother failed. Cause: " + JSON.stringify(error));
})
let request16 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication4.ServiceAbility4",
"moduleName": "myapplication4",
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
connectabillity(TAG, request16);
setTimeout(() => {
expect(Tempassert).assertEqual("onConnect");
console.log("------------end FreeInstall_FA_ConnectAbility_1600-------------");
done();
setTimeout(function () {
var request16 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication4.ServiceAbility4",
"moduleName": "myapplication4",
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
connectabillity(TAG, request16);
setTimeout(() => {
expect(Tempassert).assertEqual("onConnect");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_1600-------------");
done();
});
/*
......@@ -208,7 +211,7 @@ export default function ConnectAbilityTest1() {
it("FreeInstall_FA_ConnectAbility_1400", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1400-------------");
TAG = "FreeInstall_FA_ConnectAbility_1400";
let str = {
var str = {
"want": {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication2.MainAbility",
......@@ -221,18 +224,20 @@ export default function ConnectAbilityTest1() {
}).catch((error) => {
console.error(TAG + " startmyapp2 failed. Cause: " + JSON.stringify(error));
})
let request14 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication1.ServiceAbility_feature",
"moduleName": "myapplication3",
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
connectabillity(TAG, request14);
setTimeout(() => {
expect(Tempassert).assertEqual("onFailed");
console.log("------------end FreeInstall_FA_ConnectAbility_1400-------------");
done()
var request14 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication1.ServiceAbility_feature",
"moduleName": "myapplication3",
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
connectabillity(TAG, request14);
setTimeout(async () => {
expect(Tempassert).assertEqual("onFailed");
}, 500);
}, 2000)
done();
console.log("------------end FreeInstall_FA_ConnectAbility_1400-------------");
});
/*
......@@ -244,22 +249,23 @@ export default function ConnectAbilityTest1() {
it("FreeInstall_FA_ConnectAbility_1700", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1700-------------");
TAG = "FreeInstall_FA_ConnectAbility_1700";
let cmddif = "bm install -p data/test/ConnectDifferentApplication.hap";
var cmddif = "bm install -p data/test/ConnectDifferentApplication.hap";
await abilityDelegator.executeShellCommand(cmddif, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(2000)
let request17 = {
"bundleName": "com.example.different.hmservice",
"abilityName": "com.example.different.ServiceAbility",
"moduleName": "entry",
}
connectabillity(TAG, request17);
setTimeout(() => {
expect(Tempassert).assertEqual("onConnect");
console.log("------------end FreeInstall_FA_ConnectAbility_1700-------------");
done();
var request17 = {
"bundleName": "com.example.different.hmservice",
"abilityName": "com.example.different.ServiceAbility",
"moduleName": "entry",
}
connectabillity(TAG, request17);
setTimeout(() => {
expect(Tempassert).assertEqual("onConnect");
}, 500);
}, 2000)
console.log("------------end FreeInstall_FA_ConnectAbility_1700-------------");
done();
});
/*
......@@ -271,18 +277,21 @@ export default function ConnectAbilityTest1() {
it("FreeInstall_FA_ConnectAbility_1800", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1800-------------");
TAG = "FreeInstall_FA_ConnectAbility_1800";
let request18 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication1.ServiceAbility_feature",
"moduleName": "xxxxx",
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
connectabillity(TAG, request18);
setTimeout(() => {
expect(Tempassert).assertEqual("onFailed");
console.log("------------end FreeInstall_FA_ConnectAbility_1800-------------");
done();
setTimeout(async () => {
var request18 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication1.ServiceAbility_feature",
"moduleName": "xxxxx",
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
connectabillity(TAG, request18);
setTimeout(() => {
expect(Tempassert).assertEqual("onFailed");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_1800-------------");
done();
});
/*
......@@ -294,23 +303,25 @@ export default function ConnectAbilityTest1() {
it("FreeInstall_FA_ConnectAbility_1900", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_1900-------------");
TAG = "FreeInstall_FA_ConnectAbility_1900";
let cmdmyapp5 = "cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/" +
var cmdmyapp5 = "cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/" +
"haps/entry/files";
await abilityDelegator.executeShellCommand(cmdmyapp5, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
let request19 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication1.ServiceAbility_feature",
"moduleName": "myapplication3",
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
connectabillity(TAG, request19);
setTimeout(() => {
expect(Tempassert).assertEqual("onFailed");
console.log("------------end FreeInstall_FA_ConnectAbility_1900-------------");
done();
setTimeout(async () => {
var request19 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication1.ServiceAbility_feature",
"moduleName": "myapplication3",
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
connectabillity(TAG, request19);
setTimeout(() => {
expect(Tempassert).assertEqual("onFailed");
}, 500)
}, 2000);
console.log("------------end FreeInstall_FA_ConnectAbility_1900-------------");
done();
});
/*
......@@ -322,27 +333,28 @@ export default function ConnectAbilityTest1() {
it("FreeInstall_FA_ConnectAbility_2000", 0, async function (done) {
console.log("------------start FreeInstall_FA_ConnectAbility_2000-------------");
TAG = "FreeInstall_FA_ConnectAbility_2000";
let cmdmyapp5 = "cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/" +
var cmdmyapp5 = "cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/" +
"haps/entry/files";
abilityDelegator.executeShellCommand(cmdmyapp5, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(1000)
let request20 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication5.ServiceAbility5",
"moduleName": "myapplication5",
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
"parameters": {
"name": 1111, "key1": "value1", "site": "nice to meet you!"
},
}
connectabillity(TAG, request20);
setTimeout(() => {
expect(Tempassert).assertEqual("onConnect");
console.log("------------end FreeInstall_FA_ConnectAbility_2000-------------");
done()
setTimeout(async () => {
var request20 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication5.ServiceAbility5",
"moduleName": "myapplication5",
"flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
"parameters": {
"name": 1111, "key1": "value1", "site": "nice to meet you!"
},
}
connectabillity(TAG, request20);
setTimeout(() => {
expect(Tempassert).assertEqual("onConnect");
}, 500)
}, 4000)
done();
console.log("------------end FreeInstall_FA_ConnectAbility_2000-------------");
});
}
)
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import AbilityStage from "@ohos.app.ability.AbilityStage"
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
......
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ServiceExtensionAbility from "@ohos.application.ServiceExtensionAbility"
import rpc from '@ohos.rpc';
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des)
}
onRemoteRequest(code, data, reply, option) {
console.info('ServiceAbility feature onRemoteRequest');
if (code === 1) {
let op1 = data.readInt();
let op2 = data.readInt();
reply.writeInt(op1 + op2);
console.info('ServiceAbility feature op1:' + op1 + ' op2:' + op2);
}
return true;
}
}
export default class ServiceAbility extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ServiceAbility different onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ServiceAbility different onRequest');
}
onConnect(want) {
console.info('onConnect, want:' + want.abilityName);
console.info('ServiceAbility different onConnect');
console.info('stage_connectAbility connect different success');
return new StubTest("test");
}
onDisconnect(want) {
console.info('onDisconnect, want:' + want.abilityName);
console.info('ServiceAbility different onDisconnect');
}
onReconnect(want) {
console.info('onReconnect, want:' + want.abilityName);
console.info('ServiceAbility different onReconnect');
}
onDestroy() {
console.info('ServiceAbility different onDestroy');
}
};
\ No newline at end of file
......@@ -6,8 +6,8 @@
"description": "$string:entry_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"tablet"
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": true,
......@@ -33,18 +33,6 @@
}
]
}
],
"extensionAbilities": [
{
"name": "com.example.different.ServiceAbility",
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"label": "$string:form_FormAbility_label",
"description": "$string:form_FormAbility_desc",
"type": "service",
"visible": true,
"icon": "$media:icon"
}
]
}
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication.hmservice",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"description": "description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsFreeInstallConnectAbilityStageTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsfreeinstallconnectabilitystagetest_js_assets",
":actsfreeinstallconnectabilitystagetest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsFreeInstallConnectAbilityStageTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsfreeinstallconnectabilitystagetest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsfreeinstallconnectabilitystagetest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsfreeinstallconnectabilitystagetest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsfreeinstallconnectabilitystagetest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for freeinstallconnectabilitystagetest Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.example.myapplication.hmservice",
"module-name": "entry",
"shell-timeout": "600000",
"testcase-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsFreeInstallConnectAbilityStageTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /data/test/"
]
},
{
"type": "PushKit",
"push":[
"MockService.hap -> /data/test/MockService.hap",
"ConnectStageMyApplication0.hap -> /data/test/ConnectStageMyApplication0.hap",
"ConnectStageMyApplication1.hap -> /data/test/ConnectStageMyApplication1.hap",
"ConnectStageMyApplication2.hap -> /data/test/ConnectStageMyApplication2.hap",
"ConnectStageMyApplication3.hap -> /data/test/ConnectStageMyApplication3.hap",
"ConnectStageMyApplication4.hap -> /data/test/ConnectStageMyApplication4.hap",
"ConnectStageMyApplication5.hap -> /data/test/ConnectStageMyApplication5.hap",
"ConnectStageMyApplication6.hap -> /data/test/ConnectStageMyApplication6.hap",
"ConnectStageMyApplication7.hap -> /data/test/ConnectStageMyApplication7.hap",
"ConnectStageMyApplication8.hap -> /data/test/ConnectStageMyApplication8.hap",
"ConnectDifferentApplication.hap -> /data/test/ConnectDifferentApplication.hap"
]
}
]
}
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
import commonEvent from '@ohos.commonEvent';
let publishOptions = {
parameters: {
"assertData": "onconnect"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("Testevent service publish failed " + JSON.stringify(err));
} else {
console.info("Testevent service publish success!!!");
}
}
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context;
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
// commonEvent.publish("test_event",publishOptions,PublishCallBack);
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility2 extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.ability2 = this.context;
windowStage.setUIContent(this.context, "pages/index2", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
setTimeout(function () {
globalThis.ability2.terminateSelf()
.then((data) => {
console.info('[Demo] MainAbility2 terminateself succeeded: ' + data);
}).catch((error) => {
console.error('[Demo] MainAbility2 terminateself failed. Cause: ' + error);
})
}, 3200);
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service publish success!!!");
}
}
export default class ServiceAbility extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service onRequest');
let request = {
'deviceId': '',
'bundleName': 'com.example.myapplication.hmservice',
'abilityName': 'ServiceAbility6',
'moduleName': 'myapplication6',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service onConnect success!!!');
commonEvent.publish("service_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service onDisconnect success!!!');
commonEvent.publish("service_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service onFailed!!!');
commonEvent.publish("service_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service onDestroy');
}
};
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service2 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service2 publish success!!!");
}
}
export default class ServiceAbility2 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service2 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service2 onRequest');
let request = {
'bundleName': 'com.example.different.hmservice',
'abilityName': 'com.example.different.ServiceAbility',
'moduleName': 'entry',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service2 onConnect success!!!');
commonEvent.publish("service2_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service2 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service2 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service2 onDisconnect success!!!');
commonEvent.publish("service2_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service2 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service2 onFailed!!!');
commonEvent.publish("service2_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service2 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service2 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service2 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service2 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service2 onDestroy');
}
};
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service3 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service3 publish success!!!");
}
}
export default class ServiceAbility3 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service3 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service3 onRequest');
let request = {
'bundleName': 'com.example.different.hmservice',
'abilityName': 'com.example.different.ServiceAbility',
'moduleName': 'entry',
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service3 onConnect success!!!');
commonEvent.publish("service3_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service3 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service3 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service3 onDisconnect success!!!');
commonEvent.publish("service3_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service3 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service3 onFailed!!!');
commonEvent.publish("service3_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service3 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service3 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service3 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service3 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service3 onDestroy');
}
};
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service4 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service4 publish success!!!");
}
}
export default class ServiceAbility4 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service4 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service4 onRequest');
let request = {
'deviceId': 'XXXXX',
'bundleName': 'com.example.myapplication.hmservice',
'abilityName': 'ServiceAbility7',
'moduleName': 'myapplication7',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service4 onConnect success!!!');
commonEvent.publish("service4_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service4 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service4 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service4 onDisconnect success!!!');
commonEvent.publish("service4_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service4 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service4 onFailed!!!');
commonEvent.publish("service4_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service4 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service4 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service4 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service4 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service4 onDestroy');
}
};
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service5 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service5 publish success!!!");
}
}
export default class ServiceAbility4 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service5 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service5 onRequest');
let request = {
'bundleName': 'com.example.xxx.hmservice',
'abilityName': 'ServiceAbility7',
'moduleName': 'myapplication7',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service5 onConnect success!!!');
commonEvent.publish("service5_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service5 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service5 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service5 onDisconnect success!!!');
commonEvent.publish("service5_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service5 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service5 onFailed!!!');
commonEvent.publish("service5_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service5 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service5 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service5 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service5 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service5 onDestroy');
}
};
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service6 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service6 publish success!!!");
}
}
export default class ServiceAbility4 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service6 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service6 onRequest');
let request = {
'bundleName': 'com.example.myapplication.hmservice',
'abilityName': '',
'moduleName': 'myapplication7',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service6 onConnect success!!!');
commonEvent.publish("service6_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service6 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service6 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service6 onDisconnect success!!!');
commonEvent.publish("service6_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service6 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service6 onFailed!!!');
commonEvent.publish("service6_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service6 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service6 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service6 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service6 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service6 onDestroy');
}
};
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service7 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service7 publish success!!!");
}
}
export default class ServiceAbility4 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service7 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service7 onRequest');
let request = {
'bundleName': 'com.example.myapplication.hmservice',
'abilityName': 'ServiceAbility7',
'moduleName': 'myapplication7',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
'parameters': {
"key1": "value1", "key2": "let your heart guide you", "tag": "Every ending is a new beginning!"
}
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service7 onConnect success!!!');
commonEvent.publish("service7_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service7 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service7 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service7 onDisconnect success!!!');
commonEvent.publish("service7_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service7 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service7 onFailed!!!');
commonEvent.publish("service7_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service7 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service7 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service7 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service7 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service7 onDestroy');
}
};
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service8 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service8 publish success!!!");
}
}
export default class ServiceAbility4 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service8 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service8 onRequest');
let request = {
'bundleName': 'com.example.myapplication.hmservice',
'abilityName': 'ServiceAbility7',
'moduleName': 'xxxxx',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service8 onConnect success!!!');
commonEvent.publish("service8_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service8 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service8 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service8 onDisconnect success!!!');
commonEvent.publish("service8_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service8 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service8 onFailed!!!');
commonEvent.publish("service8_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service8 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service8 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service8 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service8 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service8 onDestroy');
}
};
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility';
import wantConstant from '@ohos.ability.wantConstant';
import commonEvent from '@ohos.commonEvent';
var publishConnectOptions = {
parameters: {
"assertData": "onConnect"
}
};
var publishDisconnectOptions = {
parameters: {
"assertData": "onDisconnect"
}
};
var publishFailedOptions = {
parameters: {
"assertData": "onFailed"
}
};
function PublishCallBack(err) {
if (err.code) {
console.error("ConnectAbilityTest_Ext service9 publish failed " + JSON.stringify(err));
} else {
console.info("ConnectAbilityTest_Ext service9 publish success!!!");
}
}
export default class ServiceAbility4 extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ConnectAbilityTest_Ext service9 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ConnectAbilityTest_Ext service9 onRequest');
let request = {
'bundleName': 'com.example.myapplication.hmservice',
'abilityName': 'ServiceAbility6',
'moduleName': 'myapplication8',
'flags': wantConstant.Flags.FLAG_INSTALL_ON_DEMAND,
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info('ConnectAbilityTest_Ext service9 onConnect success!!!');
commonEvent.publish("service9_event",publishConnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service9 onConnect element : ' + JSON.stringify(element));
console.info('ConnectAbilityTest_Ext service9 onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
console.info('ConnectAbilityTest_Ext service9 onDisconnect success!!!');
commonEvent.publish("service9_event",publishDisconnectOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service9 onDisconnect element : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info('ConnectAbilityTest_Ext service9 onFailed!!!');
commonEvent.publish("service9_event",publishFailedOptions,PublishCallBack);
console.info('ConnectAbilityTest_Ext service9 onFailed errCode : ' + JSON.stringify(code));
},
}
console.info('ConnectAbilityTest_Ext sevice connect start ');
var connection = this.context.connectAbility(request, options);
console.info('ConnectAbilityTest_Ext service9 request is:' + JSON.stringify(request));
console.info('ConnectAbilityTest_Ext service9 options is:' + JSON.stringify(options));
console.info('ConnectAbilityTest_Ext service9 connection=: ' + connection);
}
onDestroy() {
console.info('ConnectAbilityTest_Ext service9 onDestroy');
}
};
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout','-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
console.log("onAbilityCreateCallback");
}
async function addAbilityMonitorCallback(err: any) {
console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
console.info("OpenHarmonyTestRunner OnPrepare ")
}
async onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -a' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
})
globalThis.delegator = abilityDelegator;
console.info('OpenHarmonyTestRunner onRun end')
}
};
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/ListTest'
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
aboutToAppear() {
console.info("start run testcase!!!!")
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index2 {
@State message: string = 'Hello MainAbility2'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
import commonEvent from '@ohos.commonEvent';
export default function ConnectAbilityTest_Ext(abilityContext) {
var TAG = "";
var dataAssert = "";
var subscriber;
var subscribeInfo = {
events: ["service_event", "service2_event", "service3_event",
"service4_event", "service5_event", "service6_event",
"service7_event", "service8_event", "service9_event"]
};
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time))
}
async function startService(msg, str) {
console.info(msg + ' startService successful. str: ' + JSON.stringify(str));
globalThis.abilityContext.startAbility(str)
.then((data) => {
console.info(msg + ' startService successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
console.error(msg + ' startService failed. Cause: ' + JSON.stringify(error));
})
}
function checkParameters(msg1, data) {
for (var key in data.parameters) {
console.info(msg1 + " data.parameters is : " + data.parameters[key])
if (data.parameters[key] === "onFailed") {
dataAssert = "onFailed";
} else if (data.parameters[key] === "onDisconnect") {
dataAssert = "onDisconnect";
} else if (data.parameters[key] === "onConnect") {
dataAssert = "onConnect";
}
}
}
function SubscribeCallBack(err, data) {
if (err.code) {
console.error("commonEvent subscribe failed " + JSON.stringify(err));
} else {
if (data.event === "service_event") {
console.info("commonEvent subscribe service " + JSON.stringify(data));
checkParameters("commonEvent service", data)
} else if (data.event === "service2_event") {
console.info("commonEvent subscribe service2 " + JSON.stringify(data));
checkParameters("commonEvent service2", data)
} else if (data.event === "service3_event") {
console.info("commonEvent subscribe service3 " + JSON.stringify(data));
checkParameters("commonEvent service3", data)
} else if (data.event === "service4_event") {
console.info("commonEvent subscribe service4 " + JSON.stringify(data));
checkParameters("commonEvent service4", data)
} else if (data.event === "service5_event") {
console.info("commonEvent subscribe service5 " + JSON.stringify(data));
checkParameters("commonEvent service5", data)
} else if (data.event === "service6_event") {
console.info("commonEvent subscribe service6 " + JSON.stringify(data));
checkParameters("commonEvent service6", data)
} else if (data.event === "service7_event") {
console.info("commonEvent subscribe service7 " + JSON.stringify(data));
checkParameters("commonEvent service7", data)
} else if (data.event === "service8_event") {
console.info("commonEvent subscribe service8 " + JSON.stringify(data));
checkParameters("commonEvent service8", data)
} else if (data.event === "service9_event") {
console.info("commonEvent subscribe service9 " + JSON.stringify(data));
checkParameters("commonEvent service9", data)
}
}
}
function CreateSubscriberCallBack(err, commonEventSubscriber) {
if (err.code) {
console.error("commonEvent createSubscriber failed " + JSON.stringify(err));
} else {
console.info("----commonEvent createSubscriber------");
subscriber = commonEventSubscriber;
commonEvent.subscribe(subscriber, SubscribeCallBack);
}
}
describe('FreeInstall_Stage_ConnectAbility_Ext', function () {
beforeAll(async function (done) {
console.info("FreeInstall_Stage_ConnectAbility_Ext before all called");
console.info("FreeInstall_Stage_ConnectAbility_Ext commonEvent.createSubscriber start!!!");
commonEvent.createSubscriber(subscribeInfo, CreateSubscriberCallBack);
await sleep(2000);
var cmd = "bm install -p data/test/Mockservice.hap";
console.info("cmd : " + cmd)
globalThis.delegator.executeShellCommand(cmd, (err: any, d: any) => {
console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var cmd1 = "mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry";
globalThis.delegator.executeShellCommand(cmd1, (err: any, d: any) => {
console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var cmd2 = "mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files";
globalThis.delegator.executeShellCommand(cmd2, (err: any, d: any) => {
console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
done();
})
});
afterEach(async function (done) {
console.info("FreeInstall_Stage_ConnectAbility_Ext after each called");
dataAssert = ""
await sleep(1000);
if ("FreeInstall_Stage_ConnectAbility_Ext_1200" === TAG) {
var cmdUninstall = "bm uninstall -n com.ohos.hag.famanager";
globalThis.delegator.executeShellCommand(cmdUninstall, (err: any, d: any) => {
console.info("executeShellCommandUninstall : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
}
await sleep(500);
done();
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0100
* @tc.name Deviceid is empty,atomic service does not exist locally
* @tc.desc Function test
* @tc.level 0
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0100", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0100-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0100";
var cmdmyapp6 = "cp data/test/ConnectStageMyApplication6.hap /data/app/el2/100/base/com.ohos.hag.famanager/" +
"haps/entry/files";
globalThis.delegator.executeShellCommand(cmdmyapp6, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var str1 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility",
};
startService(TAG, str1);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onConnect");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0100-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0200
* @tc.name Deviceid is empty,atomic service exists locally
* @tc.desc Function test
* @tc.level 0
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0200", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0200-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0200";
var str1 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility",
};
startService(TAG, str1);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onConnect");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0200-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0300
* @tc.name The bundleName passed in is different from the local
* @tc.desc Function test
* @tc.level 1
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0300", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0300-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0300";
var cmdum = "bm uninstall -n com.example.different.hmservice";
globalThis.delegator.executeShellCommand(cmdum, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var str2 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility2",
};
startService(TAG, str2);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onFailed");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0300-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0400
* @tc.name Do not pass flags, atomic service does not exist locally
* @tc.desc Function test
* @tc.level 1
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0400", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0400-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0400";
var str3 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility3",
};
startService(TAG, str3);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onFailed");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0400-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0500
* @tc.name Do not pass flags, atomic service exists locally
* @tc.desc Function test
* @tc.level 0
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0500", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0500-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0500";
var cmdin = "bm install -p data/test/ConnectDifferentApplication.hap";
globalThis.delegator.executeShellCommand(cmdin, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var str3 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility3",
};
startService(TAG, str3);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onConnect");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0500-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0600
* @tc.name Incorrect deviceid passed in
* @tc.desc Function test
* @tc.level 1
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0600", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0600-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0600";
var str4 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility4",
};
startService(TAG, str4);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onFailed");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0600-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0700
* @tc.name Incorrect bundleName passed in
* @tc.desc Function test
* @tc.level 1
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0700", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0700-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0700";
var str5 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility5",
};
startService(TAG, str5);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onFailed");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0700-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0800
* @tc.name Pass in an empty abilityName
* @tc.desc Function test
* @tc.level 1
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0800", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0800-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0800";
var str6 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility6",
};
startService(TAG, str6);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onFailed");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0800-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_0900
* @tc.name No atomic service under path
* @tc.desc Function test
* @tc.level 1
*/
it("FreeInstall_Stage_ConnectAbility_Ext_0900", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_0900-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_0900";
var cmdrm = "rm -r /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files/*";
globalThis.delegator.executeShellCommand(cmdrm, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(500);
var str7 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility7",
};
startService(TAG, str7);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onFailed");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_0900-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_1000
* @tc.name Incorrect moduleName passed in
* @tc.desc Function test
* @tc.level 1
*/
it("FreeInstall_Stage_ConnectAbility_Ext_1000", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_1000-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_1000";
var str8 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility8",
};
startService(TAG, str8);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onFailed");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_1000-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_1100
* @tc.name Pass in parameters
* @tc.desc Function test
* @tc.level 0
*/
it("FreeInstall_Stage_ConnectAbility_Ext_1100", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_1100-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_1100";
var cmdmyapp7 = "cp data/test/ConnectStageMyApplication7.hap /data/app/el2/100/base/com.ohos.hag.famanager/" +
"haps/entry/files";
globalThis.delegator.executeShellCommand(cmdmyapp7, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(1000);
var str7 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility7",
};
startService(TAG, str7);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onConnect");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_1100-------------");
done();
}, 4000);
});
/*
* @tc.number FreeInstall_Stage_ConnectAbility_Ext_1200
* @tc.name The atomic service of the target differs only by moduleName
* @tc.desc Function test
* @tc.level 0
*/
it("FreeInstall_Stage_ConnectAbility_Ext_1200", 0, async function (done) {
console.log("------------start FreeInstall_Stage_ConnectAbility_Ext_1200-------------");
TAG = "FreeInstall_Stage_ConnectAbility_Ext_1200";
var cmdmyapp8 = "cp data/test/ConnectStageMyApplication8.hap /data/app/el2/100/base/com.ohos.hag.famanager/" +
"haps/entry/files";
globalThis.delegator.executeShellCommand(cmdmyapp8, (err: any, d: any) => {
console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d));
})
await sleep(1000);
var str9 = {
"bundleName": "com.example.myapplication.hmservice",
"abilityName": "com.example.myapplication.ServiceAbility9",
};
startService(TAG, str9);
setTimeout(function () {
console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert));
expect(dataAssert).assertEqual("onConnect");
console.log("------------end FreeInstall_Stage_ConnectAbility_Ext_1200-------------");
done();
}, 4000);
});
}
)
}
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ConnectAbilityTest from './ConnectAbilityTest'
import ConnectAbilityTest_Ext from './ConnectAbilityTest_Ext'
export default function List(context) {
ConnectAbilityTest(context)
ConnectAbilityTest_Ext(context)
}
{
"module": {
"name": "entry",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:entry_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "com.example.myapplication.hmservice.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"orientation": "portrait",
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
},
{
"name": "com.example.myapplication.MainAbility2",
"srcEntrance": "./ets/MainAbility2/MainAbility2.ts",
"description": "$string:MainAbility2_desc",
"icon": "$media:icon",
"label": "$string:MainAbility2_label"
}
],
"extensionAbilities": [
{
"name": "com.example.myapplication.ServiceAbility",
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"label": "$string:form_ServiceAbility_label",
"description": "$string:form_ServiceAbility_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility2",
"srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts",
"label": "$string:form_ServiceAbility2_label",
"description": "$string:form_ServiceAbility2_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility3",
"srcEntrance": "./ets/ServiceAbility3/ServiceAbility3.ts",
"label": "$string:form_ServiceAbility3_label",
"description": "$string:form_ServiceAbility3_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility4",
"srcEntrance": "./ets/ServiceAbility4/ServiceAbility4.ts",
"label": "$string:form_ServiceAbility4_label",
"description": "$string:form_ServiceAbility4_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility5",
"srcEntrance": "./ets/ServiceAbility5/ServiceAbility5.ts",
"label": "$string:form_ServiceAbility5_label",
"description": "$string:form_ServiceAbility5_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility6",
"srcEntrance": "./ets/ServiceAbility6/ServiceAbility6.ts",
"label": "$string:form_ServiceAbility6_label",
"description": "$string:form_ServiceAbility6_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility7",
"srcEntrance": "./ets/ServiceAbility7/ServiceAbility7.ts",
"label": "$string:form_ServiceAbility7_label",
"description": "$string:form_ServiceAbility7_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility8",
"srcEntrance": "./ets/ServiceAbility8/ServiceAbility8.ts",
"label": "$string:form_ServiceAbility8_label",
"description": "$string:form_ServiceAbility8_desc",
"type": "service"
},
{
"name": "com.example.myapplication.ServiceAbility9",
"srcEntrance": "./ets/ServiceAbility9/ServiceAbility9.ts",
"label": "$string:form_ServiceAbility9_label",
"description": "$string:form_ServiceAbility9_desc",
"type": "service"
}
],
"requestPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO"
},
{
"name": "ohos.permission.MANAGE_MISSIONS"
},
{
"name": "ohos.permission.INSTALL_BUNDLE"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name": "ohos.permission.REMOVE_CACHE_FILES"
},
{
"name": "ohos.permission.LISTEN_BUNDLE_CHANGE"
},
{
"name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND"
},
{
"name":"ohos.permission.START_INVISIBLE_ABILITY"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "MainAbility2_desc",
"value": "description"
},
{
"name": "MainAbility2_label",
"value": "label"
},
{
"name": "form_ServiceAbility_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility2_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility2_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility3_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility3_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility4_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility4_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility5_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility5_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility6_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility6_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility7_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility7_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility8_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility8_label",
"value": "form_label"
},
{
"name": "form_ServiceAbility9_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility9_label",
"value": "form_label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication.hmservice",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"description": "description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ConnectStageMyApplication0") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":connectstagemyapplication0_js_assets",
":connectstagemyapplication0_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ConnectStageMyApplication0"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("connectstagemyapplication0_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("connectstagemyapplication0_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("connectstagemyapplication0_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":connectstagemyapplication0_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ServiceExtensionAbility from "@ohos.application.ServiceExtensionAbility"
import rpc from '@ohos.rpc';
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des)
}
onRemoteRequest(code, data, reply, option) {
console.info('ServiceAbility myapp0 onRemoteRequest');
if (code === 1) {
let op1 = data.readInt();
let op2 = data.readInt();
reply.writeInt(op1 + op2);
console.info('ServiceAbility myapp0 op1:' + op1 + ' op2:' + op2);
}
return true;
}
}
export default class ServiceAbility extends ServiceExtensionAbility {
onCreate(want) {
console.info('onCreate, want:' + want.abilityName);
console.info('ServiceAbility myapp0 onCreate');
}
onRequest(want, startId) {
console.info('onRequest, want: ' + want.abilityName);
console.info('onRequest, startId: ' + startId);
console.info('ServiceAbility myapp0 onRequest');
}
onConnect(want) {
console.info('onConnect, want:' + want.abilityName);
console.info('ServiceAbility myapp0 onConnect');
console.info('ConnectAbilityTest connect myapp0 Servcie success');
return new StubTest("test");
}
onDisconnect(want) {
console.info('onDisconnect, want:' + want.abilityName);
console.info('ServiceAbility myapp0 onDisconnect');
}
onReconnect(want) {
console.info('onReconnect, want:' + want.abilityName);
console.info('ServiceAbility myapp0 onReconnect');
}
onDestroy() {
console.info('ServiceAbility myapp0 onDestroy');
}
};
\ No newline at end of file
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'Hello myapp0'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "myapplication",
"type": "feature",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:myapplication_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": true,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"orientation": "portrait",
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "ServiceAbility",
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"label": "$string:form_ServiceAbility_label",
"description": "$string:form_ServiceAbility_desc",
"type": "service"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "myapplication_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "form_ServiceAbility_desc",
"value": "form_description"
},
{
"name": "form_ServiceAbility_label",
"value": "form_label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.myapplication.hmservice",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"description": "description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ConnectStageMyApplication1") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":connectstagemyapplication1_js_assets",
":connectstagemyapplication1_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ConnectStageMyApplication1"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("connectstagemyapplication1_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("connectstagemyapplication1_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("connectstagemyapplication1_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":connectstagemyapplication1_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册