Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
85f2c7e2
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
85f2c7e2
编写于
7月 21, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 21, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4241 XTS元能力api覆盖
Merge pull request !4241 from chengxingzhen/OpenHarmony-3.1-Release
上级
4af5ee50
6a32e827
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
2324 addition
and
0 deletion
+2324
-0
aafwk/aafwk_standard/BUILD.gn
aafwk/aafwk_standard/BUILD.gn
+1
-0
aafwk/aafwk_standard/faapicover/BUILD.gn
aafwk/aafwk_standard/faapicover/BUILD.gn
+24
-0
aafwk/aafwk_standard/faapicover/faapicoverhaptest/BUILD.gn
aafwk/aafwk_standard/faapicover/faapicoverhaptest/BUILD.gn
+32
-0
aafwk/aafwk_standard/faapicover/faapicoverhaptest/Test.json
aafwk/aafwk_standard/faapicover/faapicoverhaptest/Test.json
+19
-0
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/config.json
...d/faapicover/faapicoverhaptest/entry/src/main/config.json
+72
-0
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/ets/MainAbility/app.ets
.../faapicoverhaptest/entry/src/main/ets/MainAbility/app.ets
+22
-0
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/ets/MainAbility/pages/index.ets
...verhaptest/entry/src/main/ets/MainAbility/pages/index.ets
+52
-0
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
...rhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
+79
-0
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/ets/test/ListTest.ets
...er/faapicoverhaptest/entry/src/main/ets/test/ListTest.ets
+22
-0
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/ets/test/VerificationTest.ets
...coverhaptest/entry/src/main/ets/test/VerificationTest.ets
+552
-0
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/resources/base/element/string.json
...haptest/entry/src/main/resources/base/element/string.json
+16
-0
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/resources/base/media/icon.png
...coverhaptest/entry/src/main/resources/base/media/icon.png
+0
-0
aafwk/aafwk_standard/faapicover/faapicoverhaptest/signature/openharmony_sx.p7b
...faapicover/faapicoverhaptest/signature/openharmony_sx.p7b
+0
-0
aafwk/aafwk_standard/faapicover/faauxiliary/BUILD.gn
aafwk/aafwk_standard/faapicover/faauxiliary/BUILD.gn
+40
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/config.json
...tandard/faapicover/faauxiliary/entry/src/main/config.json
+273
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/FormAbility/form.ts
...icover/faauxiliary/entry/src/main/ets/FormAbility/form.ts
+37
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility/app.ets
...icover/faauxiliary/entry/src/main/ets/MainAbility/app.ets
+65
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility/pages/index.ets
...aauxiliary/entry/src/main/ets/MainAbility/pages/index.ets
+31
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility2/app.ets
...cover/faauxiliary/entry/src/main/ets/MainAbility2/app.ets
+94
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility2/pages/index.ets
...auxiliary/entry/src/main/ets/MainAbility2/pages/index.ets
+31
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility3/app.ets
...cover/faauxiliary/entry/src/main/ets/MainAbility3/app.ets
+55
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility3/pages/index.ets
...auxiliary/entry/src/main/ets/MainAbility3/pages/index.ets
+31
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility4/app.ets
...cover/faauxiliary/entry/src/main/ets/MainAbility4/app.ets
+66
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility4/pages/index.ets
...auxiliary/entry/src/main/ets/MainAbility4/pages/index.ets
+31
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility5/app.ets
...cover/faauxiliary/entry/src/main/ets/MainAbility5/app.ets
+66
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility5/pages/index.ets
...auxiliary/entry/src/main/ets/MainAbility5/pages/index.ets
+31
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility6/app.ets
...cover/faauxiliary/entry/src/main/ets/MainAbility6/app.ets
+66
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility6/pages/index.ets
...auxiliary/entry/src/main/ets/MainAbility6/pages/index.ets
+31
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/ServiceAbility/service.ts
.../faauxiliary/entry/src/main/ets/ServiceAbility/service.ts
+103
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/ServiceAbility2/service.ts
...faauxiliary/entry/src/main/ets/ServiceAbility2/service.ts
+90
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/ServiceAbility3/service.ts
...faauxiliary/entry/src/main/ets/ServiceAbility3/service.ts
+184
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/js/widget/pages/index/index.css
...aauxiliary/entry/src/main/js/widget/pages/index/index.css
+19
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/js/widget/pages/index/index.hml
...aauxiliary/entry/src/main/js/widget/pages/index/index.hml
+7
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/js/widget/pages/index/index.json
...auxiliary/entry/src/main/js/widget/pages/index/index.json
+6
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/resources/base/element/string.json
...xiliary/entry/src/main/resources/base/element/string.json
+76
-0
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/resources/base/media/icon.png
.../faauxiliary/entry/src/main/resources/base/media/icon.png
+0
-0
aafwk/aafwk_standard/faapicover/faauxiliary/signature/openharmony_sx.p7b
...ndard/faapicover/faauxiliary/signature/openharmony_sx.p7b
+0
-0
未找到文件。
aafwk/aafwk_standard/BUILD.gn
浏览文件 @
85f2c7e2
...
...
@@ -27,6 +27,7 @@ group("aafwk_standard") {
"amsgetabilityprocessinfo:amsgetabilityprocessinfo",
"context:context",
"fa:fa",
"faapicover:faapicover",
"featureability:featureability",
"formmanager:formmanager",
"want:want",
...
...
aafwk/aafwk_standard/faapicover/BUILD.gn
0 → 100644
浏览文件 @
85f2c7e2
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
group("faapicover") {
testonly = true
if (is_standard_system) {
deps = [
"faapicoverhaptest:FaApiCoverHapTest",
"faauxiliary:FaAuxiliary",
]
}
}
aafwk/aafwk_standard/faapicover/faapicoverhaptest/BUILD.gn
0 → 100644
浏览文件 @
85f2c7e2
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("FaApiCoverHapTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":faapicoverhaptest_ets_assets",
":faapicoverhaptest_ets_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "FaApiCoverHapTest"
}
ohos_js_assets("faapicoverhaptest_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("faapicoverhaptest_ets_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
aafwk/aafwk_standard/faapicover/faapicoverhaptest/Test.json
0 → 100644
浏览文件 @
85f2c7e2
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"180000"
,
"package"
:
"com.example.faapicoverhaptest"
,
"shell-timeout"
:
"600000"
},
"kits"
:
[
{
"test-file-name"
:
[
"FaApiCoverHapTest.hap"
,
"FaAuxiliary.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/config.json
0 → 100644
浏览文件 @
85f2c7e2
{
"app"
:
{
"vendor"
:
"example"
,
"bundleName"
:
"com.example.faapicoverhaptest"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
9
,
"target"
:
9
}
},
"deviceConfig"
:
{},
"module"
:
{
"mainAbility"
:
".MainAbility"
,
"deviceType"
:
[
"default"
,
"tablet"
],
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"orientation"
:
"unspecified"
,
"visible"
:
true
,
"srcPath"
:
"MainAbility"
,
"name"
:
"com.example.faapicoverhaptest.MainAbility"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility_desc"
,
"formsEnabled"
:
false
,
"label"
:
"$string:MainAbility_label"
,
"type"
:
"page"
,
"launchType"
:
"singleton"
}
],
"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
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/ets/MainAbility/app.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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 {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/ets/MainAbility/pages/index.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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 file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index"
import list from '../../test/ListTest'
@Entry
@Component
struct Index {
@State message: string = 'Hello World FA MainAbility'
aboutToAppear() {
console.info("start run testcase!!!!")
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
const reportExtend = new ReportExtend(file);
core.addService('report', reportExtend);
core.init();
core.subscribeEvent('task', reportExtend);
const configService = core.getDefaultService('config');
configService.setConfig(this)
list();
core.execute();
}
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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 "deccjsunit/index"
import FormInfo from '@ohos.application.formInfo';
import formError from '@ohos.application.formError';
export default function ApiCoverTest() {
describe('ApiCoverTestTest', function () {
/*
* @tc.number SUB_AA_Form_Provider_Test_FormErr_0100
* @tc.name Get all FormError types.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_Form_Provider_Test_FormErr_0100', 0, async function (done) {
console.info("SUB_AA_Form_Provider_Test_FormErr_0100");
expect(7).assertEqual(formError.FormError.ERR_ADD_INVALID_PARAM)
expect(10).assertEqual(formError.FormError.ERR_BIND_PROVIDER_FAILED)
expect(8).assertEqual(formError.FormError.ERR_CFG_NOT_MATCH_ID)
expect(1).assertEqual(formError.FormError.ERR_COMMON)
expect(31).assertEqual(formError.FormError.ERR_FORM_DUPLICATE_ADDED)
expect(20).assertEqual(formError.FormError.ERR_FORM_FA_NOT_INSTALLED)
expect(18).assertEqual(formError.FormError.ERR_FORM_NO_SUCH_ABILITY)
expect(19).assertEqual(formError.FormError.ERR_FORM_NO_SUCH_DIMENSION)
expect(17).assertEqual(formError.FormError.ERR_FORM_NO_SUCH_MODULE)
expect(5).assertEqual(formError.FormError.ERR_GET_BUNDLE_FAILED)
expect(4).assertEqual(formError.FormError.ERR_GET_INFO_FAILED)
expect(6).assertEqual(formError.FormError.ERR_GET_LAYOUT_FAILED)
expect(36).assertEqual(formError.FormError.ERR_IN_RECOVERY)
expect(15).assertEqual(formError.FormError.ERR_MAX_FORMS_PER_CLIENT)
expect(12).assertEqual(formError.FormError.ERR_MAX_INSTANCES_PER_FORM)
expect(11).assertEqual(formError.FormError.ERR_MAX_SYSTEM_FORMS)
expect(16).assertEqual(formError.FormError.ERR_MAX_SYSTEM_TEMP_FORMS)
expect(9).assertEqual(formError.FormError.ERR_NOT_EXIST_ID)
expect(13).assertEqual(formError.FormError.ERR_OPERATION_FORM_NOT_SELF)
expect(2).assertEqual(formError.FormError.ERR_PERMISSION_DENY)
expect(14).assertEqual(formError.FormError.ERR_PROVIDER_DEL_FAIL)
expect(30).assertEqual(formError.FormError.ERR_SYSTEM_RESPONSES_FAILED)
done()
})
/*
* @tc.number SUB_AA_Form_Provider_Test_FormInfo_0100
* @tc.name Get all FormInfo types
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_Form_Provider_Test_FormInfo_0100', 0, async function (done) {
console.info("SUB_AA_Form_Provider_Test_FormInfo_0100");
expect("ohos.extra.param.key.form_dimension").assertEqual(FormInfo.FormParam.DIMENSION_KEY)
expect("ohos.extra.param.key.form_name").assertEqual(FormInfo.FormParam.NAME_KEY)
expect("ohos.extra.param.key.module_name").assertEqual(FormInfo.FormParam.MODULE_NAME_KEY)
expect("ohos.extra.param.key.form_width").assertEqual(FormInfo.FormParam.WIDTH_KEY)
expect("ohos.extra.param.key.form_height").assertEqual(FormInfo.FormParam.HEIGHT_KEY)
expect("ohos.extra.param.key.form_temporary").assertEqual(FormInfo.FormParam.TEMPORARY_KEY)
expect(1).assertEqual(FormInfo.FormType.JS)
expect(-1).assertEqual(FormInfo.ColorMode.MODE_AUTO)
expect(0).assertEqual(FormInfo.ColorMode.MODE_DARK)
expect(1).assertEqual(FormInfo.ColorMode.MODE_LIGHT)
expect(-1).assertEqual(FormInfo.FormState.UNKNOWN)
expect(0).assertEqual(FormInfo.FormState.DEFAULT)
expect(1).assertEqual(FormInfo.FormState.READY)
done();
});
})
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/ets/test/ListTest.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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 apiCoverAbility from './ApiCoverAbility.test'
import verificationTest from './VerificationTest'
export default function List() {
apiCoverAbility()
verificationTest()
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/ets/test/VerificationTest.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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 "deccjsunit/index"
import ability_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
import appManager from "@ohos.application.appManager";
import wantConstant from '@ohos.ability.wantConstant';
import rpc from "@ohos.rpc";
var TAG
export default function verificationTest(){
describe('VerificationTestTest', function() {
/*
* @tc.number SUB_AA_OpenHarmony_Test_HasWindowFocus_0100
* @tc.name Start ability to judge whether there is window focus.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_OpenHarmony_Test_HasWindowFocus_0100', 0, async function(done) {
TAG = 'SUB_AA_OpenHarmony_Test_HasWindowFocus_0100 ==>';
try {
let flags = false
let subscriber = null
let subscribeInfo = {
events: ["Fa_Auxiliary_MainAbility_HasWindowFocus", "Fa_Auxiliary_MainAbility_onDestroy"]
}
function SubscribeInfoCallback(err, data) {
console.info(TAG + "===SubscribeInfoCallback===" + JSON.stringify(data))
if (data.event == "Fa_Auxiliary_MainAbility_HasWindowFocus") {
flags = data.parameters.hasWindowFocus
}
if (data.event == "Fa_Auxiliary_MainAbility_onDestroy") {
expect(flags).assertTrue();
commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback)
}
}
function UnSubscribeInfoCallback(err, data) {
console.info(TAG + "===UnSubscribeInfoCallback===")
done()
}
commonEvent.createSubscriber(subscribeInfo, (err, data) => {
console.info(TAG + "===CreateSubscriberCallback===")
subscriber = data
commonEvent.subscribe(subscriber, SubscribeInfoCallback)
})
let wantNum = {
want: {
bundleName: 'ohos.acts.aafwk.test.faauxiliary',
abilityName: 'ohos.acts.aafwk.test.faauxiliary.MainAbility'
}
}
ability_featureAbility.startAbility(wantNum).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
expect().assertFail();
done();
});
} catch (err) {
console.info(TAG + "catch err = " + JSON.stringify(err));
expect().assertFail();
done();
}
})
/*
* @tc.number SUB_AA_OpenHarmony_Test_RequestPermissionsFromUser_0100
* @tc.name FA model is not configured with permission for authorization verification.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_OpenHarmony_Test_RequestPermissionsFromUser_0100', 0, async function(done) {
TAG = 'SUB_AA_OpenHarmony_Test_RequestPermissionsFromUser_0100 ==>';
try {
let permissionRequestResult = null
let subscriber = null
let subscribeInfo = {
events: ["Fa_Auxiliary_MainAbility2_onCreate", "Fa_Auxiliary_MainAbility2_onDestroy"]
}
function SubscribeInfoCallback(err, data) {
console.info(TAG + "===SubscribeInfoCallback===" + JSON.stringify(data))
if (data.event == "Fa_Auxiliary_MainAbility2_onCreate") {
permissionRequestResult = data.parameters.permissionRequestResult
}
if (data.event == "Fa_Auxiliary_MainAbility2_onDestroy") {
console.info(TAG + "===PermissionRequestResult===" + JSON.stringify(permissionRequestResult))
expect(permissionRequestResult.requestCode).assertEqual(1);
expect(JSON.stringify(permissionRequestResult.permissions)).assertEqual(JSON.stringify(["ohos.permission.CAMERA"]));
expect(JSON.stringify(permissionRequestResult.authResults)).assertEqual(JSON.stringify([2]));
commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback)
}
}
function UnSubscribeInfoCallback(err, data) {
console.info(TAG + "===UnSubscribeInfoCallback===")
done()
}
commonEvent.createSubscriber(subscribeInfo, (err, data) => {
console.info(TAG + "===CreateSubscriberCallback===")
subscriber = data
commonEvent.subscribe(subscriber, SubscribeInfoCallback)
})
let wantNum = {
want: {
bundleName: 'ohos.acts.aafwk.test.faauxiliary',
abilityName: 'ohos.acts.aafwk.test.faauxiliary.MainAbility2'
}
}
ability_featureAbility.startAbility(wantNum).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
expect().assertFail();
done();
});
} catch (err) {
console.info(TAG + "catch err = " + JSON.stringify(err));
expect().assertFail();
done();
}
})
/*
* @tc.number SUB_AA_OpenHarmony_Test_AppManagerTest_0100
* @tc.name Whether the user is conducting stability test verification.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_OpenHarmony_Test_AppManagerTest_0100', 0, async function(done) {
TAG = 'SUB_AA_OpenHarmony_Test_AppManagerTest_0100 ==>';
try {
appManager.isRunningInStabilityTest((err, data) => {
console.info(TAG + "isRunningInStabilityTest err = " + JSON.stringify(err));
console.info(TAG + "isRunningInStabilityTest data = " + data);
expect(data).assertFalse();
done();
})
} catch (err) {
console.info(TAG + "catch err = " + JSON.stringify(err));
expect().assertFail();
done();
}
})
/*
* @tc.number SUB_AA_OpenHarmony_Test_StartAbilityFlags_0100
* @tc.name Validate the input parameter flags of startAbility.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_OpenHarmony_Test_StartAbilityFlags_0100', 0, async function(done) {
TAG = 'SUB_AA_OpenHarmony_Test_StartAbilityFlags_0100 ==>';
try {
let list1 = []
let list2 = ["Fa_Auxiliary_MainAbility4_onDestroy", "Fa_Auxiliary_MainAbility5_onDestroy"]
let number1 = undefined
let number2 = undefined
let number3 = undefined
let code1 = 536870912
let code2 = 2048
let subscriber = null
let subscribeInfo = {
events: ["Fa_Auxiliary_MainAbility4_onCreate", "Fa_Auxiliary_MainAbility4_onDestroy",
"Fa_Auxiliary_MainAbility5_onCreate", "Fa_Auxiliary_MainAbility5_onDestroy"]
}
function SubscribeInfoCallback(err, data) {
console.info(TAG + "===SubscribeInfoCallback===" + JSON.stringify(data))
if (data.event == "Fa_Auxiliary_MainAbility4_onCreate") {
number1 = data.parameters.flags
}
if (data.event == "Fa_Auxiliary_MainAbility5_onCreate") {
number2 = data.parameters.flags
}
if (data.event == "Fa_Auxiliary_MainAbility4_onDestroy") {
list1[0] = "Fa_Auxiliary_MainAbility4_onDestroy"
}
if (data.event == "Fa_Auxiliary_MainAbility5_onDestroy") {
list1[1] = "Fa_Auxiliary_MainAbility5_onDestroy"
}
if (JSON.stringify(list1) == JSON.stringify(list2)) {
expect(number3).assertEqual(1);
expect(number1).assertEqual(code1);
expect(number2).assertEqual(code2);
commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback)
}
}
function UnSubscribeInfoCallback(err, data) {
console.info(TAG + "===UnSubscribeInfoCallback===")
done()
}
commonEvent.createSubscriber(subscribeInfo, (err, data) => {
console.info(TAG + "===CreateSubscriberCallback===")
subscriber = data
commonEvent.subscribe(subscriber, SubscribeInfoCallback)
})
let wantNum1 = {
want: {
bundleName: 'ohos.acts.aafwk.test.faauxiliary',
abilityName: 'ohos.acts.aafwk.test.faauxiliary.MainAbility3',
flags: wantConstant.Flags.FLAG_ABILITY_CONTINUATION
}
}
ability_featureAbility.startAbility(wantNum1).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
number3 = err.code
console.info(TAG + "startAbility err = " + JSON.stringify(err));
});
let wantNum2 = {
want: {
bundleName: 'ohos.acts.aafwk.test.faauxiliary',
abilityName: 'ohos.acts.aafwk.test.faauxiliary.MainAbility4',
flags: wantConstant.Flags.FLAG_ABILITY_MISSION_TOP
}
}
ability_featureAbility.startAbility(wantNum2).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
expect().assertFail();
done();
});
let wantNum3 = {
want: {
bundleName: 'ohos.acts.aafwk.test.faauxiliary',
abilityName: 'ohos.acts.aafwk.test.faauxiliary.MainAbility5',
flags: wantConstant.Flags.FLAG_INSTALL_ON_DEMAND
}
}
ability_featureAbility.startAbility(wantNum3).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
expect().assertFail();
done();
});
} catch (err) {
console.info(TAG + "catch err = " + JSON.stringify(err));
expect().assertFail();
done();
}
})
/*
* @tc.number SUB_AA_OpenHarmony_Test_ServiceAbility_0100
* @tc.name Start and stop serviceability.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_OpenHarmony_Test_ServiceAbility_0100', 0, async function(done) {
TAG = 'SUB_AA_OpenHarmony_Test_ServiceAbility_0100 ==>';
try {
let subscriber = null
let subscribeInfo = {
events: ["Fa_Auxiliary_ServiceAbility_onCommand"]
}
function SubscribeInfoCallback(err, data) {
console.info(TAG + "===SubscribeInfoCallback===" + JSON.stringify(data))
if (data.event == "Fa_Auxiliary_ServiceAbility_onCommand") {
commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback);
}
}
function UnSubscribeInfoCallback(err, data) {
console.info(TAG + "===UnSubscribeInfoCallback===")
done()
}
commonEvent.createSubscriber(subscribeInfo, (err, data) => {
console.info(TAG + "===CreateSubscriberCallback===")
subscriber = data
commonEvent.subscribe(subscriber, SubscribeInfoCallback)
})
let wantNum = {
want: {
bundleName: 'ohos.acts.aafwk.test.faauxiliary',
abilityName: 'ohos.acts.aafwk.test.faauxiliary.ServiceAbility'
}
}
ability_featureAbility.startAbility(wantNum).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
expect().assertFail();
done();
});
} catch (err) {
console.info(TAG + "catch err = " + JSON.stringify(err));
expect().assertFail();
done();
}
})
/*
* @tc.number SUB_AA_OpenHarmony_Test_ServiceAbility_0200
* @tc.name Bind and unbind serviceability.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_OpenHarmony_Test_ServiceAbility_0200', 0, async function(done) {
TAG = 'SUB_AA_OpenHarmony_Test_ServiceAbility_0200 ==>';
try {
let liseList = []
let liseListCheck = ["onConnect","onDisconnect"]
let flag1 = false
let flag2 = false
let flag3 = false
let subscriber = null
let subscribeInfo = {
events: ["Fa_Auxiliary_ServiceAbility2_onConnect", "Fa_Auxiliary_ServiceAbility2_onDisconnect"]
}
function SubscribeInfoCallback(err, data) {
console.info(TAG + "===SubscribeInfoCallback===" + JSON.stringify(data))
if (data.event == "Fa_Auxiliary_ServiceAbility2_onConnect") {
liseList.push("onConnect")
ability_featureAbility.disconnectAbility(num).then((data) => {
console.info(TAG + "disconnectAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "disconnectAbility err = " + JSON.stringify(err));
expect().assertFail();
done();
});
}
if (data.event == "Fa_Auxiliary_ServiceAbility2_onDisconnect") {
liseList.push("onDisconnect")
setTimeout(()=>{
expect(JSON.stringify(liseList)).assertEqual(JSON.stringify(liseListCheck));
expect(flag1).assertTrue();
expect(flag2).assertTrue();
expect(flag3).assertFalse();
commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback);
}, 1000)
}
}
function UnSubscribeInfoCallback(err, data) {
console.info(TAG + "===UnSubscribeInfoCallback===")
done()
}
commonEvent.createSubscriber(subscribeInfo, (err, data) => {
console.info(TAG + "===CreateSubscriberCallback===")
subscriber = data
commonEvent.subscribe(subscriber, SubscribeInfoCallback)
})
let options = {
onConnect: function (elementName, proxy) {
flag1 = true
console.info(TAG + 'Ext onConnect SUCCESS, elementName = ' + JSON.stringify(elementName));
if (proxy == null) {
console.info(TAG + 'Ext proxy == null');
return;
}
let option = new rpc.MessageOption();
let data = new rpc.MessageParcel();
let reply = new rpc.MessageParcel();
data.writeInt(1);
data.writeInt(99);
proxy.sendRequest(1, data, reply, option, (result) => {
let msg = result.reply.readInt();
console.info(TAG + 'Ext connect, msg = ' + msg);
});
},
onDisconnect: function (elementName) {
flag2 = true
console.info(TAG + 'Ext onDisconnect, elementName = ' + JSON.stringify(elementName));
},
onFailed: function (number) {
flag3 = true
console.info(TAG + 'Ext onFailed, number = ' + number);
}
};
let wantNum = {
bundleName: 'ohos.acts.aafwk.test.faauxiliary',
abilityName: 'ohos.acts.aafwk.test.faauxiliary.ServiceAbility2'
}
let num = ability_featureAbility.connectAbility(wantNum, options)
} catch (err) {
console.info(TAG + "catch err = " + JSON.stringify(err));
expect().assertFail();
done();
}
})
/*
* @tc.number SUB_AA_OpenHarmony_Test_ServiceAbility_0300
* @tc.name Service binding unbinding service.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_OpenHarmony_Test_ServiceAbility_0300', 0, async function(done) {
TAG = 'SUB_AA_OpenHarmony_Test_ServiceAbility_0300 ==>';
try {
let status = undefined
let subscriber = null
let subscribeInfo = {
events: ["Fa_Auxiliary_ServiceAbility3_onConnect"]
}
function SubscribeInfoCallback(err, data) {
console.info(TAG + "===SubscribeInfoCallback===" + JSON.stringify(data))
if (data.event == "Fa_Auxiliary_ServiceAbility3_onConnect") {
status = data.parameters.status
commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback);
}
}
function UnSubscribeInfoCallback(err, data) {
console.info(TAG + "===UnSubscribeInfoCallback===")
expect(status).assertTrue();
done()
}
commonEvent.createSubscriber(subscribeInfo, (err, data) => {
console.info(TAG + "===CreateSubscriberCallback===")
subscriber = data
commonEvent.subscribe(subscriber, SubscribeInfoCallback)
})
let options = {
onConnect: function (elementName, proxy) {
console.info(TAG + 'Ext onConnect SUCCESS, elementName = ' + JSON.stringify(elementName));
if (proxy == null) {
console.info(TAG + 'Ext proxy == null');
return;
}
let option = new rpc.MessageOption();
let data = new rpc.MessageParcel();
let reply = new rpc.MessageParcel();
data.writeInt(1);
data.writeInt(99);
proxy.sendRequest(1, data, reply, option, (result) => {
let msg = result.reply.readInt();
console.info(TAG + 'Ext connect, msg = ' + msg);
});
},
onDisconnect: function (elementName) {
console.info(TAG + 'Ext onDisconnect, elementName = ' + JSON.stringify(elementName));
},
onFailed: function (number) {
console.info(TAG + 'Ext onFailed, number = ' + number);
}
};
let wantNum = {
bundleName: 'ohos.acts.aafwk.test.faauxiliary',
abilityName: 'ohos.acts.aafwk.test.faauxiliary.ServiceAbility3'
}
let num = ability_featureAbility.connectAbility(wantNum, options)
} catch (err) {
console.info(TAG + "catch err = " + JSON.stringify(err));
expect().assertFail();
done();
}
})
/*
* @tc.number SUB_AA_OpenHarmony_Test_GetWindow_0100
* @tc.name Call GetWindow interface.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_OpenHarmony_Test_GetWindow_0100', 0, async function(done) {
TAG = 'SUB_AA_OpenHarmony_Test_GetWindow_0100 ==>';
try {
ability_featureAbility.getWindow((err, data) => {
console.info(TAG + "getWindow err = " + JSON.stringify(err));
console.info(TAG + "getWindow data = " + data);
done();
})
} catch (err) {
console.info(TAG + "getWindow catch err = " + JSON.stringify(err));
done();
}
})
/*
* @tc.number SUB_AA_OpenHarmony_Test_TerminateSelfWithResult_0100
* @tc.name CTerminate ability through TerminateSelfWithResult.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_OpenHarmony_Test_TerminateSelfWithResult_0100', 0, async function(done) {
TAG = 'SUB_AA_OpenHarmony_Test_TerminateSelfWithResult_0100 ==>';
try {
let stageMode = ability_featureAbility.getContext().stageMode
let resultCode = undefined
let subscriber = null
let subscribeInfo = {
events: ["Fa_Auxiliary_MainAbility6_onDestroy"]
}
function SubscribeInfoCallback(err, data) {
console.info(TAG + "===SubscribeInfoCallback===" + JSON.stringify(data))
if (data.event == "Fa_Auxiliary_MainAbility6_onDestroy") {
setTimeout(()=>{
expect(stageMode).assertFalse()
expect(resultCode).assertEqual(661);
commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback)
}, 1000)
}
}
function UnSubscribeInfoCallback(err, data) {
console.info(TAG + "===UnSubscribeInfoCallback===")
done()
}
commonEvent.createSubscriber(subscribeInfo, (err, data) => {
console.info(TAG + "===CreateSubscriberCallback===")
subscriber = data
commonEvent.subscribe(subscriber, SubscribeInfoCallback)
})
let wantNum = {
want: {
bundleName: 'ohos.acts.aafwk.test.faauxiliary',
abilityName: 'ohos.acts.aafwk.test.faauxiliary.MainAbility6'
}
}
ability_featureAbility.startAbilityForResult(wantNum).then((data) => {
console.info(TAG + "startAbilityForResult data = " + JSON.stringify(data));
resultCode = data.resultCode
}).catch((err) => {
console.info(TAG + "startAbilityForResult err = " + JSON.stringify(err));
expect().assertFail();
done();
});
} catch (err) {
console.info(TAG + "getWindow catch err = " + JSON.stringify(err));
done();
}
})
})
}
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
85f2c7e2
{
"string"
:
[
{
"name"
:
"entry_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"FaXts"
}
]
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faapicoverhaptest/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
85f2c7e2
6.6 KB
aafwk/aafwk_standard/faapicover/faapicoverhaptest/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
85f2c7e2
文件已添加
aafwk/aafwk_standard/faapicover/faauxiliary/BUILD.gn
0 → 100644
浏览文件 @
85f2c7e2
# 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("FaAuxiliary") {
hap_name = "FaAuxiliary"
js_build_mode = "debug"
hap_profile = "entry/src/main/config.json"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":faauxiliary_resources",
":faauxiliary_ts_assets",
]
certificate_profile = "signature/openharmony_sx.p7b"
}
ohos_js_assets("faauxiliary_ts_assets") {
source_dir = "entry/src/main/ets"
hap_profile = "entry/src/main/config.json"
ets2abc = true
}
ohos_resources("faauxiliary_resources") {
sources = [ "entry/src/main/resources" ]
hap_profile = "entry/src/main/config.json"
}
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/config.json
0 → 100644
浏览文件 @
85f2c7e2
{
"app"
:
{
"vendor"
:
"example"
,
"bundleName"
:
"ohos.acts.aafwk.test.faauxiliary"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
9
,
"target"
:
9
}
},
"deviceConfig"
:
{},
"module"
:
{
"mainAbility"
:
".MainAbility"
,
"deviceType"
:
[
"default"
,
"tablet"
],
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"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"
:
"singleton"
},
{
"orientation"
:
"unspecified"
,
"visible"
:
true
,
"srcPath"
:
"MainAbility2"
,
"name"
:
".MainAbility2"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility2_desc"
,
"formsEnabled"
:
false
,
"label"
:
"$string:MainAbility2_label"
,
"type"
:
"page"
,
"launchType"
:
"singleton"
},
{
"orientation"
:
"unspecified"
,
"visible"
:
true
,
"srcPath"
:
"MainAbility3"
,
"name"
:
".MainAbility3"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility3_desc"
,
"formsEnabled"
:
false
,
"label"
:
"$string:MainAbility3_label"
,
"type"
:
"page"
,
"launchType"
:
"singleton"
},
{
"orientation"
:
"unspecified"
,
"visible"
:
true
,
"srcPath"
:
"MainAbility4"
,
"name"
:
".MainAbility4"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility4_desc"
,
"formsEnabled"
:
false
,
"label"
:
"$string:MainAbility4_label"
,
"type"
:
"page"
,
"launchType"
:
"singleton"
},
{
"orientation"
:
"unspecified"
,
"visible"
:
true
,
"srcPath"
:
"MainAbility5"
,
"name"
:
".MainAbility5"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility5_desc"
,
"formsEnabled"
:
false
,
"label"
:
"$string:MainAbility5_label"
,
"type"
:
"page"
,
"launchType"
:
"singleton"
},
{
"orientation"
:
"unspecified"
,
"visible"
:
true
,
"srcPath"
:
"MainAbility6"
,
"name"
:
".MainAbility6"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility6_desc"
,
"formsEnabled"
:
false
,
"label"
:
"$string:MainAbility6_label"
,
"type"
:
"page"
,
"launchType"
:
"singleton"
},
{
"srcPath"
:
"ServiceAbility"
,
"name"
:
".ServiceAbility"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:ServiceAbility_desc"
,
"type"
:
"service"
,
"visible"
:
true
},
{
"srcPath"
:
"ServiceAbility2"
,
"name"
:
".ServiceAbility2"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:ServiceAbility2_desc"
,
"type"
:
"service"
,
"visible"
:
true
},
{
"name"
:
".ServiceAbility3"
,
"srcLanguage"
:
"ets"
,
"srcPath"
:
"ServiceAbility3"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:ServiceAbility3_desc"
,
"type"
:
"service"
,
"visible"
:
true
},
{
"name"
:
".FormAbility"
,
"srcPath"
:
"FormAbility"
,
"description"
:
"$string:form_FormAbility_desc"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:form_FormAbility_label"
,
"type"
:
"service"
,
"formsEnabled"
:
true
,
"srcLanguage"
:
"ets"
,
"forms"
:
[
{
"jsComponentName"
:
"widget"
,
"isDefault"
:
true
,
"scheduledUpdateTime"
:
"10:30"
,
"defaultDimension"
:
"2*2"
,
"name"
:
"widget"
,
"description"
:
"This is a service widget."
,
"colorMode"
:
"auto"
,
"type"
:
"JS"
,
"formVisibleNotify"
:
true
,
"supportDimensions"
:
[
"2*2"
],
"updateEnabled"
:
true
,
"updateDuration"
:
1
}
]
}
],
"distro"
:
{
"moduleType"
:
"entry"
,
"installationFree"
:
false
,
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
},
"package"
:
"ohos.acts.aafwk.test.faauxiliary"
,
"srcPath"
:
""
,
"name"
:
".entry"
,
"js"
:
[
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".MainAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".MainAbility2"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".MainAbility3"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".MainAbility4"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".MainAbility5"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".MainAbility6"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"name"
:
"widget"
,
"pages"
:
[
"pages/index/index"
],
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
true
},
"type"
:
"form"
}
]
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/FormAbility/form.ts
0 → 100644
浏览文件 @
85f2c7e2
import
formBindingData
from
'
@ohos.application.formBindingData
'
;
import
formInfo
from
'
@ohos.application.formInfo
'
;
var
TAG_F1
=
"
Fa:Auxiliary:MainAbility2:
"
;
var
listPushF1
=
"
Fa_Auxiliary_MainAbility2_
"
;
export
default
{
onCreate
(
want
)
{
console
.
info
(
TAG_F1
+
'
onCreate
'
);
let
formData
=
{};
return
formBindingData
.
createFormBindingData
(
formData
);
},
onCastToNormal
(
formId
)
{
console
.
info
(
TAG_F1
+
'
onCastToNormal
'
);
},
onUpdate
(
formId
)
{
console
.
info
(
TAG_F1
+
'
onUpdate
'
);
},
onVisibilityChange
(
newStatus
)
{
console
.
info
(
TAG_F1
+
'
onVisibilityChange
'
);
},
onEvent
(
formId
,
message
)
{
console
.
info
(
TAG_F1
+
'
onEvent
'
);
},
onDestroy
(
formId
)
{
console
.
info
(
TAG_F1
+
'
onDestroy
'
);
},
onAcquireFormState
(
want
)
{
console
.
info
(
TAG_F1
+
'
onAcquireFormState
'
);
return
formInfo
.
FormState
.
READY
;
}
};
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility/app.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
var printLog1 = "Fa:Auxiliary:MainAbility:";
var listPush1 = "Fa_Auxiliary_MainAbility_";
export default {
onCreate() {
console.info(printLog1 + 'onCreate');
},
onDestroy() {
console.info(printLog1 + 'onDestroy');
commonEvent.publish(listPush1 + "onDestroy", (err) => {
console.info(printLog1 + listPush1 + "onDestroy");
});
},
onActive() {
console.info(printLog1 + 'onActive');
ability_featureAbility.hasWindowFocus().then((data) => {
console.info(printLog1 + "hasWindowFocus data = " + data);
var CommonEventPublishData = {
parameters: {
hasWindowFocus: data
}
}
commonEvent.publish(listPush1 + "HasWindowFocus", CommonEventPublishData, (err) => {
console.info(printLog1 + listPush1 + "HasWindowFocus");
});
setTimeout(()=>{
ability_featureAbility.terminateSelf().then((data) => {
console.info(printLog1 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog1 + "terminateSelf err = " + JSON.stringify(err));
});
}, 3000)
}).catch((err) => {
console.info(printLog1 + "hasWindowFocus err = " + JSON.stringify(err));
});
},
onInactive() {
console.info(printLog1 + 'onInactive');
},
onShow() {
console.info(printLog1 + 'onShow');
},
onHide() {
console.info(printLog1 + 'onHide');
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility/pages/index.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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 World Test Fa'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility2/app.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
var printLog1 = "Fa:Auxiliary:MainAbility2:";
var listPush1 = "Fa_Auxiliary_MainAbility2_";
export default {
onCreate() {
console.info(printLog1 + 'onCreate');
let list = ["ohos.permission.CAMERA"]
ability_featureAbility.getContext().requestPermissionsFromUser(list, 1, (err, data) => {
console.info(printLog1 + "requestPermissionsFromUser data = " + JSON.stringify(data));
console.info(printLog1 + "requestPermissionsFromUser err = " + JSON.stringify(err));
var CommonEventPublishData = {
parameters: {
permissionRequestResult: err
}
}
commonEvent.publish(listPush1 + "onCreate", CommonEventPublishData, (err) => {
console.info(printLog1 + listPush1 + "onCreate");
});
})
setTimeout(()=>{
ability_featureAbility.terminateSelf().then((data) => {
console.info(printLog1 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog1 + "terminateSelf err = " + JSON.stringify(err));
});
}, 3000)
},
onDestroy() {
console.info(printLog1 + 'onDestroy');
commonEvent.publish(listPush1 + "onDestroy", (err) => {
console.info(printLog1 + listPush1 + "onDestroy");
});
},
onActive() {
console.info(printLog1 + 'onActive');
},
onInactive() {
console.info(printLog1 + 'onInactive');
},
onShow() {
console.info(printLog1 + 'onShow');
},
onHide() {
console.info(printLog1 + 'onHide');
},
onNewWant(want) {
console.info(printLog1 + 'onNewWant');
},
onStartContinuation() {
console.info(printLog1 + 'onStartContinuation');
return true;
},
onSaveData(data) {
console.info(printLog1 + 'onSaveData');
return true;
},
onCompleteContinuation(number) {
console.info(printLog1 + 'onCompleteContinuation');
},
onRestoreData(data) {
console.info(printLog1 + 'onRestoreData');
},
onRemoteTerminated() {
console.info(printLog1 + 'onRemoteTerminated');
},
onSaveAbilityState(outState) {
console.info(printLog1 + 'onSaveAbilityState');
},
onRestoreAbilityState(inState) {
console.info(printLog1 + 'onRestoreAbilityState');
},
onMemoryLevel(level) {
console.info(printLog1 + 'onMemoryLevel');
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility2/pages/index.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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 World Test Fa 2'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility3/app.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
var printLog1 = "Fa:Auxiliary:MainAbility3:";
var listPush1 = "Fa_Auxiliary_MainAbility3_";
export default {
onCreate() {
console.info(printLog1 + 'onCreate');
commonEvent.publish(listPush1 + "onCreate", (err) => {
console.info(printLog1 + listPush1 + "onCreate");
});
setTimeout(()=>{
ability_featureAbility.terminateSelf().then((data) => {
console.info(printLog1 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog1 + "terminateSelf err = " + JSON.stringify(err));
});
}, 3000)
},
onDestroy() {
console.info(printLog1 + 'onDestroy');
commonEvent.publish(listPush1 + "onDestroy", (err) => {
console.info(printLog1 + listPush1 + "onDestroy");
});
},
onActive() {
console.info(printLog1 + 'onActive');
},
onInactive() {
console.info(printLog1 + 'onInactive');
},
onShow() {
console.info(printLog1 + 'onShow');
},
onHide() {
console.info(printLog1 + 'onHide');
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility3/pages/index.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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 World Test Fa 3'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility4/app.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
var printLog1 = "Fa:Auxiliary:MainAbility4:";
var listPush1 = "Fa_Auxiliary_MainAbility4_";
export default {
onCreate() {
console.info(printLog1 + 'onCreate');
ability_featureAbility.getWant().then((data) => {
console.info(printLog1 + "getWant data = " + JSON.stringify(data));
var flags = {
parameters: {
flags: data.flags
}
}
commonEvent.publish(listPush1 + "onCreate", flags, (err) => {
console.info(printLog1 + listPush1 + "onCreate");
});
}).catch((err) => {
console.info(printLog1 + "getWant err = " + JSON.stringify(err));
});
setTimeout(()=>{
ability_featureAbility.terminateSelf().then((data) => {
console.info(printLog1 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog1 + "terminateSelf err = " + JSON.stringify(err));
});
}, 3000)
},
onDestroy() {
console.info(printLog1 + 'onDestroy');
commonEvent.publish(listPush1 + "onDestroy", (err) => {
console.info(printLog1 + listPush1 + "onDestroy");
});
},
onActive() {
console.info(printLog1 + 'onActive');
},
onInactive() {
console.info(printLog1 + 'onInactive');
},
onShow() {
console.info(printLog1 + 'onShow');
},
onHide() {
console.info(printLog1 + 'onHide');
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility4/pages/index.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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 World Test Fa 4'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility5/app.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
var printLog1 = "Fa:Auxiliary:MainAbility5:";
var listPush1 = "Fa_Auxiliary_MainAbility5_";
export default {
onCreate() {
console.info(printLog1 + 'onCreate');
ability_featureAbility.getWant().then((data) => {
console.info(printLog1 + "getWant data = " + JSON.stringify(data));
var flags = {
parameters: {
flags: data.flags
}
}
commonEvent.publish(listPush1 + "onCreate", flags, (err) => {
console.info(printLog1 + listPush1 + "onCreate");
});
}).catch((err) => {
console.info(printLog1 + "getWant err = " + JSON.stringify(err));
});
setTimeout(()=>{
ability_featureAbility.terminateSelf().then((data) => {
console.info(printLog1 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog1 + "terminateSelf err = " + JSON.stringify(err));
});
}, 3000)
},
onDestroy() {
console.info(printLog1 + 'onDestroy');
commonEvent.publish(listPush1 + "onDestroy", (err) => {
console.info(printLog1 + listPush1 + "onDestroy");
});
},
onActive() {
console.info(printLog1 + 'onActive');
},
onInactive() {
console.info(printLog1 + 'onInactive');
},
onShow() {
console.info(printLog1 + 'onShow');
},
onHide() {
console.info(printLog1 + 'onHide');
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility5/pages/index.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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 World Test Fa 5'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility6/app.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
var printLog1 = "Fa:Auxiliary:MainAbility6:";
var listPush1 = "Fa_Auxiliary_MainAbility6_";
export default {
onCreate() {
console.info(printLog1 + 'onCreate');
setTimeout(()=>{
let wantNum = {
want: {
bundleName: 'ohos.acts.aafwk.test.faauxiliary',
abilityName: 'ohos.acts.aafwk.test.faauxiliary.MainAbility'
},
resultCode: 661
}
ability_featureAbility.terminateSelfWithResult(wantNum).then((data) => {
console.info(printLog1 + "terminateSelfWithResult data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog1 + "terminateSelfWithResult err = " + JSON.stringify(err));
});
}, 3000)
},
onDestroy() {
console.info(printLog1 + 'onDestroy');
commonEvent.publish(listPush1 + "onDestroy", (err) => {
console.info(printLog1 + listPush1 + "onDestroy");
});
},
onActive() {
console.info(printLog1 + 'onActive');
},
onInactive() {
console.info(printLog1 + 'onInactive');
},
onShow() {
console.info(printLog1 + 'onShow');
},
onHide() {
console.info(printLog1 + 'onHide');
},
onNewWant(want) {
console.info(printLog1 + 'onNewWant');
commonEvent.publish(listPush1 + "onNewWant", (err) => {
console.info(printLog1 + listPush1 + "onNewWant");
});
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/MainAbility6/pages/index.ets
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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 World Test Fa 6'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/ServiceAbility/service.ts
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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
rpc
from
"
@ohos.rpc
"
;
import
commonEvent
from
'
@ohos.commonEvent
'
;
import
ability_particleAbility
from
'
@ohos.ability.particleAbility
'
;
class
StubTest1
extends
rpc
.
RemoteObject
{
constructor
(
des
)
{
if
(
typeof
des
===
'
string
'
)
{
super
(
des
);
}
else
{
return
null
;
}
}
queryLocalInterface
(
descriptor
)
{
return
null
;
}
getInterfaceDescriptor
()
{
return
""
;
}
sendRequest
(
code
,
data
,
reply
,
options
)
{
return
null
;
}
getCallingPid
()
{
return
0
;
}
getCallingUid
()
{
return
0
;
}
attachLocalInterface
(
localInterface
,
descriptor
)
{
}
onRemoteRequest
(
code
,
data
,
reply
,
options
)
{
console
.
info
(
printLogS1
+
"
onRemoteRequest
"
);
if
(
code
==
1
)
{
console
.
info
(
printLogS1
+
"
onRemoteRequest code 1
"
);
let
op1
=
data
.
readInt
();
let
op2
=
data
.
readInt
();
console
.
info
(
printLogS1
+
"
onRemoteRequest op1 =
"
+
op1
+
"
, op2 =
"
+
op2
);
reply
.
writeInt
(
op1
+
op2
);
}
else
{
console
.
info
(
printLogS1
+
"
onRemoteRequest code =
"
+
code
);
}
return
true
;
}
}
var
printLogS1
=
"
Fa:Auxiliary:ServiceAbility:
"
;
var
listPushS1
=
"
Fa_Auxiliary_ServiceAbility_
"
;
export
default
{
onStart
()
{
console
.
info
(
printLogS1
+
'
onStart
'
);
commonEvent
.
publish
(
listPushS1
+
"
onStart
"
,
(
err
)
=>
{
console
.
info
(
printLogS1
+
listPushS1
+
"
onStart
"
);
});
},
onStop
()
{
console
.
info
(
printLogS1
+
'
onStop
'
);
commonEvent
.
publish
(
listPushS1
+
"
onStop
"
,
(
err
)
=>
{
console
.
info
(
printLogS1
+
listPushS1
+
"
onStop
"
);
});
},
onCommand
(
want
,
startId
)
{
console
.
info
(
printLogS1
+
'
onCommand
'
);
commonEvent
.
publish
(
listPushS1
+
"
onCommand
"
,
(
err
)
=>
{
console
.
info
(
printLogS1
+
listPushS1
+
"
onCommand
"
);
});
setTimeout
(()
=>
{
ability_particleAbility
.
terminateSelf
().
then
((
data
)
=>
{
console
.
info
(
printLogS1
+
"
terminateSelf data =
"
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
printLogS1
+
"
terminateSelf err =
"
+
JSON
.
stringify
(
err
));
});
},
3000
)
},
onConnect
(
want
)
{
console
.
info
(
printLogS1
+
'
onConnect
'
);
return
new
StubTest1
(
"
Test1
"
);
},
onDisconnect
(
want
)
{
console
.
info
(
printLogS1
+
'
onDisconnect
'
);
},
onReconnect
(
want
)
{
console
.
info
(
printLogS1
+
'
onReconnect
'
);
}
};
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/ServiceAbility2/service.ts
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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
rpc
from
"
@ohos.rpc
"
;
import
commonEvent
from
'
@ohos.commonEvent
'
;
class
StubTest2
extends
rpc
.
RemoteObject
{
constructor
(
des
)
{
if
(
typeof
des
===
'
string
'
)
{
super
(
des
);
}
else
{
return
null
;
}
}
queryLocalInterface
(
descriptor
)
{
return
null
;
}
getInterfaceDescriptor
()
{
return
""
;
}
sendRequest
(
code
,
data
,
reply
,
options
)
{
return
null
;
}
getCallingPid
()
{
return
0
;
}
getCallingUid
()
{
return
0
;
}
attachLocalInterface
(
localInterface
,
descriptor
)
{
}
onRemoteRequest
(
code
,
data
,
reply
,
options
)
{
console
.
info
(
printLogS1
+
"
onRemoteRequest
"
);
if
(
code
==
1
)
{
console
.
info
(
printLogS1
+
"
onRemoteRequest code 1
"
);
let
op1
=
data
.
readInt
();
let
op2
=
data
.
readInt
();
console
.
info
(
printLogS1
+
"
onRemoteRequest op1 =
"
+
op1
+
"
, op2 =
"
+
op2
);
reply
.
writeInt
(
op1
+
op2
);
}
else
{
console
.
info
(
printLogS1
+
"
onRemoteRequest code =
"
+
code
);
}
return
true
;
}
}
var
printLogS1
=
"
Fa:Auxiliary:ServiceAbility2:
"
;
var
listPushS1
=
"
Fa_Auxiliary_ServiceAbility2_
"
;
export
default
{
onStart
()
{
console
.
info
(
printLogS1
+
'
onStart
'
);
},
onStop
()
{
console
.
info
(
printLogS1
+
'
onStop
'
);
},
onCommand
(
want
,
startId
)
{
console
.
info
(
printLogS1
+
'
onCommand
'
);
},
onConnect
(
want
)
{
console
.
info
(
printLogS1
+
'
onConnect
'
);
commonEvent
.
publish
(
listPushS1
+
"
onConnect
"
,
(
err
)
=>
{
console
.
info
(
printLogS1
+
listPushS1
+
"
onCreate
"
);
});
return
new
StubTest2
(
"
Test1
"
);
},
onDisconnect
(
want
)
{
console
.
info
(
printLogS1
+
'
onDisconnect
'
);
commonEvent
.
publish
(
listPushS1
+
"
onDisconnect
"
,
(
err
)
=>
{
console
.
info
(
printLogS1
+
listPushS1
+
"
onDisconnect
"
);
});
},
onReconnect
(
want
)
{
console
.
info
(
printLogS1
+
'
onReconnect
'
);
}
};
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/ets/ServiceAbility3/service.ts
0 → 100644
浏览文件 @
85f2c7e2
/*
* 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
rpc
from
"
@ohos.rpc
"
;
import
commonEvent
from
'
@ohos.commonEvent
'
;
import
ability_particleAbility
from
'
@ohos.ability.particleAbility
'
;
class
StubTest3
extends
rpc
.
RemoteObject
{
constructor
(
des
)
{
if
(
typeof
des
===
'
string
'
)
{
super
(
des
);
}
else
{
return
null
;
}
}
queryLocalInterface
(
descriptor
)
{
return
null
;
}
getInterfaceDescriptor
()
{
return
""
;
}
sendRequest
(
code
,
data
,
reply
,
options
)
{
return
null
;
}
getCallingPid
()
{
return
0
;
}
getCallingUid
()
{
return
0
;
}
attachLocalInterface
(
localInterface
,
descriptor
)
{
}
onRemoteRequest
(
code
,
data
,
reply
,
options
)
{
console
.
info
(
printLogS1
+
"
onRemoteRequest
"
);
if
(
code
==
1
)
{
console
.
info
(
printLogS1
+
"
onRemoteRequest code 1
"
);
let
op1
=
data
.
readInt
();
let
op2
=
data
.
readInt
();
console
.
info
(
printLogS1
+
"
onRemoteRequest op1 =
"
+
op1
+
"
, op2 =
"
+
op2
);
reply
.
writeInt
(
op1
+
op2
);
}
else
{
console
.
info
(
printLogS1
+
"
onRemoteRequest code =
"
+
code
);
}
return
true
;
}
}
var
printLogS1
=
"
Fa:Auxiliary:ServiceAbility3:
"
;
var
listPushS1
=
"
Fa_Auxiliary_ServiceAbility3_
"
;
export
default
{
onStart
()
{
console
.
info
(
printLogS1
+
'
onStart
'
);
},
onStop
()
{
console
.
info
(
printLogS1
+
'
onStop
'
);
},
onCommand
(
want
,
startId
)
{
console
.
info
(
printLogS1
+
'
onCommand
'
);
},
onConnect
(
want
)
{
console
.
info
(
printLogS1
+
'
onConnect
'
);
try
{
let
flag1
=
false
let
flag2
=
false
let
flag3
=
false
let
subscriber
=
null
let
subscribeInfo
=
{
events
:
[
"
Fa_Auxiliary_ServiceAbility2_onConnect
"
,
"
Fa_Auxiliary_ServiceAbility2_onDisconnect
"
]
}
function
SubscribeInfoCallback
(
err
,
data
)
{
console
.
info
(
printLogS1
+
"
===SubscribeInfoCallback===
"
+
JSON
.
stringify
(
data
))
if
(
data
.
event
==
"
Fa_Auxiliary_ServiceAbility2_onConnect
"
)
{
ability_particleAbility
.
disconnectAbility
(
num
).
then
((
data
)
=>
{
console
.
info
(
printLogS1
+
"
disconnectAbility data =
"
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
printLogS1
+
"
disconnectAbility err =
"
+
JSON
.
stringify
(
err
));
var
status
=
{
parameters
:
{
status
:
false
}
}
commonEvent
.
publish
(
listPushS1
+
"
onConnect
"
,
status
,
(
err
)
=>
{
console
.
info
(
printLogS1
+
listPushS1
+
"
onConnect
"
);
});
});
}
if
(
data
.
event
==
"
Fa_Auxiliary_ServiceAbility2_onDisconnect
"
)
{
commonEvent
.
unsubscribe
(
subscriber
,
UnSubscribeInfoCallback
);
}
}
function
UnSubscribeInfoCallback
(
err
,
data
)
{
console
.
info
(
printLogS1
+
"
===UnSubscribeInfoCallback===
"
)
setTimeout
(()
=>
{
var
status
=
{
parameters
:
{
status
:
false
}
}
if
(
flag1
&&
flag2
&&
!
flag3
)
{
status
=
{
parameters
:
{
status
:
true
}
}
}
commonEvent
.
publish
(
listPushS1
+
"
onConnect
"
,
status
,
(
err
)
=>
{
console
.
info
(
printLogS1
+
listPushS1
+
"
onConnect
"
);
});
},
1000
)
}
commonEvent
.
createSubscriber
(
subscribeInfo
,
(
err
,
data
)
=>
{
console
.
info
(
printLogS1
+
"
===CreateSubscriberCallback===
"
)
subscriber
=
data
commonEvent
.
subscribe
(
subscriber
,
SubscribeInfoCallback
)
})
let
options
=
{
onConnect
:
function
(
elementName
,
proxy
)
{
flag1
=
true
console
.
info
(
printLogS1
+
'
Ext onConnect SUCCESS, elementName =
'
+
JSON
.
stringify
(
elementName
));
if
(
proxy
==
null
)
{
console
.
info
(
printLogS1
+
'
Ext proxy == null
'
);
return
;
}
let
option
=
new
rpc
.
MessageOption
();
let
data
=
new
rpc
.
MessageParcel
();
let
reply
=
new
rpc
.
MessageParcel
();
data
.
writeInt
(
1
);
data
.
writeInt
(
99
);
proxy
.
sendRequest
(
1
,
data
,
reply
,
option
,
(
result
)
=>
{
let
msg
=
result
.
reply
.
readInt
();
console
.
info
(
printLogS1
+
'
Ext connect, msg =
'
+
msg
);
});
},
onDisconnect
:
function
(
elementName
)
{
flag2
=
true
console
.
info
(
printLogS1
+
'
Ext onDisconnect, elementName =
'
+
JSON
.
stringify
(
elementName
));
},
onFailed
:
function
(
number
)
{
flag3
=
true
console
.
info
(
printLogS1
+
'
Ext onFailed, number =
'
+
number
);
}
};
let
wantNum
=
{
bundleName
:
'
ohos.acts.aafwk.test.faauxiliary
'
,
abilityName
:
'
ohos.acts.aafwk.test.faauxiliary.ServiceAbility2
'
}
let
num
=
ability_particleAbility
.
connectAbility
(
wantNum
,
options
)
}
catch
(
err
)
{
console
.
info
(
printLogS1
+
"
catch err =
"
+
JSON
.
stringify
(
err
));
var
status
=
{
parameters
:
{
status
:
false
}
}
commonEvent
.
publish
(
listPushS1
+
"
onConnect
"
,
status
,
(
err
)
=>
{
console
.
info
(
printLogS1
+
listPushS1
+
"
onConnect
"
);
});;
}
return
new
StubTest3
(
"
Test1
"
);
},
onDisconnect
(
want
)
{
console
.
info
(
printLogS1
+
'
onDisconnect
'
);
},
onReconnect
(
want
)
{
console
.
info
(
printLogS1
+
'
onReconnect
'
);
}
};
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/js/widget/pages/index/index.css
0 → 100644
浏览文件 @
85f2c7e2
#wrapper
{
flex-direction
:
column
;
}
#div1
{
width
:
100%
;
height
:
100%
;
justify-content
:
center
;
align-items
:
center
;
background-color
:
white
;
}
#text1
{
height
:
45px
;
width
:
150px
;
font-size
:
16px
;
text-align
:
center
;
}
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/js/widget/pages/index/index.hml
0 → 100644
浏览文件 @
85f2c7e2
<div>
<div id="wrapper">
<div id="div1">
<text id="text1">{{title}}</text>
</div>
</div>
</div>
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/js/widget/pages/index/index.json
0 → 100644
浏览文件 @
85f2c7e2
{
"actions"
:
{},
"data"
:
{
"title"
:
"Hello World"
}
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
85f2c7e2
{
"string"
:
[
{
"name"
:
"entry_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"FaAuxiliary"
},
{
"name"
:
"MainAbility2_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility2_label"
,
"value"
:
"label"
},
{
"name"
:
"MainAbility3_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility3_label"
,
"value"
:
"label"
},
{
"name"
:
"MainAbility4_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility4_label"
,
"value"
:
"label"
},
{
"name"
:
"MainAbility5_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility5_label"
,
"value"
:
"label"
},
{
"name"
:
"MainAbility6_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility6_label"
,
"value"
:
"label"
},
{
"name"
:
"ServiceAbility_desc"
,
"value"
:
"hap sample empty service"
},
{
"name"
:
"ServiceAbility2_desc"
,
"value"
:
"hap sample empty service"
},
{
"name"
:
"form_FormAbility_desc"
,
"value"
:
"form_description"
},
{
"name"
:
"form_FormAbility_label"
,
"value"
:
"form_label"
},
{
"name"
:
"ServiceAbility3_desc"
,
"value"
:
"hap sample empty service"
}
]
}
\ No newline at end of file
aafwk/aafwk_standard/faapicover/faauxiliary/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
85f2c7e2
6.6 KB
aafwk/aafwk_standard/faapicover/faauxiliary/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
85f2c7e2
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录