Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
dadc99bd
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看板
提交
dadc99bd
编写于
7月 07, 2023
作者:
X
xinking129
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add getrunningprocessInfo
Signed-off-by:
N
xinking129
<
xinxin13@huawei.com
>
上级
705206ff
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
1044 addition
and
228 deletion
+1044
-228
ability/ability_runtime/BUILD.gn
ability/ability_runtime/BUILD.gn
+2
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeOneReply/entry/src/main/ets/entryability/EntryAbility.ts
...eOneReply/entry/src/main/ets/entryability/EntryAbility.ts
+4
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/AppScope/app.json
...mation/ApplicationStateChangeThreeReply/AppScope/app.json
+19
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/AppScope/resources/base/element/string.json
...ngeThreeReply/AppScope/resources/base/element/string.json
+8
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/AppScope/resources/base/media/app_icon.png
...angeThreeReply/AppScope/resources/base/media/app_icon.png
+0
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/BUILD.gn
...cessinformation/ApplicationStateChangeThreeReply/BUILD.gn
+43
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/entryability/EntryAbility.ts
...hreeReply/entry/src/main/ets/entryability/EntryAbility.ts
+92
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/entryability1/EntryAbility1.ts
...eeReply/entry/src/main/ets/entryability1/EntryAbility1.ts
+59
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/pages/Index.ets
...nStateChangeThreeReply/entry/src/main/ets/pages/Index.ets
+17
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/pages/Index1.ets
...StateChangeThreeReply/entry/src/main/ets/pages/Index1.ets
+17
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/module.json
...plicationStateChangeThreeReply/entry/src/main/module.json
+47
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/resources/base/element/color.json
...reeReply/entry/src/main/resources/base/element/color.json
+8
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/resources/base/element/string.json
...eeReply/entry/src/main/resources/base/element/string.json
+24
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/resources/base/media/icon.png
...geThreeReply/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/resources/base/profile/main_pages.json
...ply/entry/src/main/resources/base/profile/main_pages.json
+6
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/resources/en_US/element/string.json
...eReply/entry/src/main/resources/en_US/element/string.json
+24
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/resources/zh_CN/element/string.json
...eReply/entry/src/main/resources/zh_CN/element/string.json
+24
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/signature/openharmony_sx.p7b
...icationStateChangeThreeReply/signature/openharmony_sx.p7b
+0
-0
ability/ability_runtime/getrunningprocessinformation/BUILD.gn
...ity/ability_runtime/getrunningprocessinformation/BUILD.gn
+2
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationOneReply/entry/src/main/ets/entryability/EntryAbility.ts
...nOneReply/entry/src/main/ets/entryability/EntryAbility.ts
+60
-139
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationOneReply/entry/src/main/ets/pages/Index.ets
...essInformationOneReply/entry/src/main/ets/pages/Index.ets
+98
-3
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/Test.json
...essinformation/GetRunningProcessInformationTest/Test.json
+3
-1
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/entry/src/main/ets/test/Ability.test.ets
...sInformationTest/entry/src/main/ets/test/Ability.test.ets
+251
-85
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/AppScope/app.json
...on/GetRunningProcessInformationTwoReply/AppScope/app.json
+19
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/AppScope/resources/base/element/string.json
...ationTwoReply/AppScope/resources/base/element/string.json
+8
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/AppScope/resources/base/media/app_icon.png
...mationTwoReply/AppScope/resources/base/media/app_icon.png
+0
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/BUILD.gn
...information/GetRunningProcessInformationTwoReply/BUILD.gn
+43
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/ets/entryability/EntryAbility.ts
...nTwoReply/entry/src/main/ets/entryability/EntryAbility.ts
+51
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/ets/pages/Index.ets
...essInformationTwoReply/entry/src/main/ets/pages/Index.ets
+17
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/module.json
...ningProcessInformationTwoReply/entry/src/main/module.json
+37
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/resources/base/element/color.json
...TwoReply/entry/src/main/resources/base/element/color.json
+8
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/resources/base/element/string.json
...woReply/entry/src/main/resources/base/element/string.json
+16
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/resources/base/media/icon.png
...tionTwoReply/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/resources/base/profile/main_pages.json
...ply/entry/src/main/resources/base/profile/main_pages.json
+5
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/resources/en_US/element/string.json
...oReply/entry/src/main/resources/en_US/element/string.json
+16
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/resources/zh_CN/element/string.json
...oReply/entry/src/main/resources/zh_CN/element/string.json
+16
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/signature/openharmony_sx.p7b
...ngProcessInformationTwoReply/signature/openharmony_sx.p7b
+0
-0
未找到文件。
ability/ability_runtime/BUILD.gn
浏览文件 @
dadc99bd
...
...
@@ -10,7 +10,9 @@
# 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("//build/ohos_var.gni")
group("ability_runtime") {
testonly = true
if (is_standard_system) {
...
...
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeOneReply/entry/src/main/ets/entryability/EntryAbility.ts
浏览文件 @
dadc99bd
...
...
@@ -69,6 +69,10 @@ export default class EntryAbility extends Ability {
globalThis
.
abilityContext
=
this
.
context
globalThis
.
want
=
want
globalThis
.
applicationContext
=
this
.
context
.
getApplicationContext
();
if
(
globalThis
.
want
.
action
==
'
RegisterOnOffOn
'
)
{
globalThis
.
applicationContext
.
on
(
'
applicationStateChange
'
,
ApplicationStateChangeCallbackFir
)
globalThis
.
applicationContext
.
off
(
'
applicationStateChange
'
,
ApplicationStateChangeCallbackFir
)
}
globalThis
.
applicationContext
.
on
(
'
applicationStateChange
'
,
ApplicationStateChangeCallbackFir
)
if
(
globalThis
.
want
.
action
==
'
doubleRegister
'
||
globalThis
.
want
.
action
==
'
doubleNeedBackGroundOff
'
||
globalThis
.
want
.
action
==
'
DoubleRegisterOff
'
)
{
...
...
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/AppScope/app.json
0 → 100644
浏览文件 @
dadc99bd
{
"app"
:
{
"bundleName"
:
"com.example.applicationstatechangethreereply"
,
"vendor"
:
"example"
,
"versionCode"
:
1000000
,
"versionName"
:
"1.0.0"
,
"icon"
:
"$media:app_icon"
,
"label"
:
"$string:app_name"
,
"distributedNotificationEnabled"
:
true
,
"keepAlive"
:
true
,
"singleUser"
:
true
,
"minAPIVersion"
:
10
,
"targetAPIVersion"
:
10
,
"car"
:
{
"apiCompatibleVersion"
:
10
,
"singleUser"
:
false
}
}
}
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
dadc99bd
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"ApplicationStateChangeThreeReply"
}
]
}
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/AppScope/resources/base/media/app_icon.png
0 → 100644
浏览文件 @
dadc99bd
6.6 KB
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/BUILD.gn
0 → 100644
浏览文件 @
dadc99bd
# Copyright (c) 2023 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("ApplicationStateChangeThreeReply") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":applicationstatechangethreereply_js_assets",
":applicationstatechangethreereply_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ApplicationStateChangeThreeReply"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("applicationstatechangethreereply_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("applicationstatechangethreereply_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("applicationstatechangethreereply_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":applicationstatechangethreereply_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/entryability/EntryAbility.ts
0 → 100644
浏览文件 @
dadc99bd
import
hilog
from
'
@ohos.hilog
'
;
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Window
from
'
@ohos.window
'
import
commonEvent
from
'
@ohos.commonEvent
'
let
TAG
=
'
getRunningProcess
'
let
commonStateArr
let
commonEventData
=
{
parameters
:{
commonStateArr
:
commonStateArr
}
}
let
ApplicationStateChangeCallbackFir
=
{
onApplicationForeground
()
{
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackFir onApplicationForeground
'
)
},
onApplicationBackground
()
{
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackFir onApplicationBackground
'
)
setTimeout
(()
=>
{
console
.
info
(
'
Enter onApplicationForeground publish!
'
)
commonEventData
.
parameters
.
commonStateArr
=
1
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
})
},
1000
)
}
}
let
ForegroundTAG
=
-
1
export
default
class
EntryAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
ForegroundTAG
=
-
1
commonEventData
.
parameters
.
commonStateArr
=
-
1
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onCreate
'
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
want param:
'
+
JSON
.
stringify
(
want
)
??
''
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
launchParam:
'
+
JSON
.
stringify
(
launchParam
)
??
''
);
globalThis
.
abilityContext1
=
this
.
context
globalThis
.
want1
=
want
globalThis
.
applicationContext1
=
this
.
context
.
getApplicationContext
();
globalThis
.
applicationContext1
.
on
(
'
applicationStateChange
'
,
ApplicationStateChangeCallbackFir
)
}
onDestroy
()
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onDestroy
'
);
}
onWindowStageCreate
(
windowStage
:
Window
.
WindowStage
)
{
// Main window is created, set main page for this ability
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onWindowStageCreate
'
);
windowStage
.
loadContent
(
'
pages/Index
'
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
ERROR
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
Failed to load the content. Cause: %{public}s
'
,
JSON
.
stringify
(
err
)
??
''
);
return
;
}
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
Succeeded in loading the content. Data: %{public}s
'
,
JSON
.
stringify
(
data
)
??
''
);
});
}
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onWindowStageDestroy
'
);
}
onForeground
()
{
// Ability has brought to foreground
ForegroundTAG
++
if
(
ForegroundTAG
==
1
)
{
setTimeout
(()
=>
{
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
})
},
3000
)
}
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onForeground
'
);
}
onBackground
()
{
// Ability has back to background
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onBackground
'
);
}
}
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/entryability1/EntryAbility1.ts
0 → 100644
浏览文件 @
dadc99bd
import
hilog
from
'
@ohos.hilog
'
;
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Window
from
'
@ohos.window
'
export
default
class
EntryAbility1
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onCreate
'
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
want param:
'
+
JSON
.
stringify
(
want
)
??
''
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
launchParam:
'
+
JSON
.
stringify
(
launchParam
)
??
''
);
globalThis
.
abilityContext2
=
this
.
context
globalThis
.
want2
=
want
globalThis
.
applicationContext2
=
this
.
context
.
getApplicationContext
();
}
onDestroy
()
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onDestroy
'
);
}
onWindowStageCreate
(
windowStage
:
Window
.
WindowStage
)
{
// Main window is created, set main page for this ability
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onWindowStageCreate
'
);
windowStage
.
loadContent
(
'
pages/Index
'
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
ERROR
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
Failed to load the content. Cause: %{public}s
'
,
JSON
.
stringify
(
err
)
??
''
);
return
;
}
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
Succeeded in loading the content. Data: %{public}s
'
,
JSON
.
stringify
(
data
)
??
''
);
});
}
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onWindowStageDestroy
'
);
}
onForeground
()
{
// Ability has brought to foreground
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onForeground
'
);
setTimeout
(()
=>
{
globalThis
.
abilityContext2
.
terminateSelf
((
err
)
=>
{
console
.
log
(
'
terminateSelf result:
'
+
JSON
.
stringify
(
err
));
})
},
3000
)
}
onBackground
()
{
// Ability has back to background
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onBackground
'
);
}
}
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/pages/Index.ets
0 → 100644
浏览文件 @
dadc99bd
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/pages/Index1.ets
0 → 100644
浏览文件 @
dadc99bd
@Entry
@Component
struct Index1 {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/module.json
0 → 100644
浏览文件 @
dadc99bd
{
"module"
:
{
"name"
:
"entry"
,
"type"
:
"entry"
,
"description"
:
"$string:module_desc"
,
"mainElement"
:
"EntryAbility"
,
"deviceTypes"
:
[
"default"
,
"tablet"
],
"deliveryWithInstall"
:
true
,
"installationFree"
:
false
,
"pages"
:
"$profile:main_pages"
,
"abilities"
:
[
{
"name"
:
"EntryAbility"
,
"srcEntrance"
:
"./ets/entryability/EntryAbility.ts"
,
"description"
:
"$string:EntryAbility_desc"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:EntryAbility_label"
,
"startWindowIcon"
:
"$media:icon"
,
"startWindowBackground"
:
"$color:start_window_background"
,
"visible"
:
true
,
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
]
},
{
"name"
:
"EntryAbility1"
,
"srcEntrance"
:
"./ets/entryability1/EntryAbility1.ts"
,
"description"
:
"$string:EntryAbility1_desc"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:EntryAbility1_label"
,
"startWindowIcon"
:
"$media:icon"
,
"startWindowBackground"
:
"$color:start_window_background"
,
"visible"
:
true
}
]
}
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/resources/base/element/color.json
0 → 100644
浏览文件 @
dadc99bd
{
"color"
:
[
{
"name"
:
"start_window_background"
,
"value"
:
"#FFFFFF"
}
]
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
dadc99bd
{
"string"
:
[
{
"name"
:
"module_desc"
,
"value"
:
"module description"
},
{
"name"
:
"EntryAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"EntryAbility1_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility1_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
dadc99bd
6.6 KB
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/resources/base/profile/main_pages.json
0 → 100644
浏览文件 @
dadc99bd
{
"src"
:
[
"pages/Index"
,
"pages/Index1"
]
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/resources/en_US/element/string.json
0 → 100644
浏览文件 @
dadc99bd
{
"string"
:
[
{
"name"
:
"module_desc"
,
"value"
:
"module description"
},
{
"name"
:
"EntryAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"EntryAbility1_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility1_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/resources/zh_CN/element/string.json
0 → 100644
浏览文件 @
dadc99bd
{
"string"
:
[
{
"name"
:
"module_desc"
,
"value"
:
"模块描述"
},
{
"name"
:
"EntryAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"EntryAbility1_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility1_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
dadc99bd
文件已添加
ability/ability_runtime/getrunningprocessinformation/BUILD.gn
浏览文件 @
dadc99bd
...
...
@@ -18,9 +18,11 @@ group("getrunningprocessinformation") {
if (is_standard_system) {
deps = [
"ApplicationStateChangeOneReply:ApplicationStateChangeOneReply",
"ApplicationStateChangeThreeReply:ApplicationStateChangeThreeReply",
"ApplicationStateChangeTwoReply:ApplicationStateChangeTwoReply",
"GetRunningProcessInformationOneReply:GetRunningProcessInformationOneReply",
"GetRunningProcessInformationTest:GetRunningProcessInformationTest",
"GetRunningProcessInformationTwoReply:GetRunningProcessInformationTwoReply",
]
}
}
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationOneReply/entry/src/main/ets/entryability/EntryAbility.ts
浏览文件 @
dadc99bd
...
...
@@ -2,17 +2,71 @@ import hilog from '@ohos.hilog';
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Window
from
'
@ohos.window
'
import
commonEvent
from
'
@ohos.commonEvent
'
import
AbilityConstant
from
'
@ohos.app.ability.AbilityConstant
'
let
commonStateArr
:
number
[]
=
[
2
,
2
,
2
,
3
,
3
,
3
]
let
sequence
=
0
;
let
TAG
=
'
GetRunningProcessInformation
'
let
commonStateArr
:
number
[]
=
[
-
1
,
-
1
,
-
1
,
-
1
]
let
commonEventData
=
{
parameters
:{
"
commonStateArr
"
:
commonStateArr
commonStateArr
:
commonStateArr
}
}
let
TAG
=
'
Runningprocessinformation
'
globalThis
.
StartFloatingAbility
=
()
=>
{
let
want
=
{
"
deviceId
"
:
""
,
"
bundleName
"
:
"
com.example.getrunningprocessinformationtworeply
"
,
//
"
abilityName
"
:
"
EntryAbility
"
};
let
options
=
{
windowMode
:
AbilityConstant
.
WindowMode
.
WINDOW_MODE_FLOATING
,
};
globalThis
.
abilityContext
.
startAbility
(
want
,
options
,
(
error
)
=>
{
console
.
log
(
TAG
,
"
start floating ability error.code =
"
+
error
.
code
)
})
}
globalThis
.
StartNormalAbility
=
()
=>
{
let
want
=
{
"
deviceId
"
:
""
,
"
bundleName
"
:
"
com.example.getrunningprocessinformationtworeply
"
,
//
"
abilityName
"
:
"
EntryAbility
"
};
globalThis
.
abilityContext
.
startAbility
(
want
,
(
error
)
=>
{
console
.
log
(
TAG
,
"
start normal ability error.code =
"
+
error
.
code
)
})
}
globalThis
.
GetRunningProcessInfoCallback
=
()
=>
{
globalThis
.
applicationContext
.
getRunningProcessInformation
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
}
else
{
console
.
log
(
TAG
,
'
Oncreate Callback State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
sequence
++
]
=
data
[
0
].
state
}
})
}
globalThis
.
GetRunningProcessInfoPromise
=
()
=>
{
globalThis
.
applicationContext
.
getRunningProcessInformation
().
then
((
data
)
=>
{
console
.
log
(
TAG
,
'
Oncreate Promise State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
sequence
++
]
=
data
[
0
].
state
}).
catch
((
err
)
=>
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
});
}
globalThis
.
PublishStateArray
=
()
=>
{
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
})
}
export
default
class
EntryAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
sequence
=
0
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onCreate
'
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
want param:
'
+
JSON
.
stringify
(
want
)
??
''
);
...
...
@@ -22,83 +76,17 @@ export default class EntryAbility extends Ability {
globalThis
.
abilityContext
=
this
.
context
globalThis
.
applicationContext
=
this
.
context
.
getApplicationContext
();
if
(
globalThis
.
want
.
action
==
'
Callback
'
)
{
globalThis
.
applicationContext
.
getRunningProcessInformation
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
}
else
{
console
.
log
(
TAG
,
'
Oncreate Callback State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
0
]
=
data
[
0
].
state
}
})
}
else
if
(
globalThis
.
want
.
action
==
'
Promise
'
)
{
globalThis
.
applicationContext
.
getRunningProcessInformation
().
then
((
data
)
=>
{
console
.
log
(
TAG
,
'
Oncreate Promise State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
0
]
=
data
[
0
].
state
}).
catch
((
err
)
=>
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
});
}
}
onDestroy
()
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onDestroy
'
);
if
(
globalThis
.
want
.
action
==
'
Callback
'
)
{
globalThis
.
applicationContext
.
getRunningProcessInformation
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
TAG
,
'
Ondestroy Callback State:
'
+
JSON
.
stringify
(
err
));
}
else
{
console
.
log
(
TAG
,
'
Ondestroy Callback State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
5
]
=
data
[
0
].
state
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
})
}
})
}
else
if
(
globalThis
.
want
.
action
==
'
Promise
'
)
{
globalThis
.
applicationContext
.
getRunningProcessInformation
().
then
((
data
)
=>
{
console
.
log
(
TAG
,
'
Ondestroy Promise State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
5
]
=
data
[
0
].
state
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
})
}).
catch
((
err
)
=>
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
});
}
}
onWindowStageCreate
(
windowStage
:
Window
.
WindowStage
)
{
// Main window is created, set main page for this ability
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onWindowStageCreate
'
);
if
(
globalThis
.
want
.
action
==
'
Callback
'
)
{
globalThis
.
applicationContext
.
getRunningProcessInformation
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
}
else
{
console
.
log
(
TAG
,
'
Onwindowstagecreate Callback State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
1
]
=
data
[
0
].
state
}
})
}
else
if
(
globalThis
.
want
.
action
==
'
Promise
'
)
{
globalThis
.
applicationContext
.
getRunningProcessInformation
().
then
((
data
)
=>
{
console
.
log
(
TAG
,
'
Onwindowstagecreate Promise State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
1
]
=
data
[
0
].
state
}).
catch
((
err
)
=>
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
});
}
windowStage
.
loadContent
(
'
pages/Index
'
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
ERROR
);
...
...
@@ -110,88 +98,21 @@ export default class EntryAbility extends Ability {
});
}
async
onWindowStageDestroy
()
{
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onWindowStageDestroy
'
);
if
(
globalThis
.
want
.
action
==
'
Callback
'
)
{
globalThis
.
applicationContext
.
getRunningProcessInformation
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
}
else
{
console
.
log
(
TAG
,
'
Onwindowstagedestroy Callback State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
4
]
=
data
[
0
].
state
}
})
}
else
if
(
globalThis
.
want
.
action
==
'
Promise
'
)
{
await
globalThis
.
applicationContext
.
getRunningProcessInformation
().
then
((
data
)
=>
{
console
.
log
(
TAG
,
'
Onwindowstagedestroy Promise State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
2
]
=
data
[
4
].
state
}).
catch
((
err
)
=>
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
});
}
}
async
onForeground
()
{
onForeground
()
{
// Ability has brought to foreground
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onForeground
'
);
if
(
globalThis
.
want
.
action
==
'
Callback
'
)
{
globalThis
.
applicationContext
.
getRunningProcessInformation
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
}
else
{
console
.
log
(
TAG
,
'
Onforeground Callback State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
2
]
=
data
[
0
].
state
globalThis
.
abilityContext
.
terminateSelf
((
err
)
=>
{
console
.
log
(
TAG
,
'
terminateSelf result:
'
+
JSON
.
stringify
(
err
));
});
}
})
}
else
if
(
globalThis
.
want
.
action
==
'
Promise
'
)
{
await
globalThis
.
applicationContext
.
getRunningProcessInformation
().
then
((
data
)
=>
{
console
.
log
(
TAG
,
'
Onforeground Promise State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
2
]
=
data
[
0
].
state
}).
catch
((
err
)
=>
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
});
}
await
setTimeout
(()
=>
{
globalThis
.
abilityContext
.
terminateSelf
((
err
)
=>
{
console
.
log
(
TAG
,
'
terminateSelf result:
'
+
JSON
.
stringify
(
err
));
});
},
4000
)
}
async
onBackground
()
{
onBackground
()
{
// Ability has back to background
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onBackground
'
);
if
(
globalThis
.
want
.
action
==
'
Callback
'
)
{
globalThis
.
applicationContext
.
getRunningProcessInformation
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
}
else
{
console
.
log
(
TAG
,
'
Onbackground Callback State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
3
]
=
data
[
0
].
state
}
})
}
// else if (globalThis.want.action == 'Promise') {
await
globalThis
.
applicationContext
.
getRunningProcessInformation
().
then
((
data
)
=>
{
console
.
log
(
TAG
,
'
Onbackground Promise State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
3
]
=
data
[
0
].
state
}).
catch
((
err
)
=>
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
});
// }
}
}
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationOneReply/entry/src/main/ets/pages/Index.ets
浏览文件 @
dadc99bd
...
...
@@ -6,9 +6,104 @@ struct Index {
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('get BackInfo')
.fontSize(25)
.fontWeight(FontWeight.Bold)
.fontColor('#FFFFFF')
}
.id('Backtest')
.type(ButtonType.Capsule)
.margin({ top: 30 })
.backgroundColor('#87CEEB')
.width('90%')
.height('6%')
.onClick(() => {
if (globalThis.want.action == 'Callback') {
setTimeout(() => {
globalThis.StartNormalAbility()
},500)
setTimeout(() => {
globalThis.GetRunningProcessInfoCallback()
},3000)
setTimeout(() => {
globalThis.PublishStateArray()
},5000)
}
else if (globalThis.want.action == 'Promise') {
setTimeout(() => {
globalThis.StartNormalAbility()
},500)
setTimeout(() => {
globalThis.GetRunningProcessInfoPromise()
},3000)
setTimeout(() => {
globalThis.PublishStateArray()
},5000)
}
})
Button() {
Text('get unFocusedInfo')
.fontSize(25)
.fontWeight(FontWeight.Bold)
.fontColor('#FFFFFF')
}
.id('unFocusedtest')
.type(ButtonType.Capsule)
.margin({ top: 30 })
.backgroundColor('#87CEEB')
.width('90%')
.height('6%')
.onClick(() => {
if (globalThis.want.action == 'Callback') {
setTimeout(() => {
globalThis.StartFloatingAbility()
},500)
setTimeout(() => {
globalThis.GetRunningProcessInfoCallback()
},2500)
}
else if (globalThis.want.action == 'Promise') {
setTimeout(() => {
globalThis.StartFloatingAbility()
},500)
setTimeout(() => {
globalThis.GetRunningProcessInfoPromise()
},2500)
}
})
Button() {
Text('get focusedInfo')
.fontSize(25)
.fontWeight(FontWeight.Bold)
.fontColor('#FFFFFF')
}
.id('Focustest')
.type(ButtonType.Capsule)
.margin({ top: 30 })
.backgroundColor('#87CEEB')
.width('90%')
.height('6%')
.onClick(() => {
if (globalThis.want.action == 'Callback') {
setTimeout(() => {
globalThis.GetRunningProcessInfoCallback()
},500)
}
else if (globalThis.want.action == 'Promise') {
setTimeout(() => {
globalThis.GetRunningProcessInfoPromise()
},500)
}
})
}
.width('100%')
}
...
...
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/Test.json
浏览文件 @
dadc99bd
...
...
@@ -6,13 +6,15 @@
"bundle-name"
:
"com.example.getrunningprocessinformationtest"
,
"module-name"
:
"entry_test"
,
"shell-timeout"
:
"600000"
,
"testcase-timeout"
:
"
15
000"
"testcase-timeout"
:
"
30
000"
},
"kits"
:
[
{
"test-file-name"
:
[
"GetRunningProcessInformationTest.hap"
,
"GetRunningProcessInformationOneReply.hap"
,
"GetRunningProcessInformationTwoReply.hap"
,
"ApplicationStateChangeThreeReply.hap"
,
"ApplicationStateChangeOneReply.hap"
,
"ApplicationStateChangeTwoReply.hap"
],
...
...
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
dadc99bd
import hilog from '@ohos.hilog'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import { Component, Driver, UiWindow, ON, UiDriver } from '@ohos.UiTest'
import commonEvent from '@ohos.commonEvent'
import appManager from '@ohos.app.ability.appManager'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
...
...
@@ -28,7 +29,9 @@ export default function abilityTest() {
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let cmd1 = 'aa force-stop com.example.applicationstatechangeonereply'
let cmd2 = 'aa force-stop com.example.applicationstatechangetworeply'
let cmd6 = 'aa force-stop com.example.applicationstatechangethreereply'
let cmd4 = 'aa force-stop com.example.getrunningprocessinformationonereply'
let cmd5 = 'aa force-stop com.example.getrunningprocessinformationtworeply'
let cmd3 = 'hilog -r'
await abilityDelegator.executeShellCommand(cmd1, (err : any, data : any) => {
console.info("executeShellCommand1 callback");
...
...
@@ -42,6 +45,12 @@ export default function abilityTest() {
await abilityDelegator.executeShellCommand(cmd4, (err : any, data : any) => {
console.info("executeShellCommand3 callback");
});
await abilityDelegator.executeShellCommand(cmd5, (err : any, data : any) => {
console.info("executeShellCommand3 callback");
});
await abilityDelegator.executeShellCommand(cmd6, (err : any, data : any) => {
console.info("executeShellCommand3 callback");
});
})
afterAll(function () {
...
...
@@ -49,6 +58,7 @@ export default function abilityTest() {
// This API supports only one parameter: clear action function.
})
it('Acts_ApplicationStateChange_0100',0, function (done) {
let want = {
"deviceId": "",
...
...
@@ -64,11 +74,11 @@ export default function abilityTest() {
}
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 unSubscribeCallback");
console.debug("====>Acts_
ApplicationStateChange_01
00 unSubscribeCallback");
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 data: " + JSON.stringify(data));
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 err: " + JSON.stringify(err));
console.debug("====>Acts_
ApplicationStateChange_01
00 data: " + JSON.stringify(data));
console.debug("====>Acts_
ApplicationStateChange_01
00 err: " + JSON.stringify(err));
if(data.event == "processState") {
try{
expect(data.parameters.commonStateArr[0]).assertEqual(1)
...
...
@@ -84,7 +94,7 @@ export default function abilityTest() {
}
setTimeout(() => {
commonEvent.createSubscriber(ACTS_ProcessState).then((data) => {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback
_0100 Create Subscribe");
console.debug("====>Acts_
ApplicationStateChange
_0100 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
...
...
@@ -96,14 +106,14 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
})
},
25
00)
},
30
00)
})
},
5
00)
},
7
00)
setTimeout(()=>{
done();
}, 1
4
000);
}, 1
8
000);
})
...
...
@@ -122,11 +132,11 @@ export default function abilityTest() {
}
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback
_0200 unSubscribeCallback");
console.debug("====>Acts_
ApplicationStateChange
_0200 unSubscribeCallback");
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback
_0200 data: " + JSON.stringify(data));
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback
_0200 err: " + JSON.stringify(err));
console.debug("====>Acts_
ApplicationStateChange
_0200 data: " + JSON.stringify(data));
console.debug("====>Acts_
ApplicationStateChange
_0200 err: " + JSON.stringify(err));
if(data.event == "processState") {
console.info("entered assert zone!")
try{
...
...
@@ -144,7 +154,7 @@ export default function abilityTest() {
}
setTimeout(() => {
commonEvent.createSubscriber(ACTS_ProcessState).then(async (data) => {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback
_0200 Create Subscribe");
console.debug("====>Acts_
ApplicationStateChange
_0200 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
...
...
@@ -156,13 +166,13 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
})
},
25
00)
},
30
00)
})
},
5
00)
},
7
00)
setTimeout(()=>{
done();
}, 1
4
000);
}, 1
8
000);
})
...
...
@@ -182,11 +192,11 @@ export default function abilityTest() {
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 unSubscribeCallback");
console.debug("====>Acts_
ApplicationStateChange_03
00 unSubscribeCallback");
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 data: " + JSON.stringify(data));
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 err: " + JSON.stringify(err));
console.debug("====>Acts_
ApplicationStateChange_03
00 data: " + JSON.stringify(data));
console.debug("====>Acts_
ApplicationStateChange_03
00 err: " + JSON.stringify(err));
if(data.event == "processState") {
console.info("entered assert zone!")
try{
...
...
@@ -203,7 +213,7 @@ export default function abilityTest() {
}
setTimeout(() => {
commonEvent.createSubscriber(ACTS_ProcessState).then(async (data) => {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback
_0300 Create Subscribe");
console.debug("====>Acts_
ApplicationStateChange
_0300 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
...
...
@@ -214,13 +224,13 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
})
},
25
00)
},
30
00)
})
},
5
00)
},
7
00)
setTimeout(()=>{
done();
}, 1
4
000);
}, 1
8
000);
})
...
...
@@ -243,11 +253,11 @@ export default function abilityTest() {
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 unSubscribeCallback");
console.debug("====>Acts_
ApplicationStateChange_04
00 unSubscribeCallback");
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 data: " + JSON.stringify(data));
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 err: " + JSON.stringify(err));
console.debug("====>Acts_
ApplicationStateChange_04
00 data: " + JSON.stringify(data));
console.debug("====>Acts_
ApplicationStateChange_04
00 err: " + JSON.stringify(err));
if(data.event == "processState") {
console.info("entered assert zone!")
try{
...
...
@@ -264,7 +274,7 @@ export default function abilityTest() {
}
setTimeout(() => {
commonEvent.createSubscriber(ACTS_ProcessState).then(async (data) => {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 Create Subscribe");
console.debug("====>Acts_
ApplicationStateChange_04
00 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
...
...
@@ -275,13 +285,13 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
})
},
25
00)
},
30
00)
})
},
5
00)
},
7
00)
setTimeout(()=>{
done();
}, 1
4
000);
}, 1
8
000);
})
...
...
@@ -303,11 +313,11 @@ export default function abilityTest() {
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 unSubscribeCallback");
console.debug("====>Acts_
ApplicationStateChange_05
00 unSubscribeCallback");
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 data: " + JSON.stringify(data));
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 err: " + JSON.stringify(err));
console.debug("====>Acts_
ApplicationStateChange_05
00 data: " + JSON.stringify(data));
console.debug("====>Acts_
ApplicationStateChange_05
00 err: " + JSON.stringify(err));
if(data.event == "processState") {
console.info("entered assert zone!")
try{
...
...
@@ -324,7 +334,7 @@ export default function abilityTest() {
}
setTimeout(() => {
commonEvent.createSubscriber(ACTS_ProcessState).then(async (data) => {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 Create Subscribe");
console.debug("====>Acts_
ApplicationStateChange_05
00 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
...
...
@@ -335,13 +345,13 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
})
},
25
00)
},
30
00)
})
},
5
00)
},
7
00)
setTimeout(()=>{
done();
}, 1
4
000);
}, 1
8
000);
})
it('Acts_ApplicationStateChange_0600',0, async function (done) {
...
...
@@ -362,11 +372,11 @@ export default function abilityTest() {
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 unSubscribeCallback");
console.debug("====>Acts_
ApplicationStateChange_06
00 unSubscribeCallback");
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 data: " + JSON.stringify(data));
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 err: " + JSON.stringify(err));
console.debug("====>Acts_
ApplicationStateChange_06
00 data: " + JSON.stringify(data));
console.debug("====>Acts_
ApplicationStateChange_06
00 err: " + JSON.stringify(err));
if(data.event == "processState") {
console.info("entered assert zone!")
try{
...
...
@@ -383,7 +393,7 @@ export default function abilityTest() {
}
setTimeout(() => {
commonEvent.createSubscriber(ACTS_ProcessState).then(async (data) => {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 Create Subscribe");
console.debug("====>Acts_
ApplicationStateChange_06
00 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
...
...
@@ -394,39 +404,43 @@ export default function abilityTest() {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
})
},
25
00)
},
30
00)
})
},
5
00)
},
7
00)
setTimeout(()=>{
done();
}, 1
4
000);
}, 1
8
000);
})
it('Acts_GetRunningProcessInformation_AsyncCallback_0200',0, function (done) {
console.info("=====>Acts_GetRunningProcessInformation_AsyncCallback_0200 start<=====")
it('Acts_ApplicationStateChange_0700',0, function (done) {
let want = {
"deviceId": "",
"bundleName": "com.example.
getrunningprocessinformation
onereply",
"bundleName": "com.example.
applicationstatechange
onereply",
"abilityName": "EntryAbility",
"action": "Callback"
"action": "RegisterOnOffOn"
}
let wantAuxiliary = {
"deviceId": "",
"bundleName": "com.example.applicationstatechangetworeply",
"abilityName": "EntryAbility",
"action": "Normal"
}
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 unSubscribeCallback");
console.debug("====>Acts_
ApplicationStateChange_07
00 unSubscribeCallback");
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 data: " + JSON.stringify(data));
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 err: " + JSON.stringify(err));
console.debug("====>Acts_
ApplicationStateChange_07
00 data: " + JSON.stringify(data));
console.debug("====>Acts_
ApplicationStateChange_07
00 err: " + JSON.stringify(err));
if(data.event == "processState") {
try{
expect(data.parameters.commonStateArr[0]).assertEqual(2||1)
expect(data.parameters.commonStateArr[1]).assertEqual(2||1)
expect(data.parameters.commonStateArr[2]).assertEqual(2||1)
expect(data.parameters.commonStateArr[3]).assertEqual(3)
expect(data.parameters.commonStateArr[4]).assertEqual(3)
expect(data.parameters.commonStateArr[5]).assertEqual(3)
expect(data.parameters.commonStateArr[0]).assertEqual(1)
expect(data.parameters.commonStateArr[1]).assertEqual(1)
expect(data.parameters.commonStateArr[2]).assertEqual(-1)
expect(data.parameters.commonStateArr[3]).assertEqual(-1)
}
catch(error) {
console.log("An error is generated")
...
...
@@ -435,71 +449,223 @@ export default function abilityTest() {
}
}
setTimeout(() => {
commonEvent.createSubscriber(ACTS_ProcessState).then(
async
(data) => {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 Create Subscribe");
commonEvent.createSubscriber(ACTS_ProcessState).then((data) => {
console.debug("====>Acts_
ApplicationStateChange_07
00 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
await
globalThis.abilityContext.startAbility(want, (error) => {
globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code)
})
})
},500)
setTimeout(()=>{
done();
}, 14000);
setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
})
},3000)
})
},700)
setTimeout(()=>{
done();
}, 18000);
})
it('Acts_GetRunningProcessInformation_Promise_0200',0, function (done) {
console.info("=====>Acts_GetRunningProcessInformation_AsyncCallback_0200 start<=====")
it('Acts_ApplicationStateChange_0800', 0, async function (done) {
let want = {
"deviceId": "",
"bundleName": "com.example.
getrunningprocessinformationon
ereply",
"bundleName": "com.example.
applicationstatechangethre
ereply",
"abilityName": "EntryAbility",
"action": "
Promise
"
"action": "
DoubleAbilityTest
"
}
let wantAuxiliary = {
"deviceId": "",
"bundleName": "com.example.applicationstatechangethreereply",
"abilityName": "EntryAbility1",
"action": "DoubleAbilityTest"
}
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_GetRunningProcessInformation_AsyncCallback_0200 unSubscribeCallback");
console.debug("====>Acts_ApplicationStateChange_0800 unSubscribeCallback");
done()
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_GetRunningProcessInformation_AsyncCallback_0200 data: " + JSON.stringify(data));
console.debug("====>Acts_GetRunningProcessInformation_AsyncCallback_0200 err: " + JSON.stringify(err));
if(data.event == "processState") {
try{
expect(data.parameters.commonStateArr[0]).assertEqual(2||1)
expect(data.parameters.commonStateArr[1]).assertEqual(2||1)
expect(data.parameters.commonStateArr[2]).assertEqual(2||1)
expect(data.parameters.commonStateArr[3]).assertEqual(3)
expect(data.parameters.commonStateArr[4]).assertEqual(3)
expect(data.parameters.commonStateArr[5]).assertEqual(3)
console.debug("====>Acts_ApplicationStateChange_0800 data: " + JSON.stringify(data));
console.debug("====>Acts_ApplicationStateChange_0800 err: " + JSON.stringify(err));
if (data.event == "processState") {
console.info("entered assert zone!")
try {
expect(data.parameters.commonStateArr).assertEqual(-1)
}
catch(error) {
catch
(error) {
console.log("An error is generated")
}
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
setTimeout(() => {
commonEvent.createSubscriber(ACTS_ProcessState).then(async (data) => {
console.debug("====>Acts_
GetRunningProcessInformation_AsyncCallback_02
00 Create Subscribe");
console.debug("====>Acts_
ApplicationStateChange_08
00 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
await
globalThis.abilityContext.startAbility(want, (error) => {
globalThis.abilityContext.startAbility(want, (error) => {
console.log("ability error.code = " + error.code)
})
setTimeout(() => {
globalThis.abilityContext.startAbility(wantAuxiliary, (error) => {
console.log("auxiliary ability error.code = " + error.code)
})
}, 3000)
})
},
5
00)
},
7
00)
setTimeout(()=>{
done();
}, 14000);
})
it('Acts_GetRunningProcessInformation_AsyncCallback_0100', 0, async function (done) {
let TAG = 'getRunningProcess'
console.info("=====>Acts_GetRunningProcessInformation_AsyncCallback_0100 start<=====")
let want = {
"deviceId": "",
"bundleName": "com.example.getrunningprocessinformationonereply",
"abilityName": "EntryAbility",
"action": "Callback"
}
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_GetRunningProcessInformation_AsyncCallback_0100 unSubscribeCallback");
done()
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_GetRunningProcessInformation_AsyncCallback_0100 data: " + JSON.stringify(data));
console.debug("====>Acts_GetRunningProcessInformation_AsyncCallback_0100 err: " + JSON.stringify(err));
if (data.event == "processState") {
console.info("entered assert zone!")
try {
expect(data.parameters.commonStateArr[0]).assertEqual(2)
console.info("this is array one")
expect(data.parameters.commonStateArr[1]).assertEqual(1)
console.info("this is array one")
expect(data.parameters.commonStateArr[2]).assertEqual(3)
console.info("this is array one")
expect(data.parameters.commonStateArr[3]).assertEqual(-1)
console.info("this is array one")
}
catch (error) {
console.log("An error is generated")
}
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
setTimeout(() => {
commonEvent.createSubscriber(ACTS_ProcessState).then(async (data) => {
console.debug("====>Acts_GetRunningProcessInformation_AsyncCallback_0100 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(want, (error) => {
console.log("start normal ability error.code = " + error.code)
})
setTimeout(async () => {
let driver = Driver.create()
await driver.delayMs(1500)
let button1 = await driver.findComponent(ON.text('get focusedInfo'))
await expect(button1 != null).assertTrue()
let button2 = await driver.findComponent(ON.text('get unFocusedInfo'))
await expect(button2 != null).assertTrue()
let button3 = await driver.findComponent(ON.text('get BackInfo'))
await expect(button3 != null).assertTrue()
await button1.click()
await driver.delayMs(2000)
await button2.click()
await driver.delayMs(4000)
await driver.pressBack()
await driver.delayMs(2000)
await button3.click()
}, 3000)
})
}, 1000)
})
it('Acts_GetRunningProcessInformation_Promise_0100', 0, async function (done) {
let TAG = 'getRunningProcess'
console.info("=====>Acts_GetRunningProcessInformation_AsyncCallback_0100 start<=====")
let want = {
"deviceId": "",
"bundleName": "com.example.getrunningprocessinformationonereply",
"abilityName": "EntryAbility",
"action": "Promise"
}
let subscriber
function unSubscribeCallback() {
console.debug("====>Acts_GetRunningProcessInformation_Promise_0100 unSubscribeCallback");
done()
}
function subscribeCallBack(err, data) {
console.debug("====>Acts_GetRunningProcessInformation_Promise_0100 data: " + JSON.stringify(data));
console.debug("====>Acts_GetRunningProcessInformation_Promise_0100 err: " + JSON.stringify(err));
if (data.event == "processState") {
console.info("entered assert zone!")
try {
expect(data.parameters.commonStateArr[0]).assertEqual(2)
console.info("this is array one")
expect(data.parameters.commonStateArr[1]).assertEqual(1)
console.info("this is array one")
expect(data.parameters.commonStateArr[2]).assertEqual(3)
console.info("this is array one")
expect(data.parameters.commonStateArr[3]).assertEqual(-1)
console.info("this is array one")
}
catch (error) {
console.log("An error is generated")
}
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
setTimeout(() => {
commonEvent.createSubscriber(ACTS_ProcessState).then(async (data) => {
console.debug("====>Acts_GetRunningProcessInformation_Promise_0100 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(want, (error) => {
console.log("start normal ability error.code = " + error.code)
})
setTimeout(async () => {
let driver = Driver.create()
await driver.delayMs(1500)
let button1 = await driver.findComponent(ON.text('get focusedInfo'))
await expect(button1 != null).assertTrue()
let button2 = await driver.findComponent(ON.text('get unFocusedInfo'))
await expect(button2 != null).assertTrue()
let button3 = await driver.findComponent(ON.text('get BackInfo'))
await expect(button3 != null).assertTrue()
await button1.click()
await driver.delayMs(2000)
await button2.click()
await driver.delayMs(4000)
await driver.pressBack()
await driver.delayMs(2000)
await button3.click()
}, 3000)
})
}, 1000)
})
})
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/AppScope/app.json
0 → 100644
浏览文件 @
dadc99bd
{
"app"
:
{
"bundleName"
:
"com.example.getrunningprocessinformationtworeply"
,
"vendor"
:
"example"
,
"versionCode"
:
1000000
,
"versionName"
:
"1.0.0"
,
"icon"
:
"$media:app_icon"
,
"label"
:
"$string:app_name"
,
"distributedNotificationEnabled"
:
true
,
"keepAlive"
:
true
,
"singleUser"
:
true
,
"minAPIVersion"
:
10
,
"targetAPIVersion"
:
10
,
"car"
:
{
"apiCompatibleVersion"
:
10
,
"singleUser"
:
false
}
}
}
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
dadc99bd
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"GetRunningProcessInformationTwoReply"
}
]
}
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/AppScope/resources/base/media/app_icon.png
0 → 100644
浏览文件 @
dadc99bd
6.6 KB
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/BUILD.gn
0 → 100644
浏览文件 @
dadc99bd
# Copyright (c) 2023 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("GetRunningProcessInformationTwoReply") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":getrunningprocessinformationtworeply_js_assets",
":getrunningprocessinformationtworeply_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "GetRunningProcessInformationTwoReply"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("getrunningprocessinformationtworeply_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("getrunningprocessinformationtworeply_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("getrunningprocessinformationtworeply_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":getrunningprocessinformationtworeply_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/ets/entryability/EntryAbility.ts
0 → 100644
浏览文件 @
dadc99bd
import
hilog
from
'
@ohos.hilog
'
;
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Window
from
'
@ohos.window
'
export
default
class
EntryAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onCreate
'
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
want param:
'
+
JSON
.
stringify
(
want
)
??
''
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
launchParam:
'
+
JSON
.
stringify
(
launchParam
)
??
''
);
}
onDestroy
()
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onDestroy
'
);
}
onWindowStageCreate
(
windowStage
:
Window
.
WindowStage
)
{
// Main window is created, set main page for this ability
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onWindowStageCreate
'
);
windowStage
.
loadContent
(
'
pages/Index
'
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
ERROR
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
Failed to load the content. Cause: %{public}s
'
,
JSON
.
stringify
(
err
)
??
''
);
return
;
}
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
Succeeded in loading the content. Data: %{public}s
'
,
JSON
.
stringify
(
data
)
??
''
);
});
}
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onWindowStageDestroy
'
);
}
onForeground
()
{
// Ability has brought to foreground
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onForeground
'
);
}
onBackground
()
{
// Ability has back to background
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onBackground
'
);
}
}
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/ets/pages/Index.ets
0 → 100644
浏览文件 @
dadc99bd
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/module.json
0 → 100644
浏览文件 @
dadc99bd
{
"module"
:
{
"name"
:
"entry"
,
"type"
:
"entry"
,
"description"
:
"$string:module_desc"
,
"mainElement"
:
"EntryAbility"
,
"deviceTypes"
:
[
"default"
,
"tablet"
],
"deliveryWithInstall"
:
true
,
"installationFree"
:
false
,
"pages"
:
"$profile:main_pages"
,
"abilities"
:
[
{
"name"
:
"EntryAbility"
,
"srcEntrance"
:
"./ets/entryability/EntryAbility.ts"
,
"description"
:
"$string:EntryAbility_desc"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:EntryAbility_label"
,
"startWindowIcon"
:
"$media:icon"
,
"startWindowBackground"
:
"$color:start_window_background"
,
"visible"
:
true
,
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
]
}
]
}
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/resources/base/element/color.json
0 → 100644
浏览文件 @
dadc99bd
{
"color"
:
[
{
"name"
:
"start_window_background"
,
"value"
:
"#FFFFFF"
}
]
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
dadc99bd
{
"string"
:
[
{
"name"
:
"module_desc"
,
"value"
:
"module description"
},
{
"name"
:
"EntryAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
dadc99bd
6.6 KB
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/resources/base/profile/main_pages.json
0 → 100644
浏览文件 @
dadc99bd
{
"src"
:
[
"pages/Index"
]
}
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/resources/en_US/element/string.json
0 → 100644
浏览文件 @
dadc99bd
{
"string"
:
[
{
"name"
:
"module_desc"
,
"value"
:
"module description"
},
{
"name"
:
"EntryAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/resources/zh_CN/element/string.json
0 → 100644
浏览文件 @
dadc99bd
{
"string"
:
[
{
"name"
:
"module_desc"
,
"value"
:
"模块描述"
},
{
"name"
:
"EntryAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
dadc99bd
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录