Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
074a8805
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看板
提交
074a8805
编写于
7月 10, 2023
作者:
X
xinking129
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add format
Signed-off-by:
N
xinking129
<
xinxin13@huawei.com
>
上级
dadc99bd
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
278 addition
and
40 deletion
+278
-40
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeOneReply/entry/src/main/ets/entryability/EntryAbility.ts
...eOneReply/entry/src/main/ets/entryability/EntryAbility.ts
+32
-18
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeOneReply/entry/src/main/ets/pages/Index.ets
...ionStateChangeOneReply/entry/src/main/ets/pages/Index.ets
+14
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/entryability/EntryAbility.ts
...hreeReply/entry/src/main/ets/entryability/EntryAbility.ts
+22
-8
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/entryability1/EntryAbility1.ts
...eeReply/entry/src/main/ets/entryability1/EntryAbility1.ts
+15
-1
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/pages/Index.ets
...nStateChangeThreeReply/entry/src/main/ets/pages/Index.ets
+14
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/pages/Index1.ets
...StateChangeThreeReply/entry/src/main/ets/pages/Index1.ets
+14
-0
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeTwoReply/entry/src/main/ets/entryability/EntryAbility.ts
...eTwoReply/entry/src/main/ets/entryability/EntryAbility.ts
+17
-3
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeTwoReply/entry/src/main/ets/pages/Index.ets
...ionStateChangeTwoReply/entry/src/main/ets/pages/Index.ets
+14
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationOneReply/entry/src/main/ets/entryability/EntryAbility.ts
...nOneReply/entry/src/main/ets/entryability/EntryAbility.ts
+24
-10
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationOneReply/entry/src/main/ets/pages/Index.ets
...essInformationOneReply/entry/src/main/ets/pages/Index.ets
+14
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+14
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/entry/src/main/ets/test/Ability.test.ets
...sInformationTest/entry/src/main/ets/test/Ability.test.ets
+14
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/entry/src/main/ets/test/List.test.ets
...cessInformationTest/entry/src/main/ets/test/List.test.ets
+14
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/entry/src/main/ets/testability/TestAbility.ets
...mationTest/entry/src/main/ets/testability/TestAbility.ets
+14
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/entry/src/main/ets/testability/pages/Index.ets
...mationTest/entry/src/main/ets/testability/pages/Index.ets
+14
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/ets/entryability/EntryAbility.ts
...nTwoReply/entry/src/main/ets/entryability/EntryAbility.ts
+14
-0
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/ets/pages/Index.ets
...essInformationTwoReply/entry/src/main/ets/pages/Index.ets
+14
-0
未找到文件。
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeOneReply/entry/src/main/ets/entryability/EntryAbility.ts
浏览文件 @
074a8805
/*
* 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
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Window
from
'
@ohos.window
'
import
Window
from
'
@ohos.window
'
import
commonEvent
from
'
@ohos.commonEvent
'
;
import
commonEvent
from
'
@ohos.commonEvent
'
;
let
commonStateArr
:
number
[]
=
[
-
1
,
-
1
,
-
1
,
-
1
]
let
commonStateArr
:
number
[]
=
[
-
1
,
-
1
,
-
1
,
-
1
]
let
commonEventData
=
{
let
commonEventData
=
{
parameters
:{
parameters
:
{
commonStateArr
:
commonStateArr
commonStateArr
:
commonStateArr
}
}
}
}
...
@@ -12,19 +26,19 @@ let onForeGroundTAG = -1
...
@@ -12,19 +26,19 @@ let onForeGroundTAG = -1
let
TAG
=
'
StateChangeTestTAG
'
let
TAG
=
'
StateChangeTestTAG
'
let
ApplicationStateChangeCallbackFir
=
{
let
ApplicationStateChangeCallbackFir
=
{
onApplicationForeground
()
{
onApplicationForeground
()
{
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackFir onApplicationForeground
'
)
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackFir onApplicationForeground
'
)
commonEventData
.
parameters
.
commonStateArr
[
0
]
=
1
commonEventData
.
parameters
.
commonStateArr
[
0
]
=
1
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
Enter onApplicationForeground publish!
'
)
console
.
info
(
'
Enter onApplicationForeground publish!
'
)
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
})
})
},
1000
)
},
1000
)
},
},
onApplicationBackground
()
{
onApplicationBackground
()
{
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackFir onApplicationBackground
'
)
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackFir onApplicationBackground
'
)
commonEventData
.
parameters
.
commonStateArr
[
1
]
=
1
commonEventData
.
parameters
.
commonStateArr
[
1
]
=
1
if
(
globalThis
.
want
.
action
==
'
NeedBackGroundOff
'
||
globalThis
.
want
.
action
==
'
MultiAppRegister
'
if
(
globalThis
.
want
.
action
==
'
NeedBackGroundOff
'
||
globalThis
.
want
.
action
==
'
MultiAppRegister
'
...
@@ -37,22 +51,22 @@ let ApplicationStateChangeCallbackFir = {
...
@@ -37,22 +51,22 @@ let ApplicationStateChangeCallbackFir = {
let
ApplicationStateChangeCallbackSec
=
{
let
ApplicationStateChangeCallbackSec
=
{
onApplicationForeground
()
{
onApplicationForeground
()
{
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackSec onApplicationForeground
'
)
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackSec onApplicationForeground
'
)
commonEventData
.
parameters
.
commonStateArr
[
2
]
=
1
commonEventData
.
parameters
.
commonStateArr
[
2
]
=
1
},
},
onApplicationBackground
()
{
onApplicationBackground
()
{
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackSec onApplicationBackground
'
)
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackSec onApplicationBackground
'
)
commonEventData
.
parameters
.
commonStateArr
[
3
]
=
1
commonEventData
.
parameters
.
commonStateArr
[
3
]
=
1
if
(
globalThis
.
want
.
action
==
'
doubleNeedBackGroundOff
'
)
{
if
(
globalThis
.
want
.
action
==
'
doubleNeedBackGroundOff
'
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
globalThis
.
applicationContext
.
off
(
'
applicationStateChange
'
,
ApplicationStateChangeCallbackSec
)
globalThis
.
applicationContext
.
off
(
'
applicationStateChange
'
,
ApplicationStateChangeCallbackSec
)
},
500
)
},
500
)
}
}
else
if
(
globalThis
.
want
.
action
==
'
DoubleRegisterOff
'
)
{
else
if
(
globalThis
.
want
.
action
==
'
DoubleRegisterOff
'
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
entered DoubleRegisterOff
'
)
console
.
info
(
'
entered DoubleRegisterOff
'
)
globalThis
.
applicationContext
.
off
(
'
applicationStateChange
'
)
globalThis
.
applicationContext
.
off
(
'
applicationStateChange
'
)
},
500
)
},
500
)
}
}
}
}
}
}
...
@@ -77,7 +91,7 @@ export default class EntryAbility extends Ability {
...
@@ -77,7 +91,7 @@ export default class EntryAbility extends Ability {
if
(
globalThis
.
want
.
action
==
'
doubleRegister
'
||
globalThis
.
want
.
action
==
'
doubleNeedBackGroundOff
'
if
(
globalThis
.
want
.
action
==
'
doubleRegister
'
||
globalThis
.
want
.
action
==
'
doubleNeedBackGroundOff
'
||
globalThis
.
want
.
action
==
'
DoubleRegisterOff
'
)
{
||
globalThis
.
want
.
action
==
'
DoubleRegisterOff
'
)
{
console
.
info
(
"
double in action is logic entered!
"
)
console
.
info
(
"
double in action is logic entered!
"
)
globalThis
.
applicationContext
.
on
(
'
applicationStateChange
'
,
ApplicationStateChangeCallbackSec
)
globalThis
.
applicationContext
.
on
(
'
applicationStateChange
'
,
ApplicationStateChangeCallbackSec
)
}
}
}
}
...
@@ -114,13 +128,13 @@ export default class EntryAbility extends Ability {
...
@@ -114,13 +128,13 @@ export default class EntryAbility extends Ability {
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Abilityone onForeground
'
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Abilityone onForeground
'
);
onForeGroundTAG
+=
1
onForeGroundTAG
+=
1
if
(
onForeGroundTAG
==
1
&&
(
globalThis
.
want
.
action
==
'
NeedBackGroundOff
'
||
globalThis
.
want
.
action
==
'
MultiAppRegister
'
if
(
onForeGroundTAG
==
1
&&
(
globalThis
.
want
.
action
==
'
NeedBackGroundOff
'
||
globalThis
.
want
.
action
==
'
MultiAppRegister
'
||
globalThis
.
want
.
action
==
'
DoubleRegisterOff
'
))
{
||
globalThis
.
want
.
action
==
'
DoubleRegisterOff
'
))
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
})
})
},
2000
)
},
2000
)
}
}
}
}
...
...
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeOneReply/entry/src/main/ets/pages/Index.ets
浏览文件 @
074a8805
/*
* 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.
*/
@Entry
@Entry
@Component
@Component
struct Index {
struct Index {
...
...
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/entryability/EntryAbility.ts
浏览文件 @
074a8805
/*
* 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
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Window
from
'
@ohos.window
'
import
Window
from
'
@ohos.window
'
...
@@ -7,23 +21,23 @@ import commonEvent from '@ohos.commonEvent'
...
@@ -7,23 +21,23 @@ import commonEvent from '@ohos.commonEvent'
let
TAG
=
'
getRunningProcess
'
let
TAG
=
'
getRunningProcess
'
let
commonStateArr
let
commonStateArr
let
commonEventData
=
{
let
commonEventData
=
{
parameters
:{
parameters
:
{
commonStateArr
:
commonStateArr
commonStateArr
:
commonStateArr
}
}
}
}
let
ApplicationStateChangeCallbackFir
=
{
let
ApplicationStateChangeCallbackFir
=
{
onApplicationForeground
()
{
onApplicationForeground
()
{
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackFir onApplicationForeground
'
)
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackFir onApplicationForeground
'
)
},
},
onApplicationBackground
()
{
onApplicationBackground
()
{
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackFir onApplicationBackground
'
)
console
.
log
(
TAG
,
'
ApplicationStateChangeCallbackFir onApplicationBackground
'
)
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
info
(
'
Enter onApplicationForeground publish!
'
)
console
.
info
(
'
Enter onApplicationForeground publish!
'
)
commonEventData
.
parameters
.
commonStateArr
=
1
commonEventData
.
parameters
.
commonStateArr
=
1
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
})
})
},
1000
)
},
1000
)
}
}
}
}
let
ForegroundTAG
=
-
1
let
ForegroundTAG
=
-
1
...
@@ -72,12 +86,12 @@ export default class EntryAbility extends Ability {
...
@@ -72,12 +86,12 @@ export default class EntryAbility extends Ability {
onForeground
()
{
onForeground
()
{
// Ability has brought to foreground
// Ability has brought to foreground
ForegroundTAG
++
ForegroundTAG
++
if
(
ForegroundTAG
==
1
)
{
if
(
ForegroundTAG
==
1
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
})
})
},
3000
)
},
3000
)
}
}
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
...
...
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/entryability1/EntryAbility1.ts
浏览文件 @
074a8805
/*
* 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
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Window
from
'
@ohos.window
'
import
Window
from
'
@ohos.window
'
...
@@ -48,7 +62,7 @@ export default class EntryAbility1 extends Ability {
...
@@ -48,7 +62,7 @@ export default class EntryAbility1 extends Ability {
globalThis
.
abilityContext2
.
terminateSelf
((
err
)
=>
{
globalThis
.
abilityContext2
.
terminateSelf
((
err
)
=>
{
console
.
log
(
'
terminateSelf result:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
terminateSelf result:
'
+
JSON
.
stringify
(
err
));
})
})
},
3000
)
},
3000
)
}
}
onBackground
()
{
onBackground
()
{
...
...
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/pages/Index.ets
浏览文件 @
074a8805
/*
* 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.
*/
@Entry
@Entry
@Component
@Component
struct Index {
struct Index {
...
...
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeThreeReply/entry/src/main/ets/pages/Index1.ets
浏览文件 @
074a8805
/*
* 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.
*/
@Entry
@Entry
@Component
@Component
struct Index1 {
struct Index1 {
...
...
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeTwoReply/entry/src/main/ets/entryability/EntryAbility.ts
浏览文件 @
074a8805
/*
* 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
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Window
from
'
@ohos.window
'
import
Window
from
'
@ohos.window
'
...
@@ -6,11 +20,11 @@ let TAG = 'StateChangeTestTAG'
...
@@ -6,11 +20,11 @@ let TAG = 'StateChangeTestTAG'
let
ApplicationStateChangeCallbackSec
=
{
let
ApplicationStateChangeCallbackSec
=
{
onApplicationForeground
()
{
onApplicationForeground
()
{
console
.
info
(
'
==== ApplicationStateChange Foreground ====
'
);
console
.
info
(
'
==== ApplicationStateChange Foreground ====
'
);
console
.
log
(
TAG
,
'
App2 ApplicationStateChangeCallbackSec onApplicationForeground
'
)
console
.
log
(
TAG
,
'
App2 ApplicationStateChangeCallbackSec onApplicationForeground
'
)
},
},
onApplicationBackground
()
{
onApplicationBackground
()
{
console
.
info
(
'
==== ApplicationStateChange Background ====
'
);
console
.
info
(
'
==== ApplicationStateChange Background ====
'
);
console
.
log
(
TAG
,
'
App2 ApplicationStateChangeCallbackSec onApplicationBackground
'
)
console
.
log
(
TAG
,
'
App2 ApplicationStateChangeCallbackSec onApplicationBackground
'
)
}
}
}
}
export
default
class
EntryAbility
extends
Ability
{
export
default
class
EntryAbility
extends
Ability
{
...
@@ -63,7 +77,7 @@ export default class EntryAbility extends Ability {
...
@@ -63,7 +77,7 @@ export default class EntryAbility extends Ability {
globalThis
.
abilityContext
.
terminateSelf
((
err
)
=>
{
globalThis
.
abilityContext
.
terminateSelf
((
err
)
=>
{
console
.
log
(
'
terminateSelf result:
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
terminateSelf result:
'
+
JSON
.
stringify
(
err
));
})
})
},
3000
)
},
3000
)
}
}
onBackground
()
{
onBackground
()
{
...
...
ability/ability_runtime/getrunningprocessinformation/ApplicationStateChangeTwoReply/entry/src/main/ets/pages/Index.ets
浏览文件 @
074a8805
/*
* 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.
*/
@Entry
@Entry
@Component
@Component
struct Index {
struct Index {
...
...
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationOneReply/entry/src/main/ets/entryability/EntryAbility.ts
浏览文件 @
074a8805
/*
* 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
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Window
from
'
@ohos.window
'
import
Window
from
'
@ohos.window
'
...
@@ -6,9 +20,9 @@ import AbilityConstant from '@ohos.app.ability.AbilityConstant'
...
@@ -6,9 +20,9 @@ import AbilityConstant from '@ohos.app.ability.AbilityConstant'
let
sequence
=
0
;
let
sequence
=
0
;
let
TAG
=
'
GetRunningProcessInformation
'
let
TAG
=
'
GetRunningProcessInformation
'
let
commonStateArr
:
number
[]
=
[
-
1
,
-
1
,
-
1
,
-
1
]
let
commonStateArr
:
number
[]
=
[
-
1
,
-
1
,
-
1
,
-
1
]
let
commonEventData
=
{
let
commonEventData
=
{
parameters
:{
parameters
:
{
commonStateArr
:
commonStateArr
commonStateArr
:
commonStateArr
}
}
}
}
...
@@ -22,7 +36,7 @@ globalThis.StartFloatingAbility = () => {
...
@@ -22,7 +36,7 @@ globalThis.StartFloatingAbility = () => {
windowMode
:
AbilityConstant
.
WindowMode
.
WINDOW_MODE_FLOATING
,
windowMode
:
AbilityConstant
.
WindowMode
.
WINDOW_MODE_FLOATING
,
};
};
globalThis
.
abilityContext
.
startAbility
(
want
,
options
,
(
error
)
=>
{
globalThis
.
abilityContext
.
startAbility
(
want
,
options
,
(
error
)
=>
{
console
.
log
(
TAG
,
"
start floating ability error.code =
"
+
error
.
code
)
console
.
log
(
TAG
,
"
start floating ability error.code =
"
+
error
.
code
)
})
})
}
}
...
@@ -38,12 +52,12 @@ globalThis.StartNormalAbility = () => {
...
@@ -38,12 +52,12 @@ globalThis.StartNormalAbility = () => {
}
}
globalThis
.
GetRunningProcessInfoCallback
=
()
=>
{
globalThis
.
GetRunningProcessInfoCallback
=
()
=>
{
globalThis
.
applicationContext
.
getRunningProcessInformation
((
err
,
data
)
=>
{
globalThis
.
applicationContext
.
getRunningProcessInformation
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
}
}
else
{
else
{
console
.
log
(
TAG
,
'
Oncreate Callback State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
console
.
log
(
TAG
,
'
Oncreate Callback State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
sequence
++
]
=
data
[
0
].
state
commonStateArr
[
sequence
++
]
=
data
[
0
].
state
}
}
})
})
...
@@ -51,15 +65,15 @@ globalThis.GetRunningProcessInfoCallback = () => {
...
@@ -51,15 +65,15 @@ globalThis.GetRunningProcessInfoCallback = () => {
globalThis
.
GetRunningProcessInfoPromise
=
()
=>
{
globalThis
.
GetRunningProcessInfoPromise
=
()
=>
{
globalThis
.
applicationContext
.
getRunningProcessInformation
().
then
((
data
)
=>
{
globalThis
.
applicationContext
.
getRunningProcessInformation
().
then
((
data
)
=>
{
console
.
log
(
TAG
,
'
Oncreate Promise State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
console
.
log
(
TAG
,
'
Oncreate Promise State:
'
+
JSON
.
stringify
(
data
[
0
].
state
));
commonStateArr
[
sequence
++
]
=
data
[
0
].
state
commonStateArr
[
sequence
++
]
=
data
[
0
].
state
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
console
.
log
(
TAG
,
`getRunningProcessInformation err: `
+
JSON
.
stringify
(
err
));
});
});
}
}
globalThis
.
PublishStateArray
=
()
=>
{
globalThis
.
PublishStateArray
=
()
=>
{
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
commonEvent
.
publish
(
'
processState
'
,
commonEventData
,
(
err
)
=>
{
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
console
.
info
(
"
====>processState publish err:
"
+
JSON
.
stringify
(
err
))
})
})
}
}
...
...
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationOneReply/entry/src/main/ets/pages/Index.ets
浏览文件 @
074a8805
/*
* 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.
*/
@Entry
@Entry
@Component
@Component
struct Index {
struct Index {
...
...
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
浏览文件 @
074a8805
/*
* 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
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
TestRunner
from
'
@ohos.application.testRunner
'
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
...
...
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
074a8805
/*
* 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 hilog from '@ohos.hilog'
import hilog from '@ohos.hilog'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import { Component, Driver, UiWindow, ON, UiDriver } from '@ohos.UiTest'
import { Component, Driver, UiWindow, ON, UiDriver } from '@ohos.UiTest'
...
...
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/entry/src/main/ets/test/List.test.ets
浏览文件 @
074a8805
/*
* 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 abilityTest from './Ability.test'
import abilityTest from './Ability.test'
export default function testsuite() {
export default function testsuite() {
...
...
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/entry/src/main/ets/testability/TestAbility.ets
浏览文件 @
074a8805
/*
* 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 hilog from '@ohos.hilog';
import hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility'
import Ability from '@ohos.app.ability.UIAbility'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
...
...
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTest/entry/src/main/ets/testability/pages/Index.ets
浏览文件 @
074a8805
/*
* 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 hilog from '@ohos.hilog';
import hilog from '@ohos.hilog';
@Entry
@Entry
...
...
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/ets/entryability/EntryAbility.ts
浏览文件 @
074a8805
/*
* 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
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Window
from
'
@ohos.window
'
import
Window
from
'
@ohos.window
'
...
...
ability/ability_runtime/getrunningprocessinformation/GetRunningProcessInformationTwoReply/entry/src/main/ets/pages/Index.ets
浏览文件 @
074a8805
/*
* 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.
*/
@Entry
@Entry
@Component
@Component
struct Index {
struct Index {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录