提交 8a08a4fc 编写于 作者: C chengxingzhen

XTS元能力测试套整改

Signed-off-by: Nchengxingzhen <chengxingzhen@huawei.com>
上级 585fc6dc
......@@ -32,6 +32,7 @@ group("ability_runtime") {
"amsdatauriutils:ActsAmsDataUriUtilsTest",
"amsdisplayIdtest:amsdisplayIdtest",
"amsgetabilityprocessinfo:amsgetabilityprocessinfo",
"apicover:apicover",
"context:context",
"fa:fa",
"featureability:featureability",
......
# 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("apicover") {
testonly = true
if (is_standard_system) {
deps = [
"apicoverhaptest:ApiCoverhapTest",
"fasupplement:FaSupplement",
"formmodule:FormModule",
"stagesupplement:StageSupplement",
]
}
}
{
"app": {
"bundleName": "com.example.apicoverhaptest",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"debug": false,
"icon": "$media:icon",
"label": "$string:app_name",
"description": "$string:description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string":[
{
"name":"app_name",
"value":"LifecycleTest"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ApiCoverhapTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":apicoverhaptest_js_assets",
":apicoverhaptest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ApiCoverhapTest"
}
ohos_app_scope("apicoverhaptest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("apicoverhaptest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("apicoverhaptest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":apicoverhaptest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"package": "com.example.apicoverhaptest",
"shell-timeout": "600000"
},
"kits": [
{
"test-file-name": [
"ApiCoverhapTest.hap",
"FaSupplement.hap",
"StageSupplement.hap",
"FormModule.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
/*
* 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 AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
globalThis.stageContext = this.context;
}
}
\ No newline at end of file
import commonEvent from '@ohos.commonEvent';
import FormExtension from '@ohos.application.FormExtension';
import formBindingData from '@ohos.application.formBindingData';
import formInfo from '@ohos.application.formInfo';
var extensionInfo_config_direction
export default class FormAbility extends FormExtension {
onCreate(want) {
// Called to return a FormBindingData object.
let formData = {};
let extensionInfo_currentInfo_name = this.context.currentHapModuleInfo.name
let extensionInfo_currentInfo_description = this.context.currentHapModuleInfo.description
this.context.resourceManager.getConfiguration((err, data) => {
if (err.code != 0 ) {
console.error(`Ability: getConfiguration failed: ${JSON.stringify(err)}`);
} else {
console.log(`Ability: getConfiguration success: ${JSON.stringify(data)}`);
extensionInfo_config_direction = data.direction
}
})
var CommonEventPublishData = {
parameters: {
"extensionInfo_currentInfo_name": extensionInfo_currentInfo_name,
"extensionInfo_currentInfo_description": extensionInfo_currentInfo_description,
"extensionInfo_config_direction": extensionInfo_config_direction,
"key":"value"
}
}
commonEvent.publish("FormAbility_OnCreate", CommonEventPublishData, (err) => {
console.log('FormAbility_OnCreate');
});
console.info("FormAbility onCreate")
return formBindingData.createFormBindingData(formData);
}
onCastToNormal(formId) {
// Called when the form provider is notified that a temporary form is successfully
// converted to a normal form.
}
onUpdate(formId) {
// Called to notify the form provider to update a specified form.
}
onVisibilityChange(newStatus) {
// Called when the form provider receives form events from the system.
}
onEvent(formId, message) {
// Called when a specified message event defined by the form provider is triggered.
}
onDestroy(formId) {
// Called to notify the form provider that a specified form has been destroyed.
}
onAcquireFormState(want) {
// Called to return a {@link FormState} object.
return formInfo.FormState.READY;
}
};
\ 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 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")
globalThis.abilityContext = this.context;
windowStage.setUIContent(this.context, "pages/MainAbility_pages", 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")
}
};
// @ts-nocheck
/*
* 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 file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index"
import list from '../test/ListTest'
@Entry
@Component
struct Index {
@State message: string = '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()
globalThis.abilityWant.parameters.timeout = 20000;
core.subscribeEvent('task', reportExtend)
const configService = core.getDefaultService('config')
configService.setConfig(globalThis.abilityWant.parameters)
console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters))
list(globalThis.abilityContext)
core.execute()
}
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 "deccjsunit/index"
import formProvider from '@ohos.application.formProvider';
import FormInfo from '@ohos.application.formInfo';
import formError from '@ohos.application.formError';
var EXTENSION_INFO_ERR = 2097152
var USERID_ERR = 2097177
var trueInfo;
var array = new Array();
function sleep(time) {
return new Promise((resolve)=>setTimeout(resolve,time));
}
export default function ApiCoverTest(abilityContext) {
describe('ApiCoverTestTest', function () {
/*
* @tc.number SUB_AA_ABILITY_Extension_API_001
* @tc.name StartServiceExtensionAbility with incorrect abilityName.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_ABILITY_Extension_API_001', 0, async function (done) {
await sleep(2000);
let want = {
bundleName: "com.example.extensionapitest",
abilityName: "FirstExtension1"
};
await abilityContext.startServiceExtensionAbility(want).then((data) => {
console.log('Ability: startServiceExtensionAbility success:' + JSON.stringify(data));
expect("case execute failed").assertEqual(data);
}).catch((error) => {
console.error(`Ability: startServiceExtensionAbility failed: ${JSON.stringify(error)}`);
expect(EXTENSION_INFO_ERR).assertEqual(error.code);
})
done()
})
/*
* @tc.number SUB_AA_ABILITY_Extension_API_002
* @tc.name StopServiceExtensionAbility with incorrect bundleName.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_ABILITY_Extension_API_002', 0, async function (done) {
await sleep(2000);
let want = {
bundleName: "com.example.extensionapitest1",
abilityName: "FirstExtension"
};
await abilityContext.stopServiceExtensionAbility(want).then((data) => {
console.log(`Ability: stopServiceExtensionAbility success: ${JSON.stringify(data)}`);
expect("case execute failed").assertEqual(data);
}).catch((error) => {
console.error(`Ability: stopServiceExtensionAbility failed: ${JSON.stringify(error)}`);
expect(EXTENSION_INFO_ERR).assertEqual(error.code);
})
done()
})
/*
* @tc.number SUB_AA_ABILITY_Extension_API_003
* @tc.name startServiceExtensionAbilityWithAccount with incorrect userId.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_ABILITY_Extension_API_003', 0, async function (done) {
await sleep(2000);
let want = {
bundleName: "com.example.extensionapitest",
abilityName: "FirstExtension"
};
await abilityContext.startServiceExtensionAbilityWithAccount(want, 999).then((data) => {
console.log(`Ability: startServiceExtensionAbilityWithAccount success: ${JSON.stringify(data)}`);
expect("case execute failed").assertEqual("data");
}).catch((error) => {
console.error(`Ability: startServiceExtensionAbilityWithAccount failed: ${JSON.stringify(error)}`);
expect(USERID_ERR).assertEqual(error.code);
})
done()
})
/*
* @tc.number SUB_AA_ABILITY_Extension_API_004
* @tc.name stopServiceExtensionAbilityWithAccount with incorrect userId.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_ABILITY_Extension_API_004', 0, async function (done) {
await sleep(2000);
let want = {
bundleName: "com.example.extensionapitest",
abilityName: "FirstExtension"
};
await abilityContext.stopServiceExtensionAbilityWithAccount(want, 999).then((data) => {
console.log(`Ability: stopServiceExtensionAbilityWithAccount success: ${JSON.stringify(data)}`);
expect("case execute failed").assertEqual(data);
}).catch((error) => {
console.error(`Ability: stopServiceExtensionAbilityWithAccount failed: ${JSON.stringify(error)}`);
expect(USERID_ERR).assertEqual(error.code);
})
done()
})
/*
* @tc.number SUB_AA_ABILITY_Extension_API_005
* @tc.name StartServiceExtensionAbility with incorrect abilityName.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_ABILITY_Extension_API_005', 0, async function (done) {
await sleep(2000);
let want = {
bundleName: "com.example.extensionapitest",
abilityName: "FirstExtension1"
}
await abilityContext.startServiceExtensionAbility(want, (err, data) => {
if (err.code) {
console.error(`Ability: startServiceExtensionAbility failed: ${JSON.stringify(err)}`);
expect(EXTENSION_INFO_ERR).assertEqual(err.code);
} else {
console.log(`Ability: startServiceExtensionAbility success: ${JSON.stringify(data)}`);
expect("case execute failed").assertEqual(data);
}
done()
})
})
/*
* @tc.number SUB_AA_ABILITY_Extension_API_006
* @tc.name StopServiceExtensionAbility with incorrect bundleName.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_ABILITY_Extension_API_006', 0, async function (done) {
await sleep(2000);
let want = {
bundleName: "com.example.extensionapitest1",
abilityName: "FirstExtension"
};
await abilityContext.stopServiceExtensionAbility(want, (err, data) => {
if (err.code) {
console.error(`Ability: stopServiceExtensionAbility failed: ${JSON.stringify(err)}`);
expect(EXTENSION_INFO_ERR).assertEqual(err.code);
} else {
console.log(`Ability: stopServiceExtensionAbility success: ${JSON.stringify(data)}`);
expect("case execute failed").assertEqual(data);
}
done()
})
done()
})
/*
* @tc.number SUB_AA_ABILITY_Extension_API_007
* @tc.name startServiceExtensionAbilityWithAccount with incorrect userId.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_ABILITY_Extension_API_007', 0, async function (done) {
await sleep(2000);
let want = {
bundleName: "com.example.extensionapitest",
abilityName: "FirstExtension"
};
await abilityContext.startServiceExtensionAbilityWithAccount(want, 999, (err, data) => {
if (err.code) {
console.error(`Ability: startServiceExtensionAbilityWithAccount failed: ${JSON.stringify(err)}`);
expect(USERID_ERR).assertEqual(err.code);
} else {
console.log(`Ability: startServiceExtensionAbilityWithAccount success: ${JSON.stringify(data)}`);
expect("case execute failed").assertEqual(data);
}
done()
})
})
/*
* @tc.number SUB_AA_ABILITY_Extension_API_008
* @tc.name stopServiceExtensionAbilityWithAccount with incorrect userId.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_ABILITY_Extension_API_008', 0, async function (done) {
await sleep(2000);
let want = {
bundleName: "com.example.extensionapitest",
abilityName: "FirstExtension"
};
abilityContext.stopServiceExtensionAbilityWithAccount(want, 999, (err, data) => {
if (err.code) {
console.error(`Ability: stopServiceExtensionAbilityWithAccount failed: ${JSON.stringify(err)}`);
expect(USERID_ERR).assertEqual(err.code);
} else {
console.log(`Ability: stopServiceExtensionAbilityWithAccount success: ${JSON.stringify(data)}`);
expect("case execute failed").assertEqual(data);
}
done()
})
})
/*
* @tc.number SUB_AA_AMS_Context_0100
* @tc.name Get the resource and path of the context.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_AMS_Context_0100', 0, async function (done) {
expect("/data/storage/el2/base/haps/phone/cache").assertEqual(abilityContext.cacheDir)
expect("/data/storage/el2/base/haps/phone/temp").assertEqual(abilityContext.tempDir)
expect("/data/storage/el2/base/haps/phone/files").assertEqual(abilityContext.filesDir)
expect("/data/storage/el2/database/phone").assertEqual(abilityContext.databaseDir)
expect("/data/storage/el2/base/haps/phone/preferences").assertEqual(abilityContext.preferencesDir)
expect("/data/storage/el1/bundle").assertEqual(abilityContext.bundleCodeDir)
expect("/data/storage/el2/distributedfiles").assertEqual(abilityContext.distributedFilesDir)
expect(1).assertEqual(abilityContext.area)
abilityContext.resourceManager.getConfiguration((err, data) => {
if (err.code != 0 ) {
console.error(`Ability: getConfiguration failed: ${JSON.stringify(err)}`);
expect(USERID_ERR).assertEqual(err.code);
done()
} else {
console.log(`Ability: getConfiguration success: ${JSON.stringify(data)}`);
expect(1).assertEqual(data.direction)
done()
}
})
let moduleContext = abilityContext.createModuleContext("module1")
expect("/data/storage/el2/base/cache").assertEqual(moduleContext.cacheDir)
done()
})
/*
* @tc.number SUB_AA_Form_provider_getFormsInfo_0100
* @tc.name The provider calls the getFormsInfo interface to obtain form information.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_Form_provider_getFormsInfo_0100', 0, async function (done) {
console.info("SUB_AA_Form_provider_getFormsInfo_0100");
formProvider.getFormsInfo((err, value) => {
console.info("formProvider::GetFormsInfoTest err: " + JSON.stringify(err));
console.info("formProvider::GetFormsInfoTest value: " + JSON.stringify(value));
if (err.code != 0) {
expect(0).assertEqual(2)
} else {
for(let i = 0; i < value.length; i++){
if(value[i].bundleName == "com.example.extensionapitest" && value[i].name == "widget"){
trueInfo = value[i]
console.info("formProvider::GetFormsInfoTest trueInfo: " + JSON.stringify(trueInfo));
}
}
}
checkFormInfo(trueInfo)
done()
})
done()
})
/*
* @tc.number SUB_AA_Form_provider_getFormsInfo_0200
* @tc.name The provider calls the getFormsInfo interface to obtain form information in the module1.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_Form_provider_getFormsInfo_0200', 0, async function (done) {
console.info("SUB_AA_Form_provider_getFormsInfo_0200");
const filter: formInfo.FormInfoFilter = {
moduleName: "module1"
};
formProvider.getFormsInfo(filter, (err, value) => {
console.info("formProvider::GetFormsInfoTest err: " + JSON.stringify(err));
console.info("formProvider::GetFormsInfoTest value: " + JSON.stringify(value));
if (err.code != 0) {
expect(0).assertEqual(2)
} else {
if(value.length == 0){
expect(1).assertEqual(0)
}else{
for(let i = 0; i < value.length; i++){
if(value[i].bundleName == "com.example.extensionapitest" && value[i].name == "widget1"){
trueInfo = value[i]
console.info("formProvider::GetFormsInfoTest trueInfo: " + JSON.stringify(trueInfo));
}
}
}
}
checkFormInfoModule1(trueInfo)
done();
})
done()
})
/*
* @tc.number SUB_AA_Form_provider_TestFormErr_0100
* @tc.name Get all FormError types.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_Form_provider_TestFormErr_0100', 0, async function (done) {
console.info("SUB_AA_Form_provider_TestFormErr_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_TestFormInfo_0100
* @tc.name Get all FormInfo types
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_Form_provider_TestFormInfo_0100', 0, async function (done) {
console.info("SUB_AA_Form_provider_TestFormInfo_0100");
expect("ohos.extra.param.key.form_dimension").assertEqual(FormInfo.FormParam.DIMENSION_KEY)
expect("ohos.extra.param.key.form_height").assertEqual(FormInfo.FormParam.HEIGHT_KEY)
expect("ohos.extra.param.key.module_name").assertEqual(FormInfo.FormParam.MODULE_NAME_KEY)
expect("ohos.extra.param.key.form_name").assertEqual(FormInfo.FormParam.NAME_KEY)
expect("ohos.extra.param.key.form_temporary").assertEqual(FormInfo.FormParam.TEMPORARY_KEY)
expect("ohos.extra.param.key.form_width").assertEqual(FormInfo.FormParam.WIDTH_KEY)
expect(0).assertEqual(FormInfo.FormState.DEFAULT)
expect(1).assertEqual(FormInfo.FormState.READY)
expect(-1).assertEqual(FormInfo.FormState.UNKNOWN)
expect(0).assertEqual(FormInfo.ColorMode.MODE_DARK)
expect(1).assertEqual(FormInfo.ColorMode.MODE_LIGHT)
done();
});
})
}
function checkFormInfoModule1(formInfo){
console.info("formProvider::GetFormsInfoTest value: " + JSON.stringify(formInfo));
expect("com.example.extensionapitest").assertEqual(formInfo.bundleName)
expect("module1").assertEqual(formInfo.moduleName)
expect("FormAbility").assertEqual(formInfo.abilityName)
expect("widget1").assertEqual(formInfo.name)
expect("This is a service widget.").assertEqual(formInfo.description)
expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect(FormInfo.ColorMode.MODE_DARK).assertEqual(formInfo.colorMode)
expect(1).assertEqual(formInfo.isDefault)
expect(1).assertEqual(formInfo.updateEnabled)
expect(0).assertEqual(formInfo.formVisibleNotify)
expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("ability://xxxxx").assertEqual(formInfo.formConfigAbility)
expect(1).assertEqual(formInfo.updateDuration)
expect(2).assertEqual(formInfo.defaultDimension)
expect(2).assertEqual(formInfo.supportDimensions[0])
}
function checkFormInfo(formInfo){
console.info("formProvider::GetFormsInfoTest formInfo: " + JSON.stringify(formInfo));
expect("com.example.extensionapitest").assertEqual(formInfo.bundleName)
expect("entry").assertEqual(formInfo.moduleName)
expect("FormAbility").assertEqual(formInfo.abilityName)
expect("widget").assertEqual(formInfo.name)
expect("This is a service widget.").assertEqual(formInfo.description)
expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect(FormInfo.ColorMode.MODE_AUTO).assertEqual(formInfo.colorMode)
expect(1).assertEqual(formInfo.isDefault)
expect(1).assertEqual(formInfo.updateEnabled)
expect(0).assertEqual(formInfo.formVisibleNotify)
expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("ability://xxxxx").assertEqual(formInfo.formConfigAbility)
expect(1).assertEqual(formInfo.updateDuration)
expect(2).assertEqual(formInfo.defaultDimension)
expect(2).assertEqual(formInfo.supportDimensions[0])
}
\ 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 verificationTest from './VerificationTest'
import apiCoverAbility from './ApiCoverAbility.test'
export default function List(context) {
verificationTest(context)
apiCoverAbility(context)
}
\ No newline at end of file
#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;
}
<div>
<div id="wrapper">
<div id="div1">
<text id="text1">{{title}}</text>
</div>
</div>
</div>
\ No newline at end of file
{
"actions": {},
"data": {
"title": "Hello World"
}
}
\ No newline at end of file
{
"module": {
"name": "phone",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc",
"mainElement": "MainAbility",
"deviceTypes": [
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "com.example.apicoverhaptest.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"orientation": "portrait",
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "FormAbility",
"srcEntrance": "./ets/FormAbility/FormAbility.ts",
"label": "$string:MainAbility_label",
"description": "$string:MainAbility_desc",
"type": "form",
"metadata": [
{
"name": "ohos.extension.form",
"resource": "$profile:form_config"
}
]
}
]
}
}
\ No newline at end of file
{
"color": [
{
"name": "white",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "phone_entry_dsc",
"value": "i am an entry for phone"
},
{
"name": "phone_entry_main",
"value": "the phone entry ability"
},
{
"name": "entry_label",
"value": "ActsLifecycleMultihapTest"
},
{
"name": "form_description",
"value": "my form"
},
{
"name": "description_application",
"value": "demo for test"
},
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
}
]
}
{
"forms": [
{
"isDefault": true,
"src": "./js/widget/pages/index/index",
"scheduledUpdateTime": "10:30",
"defaultDimension": "2*2",
"name": "widget",
"description": "This is a service widget.",
"colorMode": "auto",
"window": {
"designWidth": 720,
"autoDesignWidth": true
},
"formConfigAbility": "ability://xxxxx",
"supportDimensions": [
"2*2"
],
"updateEnabled": true,
"updateDuration": 1
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_hap("FaSupplement") {
hap_profile = "entry/src/main/config.json"
hap_name = "FaSupplement"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":fasupplement_resources",
":fasupplement_ts_assets",
]
certificate_profile = "signature/openharmony_sx.p7b"
}
ohos_js_assets("fasupplement_ts_assets") {
source_dir = "entry/src/main/ets"
hap_profile = "entry/src/main/config.json"
ets2abc = true
}
ohos_resources("fasupplement_resources") {
sources = [ "entry/src/main/resources" ]
hap_profile = "entry/src/main/config.json"
}
{
"app": {
"vendor": "example",
"bundleName": "ohos.acts.aafwk.test.fasupplement",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 9,
"target": 9
}
},
"deviceConfig": {},
"module": {
"mainAbility": ".MainAbility",
"deviceType": [
"phone"
],
"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"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "ohos.acts.aafwk.test.fasupplement",
"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
}
}
]
}
}
\ 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_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
var printLog1 = "Fa:MainAbility:";
var listPush1 = "Fa_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
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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:MainAbility2:";
var listPush1 = "Fa_MainAbility2_";
export default {
onCreate() {
console.info(printLog1 + 'onCreate');
let list = ["ohos.permission.CAMERA"]
ability_featureAbility.getContext().requestPermissionsFromUser(list, 1).then((permissionRequestResult) => {
console.info(printLog1 + "requestPermissionsFromUser data = " + JSON.stringify(permissionRequestResult));
var CommonEventPublishData = {
parameters: {
permissionRequestResult: permissionRequestResult
}
}
commonEvent.publish(listPush1 + "onCreate", CommonEventPublishData, (err) => {
console.info(printLog1 + listPush1 + "onCreate");
});
}).catch((err) => {
console.info(printLog1 + "requestPermissionsFromUser 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
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "FaSupplement"
},
{
"name": "MainAbility2_desc",
"value": "description"
},
{
"name": "MainAbility2_label",
"value": "label"
},
{
"name": "MainAbility3_desc",
"value": "description"
},
{
"name": "MainAbility3_label",
"value": "label"
},
{
"name": "PageAbility_desc",
"value": "description"
},
{
"name": "PageAbility_label",
"value": "label"
},
{
"name": "DataAbility_desc",
"value": "hap sample empty provider"
}
]
}
\ No newline at end of file
[ZoneTransfer]
ZoneId=0
ReferrerUrl=vscode-file://vscode-app/d:/Software/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html
HostUrl=file:///d%3A/OpenHarmony/Xts/xts_acts-master/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/signature/openharmony_sx.p7b
{
"app":{
"bundleName": "com.example.apicoverhaptest",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"debug": false,
"icon": "$media:icon",
"label": "$string:app_name",
"description": "$string:description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car":{
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string":[
{
"name":"app_name",
"value":"ohosProject"
}
]
}
\ 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("FormModule") {
hap_name = "FormModule"
js_build_mode = "debug"
hap_profile = "entry/src/main/module.json"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":formmodule_js_assets",
":formmodule_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
}
ohos_app_scope("formmodule_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("formmodule_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("formmodule_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":formmodule_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
import FormExtension from '@ohos.application.FormExtension';
import formBindingData from '@ohos.application.formBindingData';
import formInfo from '@ohos.application.formInfo';
export default class FormModuleAbility extends FormExtension {
onCreate(want) {
// Called to return a FormBindingData object.
let formData = {};
return formBindingData.createFormBindingData(formData);
}
onCastToNormal(formId) {
// Called when the form provider is notified that a temporary form is successfully
// converted to a normal form.
}
onUpdate(formId) {
// Called to notify the form provider to update a specified form.
}
onVisibilityChange(newStatus) {
// Called when the form provider receives form events from the system.
}
onEvent(formId, message) {
// Called when a specified message event defined by the form provider is triggered.
}
onDestroy(formId) {
// Called to notify the form provider that a specified form has been destroyed.
}
onAcquireFormState(want) {
// Called to return a {@link FormState} object.
return formInfo.FormState.READY;
}
};
\ No newline at end of file
import Ability from '@ohos.application.Ability'
export default class ModuleAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
#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;
}
<div>
<div id="wrapper">
<div id="div1">
<text id="text1">{{title}}</text>
</div>
</div>
</div>
\ No newline at end of file
{
"actions": {},
"data": {
"title": "Hello World"
}
}
\ No newline at end of file
{
"module": {
"name": "module1",
"type": "feature",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:module1_desc",
"mainElement": "ModuleAbility",
"deviceTypes": [
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "ModuleAbility",
"srcEntrance": "./ets/ModuleAbility/ModuleAbility.ts",
"description": "$string:ModuleAbility_desc",
"icon": "$media:icon",
"label": "$string:ModuleAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "FormAbility",
"srcEntrance": "./ets/FormAbility/FormAbility.ts",
"label": "$string:form_FormAbility_label",
"description": "$string:form_FormAbility_desc",
"type": "form",
"metadata": [
{
"name": "ohos.extension.form",
"resource": "$profile:form_config"
}
]
}
]
}
}
\ No newline at end of file
{
"color": [
{
"name": "white",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module1_desc",
"value": "description"
},
{
"name": "ModuleAbility_desc",
"value": "description"
},
{
"name": "ModuleAbility_label",
"value": "label"
},
{
"name": "form_FormAbility_desc",
"value": "form_description"
},
{
"name": "form_FormAbility_label",
"value": "form_label"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
{
"forms": [
{
"name": "widget1",
"description": "This is a service widget.",
"src": "./js/widget1/pages/index/index",
"window": {
"designWidth": 720,
"autoDesignWidth": true
},
"colorMode": "dark",
"isDefault": true,
"updateEnabled": true,
"scheduledUpdateTime": "10:30",
"updateDuration": 1,
"defaultDimension": "2*2",
"supportDimensions": [
"2*2"
],
"formConfigAbility": "ability://xxxxx"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "ohos.acts.aafwk.test.stagesupplement",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"debug": false,
"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": "StageSupplement"
}
]
}
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES 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("StageSupplement") {
hap_profile = "entry/src/main/module.json"
hap_name = "StageSupplement"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":stagesupplement_js_assets",
":stagesupplement_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
}
ohos_app_scope("stagesupplement_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("stagesupplement_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("stagesupplement_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":stagesupplement_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.info("[Demo] MyAbilityStage onCreate")
}
}
\ No newline at end of file
import ServiceExtensionAbility from "@ohos.application.ServiceExtensionAbility";
import rpc from "@ohos.rpc";
import commonEvent from '@ohos.commonEvent';
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.log(printLogS1 + "onRemoteRequest");
if (code == 1) {
console.log(printLogS1 + "onRemoteRequest code 1");
let op1 = data.readInt();
let op2 = data.readInt();
console.log(printLogS1 + "onRemoteRequest op1 = " + op1 + ", op2 = " + op2);
reply.writeInt(op1 + op2);
}
else {
console.log(printLogS1 + "onRemoteRequest code = " + code);
}
return true;
}
}
var printLogS1 = "Stage:ServiceAbility:";
var listPushS1 = "Stage_ServiceAbility_";
class ExtensionAbility extends ServiceExtensionAbility {
onCreate(want) {
console.log(printLogS1 + 'onCreate');
commonEvent.publish(listPushS1 + "onCreate", (err) => {
console.info(printLogS1 + listPushS1 + "onCreate");
});
}
onDestroy() {
console.log(printLogS1 + 'onDestroy');
commonEvent.publish(listPushS1 + "onDestroy", (err) => {
console.info(printLogS1 + listPushS1 + "onDestroy");
});
}
onRequest(want, startId) {
console.log(printLogS1 + 'onRequest');
}
onConnect(want) {
console.log(printLogS1 + 'onConnect');
return new StubTest1("Test1");
}
onDisconnect(want) {
console.log(printLogS1 + 'onDisconnect');
this.context
}
dump(param) {
console.info(printLogS1 + "dump = " + JSON.stringify(param))
var CommonEventPublishData = {
parameters: {
dumpParam: param
}
}
commonEvent.publish(listPushS1 + "Dump", CommonEventPublishData, (err) => {
console.info(printLogS1 + listPushS1 + "Dump");
});
return ["ExtensionAbility"]
}
};
export default ExtensionAbility
\ No newline at end of file
import ServiceExtensionAbility from "@ohos.application.ServiceExtensionAbility";
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.log(printLogS2 + "onRemoteRequest");
if (code == 1) {
console.log(printLogS2 + "onRemoteRequest code 1");
let op1 = data.readInt();
let op2 = data.readInt();
console.log(printLogS2 + "onRemoteRequest op1 = " + op1 + ", op2 = " + op2);
reply.writeInt(op1 + op2);
}
else {
console.log(printLogS2 + "onRemoteRequest code = " + code);
}
return true;
}
}
var printLogS2 = "Stage:ServiceAbility2:";
var listPushS2 = "Stage_ServiceAbility2_";
class ExtensionAbility2 extends ServiceExtensionAbility {
onCreate(want) {
console.log(printLogS2 + 'onCreate');
commonEvent.publish(listPushS2 + "onCreate", (err) => {
console.info(printLogS2 + listPushS2 + "onCreate");
});
}
onDestroy() {
console.log(printLogS2 + 'onDestroy');
commonEvent.publish(listPushS2 + "onDestroy", (err) => {
console.info(printLogS2 + listPushS2 + "onDestroy");
});
}
onRequest(want, startId) {
console.log(printLogS2 + 'onRequest');
}
onConnect(want) {
console.log(printLogS2 + 'onConnect');
return new StubTest2("Test1");
}
onDisconnect(want) {
console.log(printLogS2 + 'onDisconnect');
}
};
export default ExtensionAbility2
\ No newline at end of file
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent';
var printLog1 = "Stage:MainAbility:";
var listPush1 = "Stage_MainAbility_";
var launchWant
var lastRequestWant
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.info(printLog1 + "onCreate")
launchWant = this.launchWant
lastRequestWant = this.lastRequestWant
commonEvent.publish(listPush1 + "onCreate", (err) => {
console.info(printLog1 + listPush1 + "onCreate");
});
setTimeout(()=>{
this.context.terminateSelf().then((data) => {
console.info(printLog1 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog1 + "terminateSelf err = " + JSON.stringify(err));
});
}, 6000)
}
onDestroy() {
console.info(printLog1 + "onDestroy")
commonEvent.publish(listPush1 + "onDestroy", (err) => {
console.info(printLog1 + listPush1 + "onDestroy");
});
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.info(printLog1 + "onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.info(printLog1 + "onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.info(printLog1 + "onForeground")
}
onBackground() {
// Ability has back to background
console.info(printLog1 + "onBackground")
}
dump(param) {
console.info(printLog1 + "dump = " + JSON.stringify(param))
var CommonEventPublishData = {
parameters: {
dumpParam: param,
lastRequestWant: lastRequestWant,
launchWant: launchWant
}
}
commonEvent.publish(listPush1 + "Dump", CommonEventPublishData, (err) => {
console.info(printLog1 + listPush1 + "Dump");
});
return ["MainAbility"]
}
};
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent';
var printLog10 = "Stage:MainAbility10:";
var listPush10 = "Stage_MainAbility10_";
export default class MainAbility10 extends Ability {
onCreate(want, launchParam) {
console.info(printLog10 + "onCreate")
let list = ["ohos.permission.CAMERA"]
this.context.requestPermissionsFromUser(list).then((permissionRequestResult) => {
console.info(printLog10 + "requestPermissionsFromUser data = " + JSON.stringify(permissionRequestResult));
var CommonEventPublishData = {
parameters: {
permissionRequestResult: permissionRequestResult
}
}
commonEvent.publish(listPush10 + "onCreate", CommonEventPublishData, (err) => {
console.info(printLog10 + listPush10 + "onCreate");
});
}).catch((err) => {
console.info(printLog10 + "requestPermissionsFromUser err = " + JSON.stringify(err));
});
setTimeout(()=>{
this.context.terminateSelf().then((data) => {
console.info(printLog10 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog10 + "terminateSelf err = " + JSON.stringify(err));
});
}, 3000)
}
onDestroy() {
console.info(printLog10 + "onDestroy")
commonEvent.publish(listPush10 + "onDestroy", (err) => {
console.info(printLog10 + listPush10 + "onDestroy");
});
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.info(printLog10 + "onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.info(printLog10 + "onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.info(printLog10 + "onForeground")
}
onBackground() {
// Ability has back to background
console.info(printLog10 + "onBackground")
}
};
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent';
import AbilityConstant from '@ohos.application.AbilityConstant';
import distributedObject from '@ohos.data.distributedDataObject';
import accessControl from '@ohos.abilityAccessCtrl';
import bundle from '@ohos.bundle';
var BUNDLE_NAME = 'ohos.acts.aafwk.test.stagesupplement'
var PERMISSION_REJECT = -1
var printLog2 = "Stage:MainAbility2:";
var listPush2 = "Stage_MainAbility2_";
class ContentStorage {
}
var g_object = distributedObject.createDistributedObject({name:undefined});
export default class MainAbility2 extends Ability {
contentStorage : ContentStorage
sessionId : string;
statusCallback(sessionId, networkid, status) {
// @ts-ignore
console.info(printLog2 + `continuation object status change, sessionId: ${sessionId}, status: ${status}, g_object.name: ${g_object.name}`)
}
onCreate(want, launchParam) {
console.info(printLog2 + "onCreate = " + launchParam.launchReason)
if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) {
let input = want.parameters.input // get user data from want params
// @ts-ignore
AppStorage.SetOrCreate<string>('ContinueInput', input)
console.info(printLog2 + `onCreate for continuation sessionId: ${this.sessionId}`)
this.contentStorage = new ContentStorage();
this.context.restoreWindowStage(this.contentStorage);
}
}
onDestroy() {
console.info(printLog2 + "onDestroy")
commonEvent.publish(listPush2 + "onDestroy", (err) => {
console.info(printLog2 + listPush2 + "onDestroy");
});
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.info(printLog2 + "onWindowStageCreate")
// this.requestPermissions()
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.info(printLog2 + "onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.info(printLog2 + "onForeground")
}
onBackground() {
// Ability has back to background
console.info(printLog2 + "onBackground")
}
onContinue(wantParam : {[key: string]: any}) {
console.info(printLog2 + "onContinue")
// set user input data into want params
// @ts-ignore
wantParam["input"] = AppStorage.Get<string>('ContinueInput');
console.info(printLog2 + `onContinue input = ${wantParam["input"]}`);
return AbilityConstant.OnContinueResult.AGREE
}
// @ts-ignore
onNewWant(want, launchParam) {
console.info(printLog2 + "onNewWant = " + launchParam.launchReason)
if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) {
// get distributed data object session id from want params
this.sessionId = want.parameters.session
// @ts-ignore
g_object.name = undefined;
// @ts-ignore
g_object.on("status", this.statusCallback);
// set session id, so it will sync data from remote device
g_object.setSessionId(this.sessionId);
this.contentStorage = new ContentStorage();
this.context.restoreWindowStage(this.contentStorage);
}
}
onWindowStageRestore(windowStage) {
console.info(printLog2 + "onWindowStageCreate")
// this.requestPermissions()
commonEvent.publish(listPush2 + "onWindowStageRestore", (err) => {
console.info(printLog2 + listPush2 + "onWindowStageRestore");
});
setTimeout(()=>{
this.context.terminateSelf().then((data) => {
console.info(printLog2 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog2 + "terminateSelf err = " + JSON.stringify(err));
});
}, 3000)
}
requestPermissions = async () => {
let permissions: Array<string> = [
"ohos.permission.DISTRIBUTED_DATASYNC"
];
let needGrantPermission = false
let accessManger = accessControl.createAtManager()
console.info(printLog2 + "app permission get bundle info")
let bundleInfo = await bundle.getApplicationInfo(BUNDLE_NAME, 0, 100)
console.info(printLog2 + `app permission query permission ${bundleInfo.accessTokenId.toString()}`)
for (const permission of permissions) {
console.info(printLog2 + `app permission query grant status ${permission}`)
try {
let grantStatus = await accessManger.verifyAccessToken(bundleInfo.accessTokenId, permission)
if (grantStatus === PERMISSION_REJECT) {
needGrantPermission = true
break;
}
} catch (err) {
console.info(printLog2 + `app permission query grant status error ${permission} ${JSON.stringify(err)}`)
needGrantPermission = true
break;
}
}
if (needGrantPermission) {
console.info(printLog2 + "app permission needGrantPermission")
try {
await this.context.requestPermissionsFromUser(permissions)
} catch (err) {
console.info(printLog2 + `app permission ${JSON.stringify(err)}`)
}
} else {
console.info(printLog2 + "app permission already granted")
}
}
};
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent';
var printLog3 = "Stage:MainAbility3:";
var listPush3 = "Stage_MainAbility3_";
export default class MainAbility3 extends Ability {
onCreate(want, launchParam) {
console.info(printLog3 + "onCreate")
let launchWant = this.launchWant
let lastRequestWant = this.lastRequestWant
var CommonEventPublishData = {
parameters: {
launchWant: launchWant,
lastRequestWant: lastRequestWant,
launchReason: launchParam.launchReason,
lastExitReason: launchParam.lastExitReason
}
}
commonEvent.publish(listPush3 + "onCreate", CommonEventPublishData, (err) => {
console.info(printLog3 + listPush3 + "onCreate");
});
setTimeout(()=>{
this.context.terminateSelf().then((data) => {
console.info(printLog3 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog3 + "terminateSelf err = " + JSON.stringify(err));
});
}, 3000)
}
onDestroy() {
console.info(printLog3 + "onDestroy")
commonEvent.publish(listPush3 + "onDestroy", (err) => {
console.info(printLog3 + listPush3 + "onDestroy");
});
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.info(printLog3 + "onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.info(printLog3 + "onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.info(printLog3 + "onForeground")
}
onBackground() {
// Ability has back to background
console.info(printLog3 + "onBackground")
}
};
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent';
var printLog4 = "Stage:MainAbility4:";
var listPush4 = "Stage_MainAbility4_";
export default class MainAbility4 extends Ability {
onCreate(want, launchParam) {
console.info(printLog4 + "onCreate")
let screenDensity = this.context.config.screenDensity
var CommonEventPublishData = {
parameters: {
screenDensity: screenDensity
}
}
commonEvent.publish(listPush4 + "onCreate", CommonEventPublishData, (err) => {
console.info(printLog4 + listPush4 + "onCreate");
});
setTimeout(()=>{
this.context.terminateSelf().then((data) => {
console.info(printLog4 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog4 + "terminateSelf err = " + JSON.stringify(err));
});
}, 3000)
}
onDestroy() {
console.info(printLog4 + "onDestroy")
commonEvent.publish(listPush4 + "onDestroy", (err) => {
console.info(printLog4 + listPush4 + "onDestroy");
});
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.info(printLog4 + "onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.info(printLog4 + "onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.info(printLog4 + "onForeground")
}
onBackground() {
// Ability has back to background
console.info(printLog4 + "onBackground")
}
};
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent';
var printLog5 = "Stage:MainAbility5:";
var listPush5 = "Stage_MainAbility5_";
export default class MainAbility5 extends Ability {
onCreate(want, launchParam) {
console.info(printLog5 + "onCreate")
// @ts-ignore
var isTerminating = this.context.isTerminating()
var createIsTerminating = {
parameters: {
isTerminating: isTerminating
}
}
commonEvent.publish(listPush5 + "onCreate", createIsTerminating, (err) => {
console.info(printLog5 + listPush5 + "onCreate");
});
setTimeout(()=>{
this.context.terminateSelf().then((data) => {
console.info(printLog5 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog5 + "terminateSelf err = " + JSON.stringify(err));
});
}, 3000)
}
onDestroy() {
console.info(printLog5 + "onDestroy")
// @ts-ignore
var isTerminating = this.context.isTerminating()
var destroyIsTerminating = {
parameters: {
isTerminating: isTerminating
}
}
commonEvent.publish(listPush5 + "onDestroy", destroyIsTerminating, (err) => {
console.info(printLog5 + listPush5 + "onDestroy");
});
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.info(printLog5 + "onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.info(printLog5 + "onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.info(printLog5 + "onForeground")
}
onBackground() {
// Ability has back to background
console.info(printLog5 + "onBackground")
}
};
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent';
var printLog6 = "Stage:MainAbility6:";
var listPush6 = "Stage_MainAbility6_";
export default class MainAbility6 extends Ability {
onCreate(want, launchParam) {
console.info(printLog6 + "onCreate = " + want.flags)
var flags = {
parameters: {
flags: want.flags
}
}
commonEvent.publish(listPush6 + "onCreate", flags, (err) => {
console.info(printLog6 + listPush6 + "onCreate");
});
setTimeout(()=>{
this.context.terminateSelf().then((data) => {
console.info(printLog6 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog6 + "terminateSelf err = " + JSON.stringify(err));
});
}, 3000)
}
onDestroy() {
console.info(printLog6 + "onDestroy")
commonEvent.publish(listPush6 + "onDestroy", (err) => {
console.info(printLog6 + listPush6 + "onDestroy");
});
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.info(printLog6 + "onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.info(printLog6 + "onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.info(printLog6 + "onForeground")
}
onBackground() {
// Ability has back to background
console.info(printLog6 + "onBackground")
}
};
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent';
var printLog7 = "Stage:MainAbility7:";
var listPush7 = "Stage_MainAbility7_";
export default class MainAbility7 extends Ability {
onCreate(want, launchParam) {
console.info(printLog7 + "onCreate = " + want.flags)
var flags = {
parameters: {
flags: want.flags
}
}
commonEvent.publish(listPush7 + "onCreate", flags, (err) => {
console.info(printLog7 + listPush7 + "onCreate");
});
setTimeout(()=>{
this.context.terminateSelf().then((data) => {
console.info(printLog7 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog7 + "terminateSelf err = " + JSON.stringify(err));
});
}, 3000)
}
onDestroy() {
console.info(printLog7 + "onDestroy")
commonEvent.publish(listPush7 + "onDestroy", (err) => {
console.info(printLog7 + listPush7 + "onDestroy");
});
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.info(printLog7 + "onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.info(printLog7 + "onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.info(printLog7 + "onForeground")
}
onBackground() {
// Ability has back to background
console.info(printLog7 + "onBackground")
}
};
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent';
var printLog8 = "Stage:MainAbility8:";
var listPush8 = "Stage_MainAbility8_";
export default class MainAbility8 extends Ability {
onCreate(want, launchParam) {
console.info(printLog8 + "onCreate = " + want.flags)
var flags = {
parameters: {
flags: want.flags
}
}
commonEvent.publish(listPush8 + "onCreate", flags, (err) => {
console.info(printLog8 + listPush8 + "onCreate");
});
setTimeout(()=>{
this.context.terminateSelf().then((data) => {
console.info(printLog8 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog8 + "terminateSelf err = " + JSON.stringify(err));
});
}, 3000)
}
onDestroy() {
console.info(printLog8 + "onDestroy")
commonEvent.publish(listPush8 + "onDestroy", (err) => {
console.info(printLog8 + listPush8 + "onDestroy");
});
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.info(printLog8 + "onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.info(printLog8 + "onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.info(printLog8 + "onForeground")
}
onBackground() {
// Ability has back to background
console.info(printLog8 + "onBackground")
}
};
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonEvent';
import AbilityConstant from '@ohos.application.AbilityConstant';
var printLog9 = "Stage:MainAbility9:";
var listPush9 = "Stage_MainAbility9_";
var lifeList9 = [];
export default class MainAbility9 extends Ability {
onCreate(want, launchParam) {
console.info(printLog9 + "onCreate")
lifeList9 = []
lifeList9.push(listPush9 + "onCreate")
setTimeout(()=>{
this.context.terminateSelf().then((data) => {
console.info(printLog9 + "terminateSelf data = " + JSON.stringify(data));
}).catch((err) => {
console.info(printLog9 + "terminateSelf err = " + JSON.stringify(err));
});
}, 3000)
}
onDestroy() {
console.info(printLog9 + "onDestroy")
lifeList9.push(listPush9 + "onDestroy")
var lifeList = {
parameters: {
lifeList: lifeList9
}
}
commonEvent.publish(listPush9 + "onDestroy", lifeList, (err) => {
console.info(printLog9 + listPush9 + "onDestroy");
});
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.info(printLog9 + "onWindowStageCreate")
lifeList9.push(listPush9 + "onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.info(printLog9 + "onWindowStageDestroy")
lifeList9.push(listPush9 + "onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.info(printLog9 + "onForeground")
lifeList9.push(listPush9 + "onForeground")
}
onBackground() {
// Ability has back to background
console.info(printLog9 + "onBackground")
lifeList9.push(listPush9 + "onBackground")
}
onWindowStageRestore(windowStage) {
console.info(printLog9 + "onWindowStageRestore")
lifeList9.push(listPush9 + "onWindowStageRestore")
}
onNewWant() {
console.info(printLog9 + "onNewWant")
lifeList9.push(listPush9 + "onNewWant")
}
onContinue(wantParam : {[key: string]: any}) {
console.info(printLog9 + "onContinue")
lifeList9.push(listPush9 + "onContinue")
commonEvent.publish(listPush9 + "onContinue", (err) => {
console.info(printLog9 + listPush9 + "onContinue");
});
return AbilityConstant.OnContinueResult.AGREE
}
};
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 Stage'
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": [
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"launchType": "singleton",
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
},
{
"name": "MainAbility2",
"srcEntrance": "./ets/MainAbility2/MainAbility2.ts",
"description": "$string:MainAbility2_desc",
"icon": "$media:icon",
"label": "$string:MainAbility2_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"launchType": "singleton",
"continuable": true
},
{
"name": "MainAbility3",
"srcEntrance": "./ets/MainAbility3/MainAbility3.ts",
"description": "$string:MainAbility3_desc",
"icon": "$media:icon",
"label": "$string:MainAbility3_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"launchType": "singleton"
},
{
"name": "MainAbility4",
"srcEntrance": "./ets/MainAbility4/MainAbility4.ts",
"description": "$string:MainAbility4_desc",
"icon": "$media:icon",
"label": "$string:MainAbility4_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"launchType": "singleton"
},
{
"name": "MainAbility5",
"srcEntrance": "./ets/MainAbility5/MainAbility5.ts",
"description": "$string:MainAbility5_desc",
"icon": "$media:icon",
"label": "$string:MainAbility5_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"launchType": "singleton"
},
{
"name": "MainAbility6",
"srcEntrance": "./ets/MainAbility6/MainAbility6.ts",
"description": "$string:MainAbility6_desc",
"icon": "$media:icon",
"label": "$string:MainAbility6_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"launchType": "singleton"
},
{
"name": "MainAbility7",
"srcEntrance": "./ets/MainAbility7/MainAbility7.ts",
"description": "$string:MainAbility7_desc",
"icon": "$media:icon",
"label": "$string:MainAbility7_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"launchType": "singleton"
},
{
"name": "MainAbility8",
"srcEntrance": "./ets/MainAbility8/MainAbility8.ts",
"description": "$string:MainAbility8_desc",
"icon": "$media:icon",
"label": "$string:MainAbility8_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"launchType": "singleton"
},
{
"name": "MainAbility9",
"srcEntrance": "./ets/MainAbility9/MainAbility9.ts",
"description": "$string:MainAbility9_desc",
"icon": "$media:icon",
"label": "$string:MainAbility9_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"launchType": "singleton"
},
{
"name": "MainAbility10",
"srcEntrance": "./ets/MainAbility10/MainAbility10.ts",
"description": "$string:MainAbility10_desc",
"icon": "$media:icon",
"label": "$string:MainAbility10_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"launchType": "singleton"
}
],
"extensionAbilities": [
{
"srcEntrance": "./ets/ExtensionAbility/ExtensionAbility.ts",
"name": "ExtensionAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"type": "service",
"visible": true
},
{
"srcEntrance": "./ets/ExtensionAbility2/ExtensionAbility2.ts",
"name": "ExtensionAbility2",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"type": "fileShare",
"uri": "fileshare://com.samples.filesharetest.FileShare",
"visible": true
}
],
"requestPermissions": [
{
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO"
},
{
"name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name":"ohos.permission.REMOVE_CACHE_FILES"
},
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE"
},
{
"name":"ohos.permission.INSTALL_BUNDLE"
}
]
}
}
\ No newline at end of file
{
"color": [
{
"name": "white",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "StageSupplement"
},
{
"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": "MainAbility7_desc",
"value": "description"
},
{
"name": "MainAbility7_label",
"value": "label"
},
{
"name": "MainAbility8_desc",
"value": "description"
},
{
"name": "MainAbility8_label",
"value": "label"
},
{
"name": "MainAbility9_desc",
"value": "description"
},
{
"name": "MainAbility9_label",
"value": "label"
},
{
"name": "MainAbility10_desc",
"value": "description"
},
{
"name": "MainAbility10_label",
"value": "label"
},
{
"name": "MainAbility11_desc",
"value": "description"
},
{
"name": "MainAbility11_label",
"value": "label"
}
]
}
\ No newline at end of file
[ZoneTransfer]
ZoneId=0
ReferrerUrl=vscode-file://vscode-app/d:/Software/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html
HostUrl=file:///d%3A/OpenHarmony/Xts/xts_acts-master/aafwk/aafwk_standard/newwant/actsnewwantbrelyhap/signature/openharmony_sx.p7b
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册