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

!9136 xts接口属性覆盖

Merge pull request !9136 from kirl75/master
......@@ -14,10 +14,40 @@
*/
import AbilityStage from "@ohos.app.ability.AbilityStage"
const ONACCEPTWANT_KEY_NOTSET_ID = -1;
const ONACCEPTWANT_KEY_UNDEFINED_ID = -2;
var onAcceptWantCalledSeq;
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
globalThis.stageContext = this.context;
}
onAcceptWant(want) {
console.log("AbilityMultiInstanceAppA onAcceptWant called want:" + JSON.stringify(want));
if ((want.parameters == undefined) || (want.parameters.startId == undefined)) {
console.log("AbilityMultiInstanceAppA specified param err");
return;
}
var abilityId = want.parameters.startId.toString();
onAcceptWantCalledSeq = "onAcceptWantCalled";
onAcceptWantCalledSeq += "Id";
onAcceptWantCalledSeq += abilityId;
globalThis.onAcceptWantCalledSeq = onAcceptWantCalledSeq;
if (want.parameters.startId == ONACCEPTWANT_KEY_NOTSET_ID) {
return;
} else if (want.parameters.startId == ONACCEPTWANT_KEY_UNDEFINED_ID) {
return undefined;
}
globalThis.abilityWant = want;
console.log("AbilityMultiInstanceAppA set globalThis result :" + globalThis.onAcceptWantCalledSeq);
return abilityId;
}
onConfigurationUpdate(config) {
console.log('[Demo] MainAbility onConfigurationUpdate: ' + this.context.config.language)
console.log('[Demo] MainAbility onConfigurationUpdate: ' + config.language)
globalThis.UpdateConfiguration_0200 = config.language
}
}
\ No newline at end of file
......@@ -43,21 +43,35 @@ export default class FormAbility extends FormExtension {
onCastToNormalForm(formId) {
// Called when the form provider is notified that a temporary form is successfully
// converted to a normal form.
console.info("FormAbility onCastToNormalForm===end=== " + formId)
}
onUpdateForm(formId) {
console.info("FormAbility onUpdateForm===end=== " + formId)
// Called to notify the form provider to update a specified form.
let formData = {};
let proxies = [
{
"key": "detail",
"subscriberId": "11"
}
]
let formBinding = formBindingData.createFormBindingData(formData);
formBinding["proxies"] = proxies;
}
onChangeFormVisibility(newStatus) {
console.info("FormAbility onChangeFormVisibility===end=== " + newStatus)
// Called when the form provider receives form events from the system.
}
onFormEvent(formId, message) {
console.info("FormAbility onFormEvent===end=== " + message)
// Called when a specified message event defined by the form provider is triggered.
}
onRemoveForm(formId) {
console.info("FormAbility onRemoveForm===end=== " + formId)
// Called to notify the form provider that a specified form has been destroyed.
}
......@@ -66,4 +80,9 @@ export default class FormAbility extends FormExtension {
console.info("FormAbility want success" + JSON.stringify(want.parameters))
return formInfo.FormState.READY;
}
onConfigurationUpdate(config) {
console.log('[Demo] MainAbility onConfigurationUpdate: ' + this.context.config.language)
console.log('[Demo] MainAbility onConfigurationUpdate: ' + config.language)
}
};
\ No newline at end of file
......@@ -33,6 +33,10 @@ export default class MainAbility extends Ability {
windowStage.setUIContent(this.context, "MainAbility/pages/MainAbility_pages", null)
}
onWindowStageRestore(windowStage){
console.log("[Demo] MainAbility onWindowStageRestore")
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
......
......@@ -20,6 +20,7 @@ export default class SecondAbility extends Ability {
console.log("[Demo] SecondAbility onCreate")
globalThis.abilityWant = want;
globalThis.applicationContext = this.context.getApplicationContext();
globalThis.SecondLaunchParm = launchParam;
}
onDestroy() {
......
/*
* 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.app.ability.UIAbility'
import commonEvent from '@ohos.commonEvent';
import wantConstant from '@ohos.app.ability.wantConstant'
export default class SecondAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] SecondAbility onCreate")
globalThis.abilityWant = want;
globalThis.applicationContext = this.context.getApplicationContext();
}
onDestroy() {
console.log("[Demo] SecondAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] SecondAbility onWindowStageCreate")
globalThis.abilityContext = this.context;
windowStage.setUIContent(this.context, "ThirdAbility/pages/MainAbility_pages", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] SecondAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] SecondAbility onForeground")
var CommonEventPublishData = {
parameters: {
"Life": "onForeground"
}
}
commonEvent.publish("Form_StartAbility", CommonEventPublishData, (err) => {
console.info("Form_StartAbility onCreate");
});
}
onBackground() {
// Ability has back to background
console.log("[Demo] SecondAbility onBackground")
}
onDump(Param){
return null;
}
onShare(wantParam){
wantParam[wantConstant.Params.CONTENT_TITLE_KEY] = {title:"baidu"},
wantParam[wantConstant.Params.SHARE_ABSTRACT_KEY] = {Abstract:"share data"},
wantParam[wantConstant.Params.SHARE_URL_KEY] = {uri:"www.baidu.com"}
}
};
\ 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 router from '@ohos.router';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../test/List.test'
@Entry
@Component
struct Index {
@State message: string = 'ThirdAbility'
@State create: string = 'ThirdAbility'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
......@@ -25,6 +25,7 @@ import ability from '@ohos.ability.ability';
import abilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
import common from '@ohos.app.ability.common';
import contextConstant from "@ohos.app.ability.contextConstant"
import wantConstant from "@ohos.app.ability.wantConstant"
let EXTENSION_INFO_ERR = 16000001;
let INNER_ERROR = 16000050;
......@@ -472,6 +473,10 @@ export default function ApiCoverTest() {
expect("ohos.extra.param.key.form_identity").assertEqual(formInfoNew.FormParam.IDENTITY_KEY)
expect("ohos.extra.param.key.bundle_name").assertEqual(formInfoNew.FormParam.BUNDLE_NAME_KEY)
expect("ohos.extra.param.key.ability_name").assertEqual(formInfoNew.FormParam.ABILITY_NAME_KEY)
expect('ohos.extra.param.key.form_customize').assertEqual(formInfoNew.FormParam.PARAM_FORM_CUSTOMIZE_KEY)
expect('ohos.extra.param.key.form_launch_reason').assertEqual(formInfoNew.FormParam.LAUNCH_REASON_KEY)
expect(1).assertEqual(formInfoNew.LaunchReason.FORM_DEFAULT);
expect(2).assertEqual(formInfoNew.LaunchReason.FORM_SHARE);
expect(0).assertEqual(formInfoNew.FormState.DEFAULT)
expect(1).assertEqual(formInfoNew.FormState.READY)
expect(-1).assertEqual(formInfoNew.FormState.UNKNOWN)
......@@ -507,9 +512,19 @@ export default function ApiCoverTest() {
expect(1).assertEqual(abilityConstant.LaunchReason.START_ABILITY)
expect(1).assertEqual(abilityConstant.LastExitReason.ABILITY_NOT_RESPONDING)
expect(2).assertEqual(abilityConstant.LastExitReason.NORMAL)
expect(3).assertEqual(abilityConstant.LastExitReason.CPP_CRASH)
expect(4).assertEqual(abilityConstant.LastExitReason.JS_ERROR)
expect(5).assertEqual(abilityConstant.LastExitReason.APP_FREEZE)
expect(6).assertEqual(abilityConstant.LastExitReason.PERFORMANCE_CONTROL)
expect(7).assertEqual(abilityConstant.LastExitReason.RESOURCE_CONTROL)
expect(8).assertEqual(abilityConstant.LastExitReason.UPGRADE)
expect(0).assertEqual(abilityConstant.MemoryLevel.MEMORY_LEVEL_MODERATE)
expect(1).assertEqual(abilityConstant.MemoryLevel.MEMORY_LEVEL_LOW)
expect(2).assertEqual(abilityConstant.MemoryLevel.MEMORY_LEVEL_CRITICAL)
expect(5).assertEqual(abilityConstant.LaunchReason.SHARE)
expect('ohos.extra.param.key.contentTitle').assertEqual(wantConstant.Params.CONTENT_TITLE_KEY)
expect('ohos.extra.param.key.shareAbstract').assertEqual(wantConstant.Params.SHARE_ABSTRACT_KEY)
expect('ohos.extra.param.key.shareUrl').assertEqual(wantConstant.Params.SHARE_URL_KEY)
done()
});
......
......@@ -187,6 +187,7 @@ export default function ApiCoverTest() {
}).finally(() => {
globalThis.UpdateConfiguration_0200_resolve = null;
globalThis.UpdateConfiguration_0200_reject = null;
expect(globalThis.UpdateConfiguration_0200).assertEqual('zh-Hans')
console.info("SUB_AA_UpdateConfiguration_0200 ----> set promise to null after all");
done();
});
......
......@@ -46,6 +46,17 @@
"visible": true,
"launchType": "singleton"
},
{
"name": "ThirdAbility",
"srcEntrance": "./ets/ThirdAbility/SecondAbility.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"launchType": "specified"
},
{
"name": "CreateFormAbility",
"srcEntrance": "./ets/CreateFormAbility/CreateFormAbility.ts",
......
......@@ -3,6 +3,7 @@
"MainAbility/pages/MainAbility_pages",
"SecondAbility/pages/MainAbility_pages",
"CreateFormAbility/pages/MainAbility_pages",
"FormHostAbility/pages/MainAbility_pages"
"FormHostAbility/pages/MainAbility_pages",
"ThirdAbility/pages/MainAbility_pages"
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册