Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a269a7d8
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看板
提交
a269a7d8
编写于
3月 23, 2023
作者:
C
chengxingzhen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
xts-getCurrentTopAbility问题修改
Signed-off-by:
N
chengxingzhen
<
chengxingzhen@huawei.com
>
上级
2babb2cd
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
144 addition
and
1089 deletion
+144
-1089
ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/Test.json
...squeryfunctiontest/actsgetabilitystatestagetest/Test.json
+1
-1
ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility2/MainAbility2.ts
...stagetest/entry/src/main/ets/MainAbility2/MainAbility2.ts
+13
-3
ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility3/MainAbility3.ts
...stagetest/entry/src/main/ets/MainAbility3/MainAbility3.ts
+14
-2
ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility4/MainAbility4.ts
...stagetest/entry/src/main/ets/MainAbility4/MainAbility4.ts
+13
-3
ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/test/Ability.test.ets
...tystatestagetest/entry/src/main/ets/test/Ability.test.ets
+103
-81
ability/ability_runtime/non_concurrent/BUILD.gn
ability/ability_runtime/non_concurrent/BUILD.gn
+0
-2
ability/ability_runtime/non_concurrent/actsthirdappatest/AppScope/app.json
...untime/non_concurrent/actsthirdappatest/AppScope/app.json
+0
-19
ability/ability_runtime/non_concurrent/actsthirdappatest/AppScope/resources/base/element/string.json
...thirdappatest/AppScope/resources/base/element/string.json
+0
-8
ability/ability_runtime/non_concurrent/actsthirdappatest/AppScope/resources/base/media/app_icon.png
...sthirdappatest/AppScope/resources/base/media/app_icon.png
+0
-0
ability/ability_runtime/non_concurrent/actsthirdappatest/BUILD.gn
...ability_runtime/non_concurrent/actsthirdappatest/BUILD.gn
+0
-43
ability/ability_runtime/non_concurrent/actsthirdappatest/Test.json
...bility_runtime/non_concurrent/actsthirdappatest/Test.json
+0
-63
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/Application/AbilityStage.ts
...rdappatest/entry/src/main/ets/Application/AbilityStage.ts
+0
-21
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/MainAbility2/MainAbility2.ts
...dappatest/entry/src/main/ets/MainAbility2/MainAbility2.ts
+0
-57
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/TestAbility/TestAbility.ts
...irdappatest/entry/src/main/ets/TestAbility/TestAbility.ts
+0
-53
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/TestAbility/pages/index.ets
...rdappatest/entry/src/main/ets/TestAbility/pages/index.ets
+0
-27
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+0
-73
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/pages/index/index2.ets
...tsthirdappatest/entry/src/main/ets/pages/index/index2.ets
+0
-27
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/test/AbilityPermission.test.ets
...patest/entry/src/main/ets/test/AbilityPermission.test.ets
+0
-177
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/test/List.test.ets
...t/actsthirdappatest/entry/src/main/ets/test/List.test.ets
+0
-19
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/module.json
...n_concurrent/actsthirdappatest/entry/src/main/module.json
+0
-52
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/resources/base/element/string.json
...ppatest/entry/src/main/resources/base/element/string.json
+0
-36
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/resources/base/media/icon.png
...hirdappatest/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+0
-6
ability/ability_runtime/non_concurrent/actsthirdappatest/signature/openharmony_sx.p7b
...concurrent/actsthirdappatest/signature/openharmony_sx.p7b
+0
-0
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/AppScope/app.json
.../non_concurrent/actsthirdapponerelytest/AppScope/app.json
+0
-19
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/AppScope/resources/base/element/string.json
...pponerelytest/AppScope/resources/base/element/string.json
+0
-8
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/AppScope/resources/base/media/app_icon.png
...apponerelytest/AppScope/resources/base/media/app_icon.png
+0
-0
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/BUILD.gn
...y_runtime/non_concurrent/actsthirdapponerelytest/BUILD.gn
+0
-42
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/ets/Application/AbilityStage.ts
...nerelytest/entry/src/main/ets/Application/AbilityStage.ts
+0
-23
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/ets/MainAbility/MainAbility.ts
...onerelytest/entry/src/main/ets/MainAbility/MainAbility.ts
+0
-59
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/ets/pages/index/index.ets
...rdapponerelytest/entry/src/main/ets/pages/index/index.ets
+0
-40
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/ets/pages/second/second.ets
...apponerelytest/entry/src/main/ets/pages/second/second.ets
+0
-43
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/module.json
...urrent/actsthirdapponerelytest/entry/src/main/module.json
+0
-44
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/resources/base/element/string.json
...elytest/entry/src/main/resources/base/element/string.json
+0
-32
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/resources/base/media/icon.png
...ponerelytest/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+0
-6
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/signature/openharmony_sx.p7b
...rent/actsthirdapponerelytest/signature/openharmony_sx.p7b
+0
-0
未找到文件。
ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/Test.json
浏览文件 @
a269a7d8
...
...
@@ -5,7 +5,7 @@
"test-timeout"
:
"600000"
,
"bundle-name"
:
"com.example.actsgetabilitystatestagetest"
,
"module-name"
:
"entry"
,
"shell-timeout"
:
"
60
0000"
"shell-timeout"
:
"
1
0000"
},
"kits"
:
[
{
...
...
ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility2/MainAbility2.ts
浏览文件 @
a269a7d8
...
...
@@ -14,6 +14,10 @@
*/
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
commonEvent
from
'
@ohos.commonEvent
'
function
publishCallBackOne
()
{
console
.
log
(
"
====MainAbility2 Publish CallBack GetCurrentTopAbility
"
);
}
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
...
...
@@ -27,9 +31,15 @@ export default class MainAbility extends Ability {
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
[Demo] MainAbility onWindowStageCreate
"
)
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index
"
,
null
)
console
.
log
(
"
[Demo] MainAbility onWindowStageCreate
"
);
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index
"
,
null
);
windowStage
.
on
(
'
windowStageEvent
'
,
(
data
)
=>
{
console
.
log
(
`ActsGetAbilityStatestAgeTest onWindwoStageMainAbilty2 is :
${
JSON
.
stringify
(
data
)}
`
);
if
(
data
==
2
)
{
console
.
log
(
`ActsGetAbilityStatestAgeTest getWindowStageActiveMainAbility2 is sucess`
);
commonEvent
.
publish
(
"
GetCurrentTopAbility
"
,
publishCallBackOne
);
}
})
}
onWindowStageDestroy
()
{
...
...
ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility3/MainAbility3.ts
浏览文件 @
a269a7d8
...
...
@@ -14,6 +14,11 @@
*/
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
commonEvent
from
'
@ohos.commonEvent
'
function
publishCallBackOne
()
{
console
.
log
(
"
====MainAbility3 Publish CallBack GetCurrentTopAbility
"
);
}
export
default
class
MainAbility3
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
...
...
@@ -27,9 +32,16 @@ export default class MainAbility3 extends Ability {
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
MainAbility3 onWindowStageCreate
"
)
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index
"
,
null
)
console
.
log
(
"
MainAbility3 onWindowStageCreate
"
)
;
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index
"
,
null
)
;
globalThis
.
ability3Context
=
this
.
context
;
windowStage
.
on
(
'
windowStageEvent
'
,
(
data
)
=>
{
console
.
log
(
`ActsGetAbilityStatestAgeTest onWindwoStageMainAbilty3 is :
${
JSON
.
stringify
(
data
)}
`
);
if
(
data
==
2
)
{
console
.
log
(
`ActsGetAbilityStatestAgeTest getWindowStageActiveMainAbility3 is sucess`
);
commonEvent
.
publish
(
"
GetCurrentTopAbility
"
,
publishCallBackOne
);
}
})
}
onWindowStageDestroy
()
{
...
...
ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility4/MainAbility4.ts
浏览文件 @
a269a7d8
...
...
@@ -13,7 +13,11 @@
* limitations under the License.
*/
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
commonEvent
from
'
@ohos.commonEvent
'
function
publishCallBackOne
()
{
console
.
debug
(
"
====MainAbility4 Publish CallBack GetCurrentTopAbility
"
);
}
export
default
class
MainAbility4
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
...
...
@@ -27,10 +31,16 @@ export default class MainAbility4 extends Ability {
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
MainAbility4 onWindowStageCreate
"
)
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index
"
,
null
)
console
.
log
(
"
MainAbility4 onWindowStageCreate
"
)
;
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index
"
,
null
)
;
globalThis
.
ability4Context
=
this
.
context
;
//commonEvent.publish("ACTS_GetAppContext", PublishCallBackOne4);
windowStage
.
on
(
'
windowStageEvent
'
,
(
data
)
=>
{
console
.
log
(
`ActsGetAbilityStatestAgeTest onWindwoStageMainAbilty4 is :
${
JSON
.
stringify
(
data
)}
`
);
if
(
data
==
2
)
{
console
.
log
(
`ActsGetAbilityStatestAgeTest getWindowStageActiveMainAbility4 is sucess`
);
commonEvent
.
publish
(
"
GetCurrentTopAbility
"
,
publishCallBackOne
);
}
})
}
onWindowStageDestroy
()
{
...
...
ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
a269a7d8
...
...
@@ -15,8 +15,11 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
const START_ABILITY_TIMEOUT = 4000;
import commonEvent from "@ohos.commonEvent"
let subscriberInfo_MainAbility = {
events: ["GetCurrentTopAbility"],
};
export default function abilityTest() {
describe('ActsGetAbilityStateStageTest', function () {
...
...
@@ -26,31 +29,44 @@ export default function abilityTest() {
* @tc.desc : Get the status of the Ability in the BACKGROUND state
*/
it('ACTS_GetAbilityState_0200', 0, async function (done) {
console.debug('====>start ACTS_GetAbilityState_0200====');
var flag = true;
var ability;
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
console.log('====>start ACTS_GetAbilityState_0200====');
let ability;
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let count = 0;
let subscriber;
function onAbilityForegroundCallback2(){
console.debug("====>onAbilityForegroundCallback2====");
abilityDelegator.getCurrentTopAbility((err, data)=>{
console.debug("====>getCurrentTopAbility_0200 err:" + JSON.stringify(err) + " data:" + JSON.stringify(data));
console.log("====>onAbilityForegroundCallback2====");
count ++;
if (count == 2) {
abilityDelegator.getCurrentTopAbility((err, data)=>{
console.log("====>getCurrentTopAbility_0200 err:" + JSON.stringify(err) + " data:" + JSON.stringify(data));
ability = data;
abilityDelegator.doAbilityBackground(ability, (err)=>{
console.
debu
g("====>doAbilityBackground_0200 data:" + JSON.stringify(err));
console.
lo
g("====>doAbilityBackground_0200 data:" + JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
}
}
function onAbilityBackgroundCallback2(){
console.
debu
g("====>onAbilityBackgroundCallback2====");
var
state = abilityDelegator.getAbilityState(ability);
console.
debu
g("====>ACTS_GetAbilityState_0200 state:" + state);
console.
lo
g("====>onAbilityBackgroundCallback2====");
let
state = abilityDelegator.getAbilityState(ability);
console.
lo
g("====>ACTS_GetAbilityState_0200 state:" + state);
expect(state).assertEqual(AbilityDelegatorRegistry.AbilityLifecycleState.BACKGROUND);
console.debug("====>ACTS_GetAbilityState_0200 end====");
flag=false;
done();
console.log("====>ACTS_GetAbilityState_0200 end====");
commonEvent.unsubscribe(subscriber, UnSubscribeCallback);
}
commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => {
console.log("ACTS_GetAbilityState_0200====>Create Subscriber====>");
subscriber = data;
await commonEvent.subscribe(subscriber, onAbilityForegroundCallback2);
})
function UnSubscribeCallback() {
console.log("ACTS_GetAbilityState_0200====>UnSubscribe CallBack====>");
done();
}
abilityDelegator.addAbilityMonitor(
{abilityName: 'MainAbility2',
...
...
@@ -58,24 +74,15 @@ export default function abilityTest() {
onAbilityBackground:onAbilityBackgroundCallback2
}
).then(()=>{
console.
debu
g("====>addAbilityMonitor_0200 finish====");
console.
lo
g("====>addAbilityMonitor_0200 finish====");
globalThis.abilityContext.startAbility(
{
bundleName: 'com.example.actsgetabilitystatestagetest',
abilityName: 'MainAbility2',
}, (err)=>{
console.
debu
g("====>startAbility_0200 err:" + JSON.stringify(err));
console.
lo
g("====>startAbility_0200 err:" + JSON.stringify(err));
})
})
setTimeout(()=>{
if(flag==true){
console.debug("====>in timeout 0200====");
expect().assertFail();
done();
}
},START_ABILITY_TIMEOUT)
})
/*
...
...
@@ -84,46 +91,54 @@ export default function abilityTest() {
* @tc.desc : Get the status of the Ability in the FOREGROUND state
*/
it('ACTS_GetAbilityState_0300', 0, async function (done) {
console.debug('====>start ACTS_GetAbilityState_0300====');
var flag = true;
var ability;
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
console.log('====>start ACTS_GetAbilityState_0300====');
let ability;
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let count = 0;
let subscriber;
function onAbilityForegroundCallback3(){
console.debug("====>onAbilityForegroundCallback3====");
abilityDelegator.getCurrentTopAbility((err, data)=>{
console.debug("====>getCurrentTopAbility_0300 err:" + JSON.stringify(err) + "data:" + JSON.stringify(data));
console.log("====>onAbilityForegroundCallback3====");
count++;
if (count == 2) {
abilityDelegator.getCurrentTopAbility((err, data)=>{
console.log("====>getCurrentTopAbility_0300 err:" + JSON.stringify(err) + "data:" + JSON.stringify(data));
ability = data;
var
state = abilityDelegator.getAbilityState(ability);
console.
debu
g("====>ACTS_GetAbilityState_0300 state:" + state);
let
state = abilityDelegator.getAbilityState(ability);
console.
lo
g("====>ACTS_GetAbilityState_0300 state:" + state);
expect(state).assertEqual(AbilityDelegatorRegistry.AbilityLifecycleState.FOREGROUND);
expect(state != AbilityDelegatorRegistry.AbilityLifecycleState.CREATE).assertTrue()
expect(state != AbilityDelegatorRegistry.AbilityLifecycleState.DESTROY).assertTrue()
expect(state != AbilityDelegatorRegistry.AbilityLifecycleState.CREATE).assertTrue()
;
expect(state != AbilityDelegatorRegistry.AbilityLifecycleState.DESTROY).assertTrue()
;
abilityDelegator.doAbilityBackground(ability, (err)=>{
console.
debu
g("====>doAbilityBackground_0300 data:" + JSON.stringify(err));
console.
lo
g("====>doAbilityBackground_0300 data:" + JSON.stringify(err));
expect(err.code).assertEqual(0);
console.debug("====>ACTS_GetAbilityState_0300 end====");
flag=false;
done();
console.log("====>ACTS_GetAbilityState_0300 end====");
commonEvent.unsubscribe(subscriber, UnSubscribeCallback);
})
})
}
setTimeout(()=>{
if(flag==true){
console.debug("====>in timeout 0300====");
expect().assertFail();
done();
}
},START_ABILITY_TIMEOUT)
}
commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => {
console.log("ACTS_GetAbilityState_0300====>Create Subscriber====>");
subscriber = data;
await commonEvent.subscribe(subscriber, onAbilityForegroundCallback3);
})
function UnSubscribeCallback() {
console.log("ACTS_GetAbilityState_0300====>UnSubscribe CallBack====>");
done();
}
abilityDelegator.addAbilityMonitor(
{abilityName: 'MainAbility3',
onAbilityForeground:onAbilityForegroundCallback3}).then(()=>{
console.
debu
g("====>addAbilityMonitor_0300 finish====");
console.
lo
g("====>addAbilityMonitor_0300 finish====");
globalThis.abilityContext.startAbility(
{
bundleName: 'com.example.actsgetabilitystatestagetest',
abilityName: 'MainAbility3',
}, (err)=>{
console.
debu
g("====>startAbility_0300 err:" + JSON.stringify(err));
console.
lo
g("====>startAbility_0300 err:" + JSON.stringify(err));
})
})
})
...
...
@@ -134,13 +149,13 @@ export default function abilityTest() {
* @tc.desc : Get the status of an inactive or nonexistent Ability
*/
it('ACTS_GetAbilityState_0500', 0, async function (done) {
console.
debu
g('====>start ACTS_GetAbilityState_0500====');
var
ability = Object.create(null);
var
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
var
state = abilityDelegator.getAbilityState(ability);
console.
debu
g("====>ACTS_GetAppState_0500 state:" + state);
console.
lo
g('====>start ACTS_GetAbilityState_0500====');
let
ability = Object.create(null);
let
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let
state = abilityDelegator.getAbilityState(ability);
console.
lo
g("====>ACTS_GetAppState_0500 state:" + state);
expect(state).assertEqual(undefined);
console.
debu
g("====>ACTS_GetAbilityState_0500 end====");
console.
lo
g("====>ACTS_GetAbilityState_0500 end====");
done();
})
...
...
@@ -150,49 +165,56 @@ export default function abilityTest() {
* @tc.desc : Get the status of the Ability in the uninitialized state
*/
it('ACTS_GetAbilityState_0600', 0, async function (done) {
console.debug('====>start ACTS_GetAbilityState_0600====')
var flag = true;
var ability;
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
console.log('====>start ACTS_GetAbilityState_0600====');
let ability;
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let count = 0;
let subscriber;
function onAbilityForegroundCallback6(){
console.debug("====>onAbilityForegroundCallback6====");
abilityDelegator.getCurrentTopAbility((err, data)=>{
console.debug("====>getCurrentTopAbility_0600 err:" + JSON.stringify(err) + "data:" + JSON.stringify(data));
console.log("====>onAbilityForegroundCallback6====");
count++;
if (count == 2) {
abilityDelegator.getCurrentTopAbility((err, data)=>{
console.log("====>getCurrentTopAbility_0600 err:" + JSON.stringify(err) + "data:" + JSON.stringify(data));
ability = data;
globalThis.ability4Context.terminateSelf();
})
})
}
}
function onAbilityDestroyCallback6(){
console.
debu
g("====>onAbilityDestroyCallback6====");
var
state = abilityDelegator.getAbilityState(ability);
console.
debu
g("====>ACTS_GetAbilityState_0600 data:" + state);
console.
debu
g("====>UNINITIALIZED:"+ AbilityDelegatorRegistry.AbilityLifecycleState.UNINITIALIZED);
console.
lo
g("====>onAbilityDestroyCallback6====");
let
state = abilityDelegator.getAbilityState(ability);
console.
lo
g("====>ACTS_GetAbilityState_0600 data:" + state);
console.
lo
g("====>UNINITIALIZED:"+ AbilityDelegatorRegistry.AbilityLifecycleState.UNINITIALIZED);
expect(state).assertEqual(AbilityDelegatorRegistry.AbilityLifecycleState.UNINITIALIZED);
console.debug("====>ACTS_GetAbilityState_0600 end====");
flag=false;
done();
console.log("====>ACTS_GetAbilityState_0600 end====");
commonEvent.unsubscribe(subscriber, UnSubscribeCallback);
}
setTimeout(()=>{
if(flag==true){
console.debug("====>in timeout 0600===");
expect().assertFail();
done();
}
},START_ABILITY_TIMEOUT)
commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => {
console.log("ACTS_GetAbilityState_0600====>Create Subscriber====>");
subscriber = data;
await commonEvent.subscribe(subscriber, onAbilityForegroundCallback6);
})
function UnSubscribeCallback() {
console.log("ACTS_GetAbilityState_0600====>UnSubscribe CallBack====>");
done();
}
abilityDelegator.addAbilityMonitor(
{abilityName: 'MainAbility4',
onAbilityForeground:onAbilityForegroundCallback6,
onAbilityDestroy:onAbilityDestroyCallback6}).then(()=>{
console.
debu
g("====>addAbilityMonitor_0600 finish====");
console.
lo
g("====>addAbilityMonitor_0600 finish====");
globalThis.abilityContext.startAbility(
{
bundleName: 'com.example.actsgetabilitystatestagetest',
abilityName: 'MainAbility4',
}, (err)=>{
console.
debu
g("====>startAbility_0600 err:" + JSON.stringify(err));
console.
lo
g("====>startAbility_0600 err:" + JSON.stringify(err));
})
})
})
})
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/BUILD.gn
浏览文件 @
a269a7d8
...
...
@@ -19,8 +19,6 @@ group("non_concurrent") {
deps = [
"acts_systemappa_test:ActsSystemAppATest",
"acts_systemappone_rely_test:ActsSystemAppOneRelyHap",
"actsthirdappatest:ActsThirdAppATest",
"actsthirdapponerelytest:ActsThirdAppOneRelyHap",
]
}
}
ability/ability_runtime/non_concurrent/actsthirdappatest/AppScope/app.json
已删除
100755 → 0
浏览文件 @
2babb2cd
{
"app"
:
{
"bundleName"
:
"com.example.actsabilitypermissionthirdtest"
,
"vendor"
:
"example"
,
"versionCode"
:
1000000
,
"versionName"
:
"1.0.0"
,
"icon"
:
"$media:app_icon"
,
"label"
:
"$string:app_name"
,
"distributedNotificationEnabled"
:
true
,
"keepAlive"
:
true
,
"singleUser"
:
true
,
"minAPIVersion"
:
9
,
"targetAPIVersion"
:
9
,
"car"
:
{
"apiCompatibleVersion"
:
9
,
"singleUser"
:
false
}
}
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdappatest/AppScope/resources/base/element/string.json
已删除
100755 → 0
浏览文件 @
2babb2cd
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"ohosProject"
}
]
}
ability/ability_runtime/non_concurrent/actsthirdappatest/AppScope/resources/base/media/app_icon.png
已删除
100755 → 0
浏览文件 @
2babb2cd
6.6 KB
ability/ability_runtime/non_concurrent/actsthirdappatest/BUILD.gn
已删除
100755 → 0
浏览文件 @
2babb2cd
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsThirdAppATest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsthirdappatest_ets_assets",
":actsthirdappatest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsThirdAppATest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsthirdappatest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsthirdappatest_ets_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsthirdappatest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsthirdappatest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
ability/ability_runtime/non_concurrent/actsthirdappatest/Test.json
已删除
100755 → 0
浏览文件 @
2babb2cd
{
"description"
:
"Configuration for aceceshi Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"300000"
,
"bundle-name"
:
"com.example.actsabilitypermissionthirdtest"
,
"module-name"
:
"entry"
,
"shell-timeout"
:
"300000"
},
"kits"
:
[
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"power-shell setmode 602"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"remount"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"acm create -n 101 -t normal"
,
"acm switch -i 101"
],
"teardown-command"
:
[
"acm delete -i 101"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"acm switch -i 100"
]
},
{
"type"
:
"PushKit"
,
"push"
:
[
"ActsThirdAppATest.hap->/data/app/ActsThirdAppATest.hap"
,
"ActsThirdAppOneRelyHap.hap->/data/app/ActsThirdAppOneRelyHap.hap"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"bm install -u100 -p /data/app/ActsThirdAppATest.hap"
,
"bm install -u101 -p /data/app/ActsThirdAppOneRelyHap.hap"
],
"teardown-command"
:
[
"bm uninstall -n com.example.actsabilitypermissionthirdtest"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"chmod 644 /data/*.hap"
]
}
]
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/Application/AbilityStage.ts
已删除
100755 → 0
浏览文件 @
2babb2cd
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
AbilityStage
from
"
@ohos.app.ability.AbilityStage
"
export
default
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
console
.
log
(
"
MyAbilityStage onCreate
"
)
}
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/MainAbility2/MainAbility2.ts
已删除
100755 → 0
浏览文件 @
2babb2cd
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
commonEvent
from
'
@ohos.commonEvent
'
function
PublishCallBackOne1
()
{
console
.
debug
(
"
====>Publish CallBack ACTS_ThirdPartyAbilityPermission_0100_CommonEvent====>
"
);
globalThis
.
ability2Context
.
terminateSelf
();
console
.
debug
(
"
====>close this context====>
"
)
}
export
default
class
MainAbility2
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
"
MainAbility2 onCreate
"
)
}
onDestroy
()
{
// Ability is destroying, release resources for this ability
console
.
log
(
"
MainAbility2 onDestroy
"
)
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
MainAbility2 onWindowStageCreate
"
)
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index/index2
"
,
null
)
globalThis
.
ability2Context
=
this
.
context
;
commonEvent
.
publish
(
"
ACTS_ThirdPartyAbilityPermission_0100_Start_CommonEvent
"
,
PublishCallBackOne1
);
}
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
console
.
log
(
"
MainAbility2 onWindowStageDestroy
"
)
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
MainAbility2 onForeground
"
)
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
MainAbility2 onBackground
"
)
}
};
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/TestAbility/TestAbility.ts
已删除
100755 → 0
浏览文件 @
2babb2cd
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
{
Hypium
}
from
'
@ohos/hypium
'
import
testsuite
from
'
../test/List.test
'
export
default
class
TestAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
TestAbility onCreate
'
)
globalThis
.
abilityContext
=
this
.
context
;
}
onDestroy
()
{
console
.
log
(
'
TestAbility onDestroy
'
)
}
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
TestAbility onWindowStageCreate
'
)
windowStage
.
setUIContent
(
this
.
context
,
'
TestAbility/pages/index
'
,
null
)
var
abilityDelegator
:
any
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
abilityDelegatorArguments
:
any
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
console
.
info
(
'
start run testcase!!!
'
)
Hypium
.
hypiumTest
(
abilityDelegator
,
abilityDelegatorArguments
,
testsuite
)
}
onWindowStageDestroy
()
{
console
.
log
(
'
TestAbility onWindowStageDestroy
'
)
}
onForeground
()
{
console
.
log
(
'
TestAbility onForeground
'
)
}
onBackground
()
{
console
.
log
(
'
TestAbility onBackground
'
)
}
};
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/TestAbility/pages/index.ets
已删除
100755 → 0
浏览文件 @
2babb2cd
/*
* 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 {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('页面1')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
已删除
100755 → 0
浏览文件 @
2babb2cd
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s it
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
=
`
${
targetParams
}
${
key
}
${
parameters
[
key
]}
`
}
}
return
targetParams
.
trim
()
}
async
function
onAbilityCreateCallback
()
{
console
.
log
(
"
onAbilityCreateCallback
"
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
"
addAbilityMonitorCallback :
"
+
JSON
.
stringify
(
err
))
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
console
.
info
(
"
OpenHarmonyTestRunner OnPrepare
"
)
}
async
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.TestAbility
'
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a TestAbility
'
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
})
console
.
info
(
'
OpenHarmonyTestRunner onRun end
'
)
}
};
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/pages/index/index2.ets
已删除
100755 → 0
浏览文件 @
2babb2cd
/*
* 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 Index2 {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('页面2')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/test/AbilityPermission.test.ets
已删除
100755 → 0
浏览文件 @
2babb2cd
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import commonEvent from '@ohos.commonEvent'
var AbilityPermission1 = {
events: ["ACTS_ThirdPartyAbilityPermission_0100_Start_CommonEvent"]
}
var AbilityPermission3 = {
events: ["ACTS_ThirdPartyAbilityPermission_0300_Start_CommonEvent"]
}
var AbilityPermission6 = {
events: ["ACTS_ThirdPartyAbilityPermission_0600_Start_CommonEvent"]
}
const START_ABILITY_TIMEOUT = 3000;
export default function abilityPermissionTest() {
describe('ActsAbilityPermissionTest', function () {
var userA=100;
var userB=101;
/*
* @tc.number: ACTS_ThirdPartyAbilityPermission_0100
* @tc.name: In non-concurrent mode, if the target application is not the current user, it is forbidden to start
* @tc.desc: Start an ability that belongs to the current user with the current user
*/
it('ACTS_ThirdPartyAbilityPermission_0100', 0, async function (done) {
console.log("ACTS_ThirdPartyAbilityPermission_0100====>callback start====>")
var Subscriber;
var flag = true;
function SubscribeCallBack(err, data) {
console.debug("ACTS_ThirdPartyAbilityPermission_0100====>Subscribe CallBack data:" + JSON.stringify(data));
expect(data.event == 'ACTS_ThirdPartyAbilityPermission_0100_Start_CommonEvent').assertTrue()
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
}
commonEvent.createSubscriber(AbilityPermission1).then(async (data) => {
console.debug("ACTS_ThirdPartyAbilityPermission_0100====>Create Subscriber====>");
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility_100====>");
await globalThis.abilityContext.startAbilityWithAccount(
{
bundleName: 'com.example.actsabilitypermissionthirdtest',
abilityName: 'MainAbility2'
}, userA, () => {
console.debug("====>startAbility end_100====>");
})
})
function UnSubscribeCallback() {
flag = false
console.debug("ACTS_ThirdPartyAbilityPermission_0100====>UnSubscribe CallBack====>"+flag);
done();
}
setTimeout(()=>{
if (flag == true) {
expect().assertFail();
console.debug('in ACTS_ThirdPartyAbilityPermission_0100====>timeout====>'+flag);
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
}
console.debug('ACTS_ThirdPartyAbilityPermission_0100====>timeout====>');
}, START_ABILITY_TIMEOUT);
})
/*
* @tc.number: ACTS_ThirdPartyAbilityPermission_0300
* @tc.name: In non-concurrent mode, if the target application is not the current user, it is forbidden to start
* @tc.desc: Start an ability under user U101 with the current user
*/
it('ACTS_ThirdPartyAbilityPermission_0300', 0, async function (done) {
console.log("ACTS_ThirdPartyAbilityPermission_0300====>callback start====>")
var Subscriber
var flag = 0;
console.debug("====>get AccountManager finish====");
function SubscribeCallBack(err, data) {
console.debug("ACTS_ThirdPartyAbilityPermission_0300====>Subscribe CallBack data:" + JSON.stringify(data));
expect(data.event == 'ACTS_ThirdPartyAbilityPermission_0300_Start_CommonEvent').assertTrue()
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
}
commonEvent.createSubscriber(AbilityPermission3).then(async (data) => {
console.debug("ACTS_ThirdPartyAbilityPermission_0300====>Create Subscriber====>");
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility_0300====>");
await globalThis.abilityContext.startAbilityWithAccount(
{
bundleName: 'com.example.actsthirdappuonehundredone',
abilityName: 'MainAbility'
}, userB ).then().catch((err) => {
console.debug("ACTS_ThirdPartyAbilityPermission_0300====>" + err)
console.debug("====>startAbility end_0300====>");
})
})
function UnSubscribeCallback() {
if(flag == 0) {
expect().assertFail();
}
console.debug("ACTS_ThirdPartyAbilityPermission_0300====>UnSubscribe CallBack====>");
done();
}
function timeout() {
console.debug('ACTS_ThirdPartyAbilityPermission_0300====>timeout====>');
if(flag == 0){
flag = 1;
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
}
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
})
/*
* @tc.number: ACTS_ThirdPartyAbilityPermission_0600
* @tc.name: In non-concurrent mode, if the target application is not the current user, it is forbidden to start
* @tc.desc: Bind a U101 Ability with the current user
*/
it('ACTS_ThirdPartyAbilityPermission_0600', 0, async function (done) {
console.log("ACTS_ThirdPartyAbilityPermission_0600====>callback start====>")
let Subscriber
let connId
function onConnectCallbackC(element, remote) {
console.log('ACTS_ThirdPartyAbilityPermission_0600_Start_CommonEvent onConnectCallback====>'+
' element=' + JSON.stringify(element));
console.log('ACTS_ThirdPartyAbilityPermission_0600_Start_CommonEvent onConnectCallback====>'+
' remote=' + JSON.stringify(remote));
expect().assertFail();
}
function onDisconnectCallbackC(element) {
console.log('onDisconnectCallback====> element=' + JSON.stringify(element));
}
function onFailedCallbackC(code) {
console.log('onFailedCallback====> code=' + JSON.stringify(code))
}
function SubscribeCallBackF(err, data) {
console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data));
}
function UnSubscribeCallbackF() {
console.debug("====>UnSubscribeCallback====>");
}
commonEvent.createSubscriber(AbilityPermission6).then(async (data) => {
console.debug("====>Create Subscriber====>");
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBackF);
})
console.debug("====>0600start connectAbility====>");
connId = await globalThis.abilityContext.connectAbilityWithAccount(
{
bundleName: 'com.example.actsthirdappuonehundredone',
abilityName: 'ServiceAbility',
action: "StartAbilityPromise"
}, userB, {
onConnect: onConnectCallbackC,
onDisconnect: onDisconnectCallbackC,
onFailed: onFailedCallbackC
})
console.debug("====>number is====>" + JSON.stringify(connId));
setTimeout(() =>{
console.debug('in ACTS_ThirdPartyAbilityPermission_0600_Start_CommonEvent timeout');
commonEvent.unsubscribe(Subscriber, UnSubscribeCallbackF)
done()
}, START_ABILITY_TIMEOUT);
})
})
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/ets/test/List.test.ets
已删除
100755 → 0
浏览文件 @
2babb2cd
/*
* 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 abilityPermissionText from './AbilityPermission.test.ets'
export default function testsuite() {
abilityPermissionText()
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/module.json
已删除
100755 → 0
浏览文件 @
2babb2cd
{
"module"
:
{
"name"
:
"entry"
,
"type"
:
"entry"
,
"srcEntrance"
:
"./ets/Application/AbilityStage.ts"
,
"description"
:
"$string:entry_desc"
,
"mainElement"
:
"MainAbility"
,
"deviceTypes"
:
[
"default"
,
"tablet"
],
"deliveryWithInstall"
:
true
,
"installationFree"
:
false
,
"pages"
:
"$profile:main_pages"
,
"uiSyntax"
:
"ets"
,
"metadata"
:
[
{
"name"
:
"ArkTSPartialUpdate"
,
"value"
:
"false"
}
],
"abilities"
:
[
{
"name"
:
"TestAbility"
,
"srcEntrance"
:
"./ets/TestAbility/TestAbility.ts"
,
"description"
:
"$string:TestAbility_desc"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:TestAbility_label"
,
"visible"
:
true
,
"launchType"
:
"standard"
,
"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"
,
"launchType"
:
"standard"
}
]
}
}
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/resources/base/element/string.json
已删除
100755 → 0
浏览文件 @
2babb2cd
{
"string"
:
[
{
"name"
:
"entry_desc"
,
"value"
:
"description"
},
{
"name"
:
"entry_test_desc"
,
"value"
:
"i am an entry for tv"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"MainAbility2_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility2_label"
,
"value"
:
"label"
},
{
"name"
:
"Service_desc"
,
"value"
:
"description"
},
{
"name"
:
"Service_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/resources/base/media/icon.png
已删除
100755 → 0
浏览文件 @
2babb2cd
6.6 KB
ability/ability_runtime/non_concurrent/actsthirdappatest/entry/src/main/resources/base/profile/main_pages.json
已删除
100755 → 0
浏览文件 @
2babb2cd
{
"src"
:
[
"pages/index/index2"
,
"TestAbility/pages/index"
]
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdappatest/signature/openharmony_sx.p7b
已删除
100755 → 0
浏览文件 @
2babb2cd
文件已删除
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/AppScope/app.json
已删除
100755 → 0
浏览文件 @
2babb2cd
{
"app"
:
{
"bundleName"
:
"com.example.actsthirdappuonehundredone"
,
"vendor"
:
"example"
,
"versionCode"
:
1000000
,
"versionName"
:
"1.0.0"
,
"icon"
:
"$media:app_icon"
,
"label"
:
"$string:app_name"
,
"distributedNotificationEnabled"
:
true
,
"keepAlive"
:
true
,
"singleUser"
:
true
,
"minAPIVersion"
:
9
,
"targetAPIVersion"
:
9
,
"car"
:
{
"apiCompatibleVersion"
:
9
,
"singleUser"
:
false
}
}
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/AppScope/resources/base/element/string.json
已删除
100755 → 0
浏览文件 @
2babb2cd
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"ohosProject"
}
]
}
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/AppScope/resources/base/media/app_icon.png
已删除
100755 → 0
浏览文件 @
2babb2cd
6.6 KB
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/BUILD.gn
已删除
100755 → 0
浏览文件 @
2babb2cd
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsThirdAppOneRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActsThirdAppOneRelyHap"
testonly = true
deps = [
":actsthirdapponerelytest_js_assets",
":actsthirdapponerelytest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
}
ohos_app_scope("actsthirdapponerelytest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsthirdapponerelytest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsthirdapponerelytest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsthirdapponerelytest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/ets/Application/AbilityStage.ts
已删除
100755 → 0
浏览文件 @
2babb2cd
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
AbilityStage
from
"
@ohos.app.ability.AbilityStage
"
export
default
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
console
.
log
(
"
MyAbilityStage onCreate
"
)
globalThis
.
stageOnCreateRun
=
1
;
globalThis
.
stageContext
=
this
.
context
;
}
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/ets/MainAbility/MainAbility.ts
已删除
100755 → 0
浏览文件 @
2babb2cd
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
commonEvent
from
'
@ohos.commonEvent
'
function
PublishCallBackOne3
()
{
console
.
debug
(
"
====>Publish CallBack ACTS_ThirdPartyAbilityPermission_0300_CommonEvent====>
"
);
setTimeout
(
globalThis
.
abilityContext
.
terminateSelfWithResult
(()
=>
{
console
.
debug
(
"
====>terminateSelfWithResult succese====>
"
)
}),
1000
)
}
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
// Ability is creating, initialize resources for this ability
console
.
log
(
"
MainAbility onCreate
"
)
globalThis
.
abilityWant
=
want
;
}
onDestroy
()
{
// Ability is destroying, release resources for this ability
console
.
log
(
"
MainAbility onDestroy
"
)
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
MainAbility onWindowStageCreate
"
)
globalThis
.
abilityContext
=
this
.
context
commonEvent
.
publish
(
"
ACTS_ThirdPartyAbilityPermission_0300_Start_CommonEvent
"
,
PublishCallBackOne3
);
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index
"
,
null
)
}
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
console
.
log
(
"
MainAbility onWindowStageDestroy
"
)
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
MainAbility onForeground
"
)
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
MainAbility onBackground
"
)
}
};
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/ets/pages/index/index.ets
已删除
100755 → 0
浏览文件 @
2babb2cd
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
router
from
'@system.router'
;
async
function
routePage
()
{
let
options
=
{
uri
:
'pages/second'
}
try
{
await
router
.
push
(
options
)
}
catch
(
err
)
{
console
.
error
(
`fail callback, code: ${err.code}, msg: ${err.msg}`
)
}
}
@
Entry
@
Component
struct
Index
{
build
()
{
Flex
({
direction
:
FlexDirection
.
Column
,
alignItems
:
ItemAlign
.
Center
,
justifyContent
:
FlexAlign
.
Center
})
{
Text
(
'Hello World'
)
.
fontSize
(
50
)
.
fontWeight
(
FontWeight
.
Bold
)
}
.
width
(
'100%'
)
.
height
(
'100%'
)
}
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/ets/pages/second/second.ets
已删除
100755 → 0
浏览文件 @
2babb2cd
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
@Entry
@Component
struct Second {
private content: string = "Second Page"
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('back to index')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/module.json
已删除
100755 → 0
浏览文件 @
2babb2cd
{
"module"
:
{
"name"
:
"com.example.actsthirdappuonehundredone"
,
"type"
:
"entry"
,
"srcEntrance"
:
"./ets/Application/AbilityStage.ts"
,
"description"
:
"$string:phone_entry_dsc"
,
"mainElement"
:
"MainAbility"
,
"deviceTypes"
:
[
"default"
,
"tablet"
],
"deliveryWithInstall"
:
true
,
"installationFree"
:
false
,
"uiSyntax"
:
"ets"
,
"pages"
:
"$profile:main_pages"
,
"metadata"
:
[
{
"name"
:
"ArkTSPartialUpdate"
,
"value"
:
"false"
}
],
"abilities"
:
[
{
"name"
:
"MainAbility"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:phone_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"orientation"
:
"portrait"
,
"skills"
:
[
{
"actions"
:
[
"action.system.home"
],
"entities"
:
[
"entity.system.home"
]
}
]
}
]
}
}
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/resources/base/element/string.json
已删除
100755 → 0
浏览文件 @
2babb2cd
{
"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"
:
"ActsContextTest"
},
{
"name"
:
"form_description"
,
"value"
:
"my form"
},
{
"name"
:
"serviceability_description"
,
"value"
:
"my whether"
},
{
"name"
:
"description_application"
,
"value"
:
"demo for test"
},
{
"name"
:
"app_name"
,
"value"
:
"Demo"
}
]
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/resources/base/media/icon.png
已删除
100755 → 0
浏览文件 @
2babb2cd
6.6 KB
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/entry/src/main/resources/base/profile/main_pages.json
已删除
100755 → 0
浏览文件 @
2babb2cd
{
"src"
:
[
"pages/index/index"
,
"pages/second/second"
]
}
\ No newline at end of file
ability/ability_runtime/non_concurrent/actsthirdapponerelytest/signature/openharmony_sx.p7b
已删除
100755 → 0
浏览文件 @
2babb2cd
文件已删除
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录