Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
fcadd824
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看板
未验证
提交
fcadd824
编写于
7月 04, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 04, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4063 add lifecycle xts
Merge pull request !4063 from dy/monthly_20220614
上级
ec84188d
dd4e5d5e
变更
65
展开全部
隐藏空白更改
内联
并排
Showing
65 changed file
with
670 addition
and
327 deletion
+670
-327
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Application/AbilityStage.ts
...emultihap2/entry/src/main/ets/Application/AbilityStage.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility1/Hap2MainAbility1.ts
...2/entry/src/main/ets/Hap2MainAbility1/Hap2MainAbility1.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility10/Hap2MainAbility10.ts
...entry/src/main/ets/Hap2MainAbility10/Hap2MainAbility10.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility2/Hap2MainAbility2.ts
...2/entry/src/main/ets/Hap2MainAbility2/Hap2MainAbility2.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility3/Hap2MainAbility3.ts
...2/entry/src/main/ets/Hap2MainAbility3/Hap2MainAbility3.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility4/Hap2MainAbility4.ts
...2/entry/src/main/ets/Hap2MainAbility4/Hap2MainAbility4.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility5/Hap2MainAbility5.ts
...2/entry/src/main/ets/Hap2MainAbility5/Hap2MainAbility5.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility6/Hap2MainAbility6.ts
...2/entry/src/main/ets/Hap2MainAbility6/Hap2MainAbility6.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility7/Hap2MainAbility7.ts
...2/entry/src/main/ets/Hap2MainAbility7/Hap2MainAbility7.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility8/Hap2MainAbility8.ts
...2/entry/src/main/ets/Hap2MainAbility8/Hap2MainAbility8.ts
+7
-6
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility9/Hap2MainAbility9.ts
...2/entry/src/main/ets/Hap2MainAbility9/Hap2MainAbility9.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility10_pages.ets
...hap2/entry/src/main/ets/pages/Hap2MainAbility10_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility1_pages.ets
...ihap2/entry/src/main/ets/pages/Hap2MainAbility1_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility2_pages.ets
...ihap2/entry/src/main/ets/pages/Hap2MainAbility2_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility3_pages.ets
...ihap2/entry/src/main/ets/pages/Hap2MainAbility3_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility4_pages.ets
...ihap2/entry/src/main/ets/pages/Hap2MainAbility4_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility5_pages.ets
...ihap2/entry/src/main/ets/pages/Hap2MainAbility5_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility6_pages.ets
...ihap2/entry/src/main/ets/pages/Hap2MainAbility6_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility7_pages.ets
...ihap2/entry/src/main/ets/pages/Hap2MainAbility7_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility8_pages.ets
...ihap2/entry/src/main/ets/pages/Hap2MainAbility8_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility9_pages.ets
...ihap2/entry/src/main/ets/pages/Hap2MainAbility9_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/ets/Application/AbilityStage.ts
...emultihap3/entry/src/main/ets/Application/AbilityStage.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/ets/Hap3MainAbility1/Hap3MainAbility1.ts
...3/entry/src/main/ets/Hap3MainAbility1/Hap3MainAbility1.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/ets/Hap3MainAbility2/Hap3MainAbility2.ts
...3/entry/src/main/ets/Hap3MainAbility2/Hap3MainAbility2.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/ets/Hap3MainAbility3/Hap3MainAbility3.ts
...3/entry/src/main/ets/Hap3MainAbility3/Hap3MainAbility3.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/ets/pages/Hap3MainAbility1_pages.ets
...ihap3/entry/src/main/ets/pages/Hap3MainAbility1_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/ets/pages/Hap3MainAbility2_pages.ets
...ihap3/entry/src/main/ets/pages/Hap3MainAbility2_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/ets/pages/Hap3MainAbility3_pages.ets
...ihap3/entry/src/main/ets/pages/Hap3MainAbility3_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/Application/AbilityStage.ts
...ltihaptest/entry/src/main/ets/Application/AbilityStage.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility/MainAbility.ts
...ultihaptest/entry/src/main/ets/MainAbility/MainAbility.ts
+1
-2
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts
...tihaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts
+24
-21
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts
...tihaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts
+17
-16
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts
...tihaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts
+20
-19
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts
...tihaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts
+40
-38
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts
...tihaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts
+17
-16
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts
...tihaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts
+17
-16
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility7/MainAbility7.ts
...tihaptest/entry/src/main/ets/MainAbility7/MainAbility7.ts
+83
-0
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility1_pages.ets
...tihaptest/entry/src/main/ets/pages/MainAbility1_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility2_pages.ets
...tihaptest/entry/src/main/ets/pages/MainAbility2_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility3_pages.ets
...tihaptest/entry/src/main/ets/pages/MainAbility3_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility4_pages.ets
...tihaptest/entry/src/main/ets/pages/MainAbility4_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility5_pages.ets
...tihaptest/entry/src/main/ets/pages/MainAbility5_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility6_pages.ets
...tihaptest/entry/src/main/ets/pages/MainAbility6_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility7_pages.ets
...tihaptest/entry/src/main/ets/pages/MainAbility7_pages.ets
+32
-0
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility_pages.ets
...ltihaptest/entry/src/main/ets/pages/MainAbility_pages.ets
+2
-2
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets
...clemultihaptest/entry/src/main/ets/test/LifecycleTest.ets
+129
-100
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/test/ListTest.ets
...ifecyclemultihaptest/entry/src/main/ets/test/ListTest.ets
+1
-1
ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/ets/Application/AbilityStage.ts
...ultihaptest/hap4/src/main/ets/Application/AbilityStage.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/ets/Hap4MainAbility1/Hap4MainAbility1.ts
...st/hap4/src/main/ets/Hap4MainAbility1/Hap4MainAbility1.ts
+1
-1
ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/ets/pages/Hap4MainAbility1_pages.ets
...aptest/hap4/src/main/ets/pages/Hap4MainAbility1_pages.ets
+1
-1
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/Application/AbilityStage.ts
...glehaptest/entry/src/main/ets/Application/AbilityStage.ts
+3
-3
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts
...lehaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts
+2
-3
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility10/MainAbility10.ts
...haptest/entry/src/main/ets/MainAbility10/MainAbility10.ts
+2
-3
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility11/MainAbility11.ts
...haptest/entry/src/main/ets/MainAbility11/MainAbility11.ts
+2
-3
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility12/MainAbility12.ts
...haptest/entry/src/main/ets/MainAbility12/MainAbility12.ts
+2
-3
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts
...lehaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts
+2
-3
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts
...lehaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts
+2
-3
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts
...lehaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts
+2
-2
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility7/MainAbility7.ts
...lehaptest/entry/src/main/ets/MainAbility7/MainAbility7.ts
+2
-2
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility8/MainAbility8.ts
...lehaptest/entry/src/main/ets/MainAbility8/MainAbility8.ts
+2
-2
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility9/MainAbility9.ts
...lehaptest/entry/src/main/ets/MainAbility9/MainAbility9.ts
+2
-1
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
...lesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
+30
-23
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/ListTest.ets
...fecyclesinglehaptest/entry/src/main/ets/test/ListTest.ets
+2
-0
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/Test.ets
...tslifecyclesinglehaptest/entry/src/main/ets/test/Test.ets
+185
-0
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/module.json
...age/actslifecyclesinglehaptest/entry/src/main/module.json
+3
-2
未找到文件。
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Application/AbilityStage.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility1/Hap2MainAbility1.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility10/Hap2MainAbility10.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility2/Hap2MainAbility2.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility3/Hap2MainAbility3.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility4/Hap2MainAbility4.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility5/Hap2MainAbility5.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility6/Hap2MainAbility6.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility7/Hap2MainAbility7.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility8/Hap2MainAbility8.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
@@ -40,6 +40,12 @@ export default class Hap2MainAbility8 extends Ability {
// Ability has brought to foreground
console
.
log
(
"
[Demo] Hap2MainAbility8 onForeground
"
)
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
[Demo] Hap2MainAbility8 onBackground
"
)
setTimeout
(()
=>
{
this
.
context
.
terminateSelf
().
then
((
data
)
=>
{
console
.
log
(
"
Hap2MainAbility8 EventTest terminateSelf data:
"
+
JSON
.
stringify
(
data
));
...
...
@@ -48,9 +54,4 @@ export default class Hap2MainAbility8 extends Ability {
})
},
500
)
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
[Demo] Hap2MainAbility8 onBackground
"
)
}
};
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/Hap2MainAbility9/Hap2MainAbility9.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility10_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility1_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility2_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility3_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility4_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility5_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility6_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility7_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility8_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/ets/pages/Hap2MainAbility9_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/ets/Application/AbilityStage.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/ets/Hap3MainAbility1/Hap3MainAbility1.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/ets/Hap3MainAbility2/Hap3MainAbility2.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/ets/Hap3MainAbility3/Hap3MainAbility3.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/ets/pages/Hap3MainAbility1_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/ets/pages/Hap3MainAbility2_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/ets/pages/Hap3MainAbility3_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/Application/AbilityStage.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
@@ -15,7 +15,6 @@
import
Ability
from
'
@ohos.application.Ability
'
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
"
[Demo] MainAbility onCreate
"
)
globalThis
.
abilityWant
=
want
;
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
@@ -24,62 +24,65 @@ export default class MainAbility1 extends Ability {
let
AbilityLifecycleCallback
=
{
onAbilityCreate
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityCreate
"
);
console
.
log
(
abilityName
+
"
onAbilityCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityCreate
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityWindowStageCreate
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityWindowStageCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageCreate
"
);
console
.
log
(
abilityName
+
"
onAbilityWindowStageCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageCreate
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityForeground
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityForeground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityForeground
"
);
console
.
log
(
abilityName
+
"
onAbilityForeground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityForeground
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityBackground
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityBackground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityBackground
"
);
console
.
log
(
abilityName
+
"
onAbilityBackground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityBackground
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityWindowStageDestroy
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityWindowStageDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageDestroy
"
);
console
.
log
(
abilityName
+
"
onAbilityWindowStageDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageDestroy
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityDestroy
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityDestroy
"
);
console
.
log
(
abilityName
+
"
onAbilityDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityDestroy
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityContinue
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityContinue
"
)
listKey
.
push
(
abilityName
+
"
onAbilityContinue
"
);
console
.
log
(
abilityName
+
"
onAbilityContinue
"
)
listKey
.
push
(
abilityName
+
"
onAbilityContinue
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
}
}
globalThis
.
mainAbility1ListKey
=
listKey
var
callBackId
=
this
.
context
.
getApplicationContext
().
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
ApplicationContext1
=
this
.
context
.
getApplicationContext
();
var
callBackId
=
globalThis
.
ApplicationContext1
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
mainAbility1CallBackId
=
callBackId
setTimeout
(()
=>
{
console
.
log
(
"
listKey is :
"
+
listKey
);
console
.
log
(
"
callBackId is :
"
+
callBackId
);
this
.
context
.
getApplicationContext
().
unregisterAbilityLifecycleCallback
(
callBackId
,
(
error
,
data
)
=>
{
console
.
log
(
"
unRegisterAbilityLifecycleCallback err is :
"
+
JSON
.
stringify
(
error
)
+
"
,data is :
"
+
JSON
.
stringify
(
data
))
});
globalThis
.
ApplicationContext1
.
unregisterAbilityLifecycleCallback
(
callBackId
,
(
error
,
data
)
=>
{
console
.
log
(
"
unRegisterAbilityLifecycleCallback err is :
"
+
JSON
.
stringify
(
error
)
+
"
,data is :
"
+
JSON
.
stringify
(
data
))
});
},
4000
)
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
context
.
terminateSelf
().
then
((
data
)
=>
{
console
.
log
(
"
[Demo] MainAbility1 terminateSelf windowStage data:
"
+
JSON
.
stringify
(
data
))
}).
catch
((
error
)
=>
{
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility2/MainAbility2.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
@@ -24,49 +24,50 @@ export default class MainAbility2 extends Ability {
let
AbilityLifecycleCallback
=
{
onAbilityCreate
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityCreate
"
);
console
.
log
(
abilityName
+
"
onAbilityCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityCreate
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityWindowStageCreate
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityWindowStageCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageCreate
"
);
console
.
log
(
abilityName
+
"
onAbilityWindowStageCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageCreate
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityForeground
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityForeground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityForeground
"
);
console
.
log
(
abilityName
+
"
onAbilityForeground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityForeground
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityBackground
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityBackground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityBackground
"
);
console
.
log
(
abilityName
+
"
onAbilityBackground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityBackground
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityWindowStageDestroy
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityWindowStageDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageDestroy
"
);
console
.
log
(
abilityName
+
"
onAbilityWindowStageDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageDestroy
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityDestroy
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityDestroy
"
);
console
.
log
(
abilityName
+
"
onAbilityDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityDestroy
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityContinue
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityContinue
"
)
listKey
.
push
(
abilityName
+
"
onAbilityContinue
"
);
console
.
log
(
abilityName
+
"
onAbilityContinue
"
)
listKey
.
push
(
abilityName
+
"
onAbilityContinue
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
}
}
var
callBackId
=
this
.
context
.
getApplicationContext
().
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
ApplicationContext2
=
this
.
context
.
getApplicationContext
();
var
callBackId
=
globalThis
.
ApplicationContext2
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
setTimeout
(()
=>
{
globalThis
.
mainAbility2ListKey
=
listKey
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
@@ -26,11 +26,12 @@ export default class MainAbility3 extends Ability {
var
a
;
function
SubscribeCallBackContext
(
err
,
data
)
{
console
.
log
(
"
Subscribe CallBack data:
"
+
JSON
.
stringify
(
data
));
a
=
data
.
parameters
;
if
(
data
.
event
!=
""
)
{
for
(
var
key
in
data
.
parameters
){
if
(
data
.
event
!=
""
)
{
for
(
var
key
in
data
.
parameters
)
{
console
.
log
(
"
data.parameters[key] is :
"
+
data
.
parameters
[
key
])
}
}
...
...
@@ -47,44 +48,44 @@ export default class MainAbility3 extends Ability {
let
AbilityLifecycleCallback
=
{
onAbilityCreate
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityCreate
"
);
console
.
log
(
abilityName
+
"
onAbilityCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityCreate
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityWindowStageCreate
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityWindowStageCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageCreate
"
);
console
.
log
(
abilityName
+
"
onAbilityWindowStageCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageCreate
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityForeground
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityForeground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityForeground
"
);
console
.
log
(
abilityName
+
"
onAbilityForeground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityForeground
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityBackground
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityBackground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityBackground
"
);
console
.
log
(
abilityName
+
"
onAbilityBackground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityBackground
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityWindowStageDestroy
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityWindowStageDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageDestroy
"
);
console
.
log
(
abilityName
+
"
onAbilityWindowStageDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageDestroy
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityDestroy
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityDestroy
"
);
console
.
log
(
abilityName
+
"
onAbilityDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityDestroy
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
},
onAbilityContinue
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityContinue
"
)
listKey
.
push
(
abilityName
+
"
onAbilityContinue
"
);
console
.
log
(
abilityName
+
"
onAbilityContinue
"
)
listKey
.
push
(
abilityName
+
"
onAbilityContinue
"
);
console
.
log
(
"
listKey is :
"
+
listKey
);
}
}
...
...
@@ -92,8 +93,8 @@ export default class MainAbility3 extends Ability {
setTimeout
(()
=>
{
console
.
log
(
"
mainAbility3ListKey a is :
"
+
JSON
.
stringify
(
a
))
//TODO:
var
callBackId
=
a
.
auxMainAbilityContext
.
getApplicationContext
().
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
ApplicationContext3
=
this
.
context
.
getApplicationContext
();
var
callBackId
=
globalThis
.
ApplicationContext3
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
console
.
log
(
"
mainAbility3ListKey callBackId is :
"
+
callBackId
)
globalThis
.
mainAbility3ListKey
=
listKey
console
.
log
(
"
mainAbility3ListKey mainAbility3ListKey is :
"
+
globalThis
.
mainAbility3ListKey
)
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
@@ -18,69 +18,48 @@ export default class MainAbility4 extends Ability {
onCreate
(
want
,
launchParam
)
{
console
.
log
(
"
[Demo] MainAbility4 onCreate
"
)
globalThis
.
abilityWant
=
want
;
}
onDestroy
()
{
console
.
log
(
"
[Demo] MainAbility4 onDestroy
"
)
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
[Demo] MainAbility4 onWindowStageCreate
"
)
windowStage
.
setUIContent
(
this
.
context
,
"
pages/MainAbility4_pages
"
,
null
)
}
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
console
.
log
(
"
[Demo] MainAbility4 onWindowStageDestroy
"
)
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
[Demo] MainAbility4 onForeground
"
)
var
listKey
=
[];
var
abilityName
=
""
;
let
AbilityLifecycleCallback
=
{
onAbilityCreate
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityCreate
"
);
console
.
log
(
abilityName
+
"
onAbilityCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityCreate
"
);
},
onAbilityWindowStageCreate
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityWindowStageCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageCreate
"
);
console
.
log
(
abilityName
+
"
onAbilityWindowStageCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageCreate
"
);
},
onAbilityForeground
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityForeground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityForeground
"
);
console
.
log
(
abilityName
+
"
onAbilityForeground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityForeground
"
);
},
onAbilityBackground
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityBackground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityBackground
"
);
console
.
log
(
abilityName
+
"
onAbilityBackground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityBackground
"
);
},
onAbilityWindowStageDestroy
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityWindowStageDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageDestroy
"
);
console
.
log
(
abilityName
+
"
onAbilityWindowStageDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageDestroy
"
);
},
onAbilityDestroy
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityDestroy
"
);
console
.
log
(
abilityName
+
"
onAbilityDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityDestroy
"
);
},
onAbilityContinue
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityContinue
"
)
listKey
.
push
(
abilityName
+
"
onAbilityContinue
"
);
console
.
log
(
abilityName
+
"
onAbilityContinue
"
)
listKey
.
push
(
abilityName
+
"
onAbilityContinue
"
);
}
}
var
callBackId
=
this
.
context
.
getApplicationContext
().
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
abilityContext111
=
this
.
context
;
globalThis
.
ApplicationContext4
=
this
.
context
.
getApplicationContext
(
);
var
callBackId
=
globalThis
.
ApplicationContext4
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
)
;
console
.
log
(
"
callBackId is aaa :
"
+
callBackId
);
setTimeout
(()
=>
{
globalThis
.
mainAbility4ListKey
=
listKey
...
...
@@ -88,6 +67,29 @@ export default class MainAbility4 extends Ability {
console
.
log
(
"
listKey is :
"
+
listKey
);
console
.
log
(
"
callBackId is :
"
+
callBackId
);
},
3000
)
}
onDestroy
()
{
console
.
log
(
"
[Demo] MainAbility4 onDestroy
"
)
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
[Demo] MainAbility4 onWindowStageCreate
"
)
globalThis
.
ability4context
=
this
.
context
;
windowStage
.
setUIContent
(
this
.
context
,
"
pages/MainAbility4_pages
"
,
null
)
}
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
console
.
log
(
"
[Demo] MainAbility4 onWindowStageDestroy
"
)
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
[Demo] MainAbility4 onForeground
"
)
}
onBackground
()
{
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility5/MainAbility5.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
@@ -25,41 +25,42 @@ export default class MainAbility5 extends Ability {
let
AbilityLifecycleCallback
=
{
onAbilityCreate
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityCreate
"
);
console
.
log
(
abilityName
+
"
onAbilityCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityCreate
"
);
},
onAbilityWindowStageCreate
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityWindowStageCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageCreate
"
);
console
.
log
(
abilityName
+
"
onAbilityWindowStageCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageCreate
"
);
},
onAbilityForeground
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityForeground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityForeground
"
);
console
.
log
(
abilityName
+
"
onAbilityForeground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityForeground
"
);
},
onAbilityBackground
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityBackground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityBackground
"
);
console
.
log
(
abilityName
+
"
onAbilityBackground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityBackground
"
);
},
onAbilityWindowStageDestroy
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityWindowStageDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageDestroy
"
);
console
.
log
(
abilityName
+
"
onAbilityWindowStageDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageDestroy
"
);
},
onAbilityDestroy
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityDestroy
"
);
console
.
log
(
abilityName
+
"
onAbilityDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityDestroy
"
);
},
onAbilityContinue
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityContinue
"
)
listKey
.
push
(
abilityName
+
"
onAbilityContinue
"
);
console
.
log
(
abilityName
+
"
onAbilityContinue
"
)
listKey
.
push
(
abilityName
+
"
onAbilityContinue
"
);
}
}
var
callBackId
=
this
.
context
.
getApplicationContext
().
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
ApplicationContext5
=
this
.
context
.
getApplicationContext
();
var
callBackId
=
globalThis
.
ApplicationContext5
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
console
.
log
(
"
callBackId is aaa :
"
+
callBackId
);
setTimeout
(()
=>
{
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
@@ -25,41 +25,42 @@ export default class MainAbility6 extends Ability {
let
AbilityLifecycleCallback
=
{
onAbilityCreate
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityCreate
"
);
console
.
log
(
abilityName
+
"
onAbilityCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityCreate
"
);
},
onAbilityWindowStageCreate
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityWindowStageCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageCreate
"
);
console
.
log
(
abilityName
+
"
onAbilityWindowStageCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageCreate
"
);
},
onAbilityForeground
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityForeground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityForeground
"
);
console
.
log
(
abilityName
+
"
onAbilityForeground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityForeground
"
);
},
onAbilityBackground
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityBackground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityBackground
"
);
console
.
log
(
abilityName
+
"
onAbilityBackground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityBackground
"
);
},
onAbilityWindowStageDestroy
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityWindowStageDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageDestroy
"
);
console
.
log
(
abilityName
+
"
onAbilityWindowStageDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageDestroy
"
);
},
onAbilityDestroy
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityDestroy
"
);
console
.
log
(
abilityName
+
"
onAbilityDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityDestroy
"
);
},
onAbilityContinue
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityContinue
"
)
listKey
.
push
(
abilityName
+
"
onAbilityContinue
"
);
console
.
log
(
abilityName
+
"
onAbilityContinue
"
)
listKey
.
push
(
abilityName
+
"
onAbilityContinue
"
);
}
}
var
callBackId
=
this
.
context
.
getApplicationContext
().
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
ApplicationContext6
=
this
.
context
.
getApplicationContext
();
var
callBackId
=
globalThis
.
ApplicationContext6
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
console
.
log
(
"
callBackId is aaa :
"
+
callBackId
);
setTimeout
(()
=>
{
globalThis
.
mainAbility6ListKey
=
listKey
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/MainAbility7/MainAbility7.ts
0 → 100644
浏览文件 @
fcadd824
import
Ability
from
'
@ohos.application.Ability
'
export
default
class
MainAbility7
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
"
[Demo] MainAbility7 onCreate
"
)
globalThis
.
abilityWant
=
want
;
}
onDestroy
()
{
console
.
log
(
"
[Demo] MainAbility7 onDestroy
"
)
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
[Demo] MainAbility7 onWindowStageCreate
"
)
globalThis
.
ability7context
=
this
.
context
;
windowStage
.
setUIContent
(
this
.
context
,
"
pages/MainAbility7_pages
"
,
null
)
}
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
console
.
log
(
"
[Demo] MainAbility7 onWindowStageDestroy
"
)
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
[Demo] MainAbility7 onForeground
"
)
var
listKey
=
[];
var
abilityName
=
""
;
let
AbilityLifecycleCallback
=
{
onAbilityCreate
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityCreate
"
);
},
onAbilityWindowStageCreate
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityWindowStageCreate
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageCreate
"
);
},
onAbilityForeground
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityForeground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityForeground
"
);
},
onAbilityBackground
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityBackground
"
)
listKey
.
push
(
abilityName
+
"
onAbilityBackground
"
);
},
onAbilityWindowStageDestroy
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityWindowStageDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityWindowStageDestroy
"
);
},
onAbilityDestroy
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityDestroy
"
)
listKey
.
push
(
abilityName
+
"
onAbilityDestroy
"
);
},
onAbilityContinue
(
ability
)
{
abilityName
=
ability
.
context
.
abilityInfo
.
name
;
console
.
log
(
abilityName
+
"
onAbilityContinue
"
)
listKey
.
push
(
abilityName
+
"
onAbilityContinue
"
);
}
}
globalThis
.
ApplicationContext7
=
globalThis
.
ability7context
.
getApplicationContext
();
var
callBackId
=
globalThis
.
ApplicationContext7
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
setTimeout
(()
=>
{
globalThis
.
mainAbility7ListKey
=
listKey
globalThis
.
mainAbility7CallBackId
=
callBackId
console
.
log
(
"
listKey is :
"
+
listKey
);
console
.
log
(
"
callBackId is :
"
+
callBackId
);
},
3000
)
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
[Demo] MainAbility7 onBackground
"
)
}
};
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility1_pages.ets
浏览文件 @
fcadd824
// @ts-nocheck
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility2_pages.ets
浏览文件 @
fcadd824
// @ts-nocheck
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility3_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility4_pages.ets
浏览文件 @
fcadd824
// @ts-nocheck
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility5_pages.ets
浏览文件 @
fcadd824
// @ts-nocheck
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility6_pages.ets
浏览文件 @
fcadd824
// @ts-nocheck
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility7_pages.ets
0 → 100644
浏览文件 @
fcadd824
// @ts-nocheck
/*
* 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 MainAbility7_pages {
@State message: string = 'MainAbility7'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/pages/MainAbility_pages.ets
浏览文件 @
fcadd824
// @ts-nocheck
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index"
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index
.ets
"
import list from '../test/ListTest'
@Entry
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets
浏览文件 @
fcadd824
此差异已折叠。
点击以展开。
ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/ets/test/ListTest.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/ets/Application/AbilityStage.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/ets/Hap4MainAbility1/Hap4MainAbility1.ts
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/ets/pages/Hap4MainAbility1_pages.ets
浏览文件 @
fcadd824
/*
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Copyright (c) 202
2
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
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/Application/AbilityStage.ts
浏览文件 @
fcadd824
...
...
@@ -91,9 +91,9 @@ export default class MyAbilityStage extends AbilityStage {
console
.
log
(
"
[Demo] 7listKey:
"
+
JSON
.
stringify
(
listKey
));
}
}
let
applicationContext
=
this
.
context
.
getApplicationContext
();
console
.
log
(
"
[Demo] stage applicationContext:
"
+
JSON
.
stringify
(
applicationContext
));
let
lifecycleid
=
applicationContext
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
applicationContext
=
this
.
context
.
getApplicationContext
();
console
.
log
(
"
[Demo] stage applicationContext:
"
+
JSON
.
stringify
(
globalThis
.
applicationContext
));
let
lifecycleid
=
globalThis
.
applicationContext
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback number:
"
+
JSON
.
stringify
(
lifecycleid
));
setTimeout
(
function
()
{
console
.
log
(
"
[Demo] AbilityLifecycleCallback listKey :
"
+
JSON
.
stringify
(
listKey
));
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility1/MainAbility1.ts
浏览文件 @
fcadd824
...
...
@@ -92,9 +92,8 @@ export default class MainAbility1 extends Ability {
console
.
log
(
"
[Demo] 7listKey1:
"
+
JSON
.
stringify
(
listKey1
));
}
}
let
applicationContext
=
this
.
context
.
getApplicationContext
();
console
.
log
(
"
[Demo] MainAbility1 applicationContext:
"
+
JSON
.
stringify
(
applicationContext
));
let
lifecycleid
=
applicationContext
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
applicationContext1
=
this
.
context
.
getApplicationContext
();
let
lifecycleid
=
globalThis
.
applicationContext1
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback1 number:
"
+
JSON
.
stringify
(
lifecycleid
));
setTimeout
(
function
()
{
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback1 listKey:
"
+
JSON
.
stringify
(
listKey1
));
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility10/MainAbility10.ts
浏览文件 @
fcadd824
...
...
@@ -77,9 +77,8 @@ export default class MainAbility10 extends Ability {
console
.
log
(
"
[Demo] 7listKey10:
"
+
JSON
.
stringify
(
listKey10
));
}
}
let
applicationContext
=
this
.
context
.
getApplicationContext
();
console
.
log
(
"
[Demo] MainAbility10 applicationContext:
"
+
JSON
.
stringify
(
applicationContext
));
let
lifecycleid
=
applicationContext
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
applicationContext10
=
this
.
context
.
getApplicationContext
();
let
lifecycleid
=
globalThis
.
applicationContext10
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback10 number:
"
+
JSON
.
stringify
(
lifecycleid
));
setTimeout
(
function
()
{
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback10 listKey:
"
+
JSON
.
stringify
(
listKey10
));
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility11/MainAbility11.ts
浏览文件 @
fcadd824
...
...
@@ -71,9 +71,8 @@ export default class MainAbility11 extends Ability {
listKey11
.
push
(
abilityname
+
"
onAbilityContinue
"
);
}
}
let
applicationContext
=
globalThis
.
ability11
.
getApplicationContext
();
console
.
log
(
"
[Demo] MainAbility11 applicationContext:
"
+
JSON
.
stringify
(
applicationContext
));
let
lifecycleid
=
applicationContext
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
applicationContext11
=
globalThis
.
ability11
.
getApplicationContext
();
let
lifecycleid
=
globalThis
.
applicationContext11
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback11 number:
"
+
JSON
.
stringify
(
lifecycleid
));
setTimeout
(
function
()
{
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback11 listKey:
"
+
JSON
.
stringify
(
listKey11
));
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility12/MainAbility12.ts
浏览文件 @
fcadd824
...
...
@@ -70,9 +70,8 @@ export default class MainAbility12 extends Ability {
listKey12
.
push
(
abilityname
+
"
onAbilityContinue
"
);
}
}
let
applicationContext
=
this
.
context
.
getApplicationContext
();
console
.
log
(
"
[Demo] MainAbility12 applicationContext:
"
+
JSON
.
stringify
(
applicationContext
));
let
lifecycleid
=
applicationContext
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
applicationContext12
=
this
.
context
.
getApplicationContext
();
let
lifecycleid
=
globalThis
.
applicationContext12
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback12 number:
"
+
JSON
.
stringify
(
lifecycleid
));
setTimeout
(
function
()
{
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback12 listKey:
"
+
JSON
.
stringify
(
listKey12
));
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility3/MainAbility3.ts
浏览文件 @
fcadd824
...
...
@@ -93,9 +93,8 @@ export default class MainAbility3 extends Ability {
console
.
log
(
"
[Demo] 7listKey3:
"
+
JSON
.
stringify
(
listKey3
));
}
}
let
applicationContext
=
this
.
context
.
getApplicationContext
();
console
.
log
(
"
[Demo] MainAbility3 applicationContext:
"
+
JSON
.
stringify
(
applicationContext
));
let
lifecycleid
=
applicationContext
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
applicationContext3
=
this
.
context
.
getApplicationContext
();
let
lifecycleid
=
globalThis
.
applicationContext3
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback3 number:
"
+
JSON
.
stringify
(
lifecycleid
));
setTimeout
(
function
()
{
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback3 listKey :
"
+
JSON
.
stringify
(
listKey3
));
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility4/MainAbility4.ts
浏览文件 @
fcadd824
...
...
@@ -93,9 +93,8 @@ export default class MainAbility4 extends Ability {
console
.
log
(
"
[Demo] 7listKey4:
"
+
JSON
.
stringify
(
listKey4
));
}
}
let
applicationContext
=
this
.
context
.
getApplicationContext
();
console
.
log
(
"
[Demo] MainAbility4 applicationContext:
"
+
JSON
.
stringify
(
applicationContext
));
let
lifecycleid
=
applicationContext
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
applicationContext4
=
this
.
context
.
getApplicationContext
();
let
lifecycleid
=
globalThis
.
applicationContext4
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback4 number:
"
+
JSON
.
stringify
(
lifecycleid
));
setTimeout
(
function
()
{
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback4 listKey :
"
+
JSON
.
stringify
(
listKey4
));
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility6/MainAbility6.ts
浏览文件 @
fcadd824
...
...
@@ -113,8 +113,8 @@ export default class MainAbility6 extends Ability {
console
.
log
(
"
[Demo] 7listKey6:
"
+
JSON
.
stringify
(
listKey6
));
}
}
let
applicationContext
=
globalThis
.
ability6
.
getApplicationContext
();
let
lifecycleid
=
applicationContext
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
applicationContext6
=
globalThis
.
ability6
.
getApplicationContext
();
let
lifecycleid
=
globalThis
.
applicationContext6
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback6 number:
"
+
JSON
.
stringify
(
lifecycleid
));
setTimeout
(
function
()
{
console
.
log
(
"
[Demo] registerAbilityLifecycleCallback6 listKey:
"
+
JSON
.
stringify
(
listKey6
));
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility7/MainAbility7.ts
浏览文件 @
fcadd824
...
...
@@ -113,8 +113,8 @@ export default class MainAbility7 extends Ability {
console
.
log
(
"
[Demo] 7listKey7:
"
+
JSON
.
stringify
(
listKey7
));
}
}
let
applicationContext
=
this
.
context
.
getApplicationContext
();
let
lifecycleid
=
applicationContext
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
applicationContext7
=
this
.
context
.
getApplicationContext
();
let
lifecycleid
=
globalThis
.
applicationContext7
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
console
.
log
(
"
[Demo] AbilityLifecycleCallback7 number:
"
+
JSON
.
stringify
(
lifecycleid
));
setTimeout
(
function
()
{
console
.
log
(
"
[Demo] AbilityLifecycleCallback7 listKey:
"
+
JSON
.
stringify
(
listKey7
));
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility8/MainAbility8.ts
浏览文件 @
fcadd824
...
...
@@ -112,8 +112,8 @@ export default class MainAbility8 extends Ability {
console
.
log
(
"
[Demo] 7listKey8:
"
+
JSON
.
stringify
(
listKey8
));
}
}
let
applicationContext
=
this
.
context
.
getApplicationContext
();
let
lifecycleid
=
applicationContext
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
globalThis
.
applicationContext8
=
this
.
context
.
getApplicationContext
();
let
lifecycleid
=
globalThis
.
applicationContext8
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
console
.
log
(
"
[Demo] AbilityLifecycleCallback8 number:
"
+
JSON
.
stringify
(
lifecycleid
));
setTimeout
(
function
()
{
console
.
log
(
"
[Demo] AbilityLifecycleCallback8 listKey:
"
+
JSON
.
stringify
(
listKey8
));
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/MainAbility9/MainAbility9.ts
浏览文件 @
fcadd824
...
...
@@ -79,7 +79,8 @@ export default class MainAbility9 extends Ability {
listKey9
.
push
(
abilityName
+
"
onAbilityContinue
"
);
}
}
var
callBackId
=
this
.
context
.
getApplicationContext
()
globalThis
.
applicationContext9
=
this
.
context
.
getApplicationContext
();
var
callBackId
=
globalThis
.
applicationContext9
.
registerAbilityLifecycleCallback
(
AbilityLifecycleCallback
);
console
.
log
(
"
callBackId is aaa :
"
+
callBackId
);
...
...
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets
浏览文件 @
fcadd824
...
...
@@ -64,9 +64,12 @@ export default function lifecycleTest(abilityContext) {
var TAG = "";
var listKeyTemp = ""
var tempCallbackId;
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time))
}
/*
* @tc.number Singlehap_LifeCycleTest_0100
* @tc.name Register in abilitystage,listen to the lifecycle of abilityA,deregister after listening
...
...
@@ -90,6 +93,8 @@ export default function lifecycleTest(abilityContext) {
setTimeout(function () {
console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list));
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid));
tempCallbackId = globalThis.callbackid;
console.log(TAG + " registerAbilityLifecycleCallback tempCallbackId : " + JSON.stringify(tempCallbackId));
var strtemp = "";
var listtemp = [];
for (var i = 0; i < globalThis.list.length; i++) {
...
...
@@ -100,8 +105,8 @@ export default function lifecycleTest(abilityContext) {
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
let exlist = listtemp;
globalThis.a
bilityContext.getApplicationContext()
.unregisterAbilityLifecycleCallback(
globalThis.callbacki
d, (error, data) => {
globalThis.a
pplicationContext
.unregisterAbilityLifecycleCallback(
tempCallbackI
d, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
code = error.code;
...
...
@@ -154,7 +159,6 @@ export default function lifecycleTest(abilityContext) {
}, 500);
setTimeout(function () {
console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list1));
var list = globalThis.list1
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1));
var strtemp = "";
var listtemp = [];
...
...
@@ -166,7 +170,7 @@ export default function lifecycleTest(abilityContext) {
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
let exlist = listtemp;
globalThis.a
bility1context.getApplicationContext()
globalThis.a
pplicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
...
...
@@ -235,7 +239,7 @@ export default function lifecycleTest(abilityContext) {
}
console.log(TAG + " listtemp is :" + JSON.stringify(listtemp));
let exlist = listtemp;
globalThis.a
bility1context.getApplicationContext()
globalThis.a
pplicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1)
.then((data) => {
console.info(TAG + ' unregisterAbilityLifecycleCallback successful. Data: ' + data);
...
...
@@ -245,7 +249,7 @@ export default function lifecycleTest(abilityContext) {
})
setTimeout(function () {
console.log(TAG + " secondunregister callbackid : " + JSON.stringify(globalThis.callbackid1));
globalThis.a
bility1context.getApplicationContext()
globalThis.a
pplicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback_1 success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
...
...
@@ -330,7 +334,7 @@ export default function lifecycleTest(abilityContext) {
console.log(TAG + " terminateSelfwithresult error: " + JSON.stringify(error));
});
setTimeout(function () {
globalThis.a
bility1context.getApplicationContext()
globalThis.a
pplicationContext3
.unregisterAbilityLifecycleCallback(globalThis.callbackid3, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback3 success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
...
...
@@ -388,7 +392,7 @@ export default function lifecycleTest(abilityContext) {
}, 500);
setTimeout(function () {
console.log(TAG + " start after callbackid3 : " + JSON.stringify(globalThis.callbackid3));
globalThis.a
bilityContext.getApplicationContext()
globalThis.a
pplicationContext3
.unregisterAbilityLifecycleCallback(globalThis.callbackid3)
.then((data) => {
console.info(TAG + ' unregisterAbilityLifecycleCallback3 successful. Data: ' + data);
...
...
@@ -417,12 +421,12 @@ export default function lifecycleTest(abilityContext) {
console.log(TAG + " callbackid4 : " + JSON.stringify(globalThis.callbackid4));
let id4 = globalThis.callbackid4;
expect(id3 + 1).assertEqual(id4);
globalThis.a
bility1context.getApplicationContext()
globalThis.a
pplicationContext4
.unregisterAbilityLifecycleCallback(globalThis.callbackid4, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback4 success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
})
globalThis.a
bility1context.getApplicationContext()
globalThis.a
pplicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback1 success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
...
...
@@ -500,7 +504,7 @@ export default function lifecycleTest(abilityContext) {
expect(exlist[9]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist[10]).assertEqual("MainAbility2 onAbilityWindowStageDestroy");
expect(exlist[11]).assertEqual("MainAbility2 onAbilityDestroy");
globalThis.a
bility1context.getApplicationContext()
globalThis.a
pplicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
...
...
@@ -666,6 +670,7 @@ export default function lifecycleTest(abilityContext) {
console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error));
})
}, 3000);
setTimeout(function () {
var str1 = {
"bundleName": "com.example.lifecycle_xts",
...
...
@@ -678,6 +683,7 @@ export default function lifecycleTest(abilityContext) {
console.error(TAG + ' start failed. Cause: ' + JSON.stringify(error));
})
}, 4500);
setTimeout(function () {
console.log(TAG + " registerAbilityLifecycleCallback listKey : " + JSON.stringify(globalThis.list1));
console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1));
...
...
@@ -713,7 +719,7 @@ export default function lifecycleTest(abilityContext) {
expect(exlist[19]).assertEqual("MainAbility2 onAbilityWindowStageCreate");
expect(exlist[20]).assertEqual("MainAbility2 onAbilityForeground");
expect(exlist[21]).assertEqual("MainAbility1 onAbilityBackground");
abilityContext.getApplicationContext()
globalThis.applicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
...
...
@@ -797,7 +803,7 @@ export default function lifecycleTest(abilityContext) {
expect(exlist[15]).assertEqual("MainAbility2 onAbilityBackground");
expect(exlist[16]).assertEqual("MainAbility2 onAbilityWindowStageDestroy");
expect(exlist[17]).assertEqual("MainAbility2 onAbilityDestroy");
abilityContext.getApplicationContext()
globalThis.applicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
...
...
@@ -850,7 +856,7 @@ export default function lifecycleTest(abilityContext) {
id2 = globalThis.callbackid6;
console.log(TAG + " secondCallback id : " + JSON.stringify(id2));
expect(id1 + 1).assertEqual(id2);
abilityContext.getApplicationContext()
globalThis.applicationContext6
.unregisterAbilityLifecycleCallback(globalThis.callbackid6, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
...
...
@@ -903,7 +909,7 @@ export default function lifecycleTest(abilityContext) {
id2 = globalThis.callbackid7;
console.log(TAG + " secondCallback id : " + JSON.stringify(id2));
expect(id1).assertEqual(id2);
abilityContext.getApplicationContext()
globalThis.applicationContext7
.unregisterAbilityLifecycleCallback(globalThis.callbackid7, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
...
...
@@ -967,7 +973,7 @@ export default function lifecycleTest(abilityContext) {
id2 = globalThis.callbackid8;
console.log(TAG + " secondCallback id : " + JSON.stringify(id2));
expect(id1 + 1).assertEqual(id2);
abilityContext.getApplicationContext()
globalThis.applicationContext8
.unregisterAbilityLifecycleCallback(globalThis.callbackid8, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
...
...
@@ -1035,7 +1041,7 @@ export default function lifecycleTest(abilityContext) {
expect(listKeyTemp[3]).assertEqual("Hap1MainAbility1 onAbilityBackground");
expect(listKeyTemp[4]).assertEqual("Hap1MainAbility1 onAbilityWindowStageDestroy");
expect(listKeyTemp[5]).assertEqual("Hap1MainAbility1 onAbilityDestroy");
abilityContext.getApplicationContext()
globalThis.applicationContext9
.unregisterAbilityLifecycleCallback(globalThis.mainAbility9CallBackId, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
...
...
@@ -1098,7 +1104,7 @@ export default function lifecycleTest(abilityContext) {
expect(listKeyTemp[9]).assertEqual("Hap1MainAbility2 onAbilityBackground");
expect(listKeyTemp[10]).assertEqual("Hap1MainAbility2 onAbilityWindowStageDestroy");
expect(listKeyTemp[11]).assertEqual("Hap1MainAbility2 onAbilityDestroy");
abilityContext.getApplicationContext()
globalThis.applicationContext9
.unregisterAbilityLifecycleCallback(globalThis.mainAbility9CallBackId, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
...
...
@@ -1191,7 +1197,7 @@ export default function lifecycleTest(abilityContext) {
expect(exlist[4]).assertEqual("MainAbility2 onAbilityWindowStageDestroy");
expect(exlist[5]).assertEqual("MainAbility2 onAbilityDestroy");
expect(id1 + 1).assertEqual(id2);
abilityContext.getApplicationContext()
globalThis.applicationContext11
.unregisterAbilityLifecycleCallback(globalThis.callbackid11, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
...
...
@@ -1387,8 +1393,8 @@ export default function lifecycleTest(abilityContext) {
expect(exlist[4]).assertEqual("MainAbility2 onAbilityWindowStageDestroy");
expect(exlist[5]).assertEqual("MainAbility2 onAbilityDestroy");
expect(id1 + 1).assertEqual(id2);
abilityContext.getApplicationContext()
.unregisterAbilityLifecycleCallback(
globalThis.callbackid6
, (error, data) => {
globalThis.applicationContext12
.unregisterAbilityLifecycleCallback(
id2
, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
console.log("------------Singlehap_LifeCycleTest_2000 END-------------");
...
...
@@ -1574,12 +1580,12 @@ export default function lifecycleTest(abilityContext) {
expect(exlist1[5]).assertEqual("MainAbility2 onAbilityDestroy");
expect(id1 + 1).assertEqual(id2);
expect(id3 + 1).assertEqual(id4);
abilityContext.getApplicationContext()
globalThis.applicationContext12
.unregisterAbilityLifecycleCallback(globalThis.callbackid12, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
});
abilityContext.getApplicationContext()
globalThis.applicationContext1
.unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
...
...
@@ -1589,5 +1595,6 @@ export default function lifecycleTest(abilityContext) {
}, 100);
}, 7000);
});
})
}
\ No newline at end of file
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/ListTest.ets
浏览文件 @
fcadd824
...
...
@@ -13,7 +13,9 @@
* limitations under the License.
*/
import LifeCycleTest from './LifeCycleTest'
import Test from './Test'
export default function List(context) {
LifeCycleTest(context)
// Test(context)
}
\ No newline at end of file
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/Test.ets
0 → 100644
浏览文件 @
fcadd824
// @ts-nocheck
/*
* 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"
export default function lifecycleTest(abilityContext) {
describe('LifeCycleTest', function () {
beforeEach(async function (done) {
console.info('LifeCycleTest before each called');
await sleep(1000);
done()
});
afterEach(async function (done) {
console.info('LifeCycleTest after each called');
if ("Singlehap_LifeCycleTest_0200" === TAG || "Singlehap_LifeCycleTest_0300" === TAG
|| "Singlehap_LifeCycleTest_0500" === TAG || "Singlehap_LifeCycleTest_0600" === TAG
|| "Singlehap_LifeCycleTest_0800" === TAG || "Singlehap_LifeCycleTest_0900" === TAG) {
var para = {
resultCode: 2,
want: {
"abilityName": "MainAbility1",
"bundleName": "com.example.lifecycle_xts"
}
}
console.log("LifeCycleTest terminateSelfwithresult para: " + JSON.stringify(para));
await globalThis.ability1context.terminateSelfWithResult(para)
.then((data) => {
console.log("LifeCycleTest terminateSelfwithresult successful data: " + JSON.stringify(data));
}).catch((error) => {
console.log("LifeCycleTest terminateSelfwithresult error: " + JSON.stringify(error));
});
} else if ("Singlehap_LifeCycleTest_2000" === TAG) {
var para1 = {
resultCode: 2,
want: {
"abilityName": "MainAbility12",
"bundleName": "com.example.lifecycle_xts"
}
}
console.log("LifeCycleTest terminateSelfwithresult para: " + JSON.stringify(para1));
await globalThis.ability12.terminateSelfWithResult(para1)
.then((data) => {
console.log("LifeCycleTest terminateSelfwithresult successful data: " + JSON.stringify(data));
}).catch((error) => {
console.log("LifeCycleTest terminateSelfwithresult error: " + JSON.stringify(error));
});
}
done();
});
var TAG = "";
var listKeyTemp = ""
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time))
}
/*
* @tc.number Singlehap_LifeCycleTest_0700
* @tc.name Multiple registration/unregistration
* @tc.desc Function test
* @tc.level 0
*/
it("Singlehap_LifeCycleTest_0700", 0, async function (done) {
console.log("------------Singlehap_LifeCycleTest_0700 START-------------");
TAG = "Singlehap_LifeCycleTest_0700";
var code1;
var code2;
var code3;
var id1;
var id2;
var id3;
var listKey8 = [];
let AbilityLifecycleCallback = {
onAbilityCreate(ability) {
console.log(TAG + " onAbilityCreate ability:" + JSON.stringify(ability));
let abilityname = ability.context.abilityInfo.name;
console.log(TAG + " onAbilityCreate abilityname:" + JSON.stringify(abilityname));
console.log(TAG + " " + abilityname + " onAbilityCreate");
listKey8.push(abilityname + " onAbilityCreate");
},
onAbilityWindowStageCreate(ability) {
console.log(TAG + " onAbilityWindowStageCreate ability:" + JSON.stringify(ability));
let abilityname = ability.context.abilityInfo.name;
console.log(TAG + " onAbilityWindowStageCreate abilityname:" + JSON.stringify(abilityname));
console.log(TAG + " " + abilityname + " onAbilityWindowStageCreate");
listKey8.push(abilityname + " onAbilityWindowStageCreate");
},
onAbilityWindowStageDestroy(ability) {
console.log(TAG + " AbilityLifecycleCallback1 onAbilityWindowStageDestroy ability:"
+ JSON.stringify(ability));
let abilityname = ability.context.abilityInfo.name;
console.log(TAG + " AbilityLifecycleCallback1 onAbilityWindowStageDestroy abilityname:"
+ JSON.stringify(abilityname));
console.log(TAG + " " + abilityname + " onAbilityWindowStageDestroy");
listKey8.push(abilityname + " onAbilityWindowStageDestroy");
},
onAbilityDestroy(ability) {
console.log(TAG + " AbilityLifecycleCallback1 onAbilityDestroy ability:"
+ JSON.stringify(ability));
let abilityname = ability.context.abilityInfo.name;
console.log(TAG + " AbilityLifecycleCallback1 onAbilityDestroy abilityname:"
+ JSON.stringify(abilityname));
console.log(TAG + " " + abilityname + " onAbilityDestroy");
listKey8.push(abilityname + " onAbilityDestroy");
},
onAbilityForeground(ability) {
console.log(TAG + " AbilityLifecycleCallback1 onAbilityForeground ability:"
+ JSON.stringify(ability));
let abilityname = ability.context.abilityInfo.name;
console.log(TAG + " AbilityLifecycleCallback1 onAbilityForeground abilityname:"
+ JSON.stringify(abilityname));
console.log(TAG + " " + abilityname + " onAbilityForeground");
listKey8.push(abilityname + " onAbilityForeground");
},
onAbilityBackground(ability) {
console.log(TAG + " AbilityLifecycleCallback1 onAbilityBackground ability:"
+ JSON.stringify(ability));
let abilityname = ability.context.abilityInfo.name;
console.log(TAG + " AbilityLifecycleCallback1 onAbilityBackground abilityname:"
+ JSON.stringify(abilityname));
console.log(TAG + " " + abilityname + " onAbilityBackground");
listKey8.push(abilityname + " onAbilityBackground");
},
onAbilityContinue(ability) {
console.log(TAG + " AbilityLifecycleCallback1 onAbilityContinue ability:"
+ JSON.stringify(ability));
let abilityname = ability.context.abilityInfo.name;
console.log(TAG + " AbilityLifecycleCallback1 onAbilityContinue abilityname:"
+ JSON.stringify(abilityname));
console.log(TAG + " " + abilityname + " onAbilityContinue");
listKey8.push(abilityname + " onAbilityContinue");
}
}
let applicationContext = globalThis.abilityContext.getApplicationContext();
id1 = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback);
console.log(TAG + " registerAbilityLifecycleCallback1 number: " + JSON.stringify(id1));
applicationContext.unregisterAbilityLifecycleCallback(id1, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback1 success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
code1 = error.code;
})
setTimeout(function () {
id2 = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback);
console.log(TAG + " registerAbilityLifecycleCallback2 number: " + JSON.stringify(id2));
applicationContext.unregisterAbilityLifecycleCallback(id2, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback2 success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
code2 = error.code;
})
}, 1000);
setTimeout(function () {
id3 = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback);
console.log(TAG + " registerAbilityLifecycleCallback3 number: " + JSON.stringify(id3));
applicationContext.unregisterAbilityLifecycleCallback(id3, (error, data) => {
console.log(TAG + ": unregisterAbilityLifecycleCallback3 success, err: " + JSON.stringify(error) +
",data: " + JSON.stringify(data));
code3 = error.code;
expect(id1 > 0).assertTrue();
expect(id2).assertEqual(id1 + 1);
expect(id3).assertEqual(id2 + 1);
expect(code1).assertEqual(0);
expect(code2).assertEqual(0);
expect(code3).assertEqual(0);
console.log("------------Singlehap_LifeCycleTest_0700 END-------------");
done();
})
}, 3000);
});
})
}
\ No newline at end of file
ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/module.json
浏览文件 @
fcadd824
...
...
@@ -6,7 +6,8 @@
"description"
:
"$string:phone_entry_dsc"
,
"mainElement"
:
"MainAbility"
,
"deviceTypes"
:
[
"phone"
"phone"
,
"tablet"
],
"deliveryWithInstall"
:
true
,
"installationFree"
:
false
,
...
...
@@ -133,4 +134,4 @@
"label"
:
"$string:MainAbility12_label"
}]
}
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录