Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
d9158b84
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d9158b84
编写于
8月 29, 2023
作者:
J
junyi233
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
明确错误码类型
Signed-off-by:
N
junyi233
<
zhengjun29@huawei.com
>
上级
6d1c3021
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
356 addition
and
132 deletion
+356
-132
zh-cn/application-dev/reference/apis/js-apis-bundleManager.md
...n/application-dev/reference/apis/js-apis-bundleManager.md
+284
-116
zh-cn/application-dev/reference/apis/js-apis-overlay.md
zh-cn/application-dev/reference/apis/js-apis-overlay.md
+72
-16
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-bundleManager.md
浏览文件 @
d9158b84
...
@@ -250,16 +250,18 @@ getBundleInfoForSelf(bundleFlags: [number](#bundleflag)): Promise\<[BundleInfo](
...
@@ -250,16 +250,18 @@ getBundleInfoForSelf(bundleFlags: [number](#bundleflag)): Promise\<[BundleInfo](
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
try
{
try
{
bundleManager
.
getBundleInfoForSelf
(
bundleFlags
).
then
((
data
)
=>
{
bundleManager
.
getBundleInfoForSelf
(
bundleFlags
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleInfoForSelf successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleInfoForSelf successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfoForSelf failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfoForSelf failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfoForSelf failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfoForSelf failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -282,6 +284,7 @@ getBundleInfoForSelf(bundleFlags: [number](#bundleflag), callback: AsyncCallback
...
@@ -282,6 +284,7 @@ getBundleInfoForSelf(bundleFlags: [number](#bundleflag), callback: AsyncCallback
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
...
@@ -294,7 +297,8 @@ try {
...
@@ -294,7 +297,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfoForSelf failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfoForSelf failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -336,6 +340,7 @@ getBundleInfo(bundleName: string, bundleFlags: number, userId: number, callback:
...
@@ -336,6 +340,7 @@ getBundleInfo(bundleName: string, bundleFlags: number, userId: number, callback:
```
ts
```
ts
// 额外获取AbilityInfo
// 额外获取AbilityInfo
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_HAP_MODULE
|
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_ABILITY
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_HAP_MODULE
|
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_ABILITY
;
...
@@ -350,13 +355,15 @@ try {
...
@@ -350,13 +355,15 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfo failed: %{public}s
'
,
message
);
}
}
```
```
```
ts
```
ts
// 额外获取ApplicationInfo中的metadata
// 额外获取ApplicationInfo中的metadata
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_APPLICATION
|
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_METADATA
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_APPLICATION
|
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_METADATA
;
...
@@ -371,7 +378,8 @@ try {
...
@@ -371,7 +378,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -411,6 +419,7 @@ getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<
...
@@ -411,6 +419,7 @@ getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<
```
ts
```
ts
// 额外获取extensionAbility
// 额外获取extensionAbility
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_HAP_MODULE
|
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_HAP_MODULE
|
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY
;
...
@@ -424,7 +433,8 @@ try {
...
@@ -424,7 +433,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -471,6 +481,7 @@ getBundleInfo(bundleName: string, bundleFlags: [number](#bundleflag), userId?: n
...
@@ -471,6 +481,7 @@ getBundleInfo(bundleName: string, bundleFlags: [number](#bundleflag), userId?: n
```
ts
```
ts
// 额外获取ApplicationInfo和SignatureInfo
// 额外获取ApplicationInfo和SignatureInfo
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_APPLICATION
|
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_SIGNATURE_INFO
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_APPLICATION
|
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_SIGNATURE_INFO
;
...
@@ -479,16 +490,18 @@ let userId = 100;
...
@@ -479,16 +490,18 @@ let userId = 100;
try
{
try
{
bundleManager
.
getBundleInfo
(
bundleName
,
bundleFlags
,
userId
).
then
((
data
)
=>
{
bundleManager
.
getBundleInfo
(
bundleName
,
bundleFlags
,
userId
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
...
@@ -496,11 +509,12 @@ let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT;
...
@@ -496,11 +509,12 @@ let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT;
try
{
try
{
bundleManager
.
getBundleInfo
(
bundleName
,
bundleFlags
).
then
((
data
)
=>
{
bundleManager
.
getBundleInfo
(
bundleName
,
bundleFlags
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -542,6 +556,7 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), use
...
@@ -542,6 +556,7 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), use
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
appFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_DEFAULT
;
let
appFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_DEFAULT
;
...
@@ -556,7 +571,8 @@ try {
...
@@ -556,7 +571,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getApplicationInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getApplicationInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -595,6 +611,7 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), cal
...
@@ -595,6 +611,7 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), cal
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
appFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
;
let
appFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
;
...
@@ -608,7 +625,8 @@ try {
...
@@ -608,7 +625,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getApplicationInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getApplicationInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -654,6 +672,7 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), use
...
@@ -654,6 +672,7 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), use
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
appFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
;
let
appFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
;
...
@@ -662,11 +681,12 @@ let userId = 100;
...
@@ -662,11 +681,12 @@ let userId = 100;
try
{
try
{
bundleManager
.
getApplicationInfo
(
bundleName
,
appFlags
,
userId
).
then
((
data
)
=>
{
bundleManager
.
getApplicationInfo
(
bundleName
,
appFlags
,
userId
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getApplicationInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getApplicationInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getApplicationInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getApplicationInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getApplicationInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getApplicationInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -702,6 +722,7 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), userId: number, callback: A
...
@@ -702,6 +722,7 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), userId: number, callback: A
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -715,7 +736,8 @@ try {
...
@@ -715,7 +736,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllBundleInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllBundleInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -742,6 +764,7 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), callback: AsyncCallback<Arr
...
@@ -742,6 +764,7 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), callback: AsyncCallback<Arr
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
...
@@ -754,7 +777,8 @@ try {
...
@@ -754,7 +777,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllBundleInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllBundleInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -795,17 +819,19 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), userId?: number): Promise<A
...
@@ -795,17 +819,19 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), userId?: number): Promise<A
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
try
{
try
{
bundleManager
.
getAllBundleInfo
(
bundleFlags
).
then
((
data
)
=>
{
bundleManager
.
getAllBundleInfo
(
bundleFlags
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAllBundleInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAllBundleInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllBundleInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -841,6 +867,7 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), userId: number, call
...
@@ -841,6 +867,7 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), userId: number, call
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
appFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_DEFAULT
;
let
appFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_DEFAULT
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -854,7 +881,8 @@ try {
...
@@ -854,7 +881,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllApplicationInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllApplicationInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -881,6 +909,7 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), callback: AsyncCallb
...
@@ -881,6 +909,7 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), callback: AsyncCallb
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
appFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_DEFAULT
;
let
appFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_DEFAULT
;
...
@@ -893,7 +922,8 @@ try {
...
@@ -893,7 +922,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllApplicationInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllApplicationInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -934,17 +964,19 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), userId?: number): Pr
...
@@ -934,17 +964,19 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), userId?: number): Pr
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
appFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_DEFAULT
;
let
appFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_DEFAULT
;
try
{
try
{
bundleManager
.
getAllApplicationInfo
(
appFlags
).
then
((
data
)
=>
{
bundleManager
.
getAllApplicationInfo
(
appFlags
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAllApplicationInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAllApplicationInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllApplicationInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllApplicationInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllApplicationInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllApplicationInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -986,6 +1018,7 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), userId: numbe
...
@@ -986,6 +1018,7 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), userId: numbe
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -1003,7 +1036,8 @@ try {
...
@@ -1003,7 +1036,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1042,6 +1076,7 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), callback: Asy
...
@@ -1042,6 +1076,7 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), callback: Asy
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
want
=
{
let
want
=
{
...
@@ -1058,7 +1093,8 @@ try {
...
@@ -1058,7 +1093,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1104,6 +1140,7 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), userId?: numb
...
@@ -1104,6 +1140,7 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), userId?: numb
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -1115,16 +1152,18 @@ let want = {
...
@@ -1115,16 +1152,18 @@ let want = {
try
{
try
{
bundleManager
.
queryAbilityInfo
(
want
,
abilityFlags
,
userId
).
then
((
data
)
=>
{
bundleManager
.
queryAbilityInfo
(
want
,
abilityFlags
,
userId
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
want
=
{
let
want
=
{
...
@@ -1135,11 +1174,12 @@ let want = {
...
@@ -1135,11 +1174,12 @@ let want = {
try
{
try
{
bundleManager
.
queryAbilityInfo
(
want
,
abilityFlags
).
then
((
data
)
=>
{
bundleManager
.
queryAbilityInfo
(
want
,
abilityFlags
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
})
})
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1185,6 +1225,7 @@ queryAbilityInfoSync(want: Want, abilityFlags: [number](#abilityflag), userId?:
...
@@ -1185,6 +1225,7 @@ queryAbilityInfoSync(want: Want, abilityFlags: [number](#abilityflag), userId?:
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -1198,12 +1239,14 @@ try {
...
@@ -1198,12 +1239,14 @@ try {
let
infos
=
bundleManager
.
queryAbilityInfoSync
(
want
,
abilityFlags
,
userId
);
let
infos
=
bundleManager
.
queryAbilityInfoSync
(
want
,
abilityFlags
,
userId
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfoSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
infos
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfoSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
infos
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfoSync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfoSync failed. Cause: %{public}s
'
,
message
);
}
}
```
```
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
want
=
{
let
want
=
{
...
@@ -1215,7 +1258,8 @@ try {
...
@@ -1215,7 +1258,8 @@ try {
let
infos
=
bundleManager
.
queryAbilityInfoSync
(
want
,
abilityFlags
);
let
infos
=
bundleManager
.
queryAbilityInfoSync
(
want
,
abilityFlags
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfoSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
infos
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfoSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
infos
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfoSync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfoSync failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1256,6 +1300,7 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp
...
@@ -1256,6 +1300,7 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionFlags
=
bundleManager
.
ExtensionAbilityFlag
.
GET_EXTENSION_ABILITY_INFO_DEFAULT
;
let
extensionFlags
=
bundleManager
.
ExtensionAbilityFlag
.
GET_EXTENSION_ABILITY_INFO_DEFAULT
;
...
@@ -1274,7 +1319,8 @@ try {
...
@@ -1274,7 +1319,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1313,6 +1359,7 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp
...
@@ -1313,6 +1359,7 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionFlags
=
bundleManager
.
ExtensionAbilityFlag
.
GET_EXTENSION_ABILITY_INFO_DEFAULT
;
let
extensionFlags
=
bundleManager
.
ExtensionAbilityFlag
.
GET_EXTENSION_ABILITY_INFO_DEFAULT
;
...
@@ -1330,7 +1377,8 @@ try {
...
@@ -1330,7 +1377,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1376,6 +1424,7 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp
...
@@ -1376,6 +1424,7 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
...
@@ -1389,16 +1438,18 @@ let want = {
...
@@ -1389,16 +1438,18 @@ let want = {
try
{
try
{
bundleManager
.
queryExtensionAbilityInfo
(
want
,
extensionAbilityType
,
extensionFlags
,
userId
).
then
((
data
)
=>
{
bundleManager
.
queryExtensionAbilityInfo
(
want
,
extensionAbilityType
,
extensionFlags
,
userId
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionFlags
=
bundleManager
.
ExtensionAbilityFlag
.
GET_EXTENSION_ABILITY_INFO_DEFAULT
;
let
extensionFlags
=
bundleManager
.
ExtensionAbilityFlag
.
GET_EXTENSION_ABILITY_INFO_DEFAULT
;
...
@@ -1410,11 +1461,12 @@ let want = {
...
@@ -1410,11 +1461,12 @@ let want = {
try
{
try
{
bundleManager
.
queryExtensionAbilityInfo
(
want
,
extensionAbilityType
,
extensionFlags
).
then
((
data
)
=>
{
bundleManager
.
queryExtensionAbilityInfo
(
want
,
extensionAbilityType
,
extensionFlags
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
})
})
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1460,6 +1512,7 @@ queryExtensionAbilityInfoSync(want: Want, extensionAbilityType: [ExtensionAbilit
...
@@ -1460,6 +1512,7 @@ queryExtensionAbilityInfoSync(want: Want, extensionAbilityType: [ExtensionAbilit
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
...
@@ -1474,12 +1527,14 @@ try {
...
@@ -1474,12 +1527,14 @@ try {
let
extenInfos
=
bundleManager
.
queryExtensionAbilityInfoSync
(
want
,
extensionAbilityType
,
extensionFlags
,
userId
);
let
extenInfos
=
bundleManager
.
queryExtensionAbilityInfoSync
(
want
,
extensionAbilityType
,
extensionFlags
,
userId
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfoSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
extenInfos
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfoSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
extenInfos
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfoSync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfoSync failed. Cause: %{public}s
'
,
message
);
}
}
```
```
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionFlags
=
bundleManager
.
ExtensionAbilityFlag
.
GET_EXTENSION_ABILITY_INFO_DEFAULT
;
let
extensionFlags
=
bundleManager
.
ExtensionAbilityFlag
.
GET_EXTENSION_ABILITY_INFO_DEFAULT
;
...
@@ -1492,7 +1547,8 @@ try {
...
@@ -1492,7 +1547,8 @@ try {
let
extenInfos
=
bundleManager
.
queryExtensionAbilityInfoSync
(
want
,
extensionAbilityType
,
extensionFlags
);
let
extenInfos
=
bundleManager
.
queryExtensionAbilityInfoSync
(
want
,
extensionAbilityType
,
extensionFlags
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfoSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
extenInfos
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfoSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
extenInfos
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfoSync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryExtensionAbilityInfoSync failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1527,6 +1583,7 @@ getBundleNameByUid(uid: number, callback: AsyncCallback\<string>): void;
...
@@ -1527,6 +1583,7 @@ getBundleNameByUid(uid: number, callback: AsyncCallback\<string>): void;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
uid
=
20010005
;
let
uid
=
20010005
;
try
{
try
{
...
@@ -1538,7 +1595,8 @@ try {
...
@@ -1538,7 +1595,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleNameByUid failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleNameByUid failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1578,16 +1636,18 @@ getBundleNameByUid(uid: number): Promise\<string>;
...
@@ -1578,16 +1636,18 @@ getBundleNameByUid(uid: number): Promise\<string>;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
uid
=
20010005
;
let
uid
=
20010005
;
try
{
try
{
bundleManager
.
getBundleNameByUid
(
uid
).
then
((
data
)
=>
{
bundleManager
.
getBundleNameByUid
(
uid
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleNameByUid successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleNameByUid successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleNameByUid failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleNameByUid failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleNameByUid failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleNameByUid failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1627,13 +1687,15 @@ getBundleNameByUidSync(uid: number): string;
...
@@ -1627,13 +1687,15 @@ getBundleNameByUidSync(uid: number): string;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
uid
=
20010005
;
let
uid
=
20010005
;
try
{
try
{
let
data
=
bundleManager
.
getBundleNameByUidSync
(
uid
);
let
data
=
bundleManager
.
getBundleNameByUidSync
(
uid
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleNameByUidSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleNameByUidSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleNameByUidSync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleNameByUidSync failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1669,6 +1731,7 @@ getBundleArchiveInfo(hapFilePath: string, bundleFlags: [number](#bundleflag), ca
...
@@ -1669,6 +1731,7 @@ getBundleArchiveInfo(hapFilePath: string, bundleFlags: [number](#bundleflag), ca
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
hapFilePath
=
"
/data/xxx/test.hap
"
;
let
hapFilePath
=
"
/data/xxx/test.hap
"
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
...
@@ -1682,7 +1745,8 @@ try {
...
@@ -1682,7 +1745,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleArchiveInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleArchiveInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1723,6 +1787,7 @@ getBundleArchiveInfo(hapFilePath: string, bundleFlags: [number](#bundleflag)):
...
@@ -1723,6 +1787,7 @@ getBundleArchiveInfo(hapFilePath: string, bundleFlags: [number](#bundleflag)):
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
hapFilePath
=
"
/data/xxx/test.hap
"
;
let
hapFilePath
=
"
/data/xxx/test.hap
"
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
...
@@ -1730,11 +1795,12 @@ let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT;
...
@@ -1730,11 +1795,12 @@ let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT;
try
{
try
{
bundleManager
.
getBundleArchiveInfo
(
hapFilePath
,
bundleFlags
).
then
((
data
)
=>
{
bundleManager
.
getBundleArchiveInfo
(
hapFilePath
,
bundleFlags
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleArchiveInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleArchiveInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleArchiveInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleArchiveInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleArchiveInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleArchiveInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1775,6 +1841,7 @@ getBundleArchiveInfoSync(hapFilePath: string, bundleFlags: number): BundleInfo;
...
@@ -1775,6 +1841,7 @@ getBundleArchiveInfoSync(hapFilePath: string, bundleFlags: number): BundleInfo;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
hapFilePath
=
"
/data/xxx/test.hap
"
;
let
hapFilePath
=
"
/data/xxx/test.hap
"
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_DEFAULT
;
...
@@ -1783,7 +1850,8 @@ try {
...
@@ -1783,7 +1850,8 @@ try {
let
data
=
bundleManager
.
getBundleArchiveInfoSync
(
hapFilePath
,
bundleFlags
)
let
data
=
bundleManager
.
getBundleArchiveInfoSync
(
hapFilePath
,
bundleFlags
)
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleArchiveInfoSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleArchiveInfoSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleArchiveInfoSync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleArchiveInfoSync failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1819,6 +1887,7 @@ cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback\<void>): void;
...
@@ -1819,6 +1887,7 @@ cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback\<void>): void;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
"
com.ohos.myapplication
"
;
let
bundleName
=
"
com.ohos.myapplication
"
;
...
@@ -1831,7 +1900,8 @@ try {
...
@@ -1831,7 +1900,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
cleanBundleCacheFiles failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
cleanBundleCacheFiles failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1872,17 +1942,19 @@ cleanBundleCacheFiles(bundleName: string): Promise\<void>;
...
@@ -1872,17 +1942,19 @@ cleanBundleCacheFiles(bundleName: string): Promise\<void>;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
"
com.ohos.myapplication
"
;
let
bundleName
=
"
com.ohos.myapplication
"
;
try
{
try
{
bundleManager
.
cleanBundleCacheFiles
(
bundleName
).
then
(()
=>
{
bundleManager
.
cleanBundleCacheFiles
(
bundleName
).
then
(()
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
cleanBundleCacheFiles successfully.
'
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
cleanBundleCacheFiles successfully.
'
);
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
cleanBundleCacheFiles failed: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
cleanBundleCacheFiles failed: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
cleanBundleCacheFiles failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
cleanBundleCacheFiles failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1918,6 +1990,7 @@ setApplicationEnabled(bundleName: string, isEnabled: boolean, callback: AsyncCal
...
@@ -1918,6 +1990,7 @@ setApplicationEnabled(bundleName: string, isEnabled: boolean, callback: AsyncCal
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
"
com.ohos.myapplication
"
;
let
bundleName
=
"
com.ohos.myapplication
"
;
...
@@ -1930,7 +2003,8 @@ try {
...
@@ -1930,7 +2003,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
setApplicationEnabled failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
setApplicationEnabled failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -1971,17 +2045,19 @@ setApplicationEnabled(bundleName: string, isEnabled: boolean): Promise\<void>;
...
@@ -1971,17 +2045,19 @@ setApplicationEnabled(bundleName: string, isEnabled: boolean): Promise\<void>;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
"
com.ohos.myapplication
"
;
let
bundleName
=
"
com.ohos.myapplication
"
;
try
{
try
{
bundleManager
.
setApplicationEnabled
(
bundleName
,
false
).
then
(()
=>
{
bundleManager
.
setApplicationEnabled
(
bundleName
,
false
).
then
(()
=>
{
hilog
.
info
(
0x0000
,
"
testTag
"
,
"
setApplicationEnabled successfully.
"
);
hilog
.
info
(
0x0000
,
"
testTag
"
,
"
setApplicationEnabled successfully.
"
);
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
setApplicationEnabled failed: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
setApplicationEnabled failed: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
setApplicationEnabled failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
setApplicationEnabled failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2016,6 +2092,7 @@ setApplicationEnabledSync(bundleName: string, isEnabled: boolean): void;
...
@@ -2016,6 +2092,7 @@ setApplicationEnabledSync(bundleName: string, isEnabled: boolean): void;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
"
com.ohos.myapplication
"
;
let
bundleName
=
"
com.ohos.myapplication
"
;
...
@@ -2023,7 +2100,8 @@ try {
...
@@ -2023,7 +2100,8 @@ try {
bundleManager
.
setApplicationEnabledSync
(
bundleName
,
false
);
bundleManager
.
setApplicationEnabledSync
(
bundleName
,
false
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
setApplicationEnabledSync successfully.
'
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
setApplicationEnabledSync successfully.
'
);
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
setApplicationEnabledSync failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
setApplicationEnabledSync failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2060,6 +2138,7 @@ setAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), isE
...
@@ -2060,6 +2138,7 @@ setAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), isE
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -2081,11 +2160,12 @@ try {
...
@@ -2081,11 +2160,12 @@ try {
hilog
.
info
(
0x0000
,
"
testTag
"
,
"
setAbilityEnabled successfully.
"
);
hilog
.
info
(
0x0000
,
"
testTag
"
,
"
setAbilityEnabled successfully.
"
);
}
}
});
});
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2127,6 +2207,7 @@ setAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), isE
...
@@ -2127,6 +2207,7 @@ setAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), isE
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -2143,14 +2224,15 @@ try {
...
@@ -2143,14 +2224,15 @@ try {
bundleManager
.
setAbilityEnabled
(
info
,
false
).
then
(()
=>
{
bundleManager
.
setAbilityEnabled
(
info
,
false
).
then
(()
=>
{
hilog
.
info
(
0x0000
,
"
testTag
"
,
"
setAbilityEnabled successfully.
"
);
hilog
.
info
(
0x0000
,
"
testTag
"
,
"
setAbilityEnabled successfully.
"
);
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
setAbilityEnabled failed: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
setAbilityEnabled failed: %{public}s
'
,
err
.
message
);
});
});
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2186,6 +2268,7 @@ setAbilityEnabledSync(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md),
...
@@ -2186,6 +2268,7 @@ setAbilityEnabledSync(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md),
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -2210,7 +2293,8 @@ try {
...
@@ -2210,7 +2293,8 @@ try {
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2243,6 +2327,7 @@ isApplicationEnabled(bundleName: string, callback: AsyncCallback\<boolean>): voi
...
@@ -2243,6 +2327,7 @@ isApplicationEnabled(bundleName: string, callback: AsyncCallback\<boolean>): voi
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
...
@@ -2255,7 +2340,8 @@ try {
...
@@ -2255,7 +2340,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
isApplicationEnabled failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
isApplicationEnabled failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2293,17 +2379,19 @@ isApplicationEnabled(bundleName: string): Promise\<boolean>;
...
@@ -2293,17 +2379,19 @@ isApplicationEnabled(bundleName: string): Promise\<boolean>;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
try
{
try
{
bundleManager
.
isApplicationEnabled
(
bundleName
).
then
((
data
)
=>
{
bundleManager
.
isApplicationEnabled
(
bundleName
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
isApplicationEnabled successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
isApplicationEnabled successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
isApplicationEnabled failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
isApplicationEnabled failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
isApplicationEnabled failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
isApplicationEnabled failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2341,6 +2429,7 @@ isApplicationEnabledSync(bundleName: string): boolean;
...
@@ -2341,6 +2429,7 @@ isApplicationEnabledSync(bundleName: string): boolean;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
...
@@ -2348,7 +2437,8 @@ try {
...
@@ -2348,7 +2437,8 @@ try {
let
data
=
bundleManager
.
isApplicationEnabledSync
(
bundleName
);
let
data
=
bundleManager
.
isApplicationEnabledSync
(
bundleName
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
isApplicationEnabledSync successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
isApplicationEnabledSync successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
isApplicationEnabledSync failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
isApplicationEnabledSync failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2382,6 +2472,7 @@ isAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), call
...
@@ -2382,6 +2472,7 @@ isAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), call
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -2403,11 +2494,12 @@ try {
...
@@ -2403,11 +2494,12 @@ try {
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
isAbilityEnabled successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
isAbilityEnabled successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
}
}
});
});
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2446,6 +2538,7 @@ isAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md)): Pro
...
@@ -2446,6 +2538,7 @@ isAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md)): Pro
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -2469,7 +2562,8 @@ try {
...
@@ -2469,7 +2562,8 @@ try {
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2508,6 +2602,7 @@ isAbilityEnabledSync(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md)):
...
@@ -2508,6 +2602,7 @@ isAbilityEnabledSync(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md)):
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -2532,7 +2627,8 @@ try {
...
@@ -2532,7 +2627,8 @@ try {
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2570,6 +2666,7 @@ getLaunchWantForBundle(bundleName: string, userId: number, callback: AsyncCallba
...
@@ -2570,6 +2666,7 @@ getLaunchWantForBundle(bundleName: string, userId: number, callback: AsyncCallba
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -2583,7 +2680,8 @@ try {
...
@@ -2583,7 +2680,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundle failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundle failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2619,6 +2717,7 @@ getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\<Want>): void
...
@@ -2619,6 +2717,7 @@ getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\<Want>): void
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
...
@@ -2631,7 +2730,8 @@ try {
...
@@ -2631,7 +2730,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundle failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundle failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2674,6 +2774,7 @@ getLaunchWantForBundle(bundleName: string, userId?: number): Promise\<Want>;
...
@@ -2674,6 +2774,7 @@ getLaunchWantForBundle(bundleName: string, userId?: number): Promise\<Want>;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -2681,11 +2782,12 @@ let userId = 100;
...
@@ -2681,11 +2782,12 @@ let userId = 100;
try
{
try
{
bundleManager
.
getLaunchWantForBundle
(
bundleName
,
userId
).
then
((
data
)
=>
{
bundleManager
.
getLaunchWantForBundle
(
bundleName
,
userId
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundle successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundle successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundle failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundle failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundle failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundle failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2729,6 +2831,7 @@ getLaunchWantForBundleSync(bundleName: string, userId?: number): Want;
...
@@ -2729,6 +2831,7 @@ getLaunchWantForBundleSync(bundleName: string, userId?: number): Want;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -2737,12 +2840,14 @@ try {
...
@@ -2737,12 +2840,14 @@ try {
let
want
=
bundleManager
.
getLaunchWantForBundleSync
(
bundleName
,
userId
);
let
want
=
bundleManager
.
getLaunchWantForBundleSync
(
bundleName
,
userId
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundleSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
want
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundleSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
want
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundleSync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundleSync failed. Cause: %{public}s
'
,
message
);
}
}
```
```
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -2751,7 +2856,8 @@ try {
...
@@ -2751,7 +2856,8 @@ try {
let
want
=
bundleManager
.
getLaunchWantForBundleSync
(
bundleName
);
let
want
=
bundleManager
.
getLaunchWantForBundleSync
(
bundleName
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundleSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
want
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundleSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
want
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundleSync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundleSync failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2788,6 +2894,7 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName: strin
...
@@ -2788,6 +2894,7 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName: strin
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
moduleName
=
'
entry
'
;
let
moduleName
=
'
entry
'
;
let
abilityName
=
'
EntryAbility
'
;
let
abilityName
=
'
EntryAbility
'
;
...
@@ -2802,7 +2909,8 @@ try {
...
@@ -2802,7 +2909,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByAbility failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByAbility failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2844,6 +2952,7 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName?: stri
...
@@ -2844,6 +2952,7 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName?: stri
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
moduleName
=
'
entry
'
;
let
moduleName
=
'
entry
'
;
let
abilityName
=
'
EntryAbility
'
;
let
abilityName
=
'
EntryAbility
'
;
...
@@ -2851,16 +2960,18 @@ let abilityName = 'EntryAbility';
...
@@ -2851,16 +2960,18 @@ let abilityName = 'EntryAbility';
try
{
try
{
bundleManager
.
getProfileByAbility
(
moduleName
,
abilityName
).
then
((
data
)
=>
{
bundleManager
.
getProfileByAbility
(
moduleName
,
abilityName
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByAbility successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByAbility successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByAbility failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByAbility failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByAbility failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByAbility failed. Cause: %{public}s
'
,
message
);
}
}
```
```
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
moduleName
=
'
entry
'
;
let
moduleName
=
'
entry
'
;
let
abilityName
=
'
EntryAbility
'
;
let
abilityName
=
'
EntryAbility
'
;
...
@@ -2868,11 +2979,12 @@ let metadataName = 'com.example.myapplication.metadata';
...
@@ -2868,11 +2979,12 @@ let metadataName = 'com.example.myapplication.metadata';
try
{
try
{
bundleManager
.
getProfileByAbility
(
moduleName
,
abilityName
,
metadataName
).
then
((
data
)
=>
{
bundleManager
.
getProfileByAbility
(
moduleName
,
abilityName
,
metadataName
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByAbility successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByAbility successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByAbility failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByAbility failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByAbility failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByAbility failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2914,6 +3026,7 @@ getProfileByAbilitySync(moduleName: string, abilityName: string, metadataName?:
...
@@ -2914,6 +3026,7 @@ getProfileByAbilitySync(moduleName: string, abilityName: string, metadataName?:
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
moduleName
=
'
entry
'
;
let
moduleName
=
'
entry
'
;
let
abilityName
=
'
EntryAbility
'
;
let
abilityName
=
'
EntryAbility
'
;
...
@@ -2922,12 +3035,14 @@ try {
...
@@ -2922,12 +3035,14 @@ try {
let
data
=
bundleManager
.
getProfileByAbilitySync
(
moduleName
,
abilityName
);
let
data
=
bundleManager
.
getProfileByAbilitySync
(
moduleName
,
abilityName
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByAbilitySync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByAbilitySync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByAbilitySync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByAbilitySync failed. Cause: %{public}s
'
,
message
);
}
}
```
```
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
moduleName
:
string
=
'
entry
'
;
let
moduleName
:
string
=
'
entry
'
;
let
abilityName
:
string
=
'
EntryAbility
'
;
let
abilityName
:
string
=
'
EntryAbility
'
;
...
@@ -2936,7 +3051,8 @@ try {
...
@@ -2936,7 +3051,8 @@ try {
let
data
=
bundleManager
.
getProfileByAbilitySync
(
moduleName
,
abilityName
,
metadataName
);
let
data
=
bundleManager
.
getProfileByAbilitySync
(
moduleName
,
abilityName
,
metadataName
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByAbilitySync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByAbilitySync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByAbilitySync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByAbilitySync failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -2972,6 +3088,7 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m
...
@@ -2972,6 +3088,7 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
moduleName
=
'
entry
'
;
let
moduleName
=
'
entry
'
;
let
extensionAbilityName
=
'
com.example.myapplication.extension
'
;
let
extensionAbilityName
=
'
com.example.myapplication.extension
'
;
...
@@ -2986,7 +3103,8 @@ try {
...
@@ -2986,7 +3103,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbility failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbility failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3027,6 +3145,7 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m
...
@@ -3027,6 +3145,7 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
moduleName
=
'
entry
'
;
let
moduleName
=
'
entry
'
;
let
extensionAbilityName
=
'
com.example.myapplication.extension
'
;
let
extensionAbilityName
=
'
com.example.myapplication.extension
'
;
...
@@ -3035,21 +3154,23 @@ let metadataName = 'com.example.myapplication.metadata';
...
@@ -3035,21 +3154,23 @@ let metadataName = 'com.example.myapplication.metadata';
try
{
try
{
bundleManager
.
getProfileByExtensionAbility
(
moduleName
,
extensionAbilityName
).
then
((
data
)
=>
{
bundleManager
.
getProfileByExtensionAbility
(
moduleName
,
extensionAbilityName
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbility successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbility successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbility failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbility failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbility failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbility failed. Cause: %{public}s
'
,
message
);
}
}
try
{
try
{
bundleManager
.
getProfileByExtensionAbility
(
moduleName
,
extensionAbilityName
,
metadataName
).
then
((
data
)
=>
{
bundleManager
.
getProfileByExtensionAbility
(
moduleName
,
extensionAbilityName
,
metadataName
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbility successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbility successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbility failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbility failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbility failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbility failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3090,6 +3211,7 @@ getProfileByExtensionAbilitySync(moduleName: string, extensionAbilityName: strin
...
@@ -3090,6 +3211,7 @@ getProfileByExtensionAbilitySync(moduleName: string, extensionAbilityName: strin
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
moduleName
=
'
entry
'
;
let
moduleName
=
'
entry
'
;
let
extensionAbilityName
=
'
com.example.myapplication.extension
'
;
let
extensionAbilityName
=
'
com.example.myapplication.extension
'
;
...
@@ -3099,14 +3221,16 @@ try {
...
@@ -3099,14 +3221,16 @@ try {
let
data
=
bundleManager
.
getProfileByExtensionAbilitySync
(
moduleName
,
extensionAbilityName
);
let
data
=
bundleManager
.
getProfileByExtensionAbilitySync
(
moduleName
,
extensionAbilityName
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbilitySync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbilitySync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbilitySync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbilitySync failed. Cause: %{public}s
'
,
message
);
}
}
try
{
try
{
let
data
=
bundleManager
.
getProfileByExtensionAbilitySync
(
moduleName
,
extensionAbilityName
,
metadataName
);
let
data
=
bundleManager
.
getProfileByExtensionAbilitySync
(
moduleName
,
extensionAbilityName
,
metadataName
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbilitySync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbilitySync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbilitySync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getProfileByExtensionAbilitySync failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3141,6 +3265,7 @@ getPermissionDef(permissionName: string, callback: AsyncCallback\<[PermissionDef
...
@@ -3141,6 +3265,7 @@ getPermissionDef(permissionName: string, callback: AsyncCallback\<[PermissionDef
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
permission
=
"
ohos.permission.GET_BUNDLE_INFO
"
;
let
permission
=
"
ohos.permission.GET_BUNDLE_INFO
"
;
try
{
try
{
...
@@ -3152,7 +3277,8 @@ try {
...
@@ -3152,7 +3277,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getPermissionDef failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getPermissionDef failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3192,16 +3318,18 @@ getPermissionDef(permissionName: string): Promise\<[PermissionDef](js-apis-bundl
...
@@ -3192,16 +3318,18 @@ getPermissionDef(permissionName: string): Promise\<[PermissionDef](js-apis-bundl
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
permissionName
=
"
ohos.permission.GET_BUNDLE_INFO
"
;
let
permissionName
=
"
ohos.permission.GET_BUNDLE_INFO
"
;
try
{
try
{
bundleManager
.
getPermissionDef
(
permissionName
).
then
((
data
)
=>
{
bundleManager
.
getPermissionDef
(
permissionName
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getPermissionDef successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getPermissionDef successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getPermissionDef failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getPermissionDef failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getPermissionDef failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getPermissionDef failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3241,13 +3369,15 @@ getPermissionDefSync(permissionName: string): [PermissionDef](js-apis-bundleMana
...
@@ -3241,13 +3369,15 @@ getPermissionDefSync(permissionName: string): [PermissionDef](js-apis-bundleMana
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
permissionName
=
"
ohos.permission.GET_BUNDLE_INFO
"
;
let
permissionName
=
"
ohos.permission.GET_BUNDLE_INFO
"
;
try
{
try
{
let
PermissionDef
=
bundleManager
.
getPermissionDefSync
(
permission
);
let
PermissionDef
=
bundleManager
.
getPermissionDefSync
(
permission
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getPermissionDefSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
PermissionDef
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getPermissionDefSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
PermissionDef
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getPermissionDefSync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getPermissionDefSync failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3288,6 +3418,7 @@ getAbilityLabel(bundleName: string, moduleName: string, abilityName: string, cal
...
@@ -3288,6 +3418,7 @@ getAbilityLabel(bundleName: string, moduleName: string, abilityName: string, cal
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
moduleName
=
'
entry
'
;
let
moduleName
=
'
entry
'
;
...
@@ -3302,7 +3433,8 @@ try {
...
@@ -3302,7 +3433,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAbilityLabel failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAbilityLabel failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3348,6 +3480,7 @@ getAbilityLabel(bundleName: string, moduleName: string, abilityName: string): Pr
...
@@ -3348,6 +3480,7 @@ getAbilityLabel(bundleName: string, moduleName: string, abilityName: string): Pr
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
moduleName
=
'
entry
'
;
let
moduleName
=
'
entry
'
;
...
@@ -3356,11 +3489,12 @@ let abilityName = 'EntryAbility';
...
@@ -3356,11 +3489,12 @@ let abilityName = 'EntryAbility';
try
{
try
{
bundleManager
.
getAbilityLabel
(
bundleName
,
moduleName
,
abilityName
).
then
((
data
)
=>
{
bundleManager
.
getAbilityLabel
(
bundleName
,
moduleName
,
abilityName
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAbilityLabel successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAbilityLabel successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAbilityLabel failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAbilityLabel failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAbilityLabel failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAbilityLabel failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3406,6 +3540,7 @@ getAbilityLabelSync(bundleName: string, moduleName: string, abilityName: string)
...
@@ -3406,6 +3540,7 @@ getAbilityLabelSync(bundleName: string, moduleName: string, abilityName: string)
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
moduleName
=
'
entry
'
;
let
moduleName
=
'
entry
'
;
...
@@ -3415,7 +3550,8 @@ try {
...
@@ -3415,7 +3550,8 @@ try {
let
abilityLabel
=
bundleManager
.
getAbilityLabelSync
(
bundleName
,
moduleName
,
abilityName
);
let
abilityLabel
=
bundleManager
.
getAbilityLabelSync
(
bundleName
,
moduleName
,
abilityName
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAbilityLabelSync successfully. Data: %{public}s
'
,
abilityLabel
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAbilityLabelSync successfully. Data: %{public}s
'
,
abilityLabel
);
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAbilityLabelSync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAbilityLabelSync failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3459,6 +3595,7 @@ getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: num
...
@@ -3459,6 +3595,7 @@ getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: num
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
applicationFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_DEFAULT
;
let
applicationFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_DEFAULT
;
...
@@ -3468,7 +3605,8 @@ try {
...
@@ -3468,7 +3605,8 @@ try {
let
data
=
bundleManager
.
getApplicationInfoSync
(
bundleName
,
applicationFlags
,
userId
);
let
data
=
bundleManager
.
getApplicationInfoSync
(
bundleName
,
applicationFlags
,
userId
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getApplicationInfoSync successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getApplicationInfoSync successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getApplicationInfoSync failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getApplicationInfoSync failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3510,6 +3648,7 @@ getApplicationInfoSync(bundleName: string, applicationFlags: number) : [Applicat
...
@@ -3510,6 +3648,7 @@ getApplicationInfoSync(bundleName: string, applicationFlags: number) : [Applicat
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
applicationFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_DEFAULT
;
let
applicationFlags
=
bundleManager
.
ApplicationFlag
.
GET_APPLICATION_INFO_DEFAULT
;
...
@@ -3518,7 +3657,8 @@ try {
...
@@ -3518,7 +3657,8 @@ try {
let
data
=
bundleManager
.
getApplicationInfoSync
(
bundleName
,
applicationFlags
);
let
data
=
bundleManager
.
getApplicationInfoSync
(
bundleName
,
applicationFlags
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getApplicationInfoSync successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getApplicationInfoSync successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getApplicationInfoSync failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getApplicationInfoSync failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3562,6 +3702,7 @@ getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag), userId
...
@@ -3562,6 +3702,7 @@ getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag), userId
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION
;
...
@@ -3571,7 +3712,8 @@ try {
...
@@ -3571,7 +3712,8 @@ try {
let
data
=
bundleManager
.
getBundleInfoSync
(
bundleName
,
bundleFlags
,
userId
);
let
data
=
bundleManager
.
getBundleInfoSync
(
bundleName
,
bundleFlags
,
userId
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleInfoSync successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleInfoSync successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfoSync failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfoSync failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3613,6 +3755,7 @@ getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [Bund
...
@@ -3613,6 +3755,7 @@ getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [Bund
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION
;
...
@@ -3620,7 +3763,8 @@ try {
...
@@ -3620,7 +3763,8 @@ try {
let
data
=
bundleManager
.
getBundleInfoSync
(
bundleName
,
bundleFlags
);
let
data
=
bundleManager
.
getBundleInfoSync
(
bundleName
,
bundleFlags
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleInfoSync successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleInfoSync successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfoSync failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfoSync failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3657,6 +3801,7 @@ getSharedBundleInfo(bundleName: string, moduleName: string, callback: AsyncCall
...
@@ -3657,6 +3801,7 @@ getSharedBundleInfo(bundleName: string, moduleName: string, callback: AsyncCall
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
moduleName
=
'
library
'
;
let
moduleName
=
'
library
'
;
...
@@ -3670,7 +3815,8 @@ try {
...
@@ -3670,7 +3815,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getSharedBundleInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getSharedBundleInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3712,6 +3858,7 @@ getSharedBundleInfo(bundleName: string, moduleName: string): Promise\<Array\<Sha
...
@@ -3712,6 +3858,7 @@ getSharedBundleInfo(bundleName: string, moduleName: string): Promise\<Array\<Sha
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
moduleName
=
'
library
'
;
let
moduleName
=
'
library
'
;
...
@@ -3719,11 +3866,12 @@ let moduleName = 'library';
...
@@ -3719,11 +3866,12 @@ let moduleName = 'library';
try
{
try
{
bundleManager
.
getSharedBundleInfo
(
bundleName
,
moduleName
).
then
((
data
)
=>
{
bundleManager
.
getSharedBundleInfo
(
bundleName
,
moduleName
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getSharedBundleInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getSharedBundleInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getSharedBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getSharedBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getSharedBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getSharedBundleInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3749,6 +3897,7 @@ getAllSharedBundleInfo(callback: AsyncCallback\<Array\<SharedBundleInfo\>\>): vo
...
@@ -3749,6 +3897,7 @@ getAllSharedBundleInfo(callback: AsyncCallback\<Array\<SharedBundleInfo\>\>): vo
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
try
{
try
{
...
@@ -3760,7 +3909,8 @@ try {
...
@@ -3760,7 +3909,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllSharedBundleInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllSharedBundleInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3786,16 +3936,18 @@ getAllSharedBundleInfo(): Promise\<Array\<SharedBundleInfo\>\>;
...
@@ -3786,16 +3936,18 @@ getAllSharedBundleInfo(): Promise\<Array\<SharedBundleInfo\>\>;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
try
{
try
{
bundleManager
.
getAllSharedBundleInfo
().
then
((
data
)
=>
{
bundleManager
.
getAllSharedBundleInfo
().
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAllSharedBundleInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAllSharedBundleInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllSharedBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllSharedBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllSharedBundleInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAllSharedBundleInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3830,6 +3982,7 @@ getAppProvisionInfo(bundleName: string, callback: AsyncCallback\<[AppProvisionIn
...
@@ -3830,6 +3982,7 @@ getAppProvisionInfo(bundleName: string, callback: AsyncCallback\<[AppProvisionIn
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
"
com.ohos.myapplication
"
;
let
bundleName
=
"
com.ohos.myapplication
"
;
...
@@ -3842,7 +3995,8 @@ try {
...
@@ -3842,7 +3995,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3880,6 +4034,7 @@ getAppProvisionInfo(bundleName: string, userId: number, callback: AsyncCallback\
...
@@ -3880,6 +4034,7 @@ getAppProvisionInfo(bundleName: string, userId: number, callback: AsyncCallback\
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
"
com.ohos.myapplication
"
;
let
bundleName
=
"
com.ohos.myapplication
"
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -3893,7 +4048,8 @@ try {
...
@@ -3893,7 +4048,8 @@ try {
}
}
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo failed: %{public}s
'
,
message
);
}
}
```
```
...
@@ -3936,6 +4092,7 @@ getAppProvisionInfo(bundleName: string, userId?: number): Promise\<[AppProvision
...
@@ -3936,6 +4092,7 @@ getAppProvisionInfo(bundleName: string, userId?: number): Promise\<[AppProvision
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
"
com.ohos.myapplication
"
;
let
bundleName
=
"
com.ohos.myapplication
"
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -3943,21 +4100,23 @@ let userId = 100;
...
@@ -3943,21 +4100,23 @@ let userId = 100;
try
{
try
{
bundleManager
.
getAppProvisionInfo
(
bundleName
).
then
((
data
)
=>
{
bundleManager
.
getAppProvisionInfo
(
bundleName
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo failed. Cause: %{public}s
'
,
message
);
}
}
try
{
try
{
bundleManager
.
getAppProvisionInfo
(
bundleName
,
userId
).
then
((
data
)
=>
{
bundleManager
.
getAppProvisionInfo
(
bundleName
,
userId
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo failed. Cause: %{public}s
'
,
err
.
message
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfo failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -4000,6 +4159,7 @@ getAppProvisionInfoSync(bundleName: string, userId?: number): AppProvisionInfo;
...
@@ -4000,6 +4159,7 @@ getAppProvisionInfoSync(bundleName: string, userId?: number): AppProvisionInfo;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleName
=
"
com.ohos.myapplication
"
;
let
bundleName
=
"
com.ohos.myapplication
"
;
let
userId
=
100
;
let
userId
=
100
;
...
@@ -4008,14 +4168,16 @@ try {
...
@@ -4008,14 +4168,16 @@ try {
let
data
=
bundleManager
.
getAppProvisionInfoSync
(
bundleName
);
let
data
=
bundleManager
.
getAppProvisionInfoSync
(
bundleName
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfoSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfoSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfoSync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfoSync failed. Cause: %{public}s
'
,
message
);
}
}
try
{
try
{
let
data
=
bundleManager
.
getAppProvisionInfoSync
(
bundleName
,
userId
);
let
data
=
bundleManager
.
getAppProvisionInfoSync
(
bundleName
,
userId
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfoSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfoSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfoSync failed. Cause: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getAppProvisionInfoSync failed. Cause: %{public}s
'
,
message
);
}
}
```
```
...
@@ -4053,13 +4215,15 @@ getSpecifiedDistributionType(bundleName: string): string;
...
@@ -4053,13 +4215,15 @@ getSpecifiedDistributionType(bundleName: string): string;
**示例:**
**示例:**
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
=
"
com.example.myapplication
"
;
let
bundleName
=
"
com.example.myapplication
"
;
try
{
try
{
let
type
=
bundleManager
.
getSpecifiedDistributionType
(
bundleName
);
let
type
=
bundleManager
.
getSpecifiedDistributionType
(
bundleName
);
console
.
info
(
'
getSpecifiedDistributionType successfully, type:
'
+
type
);
console
.
info
(
'
getSpecifiedDistributionType successfully, type:
'
+
type
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'
getSpecifiedDistributionType failed. Cause:
'
+
error
.
message
);
let
message
=
(
error
as
BusinessError
).
message
;
console
.
error
(
'
getSpecifiedDistributionType failed. Cause:
'
+
message
);
}
}
```
```
...
@@ -4100,13 +4264,15 @@ getAdditionalInfo(bundleName: string): string;
...
@@ -4100,13 +4264,15 @@ getAdditionalInfo(bundleName: string): string;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
=
"
com.example.myapplication
"
;
let
bundleName
=
"
com.example.myapplication
"
;
try
{
try
{
let
info
=
bundleManager
.
getAdditionalInfo
(
bundleName
);
let
info
=
bundleManager
.
getAdditionalInfo
(
bundleName
);
console
.
info
(
'
getAdditionalInfo successfully, additionInfo:
'
+
info
);
console
.
info
(
'
getAdditionalInfo successfully, additionInfo:
'
+
info
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'
getAdditionalInfo failed. Cause:
'
+
error
.
message
);
let
message
=
(
error
as
BusinessError
).
message
;
console
.
error
(
'
getAdditionalInfo failed. Cause:
'
+
message
);
}
}
```
```
...
@@ -4134,12 +4300,14 @@ getBundleInfoForSelfSync(bundleFlags: number): BundleInfo;
...
@@ -4134,12 +4300,14 @@ getBundleInfoForSelfSync(bundleFlags: number): BundleInfo;
```
ts
```
ts
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION
;
let
bundleFlags
=
bundleManager
.
BundleFlag
.
GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION
;
try
{
try
{
let
data
=
bundleManager
.
getBundleInfoForSelfSync
(
bundleFlags
);
let
data
=
bundleManager
.
getBundleInfoForSelfSync
(
bundleFlags
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleInfoForSelfSync successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getBundleInfoForSelfSync successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfoForSelfSync failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
getBundleInfoForSelfSync failed: %{public}s
'
,
message
);
}
}
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-overlay.md
浏览文件 @
d9158b84
...
@@ -45,6 +45,8 @@ setOverlayEnabled(moduleName:string, isEnabled: boolean): Promise\<void>;
...
@@ -45,6 +45,8 @@ setOverlayEnabled(moduleName:string, isEnabled: boolean): Promise\<void>;
**示例:**
**示例:**
```
ts
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
moduleName
=
"
feature
"
;
let
moduleName
=
"
feature
"
;
let
isEnabled
=
false
;
let
isEnabled
=
false
;
...
@@ -52,11 +54,13 @@ try {
...
@@ -52,11 +54,13 @@ try {
overlay
.
setOverlayEnabled
(
moduleName
,
isEnabled
)
overlay
.
setOverlayEnabled
(
moduleName
,
isEnabled
)
.
then
(()
=>
{
.
then
(()
=>
{
console
.
info
(
'
setOverlayEnabled success
'
);
console
.
info
(
'
setOverlayEnabled success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
info
(
'
setOverlayEnabled failed due to err code:
'
+
err
.
code
+
'
'
+
'
message:
'
+
err
.
message
);
console
.
info
(
'
setOverlayEnabled failed due to err code:
'
+
err
.
code
+
'
'
+
'
message:
'
+
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
setOverlayEnabled failed due to err code:
'
+
err
.
code
+
'
'
+
'
message:
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
info
(
'
setOverlayEnabled failed due to err code:
'
+
code
+
'
'
+
'
message:
'
+
message
);
}
}
```
```
...
@@ -88,6 +92,8 @@ setOverlayEnabled(moduleName:string, isEnabled: boolean, callback: AsyncCallback
...
@@ -88,6 +92,8 @@ setOverlayEnabled(moduleName:string, isEnabled: boolean, callback: AsyncCallback
**示例:**
**示例:**
```
ts
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
moduleName
=
"
feature
"
;
let
moduleName
=
"
feature
"
;
let
isEnabled
=
false
;
let
isEnabled
=
false
;
...
@@ -100,7 +106,9 @@ try {
...
@@ -100,7 +106,9 @@ try {
console
.
info
(
'
setOverlayEnabled success
'
);
console
.
info
(
'
setOverlayEnabled success
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
setOverlayEnabled failed due to err code:
'
+
err
.
code
+
'
'
+
'
message:
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
info
(
'
setOverlayEnabled failed due to err code:
'
+
code
+
'
'
+
'
message:
'
+
message
);
}
}
```
```
...
@@ -144,6 +152,8 @@ setOverlayEnabledByBundleName(bundleName:string, moduleName:string, isEnabled: b
...
@@ -144,6 +152,8 @@ setOverlayEnabledByBundleName(bundleName:string, moduleName:string, isEnabled: b
**示例:**
**示例:**
```
ts
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
let
moduleName
=
"
feature
"
;
let
moduleName
=
"
feature
"
;
let
isEnabled
=
false
;
let
isEnabled
=
false
;
...
@@ -152,11 +162,13 @@ try {
...
@@ -152,11 +162,13 @@ try {
overlay
.
setOverlayEnabledByBundleName
(
bundleName
,
moduleName
,
isEnabled
)
overlay
.
setOverlayEnabledByBundleName
(
bundleName
,
moduleName
,
isEnabled
)
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
console
.
info
(
'
setOverlayEnabledByBundleName successfully
'
);
console
.
info
(
'
setOverlayEnabledByBundleName successfully
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
info
(
'
setOverlayEnabledByBundleName failed due to err code:
'
+
err
.
code
+
'
'
+
'
message:
'
+
err
.
message
);
console
.
info
(
'
setOverlayEnabledByBundleName failed due to err code:
'
+
err
.
code
+
'
'
+
'
message:
'
+
err
.
message
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
setOverlayEnabledByBundleName failed due to err code:
'
+
err
.
code
+
'
'
+
'
message:
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
info
(
'
setOverlayEnabledByBundleName failed due to err code:
'
+
code
+
'
'
+
'
message:
'
+
message
);
}
}
```
```
...
@@ -195,6 +207,8 @@ setOverlayEnabledByBundleName(bundleName:string, moduleName:string, isEnabled: b
...
@@ -195,6 +207,8 @@ setOverlayEnabledByBundleName(bundleName:string, moduleName:string, isEnabled: b
**示例:**
**示例:**
```
ts
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
let
moduleName
=
"
feature
"
;
let
moduleName
=
"
feature
"
;
let
isEnabled
=
false
;
let
isEnabled
=
false
;
...
@@ -208,7 +222,9 @@ try {
...
@@ -208,7 +222,9 @@ try {
console
.
info
(
'
setOverlayEnabledByBundleName successfully
'
);
console
.
info
(
'
setOverlayEnabledByBundleName successfully
'
);
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
info
(
'
setOverlayEnabledByBundleName failed due to err code:
'
+
err
.
code
+
'
'
+
'
message:
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
info
(
'
setOverlayEnabledByBundleName failed due to err code:
'
+
code
+
'
'
+
'
message:
'
+
message
);
}
}
```
```
...
@@ -245,6 +261,8 @@ getOverlayModuleInfo(moduleName: string): Promise\<OverlayModuleInfo>;
...
@@ -245,6 +261,8 @@ getOverlayModuleInfo(moduleName: string): Promise\<OverlayModuleInfo>;
**示例:**
**示例:**
```
ts
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
moduleName
=
"
feature
"
;
let
moduleName
=
"
feature
"
;
(
async
()
=>
{
(
async
()
=>
{
...
@@ -252,7 +270,9 @@ let moduleName = "feature";
...
@@ -252,7 +270,9 @@ let moduleName = "feature";
let
overlayModuleInfo
=
await
overlay
.
getOverlayModuleInfo
(
moduleName
);
let
overlayModuleInfo
=
await
overlay
.
getOverlayModuleInfo
(
moduleName
);
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
overlayModuleInfo
));
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
overlayModuleInfo
));
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
'
getOverlayModuleInfo failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getOverlayModuleInfo failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
}
})();
})();
```
```
...
@@ -285,6 +305,8 @@ getOverlayModuleInfo(moduleName: string, callback: AsyncCallback\<OverlayModuleI
...
@@ -285,6 +305,8 @@ getOverlayModuleInfo(moduleName: string, callback: AsyncCallback\<OverlayModuleI
**示例:**
**示例:**
```
ts
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
moduleName
=
"
feature
"
;
let
moduleName
=
"
feature
"
;
try
{
try
{
overlay
.
getOverlayModuleInfo
(
moduleName
,
(
err
,
data
)
=>
{
overlay
.
getOverlayModuleInfo
(
moduleName
,
(
err
,
data
)
=>
{
...
@@ -295,7 +317,9 @@ try {
...
@@ -295,7 +317,9 @@ try {
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
'
getOverlayModuleInfo failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getOverlayModuleInfo failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
}
```
```
...
@@ -331,6 +355,8 @@ getTargetOverlayModuleInfos(targetModuleName: string): Promise\<Array\<OverlayMo
...
@@ -331,6 +355,8 @@ getTargetOverlayModuleInfos(targetModuleName: string): Promise\<Array\<OverlayMo
**示例:**
**示例:**
```
ts
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
targetModuleName
=
"
feature
"
;
let
targetModuleName
=
"
feature
"
;
(
async
()
=>
{
(
async
()
=>
{
...
@@ -338,7 +364,9 @@ let targetModuleName = "feature";
...
@@ -338,7 +364,9 @@ let targetModuleName = "feature";
let
overlayModuleInfos
=
await
overlay
.
getTargetOverlayModuleInfos
(
targetModuleName
);
let
overlayModuleInfos
=
await
overlay
.
getTargetOverlayModuleInfos
(
targetModuleName
);
console
.
log
(
'
overlayModuleInfos are
'
+
JSON
.
stringify
(
overlayModuleInfos
));
console
.
log
(
'
overlayModuleInfos are
'
+
JSON
.
stringify
(
overlayModuleInfos
));
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
'
getTargetOverlayModuleInfos failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getTargetOverlayModuleInfos failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
}
})();
})();
```
```
...
@@ -370,6 +398,8 @@ getTargetOverlayModuleInfos(targetModuleName: string, callback: AsyncCallback\<A
...
@@ -370,6 +398,8 @@ getTargetOverlayModuleInfos(targetModuleName: string, callback: AsyncCallback\<A
**示例:**
**示例:**
```
ts
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
targetModuleName
=
"
feature
"
;
let
targetModuleName
=
"
feature
"
;
try
{
try
{
overlay
.
getTargetOverlayModuleInfos
(
targetModuleName
,
(
err
,
data
)
=>
{
overlay
.
getTargetOverlayModuleInfos
(
targetModuleName
,
(
err
,
data
)
=>
{
...
@@ -380,7 +410,9 @@ try {
...
@@ -380,7 +410,9 @@ try {
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
'
getTargetOverlayModuleInfos failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getTargetOverlayModuleInfos failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
}
```
```
...
@@ -423,6 +455,8 @@ getOverlayModuleInfoByBundleName(bundleName: string, moduleName?: string): Promi
...
@@ -423,6 +455,8 @@ getOverlayModuleInfoByBundleName(bundleName: string, moduleName?: string): Promi
**示例:**
**示例:**
```
ts
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
let
moduleName
=
"
feature
"
;
let
moduleName
=
"
feature
"
;
...
@@ -431,7 +465,9 @@ let moduleName = "feature";
...
@@ -431,7 +465,9 @@ let moduleName = "feature";
let
overlayModuleInfos
=
await
overlay
.
getOverlayModuleInfoByBundleName
(
bundleName
,
moduleName
);
let
overlayModuleInfos
=
await
overlay
.
getOverlayModuleInfoByBundleName
(
bundleName
,
moduleName
);
console
.
log
(
'
overlayModuleInfos are
'
+
JSON
.
stringify
(
overlayModuleInfos
));
console
.
log
(
'
overlayModuleInfos are
'
+
JSON
.
stringify
(
overlayModuleInfos
));
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
'
getTargetOverlayModuleInfos failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getTargetOverlayModuleInfos failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
}
})();
})();
```
```
...
@@ -470,6 +506,8 @@ getOverlayModuleInfoByBundleName(bundleName: string, moduleName: string, callbac
...
@@ -470,6 +506,8 @@ getOverlayModuleInfoByBundleName(bundleName: string, moduleName: string, callbac
**示例:**
**示例:**
```
ts
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
let
moduleName
=
"
feature
"
;
let
moduleName
=
"
feature
"
;
...
@@ -482,7 +520,9 @@ try {
...
@@ -482,7 +520,9 @@ try {
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
'
getOverlayModuleInfoByBundleName failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getOverlayModuleInfoByBundleName failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
}
```
```
...
@@ -517,6 +557,8 @@ getOverlayModuleInfoByBundleName(bundleName: string, callback: AsyncCallback\<Ar
...
@@ -517,6 +557,8 @@ getOverlayModuleInfoByBundleName(bundleName: string, callback: AsyncCallback\<Ar
**示例:**
**示例:**
```
ts
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
let
bundleName
=
"
com.example.myapplication_xxxxx
"
;
try
{
try
{
...
@@ -528,7 +570,9 @@ try {
...
@@ -528,7 +570,9 @@ try {
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
'
getOverlayModuleInfoByBundleName failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getOverlayModuleInfoByBundleName failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
}
```
```
...
@@ -571,6 +615,8 @@ getTargetOverlayModuleInfosByBundleName(targetBundleName: string, moduleName?: s
...
@@ -571,6 +615,8 @@ getTargetOverlayModuleInfosByBundleName(targetBundleName: string, moduleName?: s
**示例:**
**示例:**
```
ts
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
targetBundleName
=
"
com.example.myapplication_xxxxx
"
;
let
targetBundleName
=
"
com.example.myapplication_xxxxx
"
;
let
moduleName
=
"
feature
"
;
let
moduleName
=
"
feature
"
;
...
@@ -579,7 +625,9 @@ let moduleName = "feature";
...
@@ -579,7 +625,9 @@ let moduleName = "feature";
let
overlayModuleInfos
=
await
overlay
.
getTargetOverlayModuleInfosByBundleName
(
targetBundleName
,
moduleName
);
let
overlayModuleInfos
=
await
overlay
.
getTargetOverlayModuleInfosByBundleName
(
targetBundleName
,
moduleName
);
console
.
log
(
'
overlayModuleInfos are
'
+
JSON
.
stringify
(
overlayModuleInfos
));
console
.
log
(
'
overlayModuleInfos are
'
+
JSON
.
stringify
(
overlayModuleInfos
));
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
'
getTargetOverlayModuleInfosByBundleName failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getTargetOverlayModuleInfosByBundleName failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
}
})();
})();
```
```
...
@@ -618,6 +666,8 @@ getTargetOverlayModuleInfosByBundleName(targetBundleName: string, moduleName: st
...
@@ -618,6 +666,8 @@ getTargetOverlayModuleInfosByBundleName(targetBundleName: string, moduleName: st
**示例:**
**示例:**
```
ts
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
targetBundleName
=
"
com.example.myapplication_xxxxx
"
;
let
targetBundleName
=
"
com.example.myapplication_xxxxx
"
;
let
moduleName
=
"
feature
"
;
let
moduleName
=
"
feature
"
;
...
@@ -630,7 +680,9 @@ try {
...
@@ -630,7 +680,9 @@ try {
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
'
getTargetOverlayModuleInfosByBundleName failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getTargetOverlayModuleInfosByBundleName failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
}
```
```
...
@@ -665,6 +717,8 @@ getTargetOverlayModuleInfosByBundleName(targetBundleName: string, callback: Asyn
...
@@ -665,6 +717,8 @@ getTargetOverlayModuleInfosByBundleName(targetBundleName: string, callback: Asyn
**示例:**
**示例:**
```
ts
```
ts
import
overlay
from
'
@ohos.bundle.overlay
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
targetBundleName
=
"
com.example.myapplication_xxxxx
"
;
let
targetBundleName
=
"
com.example.myapplication_xxxxx
"
;
try
{
try
{
...
@@ -676,7 +730,9 @@ try {
...
@@ -676,7 +730,9 @@ try {
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
overlayModuleInfo is
'
+
JSON
.
stringify
(
data
));
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
'
getTargetOverlayModuleInfosByBundleName failed due to err code :
'
+
err
.
code
+
'
'
+
'
message :
'
+
err
.
message
);
let
code
=
(
err
as
BusinessError
).
code
;
let
message
=
(
err
as
BusinessError
).
message
;
console
.
log
(
'
getTargetOverlayModuleInfosByBundleName failed due to err code :
'
+
code
+
'
'
+
'
message :
'
+
message
);
}
}
```
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录