提交 d8d051d8 编写于 作者: Y yangzk

fixed 0d3e60d from https://gitee.com/yzkp/xts_acts/pulls/6213

IssueNo: #I5Y6PR
Description: 使用UIAbility
Sig: SIG_ApplicationFramework
Feature or Bugfix: Feature
Binary Source: No
Signed-off-by: Nyangzk <yangzhongkai@huawei.com>
Change-Id: I4c1a5cc85c84a473aecb2e94904ed7d897284c81
上级 d03a565b
...@@ -315,7 +315,7 @@ export default function ApiCoverTest() { ...@@ -315,7 +315,7 @@ export default function ApiCoverTest() {
try { try {
let info: appManager.ProcessRunningInfo; let info: appManager.ProcessRunningInfo;
let stageContext: common.AbilityStageContext = globalThis.stageContext; let stageContext: common.AbilityStageContext = globalThis.stageContext;
let abilityContext: common.AbilityContext = globalThis.abilityContext; let abilityContext: common.UIAbilityContext = globalThis.abilityContext;
let appContext: common.ApplicationContext = abilityContext.getApplicationContext(); let appContext: common.ApplicationContext = abilityContext.getApplicationContext();
let baseContext: common.BaseContext = stageContext; let baseContext: common.BaseContext = stageContext;
let context: common.Context = stageContext; let context: common.Context = stageContext;
...@@ -340,18 +340,7 @@ export default function ApiCoverTest() { ...@@ -340,18 +340,7 @@ export default function ApiCoverTest() {
abilityDelegator.addAbilityMonitor(abilityMonitor, (err, data) => { abilityDelegator.addAbilityMonitor(abilityMonitor, (err, data) => {
console.log(`printMsg, err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}`); console.log(`printMsg, err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}`);
}) })
abilityDelegator.printMsg(undefined);
abilityDelegator.printMsg(undefined, (err, data) => {
console.log(`printMsg, err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}`);
});
let shellCmdResult: abilityDelegatorRegistry.ShellCmdResult; let shellCmdResult: abilityDelegatorRegistry.ShellCmdResult;
shellCmdResult = await abilityDelegator.executeShellCmd(undefined);
abilityDelegator.executeShellCmd(undefined, 0, (err, data) => {
console.log(`executeShellCmd, err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}`);
});
abilityDelegator.executeShellCmd(undefined, (err, data) => {
console.log(`executeShellCmd, err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}`);
});
} catch (err) { } catch (err) {
console.log(`catch code: ${err.code}, message: ${err.message}`); console.log(`catch code: ${err.code}, message: ${err.message}`);
} }
......
import Ability from '@ohos.app.ability.Ability' import UIAbility from '@ohos.app.ability.UIAbility'
import AbilityConstant import AbilityConstant from '@ohos.app.ability.AbilityConstant';
from "../../../../../../../../../../../../interface/sdk-js/api/@ohos.app.ability.AbilityConstant";
export default class ModuleAbility extends Ability { export default class ModuleAbility extends UIAbility {
onCreate(want, launchParam) { onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate") console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want; globalThis.abilityWant = want;
...@@ -53,5 +52,4 @@ export default class ModuleAbility extends Ability { ...@@ -53,5 +52,4 @@ export default class ModuleAbility extends Ability {
console.log("[Demo] MainAbility onDump: " + JSON.stringify(param)) console.log("[Demo] MainAbility onDump: " + JSON.stringify(param))
return ["MainAbility"] return ["MainAbility"]
} }
}; };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册