未验证 提交 feeb1fd0 编写于 作者: O openharmony_ci 提交者: Gitee

!6332 Delete the XTS which are related to dialog box

Merge pull request !6332 from zhoujun62/my_xts_acts1
......@@ -25,7 +25,6 @@ group("ability_runtime") {
"actsabilitydelegatorcase:ActsAbilityDelegatorCaseTest",
"actsabilitymanageretstest:ActsAbilityManagerEtsTest",
"actsabilityusertest:ActsAbilityuserTest",
"actsappselector:actsappselector",
"actscalldataabilitytest:ActsCallDataAbilityTest",
"actscalldataabilitytest:ActsCallDataAbilityTest",
"actscalltest:actscalltest",
......
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
group("actsappselector") {
testonly = true
if (is_standard_system) {
deps = [
"actsappselectorpctest:ActsAppSelectorPCTest",
"actsappselectorrelyhap:ActsAppSelectorRelyHap",
"actsappselectortest:ActsAppSelectorTest",
"actsimageaentryrelyhap:ActsImageAEntryRelyHap",
"actsimageafeaturerelyhap:ActsImageAFeatureRelyHap",
"actsimagebentryrelyhap:ActsImageBEntryRelyHap",
"actsimagebfeaturerelyhap:ActsImageBFeatureRelyHap",
"actsimagecentryrelyhap:ActsImageCEntryRelyHap",
"actsimagecfeaturerelyhap:ActsImageCFeatureRelyHap",
"actsimagedrelyhap:ActsImageDRelyHap",
"actsimageerelyhap:ActsImageERelyHap",
"actsimagefrelyhap:ActsImageFRelyHap",
"actsimagegrelyhap:ActsImageGRelyHap",
"actsimagehrelyhap:ActsImageHRelyHap",
"actsimageirelyhap:ActsImageIRelyHap",
"actsimagejrelyhap:ActsImageJRelyHap",
"actsimagekrelyhap:ActsImageKRelyHap",
"actsserviceabilityarelyhap:ActsServiceAbilityARelyHap",
"actsserviceabilitybrelyhap:ActsServiceAbilityBRelyHap",
"actstextarelyhap:ActstextARelyHap",
"actstextbrelyhap:ActstextBRelyHap",
"actstextcrelyhap:ActstextCRelyHap",
"actstextdrelyhap:ActstextDRelyHap",
"actstexterelyhap:ActstextERelyHap",
"actstextfrelyhap:ActstextFRelyHap",
"actstextgrelyhap:ActstextGRelyHap",
"actstexthrelyhap:ActstextHRelyHap",
"actstextirelyhap:ActstextIRelyHap",
"actstextjrelyhap:ActstextJRelyHap",
"actstextkrelyhap:ActstextKRelyHap",
]
}
}
{
"app": {
"bundleName": "com.example.appselectorpctest",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "AppSelectorTest"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAppSelectorPCTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsappselectorpctest_js_assets",
":actsappselectorpctest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAppSelectorPCTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsappselectorpctest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsappselectorpctest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsappselectorpctest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsappselectorpctest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for aceceshi Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.example.appselectorpctest",
"module-name": "entry",
"shell-timeout": "600000",
"testcase-timeout":"100000"
},
"kits": [
{
"type": "ShellKit",
"run-command": [
"setenforce 0",
"power-shell setmode 602",
"param set persist.ace.testmode.enabled 1",
"hilog -Q pidoff",
"hilog -Q domainoff",
"hilog -b D"
]
},
{
"test-file-name": [
"ActsAppSelectorPCTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "PushKit",
"push": [
"ActsAppSelectorRelyHap.hap->/data/ActsAppSelectorRelyHap.hap",
"ActsServiceAbilityARelyHap.hap->/data/ActsServiceAbilityARelyHap.hap",
"ActsServiceAbilityBRelyHap.hap->/data/ActsServiceAbilityBRelyHap.hap",
"ActsImageAEntryRelyHap.hap->/data/ActsImageAEntryRelyHap.hap",
"ActsImageAFeatureRelyHap.hap->/data/ActsImageAFeatureRelyHap.hap",
"ActsImageBEntryRelyHap.hap->/data/ActsImageBEntryRelyHap.hap",
"ActsImageBFeatureRelyHap.hap->/data/ActsImageBFeatureRelyHap.hap",
"ActsImageCEntryRelyHap.hap->/data/ActsImageCEntryRelyHap.hap",
"ActsImageCFeatureRelyHap.hap->/data/ActsImageCFeatureRelyHap.hap",
"ActsImageDRelyHap.hap->/data/ActsImageDRelyHap.hap",
"ActsImageERelyHap.hap->/data/ActsImageERelyHap.hap",
"ActsImageFRelyHap.hap->/data/ActsImageFRelyHap.hap",
"ActsImageGRelyHap.hap->/data/ActsImageGRelyHap.hap",
"ActsImageHRelyHap.hap->/data/ActsImageHRelyHap.hap",
"ActsImageIRelyHap.hap->/data/ActsImageIRelyHap.hap",
"ActsImageJRelyHap.hap->/data/ActsImageJRelyHap.hap",
"ActsImageKRelyHap.hap->/data/ActsImageKRelyHap.hap",
"ActstextARelyHap.hap->/data/ActstextARelyHap.hap",
"ActstextBRelyHap.hap->/data/ActstextBRelyHap.hap",
"ActstextCRelyHap.hap->/data/ActstextCRelyHap.hap",
"ActstextDRelyHap.hap->/data/ActstextDRelyHap.hap",
"ActstextERelyHap.hap->/data/ActstextERelyHap.hap",
"ActstextFRelyHap.hap->/data/ActstextFRelyHap.hap",
"ActstextGRelyHap.hap->/data/ActstextGRelyHap.hap",
"ActstextHRelyHap.hap->/data/ActstextHRelyHap.hap",
"ActstextIRelyHap.hap->/data/ActstextIRelyHap.hap",
"ActstextJRelyHap.hap->/data/ActstextJRelyHap.hap",
"ActstextKRelyHap.hap->/data/ActstextKRelyHap.hap"
]
}
]
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log('MainAbility onCreate')
globalThis.abilityWant = want;
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
console.log('MainAbility onDestroy')
}
onWindowStageCreate(windowStage) {
console.log('MainAbility onWindowStageCreate')
windowStage.setUIContent(this.context, 'MainAbility/pages/index', null)
globalThis.abilityContext = this.context;
}
onWindowStageDestroy() {
console.log('MainAbility onWindowStageDestroy')
}
onForeground() {
console.log('MainAbility onForeground')
}
onBackground() {
console.log('MainAbility onBackground')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
console.log("onAbilityCreateCallback");
}
async function addAbilityMonitorCallback(err: any) {
console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
console.info("OpenHarmonyTestRunner OnPrepare ")
}
async onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
let lMonitor = {
abilityName: MainAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
})
console.info('OpenHarmonyTestRunner onRun end')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'AppSelectorPC'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import commonEvent from '@ohos.commonEvent'
import { BY, UiDriver, UiComponent, MatchPattern } from '@ohos.uitest'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined;
var driver;
var cmdInstall
var cmdUninstall;
var subscriberInfo = {
events: ['AppSelector']
};
function sleep(time) {
return new Promise < void> ((resolve, reject) => {
setTimeout(() => {
resolve();
}, time)
})
}
export default function abilityTest() {
describe('ActsAppSelectorPCTest', function () {
beforeAll(async (done) => {
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
driver = await UiDriver.create()
await sleep(2000);
done();
})
afterEach(async (done) => {
abilityDelegator.executeShellCommand(cmdUninstall,
async (err: any, d: any) => {
console.log('ACTS_AppSelectorTest cmdUninstall executeShellCommand : err : ' + JSON.stringify(err));
console.log('ACTS_AppSelectorTest cmdUninstall executeShellCommand : stdResult : ' + d.stdResult);
console.log('ACTS_AppSelectorTest cmdUninstall executeShellCommand : exitCode : ' + d.exitCode);
await sleep(4000);
done();
})
})
/*
* @tc.number: ACTS_AppSelectorTest_1100
* @tc.name: Install one image type matching app
* @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_1100', 0, async function (done) {
console.log("ACTS_AppSelectorTest_1100 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActstextARelyHap.hap';
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n textarelyhap.com.example";
console.log('ACTS_AppSelectorTest_1100 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, (error, data) => {
console.debug("ACTS_AppSelectorTest_1100 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_1100 startAbility end");
})
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, SubscribeCallBack)
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_1100 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_1100 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_1100 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_1100 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_1100 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility");
expect(data.parameters.bundleName).assertEqual("imagearelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_1100 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_1200
* @tc.name: Install one image type matching app
* @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_1200', 0, async function (done) {
console.log("ACTS_AppSelectorTest_1200 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' +
'bm install -p /data/ActstextARelyHap.hap';
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" +
"bm uninstall -n textarelyhap.com.example";
console.log('ACTS_AppSelectorTest_1200 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_1200 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_1200 startAbility end");
commonEvent.subscribe(subscriber, SubscribeCallBack)
await sleep(4000);
console.log("ACTS_AppSelectorTest_1200 findComponent");
let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true))
console.log("ACTS_AppSelectorTest_1200 button " + JSON.stringify(button));
await sleep(4000);
await button.click();
await sleep(2000);
})
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_1200 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_1200 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_1200 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_1200 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_1200 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility");
expect(data.parameters.bundleName).assertEqual("imagearelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_1200 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_1300
* @tc.name: Install one image type matching app
* @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_1300', 0, async function (done) {
console.log("ACTS_AppSelectorTest_1300 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' +
'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageDRelyHap.hap;' +
'bm install -p /data/ActstextARelyHap.hap';
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" +
"bm uninstall -n imagecrelyhap;bm uninstall -n imagedrelyhap;" +
"bm uninstall -n textarelyhap.com.example"
console.log('ACTS_AppSelectorTest_1300 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_1300 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_1300 startAbility end");
commonEvent.subscribe(subscriber, SubscribeCallBack)
await sleep(2000);
console.log("ACTS_AppSelectorTest_1300 findComponent");
let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true))
console.log("ACTS_AppSelectorTest_1300 button " + JSON.stringify(button));
await sleep(4000);
await button.click();
await sleep(2000);
})
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_1300 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_1300 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_1300 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_1300 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_1300 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility");
expect(data.parameters.bundleName).assertEqual("imagearelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_1300 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_1400
* @tc.name: Install one image type matching app
* @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_1400', 0, async function (done) {
console.log("ACTS_AppSelectorTest_1400 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' +
'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageDRelyHap.hap;' +
'bm install -p /data/ActsImageERelyHap.hap;bm install -p /data/ActsImageFRelyHap.hap;bm install -p /data/ActsImageGRelyHap.hap;' +
'bm install -p /data/ActsImageHRelyHap.hap;bm install -p /data/ActsImageIRelyHap.hap;'
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;bm uninstall -n imagecrelyhap;" +
"bm uninstall -n imagedrelyhap;bm uninstall -n imageerelyhap;bm uninstall -n imagefrelyhap;bm uninstall -n imagegrelyhap;" +
"bm uninstall -n imagehrelyhap;bm uninstall -n imageirelyhap;"
console.log('ACTS_AppSelectorTest_1400 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_1400 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_1400 startAbility end");
await sleep(2000);
commonEvent.subscribe(subscriber, SubscribeCallBack)
await sleep(4000);
await driver.swipe(529, 921, 185, 921)
await sleep(4000);
await driver.click(142,749);
await sleep(2000);
})
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_1400 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_1400 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_1400 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_1400 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_1400 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility");
expect(data.parameters.bundleName).assertEqual("imagehrelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_1400 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_1500
* @tc.name: Install one image type matching app
* @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_1500', 0, async function (done) {
console.log("ACTS_AppSelectorTest_1500 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;'
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;"
console.log('ACTS_AppSelectorTest_1500 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_1500 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_1500 startAbility end");
await sleep(2000);
commonEvent.subscribe(subscriber, SubscribeCallBack)
let button1 = await driver.findComponent(BY.text('使用以下方式打开').enabled(true))
console.log("ACTS_AppSelectorTest_1500 rectSerial " + JSON.stringify(button1));
await sleep(4000);
let button2 = await driver.findComponent(BY.text('imagebrelyhap').enabled(true))
console.log("ACTS_AppSelectorTest_1500 rectSerial " + JSON.stringify(button2));
await sleep(4000);
await button1.click();
await sleep(4000);
await button2.click();
await sleep(2000);
})
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_1500 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_1500 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_1500 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_1500 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_1500 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility1");
expect(data.parameters.bundleName).assertEqual("imagebrelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_1500 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_1600
* @tc.name: Install one image type matching app
* @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_1600', 0, async function (done) {
console.log("ACTS_AppSelectorTest_1600 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;'
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;"
console.log('ACTS_AppSelectorTest_1600 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_1600 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_1600 startAbility end");
await sleep(2000);
console.log("ACTS_AppSelectorTest_1600 findComponent");
let button = await driver.findComponent(BY.text('取消').enabled(true))
console.log("ACTS_AppSelectorTest_1600 button " + JSON.stringify(button));
await sleep(4000);
await button.click();
try {
await sleep(2000);
let close = await driver.findComponent(BY.text('取消').enabled(true))
console.log("ACTS_AppSelectorTest_1600 close " + JSON.stringify(close));
expect(close == null).assertTrue();
done();
} catch (err) {
console.debug("ACTS_AppSelectorTest_1600 catch err: " + JSON.stringify(err));
console.debug("ACTS_AppSelectorTest_1600 catch err: " + err);
expect(err.code).assertEqual("INTERNAL_ERROR");
done();
}
})
})
/*
* @tc.number: ACTS_AppSelectorTest_1700
* @tc.name: Do not install matching apps
* @tc.desc: Do not install matching apps,"can't open this file" popup
*/
it('ACTS_AppSelectorTest_1700', 0, async function (done) {
console.log("ACTS_AppSelectorTest_1700 --- start")
await sleep(2000);
cmdInstall = 'bm install -p /data/ActsImageJRelyHap.hap'
cmdUninstall = "bm uninstall -n imagejrelyhap";
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_1700 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_1700 startAbility end");
try {
await sleep(2000);
console.log("ACTS_AppSelectorTest_1700 findComponent");
let cantOpen1 = await driver.findComponent(BY.text('无法打开此文件').enabled(true))
console.log("ACTS_AppSelectorTest_1700 cantOpen1 " + JSON.stringify(cantOpen1));
expect(cantOpen1 != null).assertTrue();
let button = await driver.findComponent(BY.text('知道了').enabled(true))
console.debug("ACTS_AppSelectorTest_1700 button: " + JSON.stringify(button))
await sleep(4000);
await button.click();
await sleep(2000);
await sleep(1000);
console.debug("ACTS_AppSelectorTest_1700 findComponent");
let cantOpen2 = await driver.findComponent(BY.text('无法打开此文件').enabled(true))
console.log("ACTS_AppSelectorTest_1700 cantOpen2 " + JSON.stringify(cantOpen2));
expect(cantOpen2 == null).assertTrue();
done();
} catch (err) {
console.debug("ACTS_AppSelectorTest_1700 catch err: " + JSON.stringify(err));
console.debug("ACTS_AppSelectorTest_1700 catch err: " + err);
expect(err.code).assertEqual("INTERNAL_ERROR");
done();
}
})
})
})
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import abilityTest from './Ability.test'
export default function testsuite() {
abilityTest()
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"requestPermissions": [
{
"name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
},
{
"name":"ohos.permission.START_INVISIBLE_ABILITY",
"reason":"need use 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": "MainAbility3_desc",
"value": "description"
},
{
"name": "MainAbility3_label",
"value": "label"
},
{
"name": "app_name",
"value": "actsstartrunnertest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.appselectorrelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsAppSelectorRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsAppSelectorRelyHap"
testonly = true
deps = [
":actsappselectorrelyhap_js_assets",
":actsappselectorrelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsappselectorrelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsappselectorrelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsappselectorrelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsappselectorrelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
globalThis.abilityContext = this.context;
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, (error, data) => {
console.log("ACTS_AppSelectorTest_3700 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'Hello World1'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "MainAbility2_desc",
"value": "description"
},
{
"name": "MainAbility2_label",
"value": "label"
},
{
"name": "MainAbility3_desc",
"value": "description"
},
{
"name": "MainAbility3_label",
"value": "label"
},
{
"name": "app_name",
"value": "actsstartrunnertest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.appselectortest",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "AppSelectorTest"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAppSelectorTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsappselectortest_js_assets",
":actsappselectortest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAppSelectorTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsappselectortest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsappselectortest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsappselectortest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsappselectortest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for aceceshi Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.example.appselectortest",
"module-name": "entry",
"shell-timeout": "600000",
"testcase-timeout":"300000"
},
"kits": [
{
"type": "ShellKit",
"run-command": [
"setenforce 0",
"power-shell setmode 602",
"param set persist.ace.testmode.enabled 1",
"hilog -Q pidoff",
"hilog -Q domainoff",
"hilog -b D"
]
},
{
"test-file-name": [
"ActsAppSelectorTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "PushKit",
"push": [
"ActsAppSelectorRelyHap.hap->/data/ActsAppSelectorRelyHap.hap",
"ActsServiceAbilityARelyHap.hap->/data/ActsServiceAbilityARelyHap.hap",
"ActsServiceAbilityBRelyHap.hap->/data/ActsServiceAbilityBRelyHap.hap",
"ActsImageAEntryRelyHap.hap->/data/ActsImageAEntryRelyHap.hap",
"ActsImageAFeatureRelyHap.hap->/data/ActsImageAFeatureRelyHap.hap",
"ActsImageBEntryRelyHap.hap->/data/ActsImageBEntryRelyHap.hap",
"ActsImageBFeatureRelyHap.hap->/data/ActsImageBFeatureRelyHap.hap",
"ActsImageCEntryRelyHap.hap->/data/ActsImageCEntryRelyHap.hap",
"ActsImageCFeatureRelyHap.hap->/data/ActsImageCFeatureRelyHap.hap",
"ActsImageDRelyHap.hap->/data/ActsImageDRelyHap.hap",
"ActsImageERelyHap.hap->/data/ActsImageERelyHap.hap",
"ActsImageFRelyHap.hap->/data/ActsImageFRelyHap.hap",
"ActsImageGRelyHap.hap->/data/ActsImageGRelyHap.hap",
"ActsImageHRelyHap.hap->/data/ActsImageHRelyHap.hap",
"ActsImageIRelyHap.hap->/data/ActsImageIRelyHap.hap",
"ActsImageJRelyHap.hap->/data/ActsImageJRelyHap.hap",
"ActsImageKRelyHap.hap->/data/ActsImageKRelyHap.hap",
"ActstextARelyHap.hap->/data/ActstextARelyHap.hap",
"ActstextBRelyHap.hap->/data/ActstextBRelyHap.hap",
"ActstextCRelyHap.hap->/data/ActstextCRelyHap.hap",
"ActstextDRelyHap.hap->/data/ActstextDRelyHap.hap",
"ActstextERelyHap.hap->/data/ActstextERelyHap.hap",
"ActstextFRelyHap.hap->/data/ActstextFRelyHap.hap",
"ActstextGRelyHap.hap->/data/ActstextGRelyHap.hap",
"ActstextHRelyHap.hap->/data/ActstextHRelyHap.hap",
"ActstextIRelyHap.hap->/data/ActstextIRelyHap.hap",
"ActstextJRelyHap.hap->/data/ActstextJRelyHap.hap",
"ActstextKRelyHap.hap->/data/ActstextKRelyHap.hap"
]
}
]
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log('MainAbility onCreate')
globalThis.abilityWant = want;
globalThis.abilityContext = this.context;
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
console.log('MainAbility onDestroy')
}
onWindowStageCreate(windowStage) {
console.log('MainAbility onWindowStageCreate')
windowStage.setUIContent(this.context, 'MainAbility/pages/index', null)
}
onWindowStageDestroy() {
console.log('MainAbility onWindowStageDestroy')
}
onForeground() {
console.log('MainAbility onForeground')
}
onBackground() {
console.log('MainAbility onBackground')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
console.log("onAbilityCreateCallback");
}
async function addAbilityMonitorCallback(err: any) {
console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
console.info("OpenHarmonyTestRunner OnPrepare ")
}
async onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
let lMonitor = {
abilityName: MainAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
})
console.info('OpenHarmonyTestRunner onRun end')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'AppSelector'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import commonEvent from '@ohos.commonEvent'
import { BY, UiDriver, UiComponent, MatchPattern } from '@ohos.uitest'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined;
var driver;
var cmdInstall
var cmdUninstall;
var subscriberInfo = {
events: ['AppSelector']
};
let paConnect = {
onConnect: function (elementName, proxy) {
console.info("AppSelector Service onConnect called.");
},
onDisconnect: function (elementName) {
console.info("AppSelector Service onDisconnect");
},
onFailed: function (code) {
console.info("AppSelector Service onFailed");
}
};
function sleep(time) {
return new Promise < void> ((resolve, reject) => {
setTimeout(() => {
resolve();
}, time)
})
}
export default function abilityTest() {
describe('ActsAppSelectorTest', function () {
beforeAll(async (done) => {
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
driver = await UiDriver.create()
await sleep(1000);
done();
})
afterEach(async (done) => {
abilityDelegator.executeShellCommand(cmdUninstall,
async (err: any, d: any) => {
console.info('ACTS_AppSelectorTest cmdUninstall executeShellCommand : err : ' + JSON.stringify(err));
console.info('ACTS_AppSelectorTest cmdUninstall executeShellCommand : data : ' + d.stdResult);
console.info('ACTS_AppSelectorTest cmdUninstall executeShellCommand : data : ' + d.exitCode);
await sleep(6000);
done();
})
})
/*
* @tc.number: ACTS_AppSelectorTest_3200
* @tc.name: Multi-hap application with action and type configured in feature
* @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature
*/
it('ACTS_AppSelectorTest_3200', 0, async function (done) {
console.log("ACTS_AppSelectorTest_3200 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' +
'bm install -p /data/ActsImageJRelyHap.hap'
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;bm uninstall -n imagejrelyhap"
console.log('ACTS_AppSelectorTest_3200 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(1000);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_3200 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_3200 startAbility end");
await sleep(4000);
let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true))
console.log("ACTS_AppSelectorTest_3200 button " + JSON.stringify(button));
await sleep(1000);
globalThis.abilityContext.startAbility(
{
bundleName: "imagejrelyhap",
abilityName: "MainAbility",
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_3200 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_3200 startAbility end");
commonEvent.subscribe(subscriber, SubscribeCallBack)
await sleep(6000);
await button.click();
await sleep(2000);
})
})
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_3200 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_3200 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_3200 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_3200 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_3200 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility");
expect(data.parameters.bundleName).assertEqual("imagearelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_3200 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_0100
* @tc.name: Install one image type matching app
* @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_0100', 0, async function (done) {
console.log("ACTS_AppSelectorTest_0100 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageJRelyHap.hap;' +
'bm install -p /data/ActstextARelyHap.hap';
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagejrelyhap;" +
"bm uninstall -n textarelyhap.com.example";
console.log('ACTS_AppSelectorTest_0100 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(1000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, (error, data) => {
console.log("ACTS_AppSelectorTest_0100 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.log("ACTS_AppSelectorTest_0100 startAbility end");
})
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, SubscribeCallBack)
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_0100 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_0100 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_0100 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_0100 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_0100 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility");
expect(data.parameters.bundleName).assertEqual("imagearelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_0100 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_0200
* @tc.name: Install one text type matching app
* @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_0200', 0, async function (done) {
console.log("ACTS_AppSelectorTest_0200 --- start")
cmdInstall = 'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextJRelyHap.hap;' +
'bm install -p /data/ActsImageAEntryRelyHap.hap ';
cmdUninstall = "bm uninstall -n textarelyhap.com.example;bm uninstall -n textjrelyhap.com.example;" +
"bm uninstall -n imagearelyhap";
console.log('ACTS_AppSelectorTest_0200 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(1000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "text/txt",
parameters: {
uri: "filePath"
}
}, (error, data) => {
console.debug("ACTS_AppSelectorTest_0200 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_0200 startAbility end");
})
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, SubscribeCallBack)
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_0200 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_0200 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_0200 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_0200 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_0200 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility");
expect(data.parameters.bundleName).assertEqual("textarelyhap.com.example");
expect(data.parameters.type).assertEqual("text/txt");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_0200 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_0300
* @tc.name: Install one text type matching app
* @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_0300', 0, async function (done) {
console.log("ACTS_AppSelectorTest_0300 --- start")
let subscriber;
cmdInstall = 'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextBRelyHap.hap;' +
'bm install -p /data/ActstextJRelyHap.hap;bm install -p /data/ActsImageAEntryRelyHap.hap ';
cmdUninstall = "bm uninstall -n textarelyhap.com.example;bm uninstall -n textbrelyhap.com.example;" +
"bm uninstall -n textjrelyhap.com.example;bm uninstall -n imagearelyhap";
console.log('ACTS_AppSelectorTest_0300 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "text/txt",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_0300 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_0300 startAbility end");
})
await sleep(2000);
console.log("ACTS_AppSelectorTest_0300 findComponent");
await sleep(2000);
let button = await driver.findComponent(BY.text('textbrelyhap.com.example').enabled(true))
console.log("ACTS_AppSelectorTest_0300 button " + JSON.stringify(button));
subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, SubscribeCallBack)
await sleep(4000);
await button.click();
await sleep(1000);
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_0300 SubscribeCallBack');
console.log('ACTS_AppSelectorTest_0300 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_0300 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_0300 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_0300 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_0300 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility");
expect(data.parameters.bundleName).assertEqual("textbrelyhap.com.example");
expect(data.parameters.type).assertEqual("text/txt");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_0300 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_0400
* @tc.name: Install one text type matching app
* @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_0400', 0, async function (done) {
console.log("ACTS_AppSelectorTest_0400 --- start")
let subscriber;
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' +
'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageDRelyHap.hap;' +
'bm install -p /data/ActsImageJRelyHap.hap;bm install -p /data/ActstextARelyHap.hap';
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" +
"bm uninstall -n imagecrelyhap;bm uninstall -n imagedrelyhap;" +
"bm uninstall -n imagejrelyhap;bm uninstall -n textarelyhap.com.example"
console.log('ACTS_AppSelectorTest_0400 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(1000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_0400 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_0400 startAbility end");
subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, SubscribeCallBack)
await sleep(2000);
console.log("ACTS_AppSelectorTest_0400 findComponent");
await sleep(2000);
let button = await driver.findComponent(BY.text('imagebrelyhap').enabled(true))
console.log("ACTS_AppSelectorTest_0400 button " + JSON.stringify(button));
await sleep(4000);
await button.click();
await sleep(2000);
})
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_0400 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_0400 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_0400 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_0400 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_0400 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility1");
expect(data.parameters.bundleName).assertEqual("imagebrelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_0400 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_0500
* @tc.name: Install one text type matching app
* @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_0500', 0, async function (done) {
console.log("ACTS_AppSelectorTest_0500 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' +
'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageDRelyHap.hap;' +
'bm install -p /data/ActsImageERelyHap.hap;bm install -p /data/ActsImageGRelyHap.hap;' +
'bm install -p /data/ActsImageHRelyHap.hap;bm install -p /data/ActsImageIRelyHap.hap;'
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;bm uninstall -n imagecrelyhap;" +
"bm uninstall -n imagedrelyhap;bm uninstall -n imageerelyhap;bm uninstall -n imagegrelyhap;" +
"bm uninstall -n imagehrelyhap;bm uninstall -n imageirelyhap;"
console.log('ACTS_AppSelectorTest_0500 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(1000);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_0500 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_0500 startAbility end");
commonEvent.subscribe(subscriber, SubscribeCallBack)
await sleep(2000);
console.log("ACTS_AppSelectorTest_0500 findComponent");
await sleep(2000);
let button = await driver.findComponent(BY.text('imagegrelyhap').enabled(true))
console.log("ACTS_AppSelectorTest_0500 button " + JSON.stringify(button));
await sleep(4000);
await button.click();
await sleep(2000);
})
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_0500 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_0500 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_0500 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_0500 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_0500 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility");
expect(data.parameters.bundleName).assertEqual("imagegrelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_0500 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_0600
* @tc.name: Install one text type matching app
* @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_0600', 0, async function (done) {
console.log("ACTS_AppSelectorTest_0600 --- start")
cmdInstall = 'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextBRelyHap.hap;' +
'bm install -p /data/ActstextCRelyHap.hap;bm install -p /data/ActstextDRelyHap.hap;' +
'bm install -p /data/ActstextERelyHap.hap;bm install -p /data/ActstextFRelyHap.hap;' +
'bm install -p /data/ActstextGRelyHap.hap;bm install -p /data/ActstextHRelyHap.hap;' +
'bm install -p /data/ActstextIRelyHap.hap;'
cmdUninstall = "bm uninstall -n textarelyhap.com.example;bm uninstall -n textbrelyhap.com.example;" +
"bm uninstall -n textcrelyhap.com.example;bm uninstall -n textdrelyhap.com.example;" +
"bm uninstall -n texterelyhap.com.example;bm uninstall -n textfrelyhap.com.example;" +
"bm uninstall -n textgrelyhap.com.example;bm uninstall -n texthrelyhap.com.example;" +
"bm uninstall -n textirelyhap.com.example;"
console.log('ACTS_AppSelectorTest_0600 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(1000);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "text/txt",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_0600 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_0600 startAbility end");
commonEvent.subscribe(subscriber, SubscribeCallBack)
await sleep(4000);
await driver.swipe(529, 921, 185, 921)
await sleep(4000);
await driver.click(142,749);
await sleep(2000);
})
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_0600 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_0600 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_0600 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_0600 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_0600 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility");
expect(data.parameters.bundleName).assertEqual("textirelyhap.com.example");
expect(data.parameters.type).assertEqual("text/txt");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_0600 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_0700
* @tc.name: Install one text type matching app
* @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_0700', 0, async function (done) {
console.log("ACTS_AppSelectorTest_0700 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;'
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;"
console.log('ACTS_AppSelectorTest_0700 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_0700 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_0700 startAbility end");
commonEvent.subscribe(subscriber, SubscribeCallBack)
await sleep(4000);
let button = await driver.findComponent(BY.text('imagebrelyhap').enabled(true))
console.log("ACTS_AppSelectorTest_0700 button " + JSON.stringify(button));
await sleep(4000);
let rectSerial = await driver.findComponent(BY.text('使用以下方式打开').enabled(true))
console.log("ACTS_AppSelectorTest_0700 rectSerial " + JSON.stringify(rectSerial));
await rectSerial.click();
await sleep(2000);
console.log("ACTS_AppSelectorTest_0700 findComponent");
await sleep(4000);
await button.click();
await sleep(2000);
})
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_0700 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_0700 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_0700 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_0700 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_0700 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility1");
expect(data.parameters.bundleName).assertEqual("imagebrelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_0700 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_0800
* @tc.name: Install one text type matching app
* @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_0800', 0, async function (done) {
console.log("ACTS_AppSelectorTest_0800 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;'
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;"
console.log('ACTS_AppSelectorTest_0800 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_0800 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_0800 startAbility end");
await sleep(4000);
console.log("ACTS_AppSelectorTest_0800 findComponent");
let button = await driver.findComponent(BY.text('取消').enabled(true))
console.log("ACTS_AppSelectorTest_0800 button " + JSON.stringify(button));
await sleep(4000);
await button.click();
await sleep(2000);
done();
})
})
/*
* @tc.number: ACTS_AppSelectorTest_0900
* @tc.name: Install one text type matching app
* @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_0900', 0, async function (done) {
console.log("ACTS_AppSelectorTest_0900 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' +
'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextBRelyHap.hap;' +
'bm install -p /data/ActsServiceAbilityARelyHap.hap;'
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" +
"bm uninstall -n textarelyhap.com.example;bm uninstall -n textbrelyhap.com.example;" +
"bm uninstall -n aserviceabilityrelyhap;"
console.log('ACTS_AppSelectorTest_0900 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(1000);
console.info("ACTS_AppSelectorTest_0900 Service servStart");
let connectionId;
let want = {
"bundleName": "aserviceabilityrelyhap",
"abilityName": "ServiceAbility"
};
connectionId = globalThis.abilityContext.connectAbility(want, paConnect)
console.info('ACTS_AppSelectorTest_0900 Service connectionId ' + connectionId);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, SubscribeCallBack)
await sleep(2000);
console.log("ACTS_AppSelectorTest_0900 findComponent");
let button = await driver.findComponent(BY.text('textbrelyhap.com.example').enabled(true))
console.log("ACTS_AppSelectorTest_0900 button " + JSON.stringify(button));
await sleep(4000);
await button.click();
await sleep(4000);
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_0900 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_0900 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_0900 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_0900 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_0900 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility");
expect(data.parameters.bundleName).assertEqual("textbrelyhap.com.example");
expect(data.parameters.type).assertEqual("text/txt");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_0900 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_1000
* @tc.name: Install one text type matching app
* @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up
*/
it('ACTS_AppSelectorTest_1000', 0, async function (done) {
console.log("ACTS_AppSelectorTest_1000 --- start")
cmdInstall = 'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextBRelyHap.hap;'
cmdUninstall = "bm uninstall -n textarelyhap.com.example;bm uninstall -n textbrelyhap.com.example;"
console.log('ACTS_AppSelectorTest_1000 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(1000);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
globalThis.abilityContext.startAbilityForResult(
{
action: "ohos.want.action.viewData",
type: "text/txt",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.log("ACTS_AppSelectorTest_1000 startAbilityForResult " +
JSON.stringify(error) + "," + JSON.stringify(data));
})
await sleep(4000);
console.log("ACTS_AppSelectorTest_1000 findComponent");
let button = await driver.findComponent(BY.text('textbrelyhap.com.example').enabled(true))
console.log("ACTS_AppSelectorTest_1000 button " + JSON.stringify(button));
commonEvent.subscribe(subscriber, SubscribeCallBack)
await sleep(4000);
await button.click();
await sleep(2000);
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_1000 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_1000 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_1000 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_1000 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_1000 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility");
expect(data.parameters.bundleName).assertEqual("textbrelyhap.com.example");
expect(data.parameters.type).assertEqual("text/txt");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
async function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_1000 UnSubscribeCallBack");
try {
await sleep(2000);
let close = await driver.findComponent(BY.text('取消').enabled(true))
console.log("ACTS_AppSelectorTest_1000 cantOpen2 " + JSON.stringify(close));
await sleep(4000);
await close.click();
await sleep(2000);
done();
} catch (err) {
console.debug("ACTS_AppSelectorTest_1000 catch err: " + JSON.stringify(err));
console.debug("ACTS_AppSelectorTest_1000 catch err: " + err);
expect("").assertFail();
done();
}
}
})
/*
* @tc.number: ACTS_AppSelectorTest_1800
* @tc.name: Install action matches but type does not match app
* @tc.desc: Install action matches but type does not match app,"can't open this file" popup
*/
it('ACTS_AppSelectorTest_1800', 0, async function (done) {
console.log("ACTS_AppSelectorTest_1800 --- start")
cmdInstall = 'bm install -p /data/ActstextARelyHap.hap'
cmdUninstall = "bm uninstall -n textarelyhap.com.example"
console.log('ACTS_AppSelectorTest_1800 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_1800 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_1800 startAbility end");
await sleep(4000);
console.log("ACTS_AppSelectorTest_1800 findComponent");
let cantOpen1 = await driver.findComponent(BY.text('无法打开此文件').enabled(true))
console.log("ACTS_AppSelectorTest_1800 cantOpen1 " + JSON.stringify(cantOpen1));
expect(cantOpen1 != null).assertTrue();
await sleep(4000);
let button = await driver.findComponent(BY.text('知道了').enabled(true))
console.debug("ACTS_ANROptimization_1800 button: " + JSON.stringify(button))
await sleep(4000);
await button.click();
await sleep(2000);
done();
})
})
/*
* @tc.number: ACTS_AppSelectorTest_1900
* @tc.name: Install action does not match but type matches app
* @tc.desc: Install action does not match but type matches app,"can't open this file" popup
*/
it('ACTS_AppSelectorTest_1900', 0, async function (done) {
console.log("ACTS_AppSelectorTest_1900 --- start")
cmdInstall = 'bm install -p /data/ActstextKRelyHap.hap'
cmdUninstall = "bm uninstall -n textkrelyhap.com.example"
console.log('ACTS_AppSelectorTest_1900 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "text/txt",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_1900 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_1900 startAbility end");
await sleep(4000);
console.log("ACTS_AppSelectorTest_1900 findComponent");
let cantOpen1 = await driver.findComponent(BY.text('无法打开此文件').enabled(true))
console.log("ACTS_AppSelectorTest_1900 cantOpen1 " + JSON.stringify(cantOpen1));
expect(cantOpen1 != null).assertTrue();
await sleep(4000);
let button = await driver.findComponent(BY.text('知道了').enabled(true))
console.debug("ACTS_AppSelectorTest_1900 button: " + JSON.stringify(button))
await sleep(4000);
await button.click();
await sleep(2000);
done();
})
})
/*
* @tc.number: ACTS_AppSelectorTest_2000
* @tc.name: Implicitly start the interface action and pass in an empty string
* @tc.desc: Implicitly start the interface action and pass in an empty string,return success
*/
it('ACTS_AppSelectorTest_2000', 0, async function (done) {
console.log("ACTS_AppSelectorTest_2000 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap'
cmdUninstall = "bm uninstall -n imagearelyhap"
console.log('ACTS_AppSelectorTest_2000 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(1000);
globalThis.abilityContext.startAbility(
{
action: "",
type: "image/png",
parameters: {
uri: "filePath"
}
}, (error, data) => {
console.log("ACTS_AppSelectorTest_2000 startAbility " + JSON.stringify(error));
expect(error.code).assertEqual(0);
done();
})
})
/*
* @tc.number: ACTS_AppSelectorTest_2100
* @tc.name: Implicitly start the interface action and pass in null
* @tc.desc: Implicitly start the interface action and pass in null,return failure
*/
it('ACTS_AppSelectorTest_2100', 0, async function (done) {
console.log("ACTS_AppSelectorTest_2100 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap'
cmdUninstall = "bm uninstall -n imagearelyhap"
console.log('ACTS_AppSelectorTest_2100 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(1000);
globalThis.abilityContext.startAbility(
{
action: null,
type: "image/png",
parameters: {
uri: "filePath"
}
}, (error, data) => {
console.log("ACTS_AppSelectorTest_2100 startAbility " + JSON.stringify(error));
expect(error.code).assertEqual(0);
done();
})
})
/*
* @tc.number: ACTS_AppSelector_2200
* @tc.name: Implicitly start the interface action and pass in undefined
* @tc.desc: Implicitly start the interface action and pass in undefined,return success
*/
it('ACTS_AppSelectorTest_2200', 0, async function (done) {
console.log("ACTS_AppSelectorTest_2200 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap'
cmdUninstall = "bm uninstall -n imagearelyhap"
console.log('ACTS_AppSelectorTest_2200 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
globalThis.abilityContext.startAbility(
{
action: undefined,
type: "image/png",
parameters: {
uri: "filePath"
}
}, (error, data) => {
console.log("ACTS_AppSelectorTest_2200 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
expect(error.code).assertEqual(0);
done();
})
})
/*
* @tc.number: ACTS_AppSelectorTest_2300
* @tc.name: Implicitly start the interface type and pass in an empty string
* @tc.desc: Implicitly start the interface type and pass in an empty string,return failure
*/
it('ACTS_AppSelectorTest_2300', 0, async function (done) {
console.log("ACTS_AppSelectorTest_2300 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap'
cmdUninstall = "bm uninstall -n imagearelyhap"
console.log('ACTS_AppSelectorTest_2300 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.log("ACTS_AppSelectorTest_2300 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
expect(error.code).assertEqual(16000050);
await sleep(4000);
let button = await driver.findComponent(BY.text('知道了').enabled(true))
console.debug("ACTS_AppSelectorTest_2300 button: " + JSON.stringify(button))
console.debug("ACTS_AppSelectorTest_2300 click");
await sleep(4000);
await button.click();
await sleep(2000);
done();
})
})
/*
* @tc.number: ACTS_AppSelectorTest_2400
* @tc.name: Implicitly start the interface type and pass in null
* @tc.desc: Implicitly start the interface type and pass in null,return failure
*/
it('ACTS_AppSelectorTest_2400', 0, async function (done) {
console.log("ACTS_AppSelectorTest_2400 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap'
cmdUninstall = "bm uninstall -n imagearelyhap"
console.log('ACTS_AppSelectorTest_2400 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: null,
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.log("ACTS_AppSelectorTest_2400 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
expect(error.code).assertEqual(16000050);
await sleep(4000);
let button = await driver.findComponent(BY.text('知道了').enabled(true))
console.debug("ACTS_AppSelectorTest_2400 button: " + JSON.stringify(button))
console.debug("ACTS_AppSelectorTest_2400 click");
await sleep(4000);
await button.click();
await sleep(2000);
done();
})
})
/*
* @tc.number: ACTS_AppSelectorTest_2500
* @tc.name: Implicitly start the interface type and pass in undefined
* @tc.desc: Implicitly start the interface type and pass in undefined,return failure
*/
it('ACTS_AppSelectorTest_2500', 0, async function (done) {
console.log("ACTS_AppSelectorTest_2500 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap'
cmdUninstall = "bm uninstall -n imagearelyhap"
console.log('ACTS_AppSelectorTest_2500 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: undefined,
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.log("ACTS_AppSelectorTest_2500 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
expect(error.code).assertEqual(16000050);
await sleep(4000);
let button = await driver.findComponent(BY.text('知道了').enabled(true))
console.debug("ACTS_AppSelectorTest_2500 button: " + JSON.stringify(button))
console.debug("ACTS_AppSelectorTest_2500 click");
await sleep(4000);
await button.click();
await sleep(2000);
done();
})
})
/*
* @tc.number: ACTS_AppSelectorTest_2600
* @tc.name: Multi-hap application with action and type configured in entry
* @tc.desc: Multi-hap application with action and type configured in entry,MainAbility is pulled up in entry
*/
it('ACTS_AppSelectorTest_2600', 0, async function (done) {
console.log("ACTS_AppSelectorTest_2600 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageAFeatureRelyHap.hap'
cmdUninstall = "bm uninstall -n imagearelyhap"
console.log('ACTS_AppSelectorTest_2600 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, (error, data) => {
console.debug("ACTS_AppSelectorTest_2600 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_2600 startAbility end");
})
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, SubscribeCallBack)
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_2600 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_2600 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_2600 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_2600 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_2600 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility");
expect(data.parameters.bundleName).assertEqual("imagearelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_2600 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_2700
* @tc.name: Multi-hap application with action and type configured in feature
* @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature
*/
it('ACTS_AppSelectorTest_2700', 0, async function (done) {
console.log("ACTS_AppSelectorTest_2700 --- start")
cmdInstall = 'bm install -p /data/ActsImageBFeatureRelyHap.hap;bm install -p /data/ActsImageBEntryRelyHap.hap'
cmdUninstall = "bm uninstall -n imagebrelyhap"
console.log('ACTS_AppSelectorTest_2700 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, (error, data) => {
console.debug("ACTS_AppSelectorTest_2700 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_2700 startAbility end");
})
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, SubscribeCallBack)
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_2700 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_2700 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_2700 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_2700 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_2700 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility1");
expect(data.parameters.bundleName).assertEqual("imagebrelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_2700 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_2800
* @tc.name: Multi-hap application with action and type configured in feature
* @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature
*/
it('ACTS_AppSelectorTest_2800', 0, async function (done) {
console.log("ACTS_AppSelectorTest_2800 --- start")
cmdInstall = 'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageCFeatureRelyHap.hap'
cmdUninstall = "bm uninstall -n imagecrelyhap"
console.log('ACTS_AppSelectorTest_2800 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(1000);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_2800 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_2800 startAbility end");
await sleep(4000);
console.log("ACTS_AppSelectorTest_2800 findComponent");
let button = await driver.findComponent(BY.text('imagecrelyhap').enabled(true))
console.log("ACTS_AppSelectorTest_2800 button " + JSON.stringify(button));
commonEvent.subscribe(subscriber, SubscribeCallBack)
await sleep(4000);
await button.click();
await sleep(2000);
})
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_2800 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_2800 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_2800 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_2800 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_2800 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility");
expect(data.parameters.bundleName).assertEqual("imagecrelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_2800 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_2900
* @tc.name: MainAbility configures multi-ability applications of actions and types
* @tc.desc: MainAbility configures multi-ability applications of actions and types,mainAbility is pulled up
*/
it('ACTS_AppSelectorTest_2900', 0, async function (done) {
console.log("ACTS_AppSelectorTest_2900 --- start")
cmdInstall = 'bm install -p /data/ActsImageDRelyHap.hap'
cmdUninstall = "bm uninstall -n imagedrelyhap"
console.log('ACTS_AppSelectorTest_2900 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, (error, data) => {
console.debug("ACTS_AppSelectorTest_2900 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_2900 startAbility end");
})
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, SubscribeCallBack)
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_2900 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_2900 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_2900 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_2900 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_2900 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility");
expect(data.parameters.bundleName).assertEqual("imagedrelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_2900 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_3000
* @tc.name: SecondAbility configures multi-ability applications of actions and types
* @tc.desc: SecondAbility configures multi-ability applications of actions and types,secondAbility is pulled up
*/
it('ACTS_AppSelectorTest_3000', 0, async function (done) {
console.log("ACTS_AppSelectorTest_3000 --- start")
cmdInstall = 'bm install -p /data/ActsImageERelyHap.hap'
cmdUninstall = "bm uninstall -n imageerelyhap"
console.log('ACTS_AppSelectorTest_3000 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(1000);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, (error, data) => {
console.debug("ACTS_AppSelectorTest_3000 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_3000 startAbility end");
})
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, SubscribeCallBack)
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_3000 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_3000 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_3000 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_3000 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_3000 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("SecondAbility");
expect(data.parameters.bundleName).assertEqual("imageerelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_3000 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_3100
* @tc.name: Multi-hap application with action and type configured in feature
* @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature
*/
it('ACTS_AppSelectorTest_3100', 0, async function (done) {
console.log("ACTS_AppSelectorTest_3100 --- start")
cmdInstall = 'bm install -p /data/ActsImageFRelyHap.hap'
cmdUninstall = "bm uninstall -n imagefrelyhap"
console.log('ACTS_AppSelectorTest_3100 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(1000);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.debug("ACTS_AppSelectorTest_3100 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.debug("ACTS_AppSelectorTest_3100 startAbility end");
await sleep(4000);
console.log("ACTS_AppSelectorTest_3100 findComponent");
let button = await driver.findComponent(BY.text('imagefrelyhap').enabled(true))
console.log("ACTS_AppSelectorTest_3100 button " + JSON.stringify(button));
commonEvent.subscribe(subscriber, SubscribeCallBack)
await sleep(4000);
await button.click();
await sleep(2000);
})
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_3100 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_3100 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_3100 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_3100 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_3100 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility");
expect(data.parameters.bundleName).assertEqual("imagefrelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_3100 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_3400
* @tc.name: Multi-hap application with action and type configured in feature
* @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature
*/
it('ACTS_AppSelectorTest_3400', 0, async function (done) {
console.log("ACTS_AppSelectorTest_3400 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap'
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap"
console.log('ACTS_AppSelectorTest_3400 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, SubscribeCallBack)
globalThis.abilityContext.startAbilityWithAccount(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, 100, (error, data) => {
console.log("ACTS_AppSelectorManual startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
})
await sleep(4000);
console.log("ACTS_AppSelectorTest_3400 findComponent");
let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true))
console.log("ACTS_AppSelectorTest_3400 button " + JSON.stringify(button));
await sleep(4000);
await button.click();
await sleep(2000);
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_3400 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_3400 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_3400 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_3400 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_3400 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility");
expect(data.parameters.bundleName).assertEqual("imagearelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_3400 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_3500
* @tc.name: Multi-hap application with action and type configured in feature
* @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature
*/
it('ACTS_AppSelectorTest_3500', 0, async function (done) {
console.log("ACTS_AppSelectorTest_3500 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap'
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap"
console.log('ACTS_AppSelectorTest_3500 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, SubscribeCallBack)
globalThis.abilityContext.startAbilityForResultWithAccount(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, 100, (error, data) => {
console.log("ACTS_AppSelectorManual startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
})
await sleep(4000);
console.log("ACTS_AppSelectorTest_3500 findComponent");
let button = await driver.findComponent(BY.text('imagebrelyhap').enabled(true))
console.log("ACTS_AppSelectorTest_3500 button " + JSON.stringify(button));
await sleep(4000);
await button.click();
await sleep(2000);
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_3500 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_3500 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_3500 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_3500 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_3500 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility1");
expect(data.parameters.bundleName).assertEqual("imagebrelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_3500 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_3600
* @tc.name: Multi-hap application with action and type configured in feature
* @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature
*/
it('ACTS_AppSelectorTest_3600', 0, async function (done) {
console.log("ACTS_AppSelectorTest_3600 --- start")
cmdInstall = 'bm install -p /data/ActsServiceAbilityBRelyHap.hap;bm install -p /data/ActsImageKRelyHap.hap'
cmdUninstall = "bm uninstall -n bserviceabilityrelyhap;bm uninstall -n imagekrelyhap"
console.log('ACTS_AppSelectorTest_3600 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
let subscriber = await commonEvent.createSubscriber(subscriberInfo);
commonEvent.subscribe(subscriber, SubscribeCallBack)
console.log("ACTS_AppSelectorTest_3600 connectservice")
let connectionId;
let want = {
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
},
};
connectionId = globalThis.abilityContext.connectAbility(want, paConnect)
console.info('ACTS_AppSelectorTest_3600 Service connectionId ' + connectionId);
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_3600 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_3600 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_3600 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_3600 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_3600 event = ' + data.event);
console.log('ACTS_AppSelectorTest_3600 startByService = ' + data.parameters.startByService);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.startByService).assertEqual(true);
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
}
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_3600 UnSubscribeCallBack");
done();
}
})
/*
* @tc.number: ACTS_AppSelectorTest_3700
* @tc.name: Multi-hap application with action and type configured in feature
* @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature
*/
it('ACTS_AppSelectorTest_3700', 0, async function (done) {
console.log("ACTS_AppSelectorTest_3700 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' +
'bm install -p /data/ActsAppSelectorRelyHap.hap'
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" +
"bm uninstall -n com.example.appselectorrelyhap"
console.log('ACTS_AppSelectorTest_3700 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(1000);
globalThis.abilityContext.startAbility(
{
bundleName: "com.example.appselectorrelyhap",
abilityName: "MainAbility",
}, (error, data) => {
console.log("ACTS_AppSelectorTest_3700 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
})
await sleep(4000);
let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true))
console.log("ACTS_AppSelectorTest_3700 button " + JSON.stringify(button));
var cmd = 'bm uninstall -n com.example.appselectorrelyhap ';
console.log('ACTS_AppSelectorTest_3700 cmd = ' + cmd);
abilityDelegator.executeShellCommand(cmd,
async (err: any, d: any) => {
console.info('ACTS_AppSelectorTest_3700 executeShellCommand : err : ' + JSON.stringify(err));
console.info('ACTS_AppSelectorTest_3700 executeShellCommand : stdResult : ' + d.stdResult);
console.info('ACTS_AppSelectorTest_3700 executeShellCommand : exitCode : ' + d.exitCode);
await sleep(4000);
await button.click();
await sleep(2000);
done();
})
})
/*
* @tc.number: ACTS_AppSelectorTest_3300
* @tc.name: Multi-hap application with action and type configured in feature
* @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature
*/
it('ACTS_AppSelectorTest_3300', 0, async function (done) {
console.log("ACTS_AppSelectorTest_3300 --- start")
cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap'
cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap"
let subscriber;
console.log('ACTS_AppSelectorTest_3300 cmd = ' + cmdInstall);
await abilityDelegator.executeShellCommand(cmdInstall);
await sleep(2000);
for (var i = 0; i < 10; i++) {
await sleep(2000);
subscriber = await commonEvent.createSubscriber(subscriberInfo);
globalThis.abilityContext.startAbility(
{
action: "ohos.want.action.viewData",
type: "image/png",
parameters: {
uri: "filePath"
}
}, async (error, data) => {
console.log("ACTS_AppSelectorTest_3300 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
})
commonEvent.subscribe(subscriber, SubscribeCallBack);
await sleep(4000);
console.log("ACTS_AppSelectorTest_3300 findComponent");
let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true))
console.log("ACTS_AppSelectorTest_3300 button " + JSON.stringify(button));
await sleep(4000);
await button.click();
await sleep(2000);
async function SubscribeCallBack(err, data) {
console.log('ACTS_AppSelectorTest_3300 bundleName = ' + data.parameters.bundleName);
console.log('ACTS_AppSelectorTest_3300 abilityName = ' + data.parameters.abilityName);
console.log('ACTS_AppSelectorTest_3300 type = ' + data.parameters.type);
console.log('ACTS_AppSelectorTest_3300 uri = ' + data.parameters.uri);
console.log('ACTS_AppSelectorTest_3300 event = ' + data.event);
expect(data.event).assertEqual("AppSelector");
expect(data.parameters.abilityName).assertEqual("MainAbility");
expect(data.parameters.bundleName).assertEqual("imagearelyhap");
expect(data.parameters.type).assertEqual("image/png");
expect(data.parameters.uri).assertEqual("filePath");
}
}
await sleep(2000);
commonEvent.unsubscribe(subscriber, UnSubscribeCallBack)
function UnSubscribeCallBack() {
console.log("ACTS_AppSelectorTest_3300 UnSubscribeCallBack");
done();
}
})
})
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import abilityTest from './Ability.test'
export default function testsuite() {
abilityTest()
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"requestPermissions": [
{
"name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
},
{
"name":"ohos.permission.START_INVISIBLE_ABILITY",
"reason":"need use 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": "app_name",
"value": "AppSelectorTest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "imagearelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "imageARelyHap"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsImageAEntryRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsImageAEntryRelyHap"
testonly = true
deps = [
":actsimageaentryrelyhap_js_assets",
":actsimageaentryrelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsimageaentryrelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsimageaentryrelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsimageaentryrelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsimageaentryrelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagearelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>imagearelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageAEntryRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "image/png"
}
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "imagearelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "imageARelyHap"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsImageAFeatureRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsImageAFeatureRelyHap"
testonly = true
deps = [
":actsimageafeaturerelyhap_js_assets",
":actsimageafeaturerelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsimageafeaturerelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsimageafeaturerelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsimageafeaturerelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsimageafeaturerelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagearelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>imagearelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageAFeatureRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "feature",
"type": "feature",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:feature_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility1",
"srcEntrance": "./ets/MainAbility1/MainAbility1.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "feature_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "imagebrelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "imageBRelyHap"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsImageBEntryRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsImageBEntryRelyHap"
testonly = true
deps = [
":actsimagebentryrelyhap_js_assets",
":actsimagebentryrelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsimagebentryrelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsimagebentryrelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsimagebentryrelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsimagebentryrelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagebrelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>ACTS_AppSelectorTest imagebrelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageBEntryRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "imagebrelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "imageBRelyHap"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsImageBFeatureRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsImageBFeatureRelyHap"
testonly = true
deps = [
":actsimagebfeaturerelyhap_js_assets",
":actsimagebfeaturerelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsimagebfeaturerelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsimagebfeaturerelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsimagebfeaturerelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsimagebfeaturerelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagebrelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>ACTS_AppSelectorTest imagebrelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageBFeatureRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "feature",
"type": "feature",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:feature_desc",
"mainElement": "MainAbility1",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility1",
"srcEntrance": "./ets/MainAbility1/MainAbility1.ts",
"description": "$string:MainAbility1_desc",
"icon": "$media:icon",
"label": "$string:MainAbility1_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "image/png"
}
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "feature_desc",
"value": "description"
},
{
"name": "MainAbility1_desc",
"value": "description"
},
{
"name": "MainAbility1_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "imagecrelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "imageCRelyHap"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsImageCEntryRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsImageCEntryRelyHap"
testonly = true
deps = [
":actsimagecentryrelyhap_js_assets",
":actsimagecentryrelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsimagecentryrelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsimagecentryrelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsimagecentryrelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsimagecentryrelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagearelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>imagearelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageCEntryRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "image/png"
}
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "imagecrelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "imageCRelyHap"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsImageCFeatureRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsImageCFeatureRelyHap"
testonly = true
deps = [
":actsimagecfeaturerelyhap_js_assets",
":actsimagecfeaturerelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsimagecfeaturerelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsimagecfeaturerelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsimagecfeaturerelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsimagecfeaturerelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagearelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>imagearelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageCFeatureRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "feature",
"type": "feature",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:feature_desc",
"mainElement": "MainAbility1",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility1",
"srcEntrance": "./ets/MainAbility1/MainAbility1.ts",
"description": "$string:MainAbility1_desc",
"icon": "$media:icon",
"label": "$string:MainAbility1_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "image/png"
}
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "feature_desc",
"value": "description"
},
{
"name": "MainAbility1_desc",
"value": "description"
},
{
"name": "MainAbility1_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "imagedrelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "imageDRelyHap"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsImageDRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsImageDRelyHap"
testonly = true
deps = [
":actsimagedrelyhap_js_assets",
":actsimagedrelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsimagedrelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsimagedrelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsimagedrelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsimagedrelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagearelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>imagearelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class SecondAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagearelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>imagearelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageDRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "image/png"
}
]
}
]
},
{
"name": "SecondAbility",
"srcEntrance": "./ets/SecondAbility/SecondAbility.ts",
"description": "$string:SecondAbility_desc",
"icon": "$media:icon",
"label": "$string:SecondAbility_label",
"visible": true,
"skills": [
{
"actions": [
"action.system.home"
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "SecondAbility_desc",
"value": "description"
},
{
"name": "SecondAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "imageerelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "imageERelyHap"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsImageERelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsImageERelyHap"
testonly = true
deps = [
":actsimageerelyhap_js_assets",
":actsimageerelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsimageerelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsimageerelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsimageerelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsimageerelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagearelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>imagearelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class SecondAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] SecondAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] SecondAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] SecondAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] SecondAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] SecondAbility onForeground")
console.log("[Demo] SecondAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imageerelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>imageerelyhap SecondAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] SecondAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageERelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
},
{
"name": "SecondAbility",
"srcEntrance": "./ets/SecondAbility/SecondAbility.ts",
"description": "$string:SecondAbility_desc",
"icon": "$media:icon",
"visible": true,
"label": "$string:SecondAbility_label",
"skills": [
{
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "image/png"
}
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "SecondAbility_desc",
"value": "description"
},
{
"name": "SecondAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "imagefrelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsImageFRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsImageFRelyHap"
testonly = true
deps = [
":actsimagefrelyhap_js_assets",
":actsimagefrelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsimagefrelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsimagefrelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsimagefrelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsimagefrelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagearelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>imagearelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class SecondAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagearelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>imagearelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageFRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "image/png"
}
]
}
]
},
{
"name": "SecondAbility",
"srcEntrance": "./ets/SecondAbility/SecondAbility.ts",
"description": "$string:SecondAbility_desc",
"icon": "$media:icon",
"label": "$string:SecondAbility_label",
"visible": true,
"skills": [
{
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "image/png"
}
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "SecondAbility_desc",
"value": "description"
},
{
"name": "SecondAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "imagegrelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "imageGRelyHap"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsImageGRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsImageGRelyHap"
testonly = true
deps = [
":actsimagegrelyhap_js_assets",
":actsimagegrelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsimagegrelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsimagegrelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsimagegrelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsimagegrelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagearelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>imagearelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
import file from '@system.file';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('MainAbility index aboutToAppear')
}
@State message: string = 'MainAbility'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageGRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "image/png"
}
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "imagehrelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsImageHRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsImageHRelyHap"
testonly = true
deps = [
":actsimagehrelyhap_js_assets",
":actsimagehrelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsimagehrelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsimagehrelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsimagehrelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsimagehrelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagearelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>imagearelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
import file from '@system.file';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('MainAbility index aboutToAppear')
}
@State message: string = 'MainAbility'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageHRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "image/png"
}
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "imageirelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "imageIRelyHap"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsImageIRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsImageIRelyHap"
testonly = true
deps = [
":actsimageirelyhap_js_assets",
":actsimageirelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsimageirelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsimageirelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsimageirelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsimageirelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagearelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>imagearelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
import file from '@system.file';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('MainAbility index aboutToAppear')
}
@State message: string = 'MainAbility'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageIRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "image/png"
}
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "imagejrelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "imageJRelyHap"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsImageJRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsImageJRelyHap"
deps = [
":actsimagejrelyhap_js_assets",
":actsimagejrelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsimagejrelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsimagejrelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsimagejrelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsimagejrelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
// windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
import file from '@system.file';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('MainAbility index aboutToAppear')
}
@State message: string = 'MainAbility'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageJRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "image/jpeg"
}
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "imagekrelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "imageKRelyHap"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsImageKRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsImageKRelyHap"
testonly = true
deps = [
":actsimagekrelyhap_js_assets",
":actsimagekrelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsimagekrelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsimagekrelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsimagekrelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsimagekrelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
if (want.parameters.startByService) {
AppStorage.SetOrCreate('startByService', want.parameters.startByService);
}
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant))
let commonEventData = {
code: 0,
data: 'imagekrelyhap',
parameters: {
abilityName: globalThis.abilityWant.abilityName,
bundleName: globalThis.abilityWant.bundleName,
type: globalThis.abilityWant.type,
uri: globalThis.abilityWant.parameters.uri,
startByService:globalThis.abilityWant.parameters.startByService
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>imagekrelyhap MainAbility published<======')
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageKRelyHap'
@StorageLink('startByService') startByService: boolean = false;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("startByService: " + this.startByService)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageKRelyHap'
@StorageLink('startByService') startByService: boolean = false;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("startByService: " + this.startByService)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "aserviceabilityrelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsServiceAbilityARelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsServiceAbilityARelyHap"
testonly = true
deps = [
":actsserviceabilityarelyhap_js_assets",
":actsserviceabilityarelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsserviceabilityarelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsserviceabilityarelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsserviceabilityarelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsserviceabilityarelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log('MainAbility onCreate')
globalThis.abilityWant = want;
}
onDestroy() {
console.log('MainAbility onDestroy')
}
onWindowStageCreate(windowStage) {
console.log('MainAbility onWindowStageCreate')
windowStage.setUIContent(this.context, 'MainAbility/pages/index', null)
}
onWindowStageDestroy() {
console.log('MainAbility onWindowStageDestroy')
}
onForeground() {
console.log('MainAbility onForeground')
}
onBackground() {
console.log('MainAbility onBackground')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageAEntryRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility'
import rpc from "@ohos.rpc";
import Want from '@ohos.application.Want';
export default class ServiceAbility extends ServiceExtensionAbility {
onCreate(want) {
console.log('AppSelector ServiceAbility onCreate, want: ' + want.abilityName);
}
onConnect(want: Want) {
console.log('AppSelector ServiceAbility onConnect, want:' + want.abilityName);
this.context.startAbility(
{
action: "ohos.want.action.viewData",
type: "text/txt",
parameters: {
uri: "filePath"
}
}, (error, data) => {
console.info("ACTS_AppSelector_0900 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.info("ACTS_AppSelector_0900 startAbility end");
})
return new rpc.RemoteObject('connect');
}
onDisconnect(want) {
console.log('AppSelector ServiceAbility onDisconnect, want:' + want.abilityName);
}
onDestroy() {
console.log('ServiceAbility onDestroy');
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onStart() {
console.info('ServiceAbility onStart');
},
onStop() {
console.info('ServiceAbility onStop');
},
onCommand(want, startId) {
console.info('ServiceAbility onCommand');
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageAEntryRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "ServiceAbility",
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"label": "$string:service_ServiceAbility_desc",
"description": "$string:service_ServiceAbility_desc",
"type": "service|dataShare",
"visible": true
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "app_name",
"value": "actsserviceabilityarelyhap"
},
{
"name": "description_application",
"value": "demo for test"
},
{
"name": "service_ServiceAbility_desc",
"value": "service_description"
},
{
"name": "service_ServiceAbility_label",
"value": "service_label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "bserviceabilityrelyhap",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsServiceAbilityBRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsServiceAbilityBRelyHap"
testonly = true
deps = [
":actsserviceabilitybrelyhap_js_assets",
":actsserviceabilitybrelyhap_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsserviceabilitybrelyhap_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsserviceabilitybrelyhap_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsserviceabilitybrelyhap_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsserviceabilitybrelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log('MainAbility onCreate')
globalThis.abilityWant = want;
globalThis.abilityContext = this.context;
}
onDestroy() {
console.log('MainAbility onDestroy')
}
onWindowStageCreate(windowStage) {
console.log('MainAbility onWindowStageCreate')
windowStage.setUIContent(this.context, 'MainAbility/pages/index', null)
}
onWindowStageDestroy() {
console.log('MainAbility onWindowStageDestroy')
}
onForeground() {
console.log('MainAbility onForeground')
}
onBackground() {
console.log('MainAbility onBackground')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility'
import rpc from "@ohos.rpc";
import Want from '@ohos.application.Want';
// import commonEvent from '@ohos.commonEvent'
export default class ServiceAbility extends ServiceExtensionAbility {
onCreate(want) {
console.log('AppSelector ServiceAbility onCreate, want: ' + want.abilityName);
}
onConnect(want: Want) {
console.log('AppSelector ServiceAbility onConnect, want:' + want.abilityName);
this.context.startAbility(
{
"bundleName": "imagekrelyhap",
"abilityName": "MainAbility",
parameters: {
startByService: true
}
}, (error, data) => {
console.info("ACTS_AppSelector_3600 startAbility " +
JSON.stringify(error) + "," + JSON.stringify(data));
console.info("ACTS_AppSelector_3600 startAbility end");
})
// console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want))
// let commonEventData = {
// code: 0,
// data: 'imagekrelyhap',
// parameters: {
// abilityName: want.abilityName,
// bundleName: want.bundleName,
// type: want.type,
// uri: want.parameters.uri,
// startByService:want.parameters.startByService
// }
// }
// commonEvent.publish('AppSelector', commonEventData, (err) => {
// console.log('======>imagekrelyhap MainAbility published<======')
// })
return new rpc.RemoteObject('connect');
}
onDisconnect(want) {
console.log('AppSelector ServiceAbility onDisconnect, want:' + want.abilityName);
}
onDestroy() {
console.log('ServiceAbility onDestroy');
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onStart() {
console.info('ServiceAbility onStart');
},
onStop() {
console.info('ServiceAbility onStop');
},
onCommand(want, startId) {
console.info('ServiceAbility onCommand');
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'imageAEntryRelyHap'
@StorageLink('bundleName') bundleName: string = null;
@StorageLink('abilityName') abilityName: string = null;
@StorageLink('type') type: string = null;
@StorageLink('uri') uri: string = null;
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"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": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "ServiceAbility",
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"label": "$string:service_ServiceAbility_label",
"description": "$string:service_ServiceAbility_desc",
"type": "service|dataShare",
"visible": true,
"skills": [
{
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "image/png"
}
]
}
]
}
],
"requestPermissions": [
{
"name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "app_name",
"value": "actsserviceabilitybrelyhap"
},
{
"name": "description_application",
"value": "demo for test"
},
{
"name": "service_ServiceAbility_desc",
"value": "service_description"
},
{
"name": "service_ServiceAbility_label",
"value": "service_label"
}
]
}
\ No newline at end of file
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActstextARelyHap") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActstextARelyHap"
js_build_mode = "debug"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"app": {
"vendor": "example",
"bundleName": "textarelyhap.com.example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 8,
"releaseType": "Release",
"target": 8
}
},
"deviceConfig": {},
"module": {
"mainAbility": ".MainAbility",
"deviceType": [
"default",
"tablet"
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "text/txt"
}
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"formsEnabled": false,
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "standard"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.example.entry",
"srcPath": "",
"name": ".entry",
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from "@ohos.ability.featureAbility"
import commonEvent from '@ohos.commonEvent'
export default {
onCreate() {
var want;
console.info('Application onCreate')
try{
featureAbility.getWant((err, data) => {
want = data;
try{
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want))
let commonEventData = {
code: 0,
data: 'textarelyhap',
parameters: {
abilityName: want.abilityName,
bundleName: want.bundleName,
type: want.type,
uri:want.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>textarelyhap MainAbility published<======')
})
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}catch(error)
{
console.info('Application onCreate error ='+ error);
AppStorage.SetOrCreate('err1', error.message);
}
});
}catch(err)
{
console.info('Application onCreate err ='+ err);
AppStorage.SetOrCreate('err2', err.message);
}
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'textARelyHap'
@StorageLink('bundleName') bundleName: string = "";
@StorageLink('abilityName') abilityName: string = "";
@StorageLink('type') type: string = "";
@StorageLink('uri') uri: string = "";
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "app_name",
"value": "actstextarelyhap"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActstextBRelyHap") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActstextBRelyHap"
js_build_mode = "debug"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"app": {
"vendor": "example",
"bundleName": "textbrelyhap.com.example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 8,
"releaseType": "Release",
"target": 8
}
},
"deviceConfig": {},
"module": {
"mainAbility": ".MainAbility",
"deviceType": [
"default",
"tablet"
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "text/txt"
}
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"formsEnabled": false,
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "standard"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.example.entry",
"srcPath": "",
"name": ".entry",
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from "@ohos.ability.featureAbility"
import commonEvent from '@ohos.commonEvent'
export default {
onCreate() {
console.info('Application onCreate')
try{
featureAbility.getWant((err, data) => {
var want = data;
try{
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want))
let commonEventData = {
code: 0,
data: 'textbrelyhap',
parameters: {
abilityName: want.abilityName,
bundleName: want.bundleName,
type: want.type,
uri:want.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>textbrelyhap MainAbility published<======')
})
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}catch(error)
{
console.info('Application onCreate error ='+ error);
AppStorage.SetOrCreate('err1', error.message);
}
});
}catch(err)
{
console.info('Application onCreate err ='+ err);
AppStorage.SetOrCreate('err2', err.message);
}
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'textBRelyHap'
@StorageLink('bundleName') bundleName: string = "";
@StorageLink('abilityName') abilityName: string = "";
@StorageLink('type') type: string = "";
@StorageLink('uri') uri: string = "";
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "app_name",
"value": "actsstartrunnertest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActstextCRelyHap") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActstextCRelyHap"
js_build_mode = "debug"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"app": {
"vendor": "example",
"bundleName": "textcrelyhap.com.example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 8,
"releaseType": "Release",
"target": 8
}
},
"deviceConfig": {},
"module": {
"mainAbility": ".MainAbility",
"deviceType": [
"default",
"tablet"
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "text/txt"
}
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"formsEnabled": false,
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "standard"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.example.entry",
"srcPath": "",
"name": ".entry",
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from "@ohos.ability.featureAbility"
import commonEvent from '@ohos.commonEvent'
export default {
onCreate() {
console.info('Application onCreate')
try{
featureAbility.getWant((err, data) => {
var want = data;
try{
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want))
let commonEventData = {
code: 0,
data: 'textcrelyhap',
parameters: {
abilityName: want.abilityName,
bundleName: want.bundleName,
type: want.type,
uri:want.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>textcrelyhap MainAbility published<======')
})
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}catch(error)
{
console.info('Application onCreate error ='+ error);
AppStorage.SetOrCreate('err1', error.message);
}
});
}catch(err)
{
console.info('Application onCreate err ='+ err);
AppStorage.SetOrCreate('err2', err.message);
}
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'textCRelyHap'
@StorageLink('bundleName') bundleName: string = "";
@StorageLink('abilityName') abilityName: string = "";
@StorageLink('type') type: string = "";
@StorageLink('uri') uri: string = "";
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "app_name",
"value": "actsstartrunnertest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActstextDRelyHap") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActstextDRelyHap"
js_build_mode = "debug"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"app": {
"vendor": "example",
"bundleName": "textdrelyhap.com.example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 8,
"releaseType": "Release",
"target": 8
}
},
"deviceConfig": {},
"module": {
"mainAbility": ".MainAbility",
"deviceType": [
"default",
"tablet"
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "text/txt"
}
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"formsEnabled": false,
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "standard"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.example.entry",
"srcPath": "",
"name": ".entry",
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from "@ohos.ability.featureAbility"
import commonEvent from '@ohos.commonEvent'
export default {
onCreate() {
console.info('Application onCreate')
try{
featureAbility.getWant((err, data) => {
var want = data;
try{
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want))
let commonEventData = {
code: 0,
data: 'textdrelyhap',
parameters: {
abilityName: want.abilityName,
bundleName: want.bundleName,
type: want.type,
uri:want.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>textdrelyhap MainAbility published<======')
})
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}catch(error)
{
console.info('Application onCreate error ='+ error);
AppStorage.SetOrCreate('err1', error.message);
}
});
}catch(err)
{
console.info('Application onCreate err ='+ err);
AppStorage.SetOrCreate('err2', err.message);
}
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'textDRelyHap'
@StorageLink('bundleName') bundleName: string = "";
@StorageLink('abilityName') abilityName: string = "";
@StorageLink('type') type: string = "";
@StorageLink('uri') uri: string = "";
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "app_name",
"value": "actsstartrunnertest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActstextERelyHap") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActstextERelyHap"
js_build_mode = "debug"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"app": {
"vendor": "example",
"bundleName": "texterelyhap.com.example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 8,
"releaseType": "Release",
"target": 8
}
},
"deviceConfig": {},
"module": {
"mainAbility": ".MainAbility",
"deviceType": [
"default",
"tablet"
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "text/txt"
}
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"formsEnabled": false,
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "standard"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.example.entry",
"srcPath": "",
"name": ".entry",
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from "@ohos.ability.featureAbility"
import commonEvent from '@ohos.commonEvent'
export default {
onCreate() {
console.info('Application onCreate')
try{
featureAbility.getWant((err, data) => {
var want = data;
try{
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want))
let commonEventData = {
code: 0,
data: 'texterelyhap',
parameters: {
abilityName: want.abilityName,
bundleName: want.bundleName,
type: want.type,
uri:want.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>texterelyhap MainAbility published<======')
})
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}catch(error)
{
console.info('Application onCreate error ='+ error);
AppStorage.SetOrCreate('err1', error.message);
}
});
}catch(err)
{
console.info('Application onCreate err ='+ err);
AppStorage.SetOrCreate('err2', err.message);
}
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'textERelyHap'
@StorageLink('bundleName') bundleName: string = "";
@StorageLink('abilityName') abilityName: string = "";
@StorageLink('type') type: string = "";
@StorageLink('uri') uri: string = "";
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "app_name",
"value": "actsstartrunnertest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActstextFRelyHap") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActstextFRelyHap"
js_build_mode = "debug"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"app": {
"vendor": "example",
"bundleName": "textfrelyhap.com.example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 8,
"releaseType": "Release",
"target": 8
}
},
"deviceConfig": {},
"module": {
"mainAbility": ".MainAbility",
"deviceType": [
"default",
"tablet"
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "text/txt"
}
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"formsEnabled": false,
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "standard"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.example.entry",
"srcPath": "",
"name": ".entry",
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from "@ohos.ability.featureAbility"
import commonEvent from '@ohos.commonEvent'
export default {
onCreate() {
console.info('Application onCreate')
try{
featureAbility.getWant((err, data) => {
var want = data;
try{
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want))
let commonEventData = {
code: 0,
data: 'textfrelyhap',
parameters: {
abilityName: want.abilityName,
bundleName: want.bundleName,
type: want.type,
uri:want.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>textfrelyhap MainAbility published<======')
})
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}catch(error)
{
console.info('Application onCreate error ='+ error);
AppStorage.SetOrCreate('err1', error.message);
}
});
}catch(err)
{
console.info('Application onCreate err ='+ err);
AppStorage.SetOrCreate('err2', err.message);
}
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'textFRelyHap'
@StorageLink('bundleName') bundleName: string = "";
@StorageLink('abilityName') abilityName: string = "";
@StorageLink('type') type: string = "";
@StorageLink('uri') uri: string = "";
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "app_name",
"value": "actsstartrunnertest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActstextGRelyHap") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActstextGRelyHap"
js_build_mode = "debug"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"app": {
"vendor": "example",
"bundleName": "textgrelyhap.com.example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 8,
"releaseType": "Release",
"target": 8
}
},
"deviceConfig": {},
"module": {
"mainAbility": ".MainAbility",
"deviceType": [
"default",
"tablet"
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "text/txt"
}
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"formsEnabled": false,
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "standard"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.example.entry",
"srcPath": "",
"name": ".entry",
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from "@ohos.ability.featureAbility"
import commonEvent from '@ohos.commonEvent'
export default {
onCreate() {
console.info('Application onCreate')
try{
featureAbility.getWant((err, data) => {
var want = data;
try{
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want))
let commonEventData = {
code: 0,
data: 'textgrelyhap',
parameters: {
abilityName: want.abilityName,
bundleName: want.bundleName,
type: want.type,
uri:want.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>textgrelyhap MainAbility published<======')
})
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}catch(error)
{
console.info('Application onCreate error ='+ error);
AppStorage.SetOrCreate('err1', error.message);
}
});
}catch(err)
{
console.info('Application onCreate err ='+ err);
AppStorage.SetOrCreate('err2', err.message);
}
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'textGRelyHap'
@StorageLink('bundleName') bundleName: string = "";
@StorageLink('abilityName') abilityName: string = "";
@StorageLink('type') type: string = "";
@StorageLink('uri') uri: string = "";
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "app_name",
"value": "actsstartrunnertest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActstextHRelyHap") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActstextHRelyHap"
js_build_mode = "debug"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"app": {
"vendor": "example",
"bundleName": "texthrelyhap.com.example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 8,
"releaseType": "Release",
"target": 8
}
},
"deviceConfig": {},
"module": {
"mainAbility": ".MainAbility",
"deviceType": [
"default",
"tablet"
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "text/txt"
}
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"formsEnabled": false,
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "standard"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.example.entry",
"srcPath": "",
"name": ".entry",
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from "@ohos.ability.featureAbility"
import commonEvent from '@ohos.commonEvent'
export default {
onCreate() {
console.info('Application onCreate')
try{
featureAbility.getWant((err, data) => {
var want = data;
try{
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want))
let commonEventData = {
code: 0,
data: 'texthrelyhap',
parameters: {
abilityName: want.abilityName,
bundleName: want.bundleName,
type: want.type,
uri:want.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>texthrelyhap MainAbility published<======')
})
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}catch(error)
{
console.info('Application onCreate error ='+ error);
AppStorage.SetOrCreate('err1', error.message);
}
});
}catch(err)
{
console.info('Application onCreate err ='+ err);
AppStorage.SetOrCreate('err2', err.message);
}
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'textHRelyHap'
@StorageLink('bundleName') bundleName: string = "";
@StorageLink('abilityName') abilityName: string = "";
@StorageLink('type') type: string = "";
@StorageLink('uri') uri: string = "";
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "app_name",
"value": "actsstartrunnertest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActstextIRelyHap") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActstextIRelyHap"
js_build_mode = "debug"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"app": {
"vendor": "example",
"bundleName": "textirelyhap.com.example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 8,
"releaseType": "Release",
"target": 8
}
},
"deviceConfig": {},
"module": {
"mainAbility": ".MainAbility",
"deviceType": [
"default",
"tablet"
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "text/txt"
}
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"formsEnabled": false,
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "standard"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.example.entry",
"srcPath": "",
"name": ".entry",
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from "@ohos.ability.featureAbility"
import commonEvent from '@ohos.commonEvent'
export default {
onCreate() {
console.info('Application onCreate')
try{
featureAbility.getWant((err, data) => {
var want = data;
try{
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want))
let commonEventData = {
code: 0,
data: 'textirelyhap',
parameters: {
abilityName: want.abilityName,
bundleName: want.bundleName,
type: want.type,
uri:want.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>textirelyhap MainAbility published<======')
})
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}catch(error)
{
console.info('Application onCreate error ='+ error);
AppStorage.SetOrCreate('err1', error.message);
}
});
}catch(err)
{
console.info('Application onCreate err ='+ err);
AppStorage.SetOrCreate('err2', err.message);
}
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'textIRelyHap'
@StorageLink('bundleName') bundleName: string = "";
@StorageLink('abilityName') abilityName: string = "";
@StorageLink('type') type: string = "";
@StorageLink('uri') uri: string = "";
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "app_name",
"value": "actsstartrunnertest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActstextJRelyHap") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActstextJRelyHap"
js_build_mode = "debug"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"app": {
"vendor": "example",
"bundleName": "textjrelyhap.com.example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 8,
"releaseType": "Release",
"target": 8
}
},
"deviceConfig": {},
"module": {
"mainAbility": ".MainAbility",
"deviceType": [
"default",
"tablet"
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"type": "text/md"
}
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"formsEnabled": false,
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "standard"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.example.entry",
"srcPath": "",
"name": ".entry",
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import featureAbility from "@ohos.ability.featureAbility"
import commonEvent from '@ohos.commonEvent'
export default {
onCreate() {
console.info('Application onCreate')
try{
featureAbility.getWant((err, data) => {
var want = data;
try{
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want))
let commonEventData = {
code: 0,
data: 'textarelyhap',
parameters: {
abilityName: want.abilityName,
bundleName: want.bundleName,
type: want.type,
uri:want.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>textarelyhap MainAbility published<======')
})
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}catch(error)
{
console.info('Application onCreate error ='+ error);
AppStorage.SetOrCreate('err1', error.message);
}
});
}catch(err)
{
console.info('Application onCreate err ='+ err);
AppStorage.SetOrCreate('err2', err.message);
}
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'textJRelyHap'
@StorageLink('bundleName') bundleName: string = "";
@StorageLink('abilityName') abilityName: string = "";
@StorageLink('type') type: string = "";
@StorageLink('uri') uri: string = "";
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "app_name",
"value": "actsstartrunnertest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActstextKRelyHap") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActstextKRelyHap"
js_build_mode = "debug"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"app": {
"vendor": "example",
"bundleName": "textkrelyhap.com.example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 8,
"releaseType": "Release",
"target": 8
}
},
"deviceConfig": {},
"module": {
"mainAbility": ".MainAbility",
"deviceType": [
"default",
"tablet"
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.getData"
],
"uris": [
{
"type": "text/txt"
}
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"formsEnabled": false,
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "standard"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.example.entry",
"srcPath": "",
"name": ".entry",
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from "@ohos.ability.featureAbility"
import commonEvent from '@ohos.commonEvent'
export default {
onCreate() {
console.info('Application onCreate')
try{
featureAbility.getWant((err, data) => {
var want = data;
try{
console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want))
let commonEventData = {
code: 0,
data: 'textkrelyhap',
parameters: {
abilityName: want.abilityName,
bundleName: want.bundleName,
type: want.type,
uri:want.parameters.uri
}
}
commonEvent.publish('AppSelector', commonEventData, (err) => {
console.log('======>textkrelyhap MainAbility published<======')
})
AppStorage.SetOrCreate('bundleName', want.bundleName);
AppStorage.SetOrCreate('abilityName', want.abilityName);
AppStorage.SetOrCreate('type', want.type);
AppStorage.SetOrCreate('uri', want.parameters.uri);
}catch(error)
{
console.info('Application onCreate error ='+ error);
AppStorage.SetOrCreate('err1', error.message);
}
});
}catch(err)
{
console.info('Application onCreate err ='+ err);
AppStorage.SetOrCreate('err2', err.message);
}
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'textKRelyHap'
@StorageLink('bundleName') bundleName: string = "";
@StorageLink('abilityName') abilityName: string = "";
@StorageLink('type') type: string = "";
@StorageLink('uri') uri: string = "";
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("bundleName: " + this.bundleName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("abilityName: " + this.abilityName)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("type: " + this.type)
.fontSize(25)
.fontWeight(FontWeight.Bold)
Text("uri: " + this.uri)
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
......@@ -1676,41 +1676,6 @@ describe('ActsFeatureAbilityTest', function () {
}
});
/*
* @tc.number ACTS_StartAbility_1400
* @tc.name Start ability through action and entities, which are configured as strings
* @tc.desc Function test
* @tc.level 0
*/
it("ACTS_StartAbility_1400",0, async function(done){
console.info("------------------logMessage ACTS_StartAbility_1400-------------------");
try{
let Want = {
action: "action.system.home",
entities: 'asdfghj'
}
let StartAbilityParameter = {
want:Want
}
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.info('ACTS_StartAbility_1400 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
if(err.code != 0){
expect().assertFail()
done()
}else{
expect(err.code).assertEqual(0)
done()
}
});
}catch(error){
console.info("ACTS_StartAbility_1400 : error = " + error);
expect().assertFail()
done()
}
});
/*
* @tc.number ACTS_StartAbility_1600
* @tc.name Startability input parameter want is {}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册