Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
536e4ba0
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看板
未验证
提交
536e4ba0
编写于
6月 01, 2023
作者:
O
openharmony_ci
提交者:
Gitee
6月 01, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8829 修复uri临时授权xts
Merge pull request !8829 from 于文泽/master
上级
573ab70d
15cb1c64
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
162 addition
and
153 deletion
+162
-153
ability/ability_runtime/stage/actsuripermission/actsassistanthap/entry/src/main/ets/Hap2MainAbility4/Hap2MainAbility4.ts
...p/entry/src/main/ets/Hap2MainAbility4/Hap2MainAbility4.ts
+84
-80
ability/ability_runtime/stage/actsuripermission/actsassistanthap2/entry/src/main/ets/Hap3MainAbility1/Hap3MainAbility1.ts
...2/entry/src/main/ets/Hap3MainAbility1/Hap3MainAbility1.ts
+78
-73
未找到文件。
ability/ability_runtime/stage/actsuripermission/actsassistanthap/entry/src/main/ets/Hap2MainAbility4/Hap2MainAbility4.ts
浏览文件 @
536e4ba0
...
@@ -15,6 +15,9 @@
...
@@ -15,6 +15,9 @@
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
commonEvent
from
'
@ohos.commonEvent
'
;
import
commonEvent
from
'
@ohos.commonEvent
'
;
function
sleep
(
time
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
time
))
}
export
default
class
Hap2MainAbility4
extends
Ability
{
export
default
class
Hap2MainAbility4
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
[Demo] Hap2MainAbility4 onCreate
'
)
console
.
log
(
'
[Demo] Hap2MainAbility4 onCreate
'
)
...
@@ -75,9 +78,10 @@ export default class Hap2MainAbility4 extends Ability {
...
@@ -75,9 +78,10 @@ export default class Hap2MainAbility4 extends Ability {
let
eventName6
:
string
=
'
Temp_UriPermissionTest_0300_Read_Successfully_
'
;
let
eventName6
:
string
=
'
Temp_UriPermissionTest_0300_Read_Successfully_
'
;
let
eventName7
:
string
=
'
Temp_UriPermissionTest_0300_Read_Failed_
'
;
let
eventName7
:
string
=
'
Temp_UriPermissionTest_0300_Read_Failed_
'
;
function
SubscribeCallBackContext
(
err
,
data
)
{
async
function
SubscribeCallBackContext
(
err
,
data
)
{
console
.
log
(
'
Subscribe CallBack data:
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
Subscribe CallBack data:
'
+
JSON
.
stringify
(
data
));
if
(
data
.
event
===
eventName5
)
{
if
(
data
.
event
===
eventName5
)
{
await
sleep
(
1000
);
globalThis
.
fs
.
open
(
uri
,
globalThis
.
fs
.
OpenMode
.
READ_ONLY
).
then
((
file
)
=>
{
globalThis
.
fs
.
open
(
uri
,
globalThis
.
fs
.
OpenMode
.
READ_ONLY
).
then
((
file
)
=>
{
console
.
info
(
'
file fd:
'
+
file
.
fd
);
console
.
info
(
'
file fd:
'
+
file
.
fd
);
commonEvent
.
publish
(
eventName6
,
(
err
)
=>
{
commonEvent
.
publish
(
eventName6
,
(
err
)
=>
{
...
...
ability/ability_runtime/stage/actsuripermission/actsassistanthap2/entry/src/main/ets/Hap3MainAbility1/Hap3MainAbility1.ts
浏览文件 @
536e4ba0
...
@@ -17,6 +17,10 @@ import Ability from '@ohos.app.ability.UIAbility'
...
@@ -17,6 +17,10 @@ import Ability from '@ohos.app.ability.UIAbility'
import
commonEvent
from
'
@ohos.commonEvent
'
;
import
commonEvent
from
'
@ohos.commonEvent
'
;
import
fs
from
'
@ohos.file.fs
'
import
fs
from
'
@ohos.file.fs
'
function
sleep
(
time
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
time
))
}
export
default
class
Hap3MainAbility1
extends
Ability
{
export
default
class
Hap3MainAbility1
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
[Demo] Hap3MainAbility1 onCreate
'
)
console
.
log
(
'
[Demo] Hap3MainAbility1 onCreate
'
)
...
@@ -47,9 +51,10 @@ export default class Hap3MainAbility1 extends Ability {
...
@@ -47,9 +51,10 @@ export default class Hap3MainAbility1 extends Ability {
console
.
info
(
"
Hap2MainAbility1 ===UnSubscribeInfoCallback_1===
"
)
console
.
info
(
"
Hap2MainAbility1 ===UnSubscribeInfoCallback_1===
"
)
}
}
function
SubscribeCallBackContext
(
err
,
data
)
{
async
function
SubscribeCallBackContext
(
err
,
data
)
{
console
.
log
(
'
Hap3MainAbility1 Subscribe CallBack data:
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
Hap3MainAbility1 Subscribe CallBack data:
'
+
JSON
.
stringify
(
data
));
if
(
data
.
event
===
eventName
)
{
if
(
data
.
event
===
eventName
)
{
await
sleep
(
1000
);
let
uri
:
string
=
globalThis
.
abilityWant
.
uri
;
let
uri
:
string
=
globalThis
.
abilityWant
.
uri
;
if
(
uri
==
null
)
{
if
(
uri
==
null
)
{
console
.
log
(
'
[Demo] Hap3MainAbility1 uri is invalid
'
);
console
.
log
(
'
[Demo] Hap3MainAbility1 uri is invalid
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录