未验证 提交 51193009 编写于 作者: O openharmony_ci 提交者: Gitee

!4983 翻译完成:4277 3.1release包管理资料修改

Merge pull request !4983 from wusongqing/TR4277
# Bundle Module (JavaScript SDK APIs) # Bundle Module (JavaScript SDK APIs)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br> > **NOTE**<br>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> API version 9 is a canary version for trial use. The APIs of this version may be unstable. > API version 9 is a canary version for trial use. The APIs of this version may be unstable.
## Modules to Import ## Modules to Import
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
import bundle from '@ohos.bundle'; import bundle from '@ohos.bundle';
``` ```
## System Capabilities ## System Capability
SystemCapability.BundleManager.BundleFramework SystemCapability.BundleManager.BundleFramework
...@@ -47,7 +47,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -47,7 +47,7 @@ SystemCapability.BundleManager.BundleFramework
| Type | Description | | Type | Description |
| ------------------------- | ------------------ | | ------------------------- | ------------------ |
| Promise\<ApplicationInfo> | Promise used to return the application information.| | Promise\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Promise used to return the application information.|
**Example** **Example**
...@@ -86,7 +86,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -86,7 +86,7 @@ SystemCapability.BundleManager.BundleFramework
| bundleName | string | Yes | Bundle name of the application. | | bundleName | string | Yes | Bundle name of the application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.| | bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. | | userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
| callback | AsyncCallback\<ApplicationInfo> | Yes | Callback used to return the application information. | | callback | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes | Callback used to return the application information. |
**Example** **Example**
...@@ -124,7 +124,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -124,7 +124,7 @@ SystemCapability.BundleManager.BundleFramework
| ----------- | ------------------------------- | ---- | --------------------------------------- | | ----------- | ------------------------------- | ---- | --------------------------------------- |
| bundleName | string | Yes | Bundle name of the application. | | bundleName | string | Yes | Bundle name of the application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.| | bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback | AsyncCallback\<ApplicationInfo> | Yes | Callback used to return the application information. | | callback | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes | Callback used to return the application information. |
**Example** **Example**
...@@ -166,7 +166,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -166,7 +166,7 @@ SystemCapability.BundleManager.BundleFramework
| Type | Description | | Type | Description |
| --------------------------- | -------------------------- | | --------------------------- | -------------------------- |
| Promise<Array\<BundleInfo>> | Promise used to return the information of all available bundles.| | Promise<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Promise used to return the information of all available bundles.|
**Example** **Example**
...@@ -202,7 +202,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -202,7 +202,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------- | --------------------------------- | ---- | --------------------------------------- | | ---------- | --------------------------------- | ---- | --------------------------------------- |
| bundleFlag | BundleFlag | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.| | bundleFlag | BundleFlag | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback | AsyncCallback<Array\<BundleInfo>> | Yes | Callback used to return the information of all available bundles. | | callback | AsyncCallback<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Yes | Callback used to return the information of all available bundles. |
**Example** **Example**
...@@ -238,7 +238,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -238,7 +238,7 @@ SystemCapability.BundleManager.BundleFramework
| ---------- | --------------------------------- | ---- | --------------------------------------- | | ---------- | --------------------------------- | ---- | --------------------------------------- |
| bundleFlag | BundleFlag | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.| | bundleFlag | BundleFlag | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. | | userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
| callback | AsyncCallback<Array\<BundleInfo>> | Yes | Callback used to return the information of all available bundles. | | callback | AsyncCallback<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Yes | Callback used to return the information of all available bundles. |
**Example** **Example**
...@@ -274,15 +274,15 @@ SystemCapability.BundleManager.BundleFramework ...@@ -274,15 +274,15 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------- | ------------- | ---- | --------------------------------------- | | ----------- | ------------- | ---- | --------------------------------------- |
| bundleName | string | Yes | Bundle name. | | bundleName | string | Yes | Bundle name of the application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.| | bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| options | BundleOptions | No | Includes **userId**. | | options | [BundleOptions](#bundleoptions)| No | Includes **userId**. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------------- | ---------------------------- | | -------------------- | ---------------------------- |
| Promise\<BundleInfo> | Promise used to return the bundle information.| | Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the bundle information.|
**Example** **Example**
...@@ -320,9 +320,9 @@ SystemCapability.BundleManager.BundleFramework ...@@ -320,9 +320,9 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------- | -------------------------- | ---- | --------------------------------------- | | ----------- | -------------------------- | ---- | --------------------------------------- |
| bundleName | string | Yes | Bundle name. | | bundleName | string | Yes | Bundle name of the application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.| | bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback | AsyncCallback\<BundleInfo> | Yes | Callback used to return the bundle information. | | callback | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the bundle information. |
**Example** **Example**
...@@ -357,10 +357,10 @@ SystemCapability.BundleManager.BundleFramework ...@@ -357,10 +357,10 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------- | -------------------------- | ---- | --------------------------------------- | | ----------- | -------------------------- | ---- | --------------------------------------- |
| bundleName | string | Yes | Bundle name. | | bundleName | string | Yes | Bundle name of the application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.| | bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| options | BundleOptions | Yes | Includes **userId**. | | options | [BundleOptions](#bundleoptions) | Yes | Includes **userId**. |
| callback | AsyncCallback\<BundleInfo> | Yes | Callback used to return the bundle information. | | callback | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the bundle information. |
**Example** **Example**
...@@ -405,7 +405,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -405,7 +405,7 @@ SystemCapability.BundleManager.BundleFramework
| Type | Description | | Type | Description |
| -------------------------------- | ------------------------------- | | -------------------------------- | ------------------------------- |
| Promise<Array\<ApplicationInfo>> | Promise used to return the application information.| | Promise<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Promise used to return the application information.|
**Example** **Example**
...@@ -442,7 +442,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -442,7 +442,7 @@ SystemCapability.BundleManager.BundleFramework
| ----------- | -------------------------------------- | ---- | --------------------------------------- | | ----------- | -------------------------------------- | ---- | --------------------------------------- |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.| | bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. | | userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
| callback | AsyncCallback<Array\<ApplicationInfo>> | Yes | Callback used to return the application information. | | callback | AsyncCallback<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Yes | Callback used to return the application information. |
**Example** **Example**
...@@ -478,7 +478,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -478,7 +478,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------- | -------------------------------------- | ---- | --------------------------------------- | | ----------- | -------------------------------------- | ---- | --------------------------------------- |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.| | bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback | AsyncCallback<Array\<ApplicationInfo>> | Yes | Callback used to return the application information. | | callback | AsyncCallback<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Yes | Callback used to return the application information. |
**Example** **Example**
...@@ -493,6 +493,73 @@ bundle.getAllApplicationInfo(bundleFlags, (err, data) => { ...@@ -493,6 +493,73 @@ bundle.getAllApplicationInfo(bundleFlags, (err, data) => {
}) })
``` ```
## bundle.getBundleArchiveInfo
getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise<BundleInfo>
Obtains information about the bundles contained in a HAP file. This API uses a promise to return the result.
**System capability**
SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ |
| hapFilePath | string | Yes | Path where the HAP file is stored. The path should point to the relative directory of the current application's data directory.|
| bundleFlags | number | Yes | Flags used to specify information contained in the **BundleInfo** object that will be returned. The default value is **0**. The value must be greater than 0.|
**Return value**
| Type | Description |
| -------------- | -------------------------------------- |
| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the information about the bundles.|
**Example**
```js
let hapFilePath = "/data/xxx/test.hap";
let bundleFlags = 0;
bundle.getBundleArchiveInfo(hapFilePath, bundleFlags)
.then((data) => {
console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
## bundle.getBundleArchiveInfo
getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback<BundleInfo>) : void
Obtains information about the bundles contained in a HAP file. This API uses an asynchronous callback to return the result.
**System capability**
SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ |
| hapFilePath | string | Yes | Path where the HAP file is stored. The path should point to the relative directory of the current application's data directory.|
| bundleFlags | number | Yes | Flags used to specify information contained in the **BundleInfo** object that will be returned. The default value is **0**. The value must be greater than 0.|
| callback| AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Flags used to specify information contained in the **BundleInfo** object that will be returned. The default value is **0**. The value must be greater than 0.|
**Example**
```js
let hapFilePath = "/data/xxx/test.hap";
let bundleFlags = 0;
bundle.getBundleArchiveInfo(hapFilePath, bundleFlags, (err, data) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
}
console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
## bundle.getAbilityInfo ## bundle.getAbilityInfo
getAbilityInfo(bundleName: string, abilityName: string): Promise\<AbilityInfo> getAbilityInfo(bundleName: string, abilityName: string): Promise\<AbilityInfo>
...@@ -518,7 +585,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -518,7 +585,7 @@ SystemCapability.BundleManager.BundleFramework
| Type | Description | | Type | Description |
| --------------------- | --------------------- | | --------------------- | --------------------- |
| Promise\<AbilityInfo> | Promise used to return the ability information.| | Promise\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Promise used to return the ability information.|
**Example** **Example**
...@@ -553,7 +620,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -553,7 +620,7 @@ SystemCapability.BundleManager.BundleFramework
| ----------- | ------------ | ---- | ---------------- | | ----------- | ------------ | ---- | ---------------- |
| bundleName | string | Yes | Bundle name of the application. | | bundleName | string | Yes | Bundle name of the application. |
| abilityName | string | Yes | Ability name.| | abilityName | string | Yes | Ability name.|
| callback | AsyncCallback\<AbilityInfo> | Yes | Callback used to return the ability information.| | callback | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes | Callback used to return the ability information.|
**Example** **Example**
...@@ -649,7 +716,7 @@ bundle.getAbilityLabel(bundleName, abilityName, (err, data) => { ...@@ -649,7 +716,7 @@ bundle.getAbilityLabel(bundleName, abilityName, (err, data) => {
isAbilityEnabled(info: AbilityInfo): Promise\<boolean> isAbilityEnabled(info: AbilityInfo): Promise\<boolean>
Checks whether an ability is enabled based on a given **AbilityInfo** object. This API uses a promise to return the result. Checks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses a promise to return the result.
**Required permissions** **Required permissions**
...@@ -663,7 +730,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -663,7 +730,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---- | ----------- | ---- | ------------ | | ---- | ----------- | ---- | ------------ |
| info | AbilityInfo | Yes | Ability information.| | info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes | Ability information.|
**Return value** **Return value**
...@@ -690,7 +757,7 @@ bundle.isAbilityEnabled(Info) ...@@ -690,7 +757,7 @@ bundle.isAbilityEnabled(Info)
isAbilityEnabled(info : AbilityInfo, callback : AsyncCallback\<boolean>): void isAbilityEnabled(info : AbilityInfo, callback : AsyncCallback\<boolean>): void
Checks whether an ability is enabled based on a given **AbilityInfo** object. This API uses an asynchronous callback to return the result. Checks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses an asynchronous callback to return the result.
**Required permissions** **Required permissions**
...@@ -704,7 +771,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -704,7 +771,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ----------------------- | ---- | --------------- | | -------- | ----------------------- | ---- | --------------- |
| info | AbilityInfo | Yes | Ability information. | | info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes | Ability information. |
| callback | AsyncCallback\<boolean> | Yes | Callback used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.| | callback | AsyncCallback\<boolean> | Yes | Callback used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
**Example** **Example**
...@@ -765,7 +832,7 @@ bundle.isApplicationEnabled(bundleName) ...@@ -765,7 +832,7 @@ bundle.isApplicationEnabled(bundleName)
isApplicationEnabled(bundleName: string, callback : AsyncCallback\<boolean>): void isApplicationEnabled(bundleName: string, callback : AsyncCallback\<boolean>): void
Checks whether an application is enabled based on a given want. This API uses an asynchronous callback to return the result. Checks whether an application is enabled based on a given bundle name. This API uses an asynchronous callback to return the result.
**Required permissions** **Required permissions**
...@@ -813,7 +880,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -813,7 +880,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ------------------------------------- | | ----------- | ------ | ---- | ------------------------------------- |
| want | Want | Yes | Want that contains the bundle name. | | want | [Want](js-apis-application-Want.md) | Yes | Want that contains the bundle name. |
| bundleFlags | number | Yes | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.| | bundleFlags | number | Yes | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. | | userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
...@@ -821,7 +888,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -821,7 +888,7 @@ SystemCapability.BundleManager.BundleFramework
| Type | Description | | Type | Description |
| ---------------------------- | --------------------- | | ---------------------------- | --------------------- |
| Promise\<Array\<AbilityInfo>>| Promise used to return the ability information.| | Promise<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Promise used to return the ability information.|
**Example** **Example**
...@@ -856,10 +923,10 @@ SystemCapability.BundleManager.BundleFramework ...@@ -856,10 +923,10 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------- | ---------------------------------- | ---- | ------------------------------------- | | ----------- | ---------------------------------- | ---- | ------------------------------------- |
| want | Want | Yes | Want that contains the bundle name. | | want | [Want](js-apis-application-Want.md) | Yes | Want that contains the bundle name. |
| bundleFlags | number | Yes | Type of the ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.| | bundleFlags | number | Yes | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. | | userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
| callback | AsyncCallback<Array\<AbilityInfo>> | Yes | Callback used to return the ability information. | | callback | AsyncCallback<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Yes | Callback used to return the ability information. |
**Example** **Example**
...@@ -893,9 +960,9 @@ SystemCapability.BundleManager.BundleFramework ...@@ -893,9 +960,9 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------- | ---------------------------------- | ---- | ------------------------------------- | | ----------- | ---------------------------------- | ---- | ------------------------------------- |
| want | Want | Yes | Want that contains the bundle name. | | want | [Want](js-apis-application-Want.md) | Yes | Want that contains the bundle name. |
| bundleFlags | number | Yes | Type of the ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.| | bundleFlags | number | Yes | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback | AsyncCallback<Array\<AbilityInfo>> | Yes | Callback used to return the ability information. | | callback | AsyncCallback<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Yes | Callback used to return the ability information. |
**Example** **Example**
...@@ -939,7 +1006,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -939,7 +1006,7 @@ SystemCapability.BundleManager.BundleFramework
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | -------------------------------------- | | -------------- | -------------------------------------- |
| Promise\<Want> | Promise used to return the **Want** object.| | Promise\<[Want](js-apis-application-Want.md)> | Promise used to return the **Want** object.|
**Example** **Example**
...@@ -972,7 +1039,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -972,7 +1039,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------- | -------------------- | ---- | ------------------------------ | | ---------- | -------------------- | ---- | ------------------------------ |
| bundleName | string | Yes | Bundle name of the application. | | bundleName | string | Yes | Bundle name of the application. |
| callback | AsyncCallback\<Want> | Yes | Callback used to return the **Want** object.| | callback | AsyncCallback\<[Want](js-apis-application-Want.md)> | Yes | Callback used to return the **Want** object.|
**Example** **Example**
...@@ -1056,7 +1123,7 @@ bundle.getNameForUid(uid, (err, data) => { ...@@ -1056,7 +1123,7 @@ bundle.getNameForUid(uid, (err, data) => {
getAbilityIcon(bundleName: string, abilityName: string): Promise\<image.PixelMap>; getAbilityIcon(bundleName: string, abilityName: string): Promise\<image.PixelMap>;
Obtains the [PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md) of the icon corresponding to a given bundle name and ability name. This API uses a promise to return the result. Obtains the [PixelMap](js-apis-image.md) of the icon corresponding to a given bundle name and ability name. This API uses a promise to return the result.
**Required permissions** **Required permissions**
...@@ -1076,7 +1143,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -1076,7 +1143,7 @@ SystemCapability.BundleManager.BundleFramework
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ------------------------------------------------------------ | | --------------------- | ------------------------------------------------------------ |
| Promise\<image.PixelMap> | Promise used to return the [PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md)>.| | Promise\<image.PixelMap> | Promise used to return the [PixelMap](js-apis-image.md).|
**Example** **Example**
...@@ -1095,7 +1162,7 @@ bundle.getAbilityIcon(bundleName, abilityName) ...@@ -1095,7 +1162,7 @@ bundle.getAbilityIcon(bundleName, abilityName)
getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\<image.PixelMap>): void; getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\<image.PixelMap>): void;
Obtains the [PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md) of the icon corresponding to a given bundle name and ability name. This API uses an asynchronous callback to return the result. Obtains the [PixelMap](js-apis-image.md) of the icon corresponding to a given bundle name and ability name. This API uses an asynchronous callback to return the result.
**Required permissions** **Required permissions**
...@@ -1111,7 +1178,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -1111,7 +1178,7 @@ SystemCapability.BundleManager.BundleFramework
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- | | ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| bundleName | string | Yes | Bundle name based on which the pixel map is to obtain. | | bundleName | string | Yes | Bundle name based on which the pixel map is to obtain. |
| abilityName | string | Yes | Ability name based on which the pixel map is to obtain. | | abilityName | string | Yes | Ability name based on which the pixel map is to obtain. |
| callback | AsyncCallback\<image.PixelMap> | Yes | Callback used to return the [PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md)>.| | callback | AsyncCallback\<image.PixelMap> | Yes | Callback used to return the [PixelMap](js-apis-image.md).|
**Example** **Example**
...@@ -1127,17 +1194,133 @@ bundle.getAbilityIcon(bundleName, abilityName, (err, data) => { ...@@ -1127,17 +1194,133 @@ bundle.getAbilityIcon(bundleName, abilityName, (err, data) => {
}) })
``` ```
## ElementName
**System capability**: SystemCapability.BundleManager.BundleFramework ## bundle.queryExtensionAbilityInfosByWant<sup>9+</sup>
queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, userId?: number): Promise<Array\<ExtensionAbilityInfo>>
Obtains the Extension ability information based on a given want. This API uses a promise to return the result.
**Required permissions**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO
**System capability**
SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory | Description |
| -------------- | ------ | ---- | ---------------------------------------- |
| want | [Want](js-apis-application-Want.md) | Yes | Want that contains the bundle name. |
| extensionFlags | number | Yes | Extension ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
**Return value**
| Type | Description |
| ------------------------------------- | ------------------------------ |
| Promise<Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)>> | Promise used to return the Extension ability information.|
**Example**
```js
let extensionFlags = 0;
let userId = 100;
let want = {
bundleName : "com.example.myapplication",
abilityName : "com.example.myapplication.MainAbility"
};
bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, userId)
.then((data) => {
console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
## bundle.queryExtensionAbilityInfosByWant<sup>9+</sup>
queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, userId: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void
Obtains the Extension ability information based on a given want. This API uses an asynchronous callback to return the result.
**Required permissions**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO
**System capability**
| Name | Readable/Writable| Type | Mandatory | Description | SystemCapability.BundleManager.BundleFramework
| ----------- | ---- | ------ | ---- | ---------------------------------------- |
| deviceId | Read-only | string | No | ID of the device that runs the ability. | **Parameters**
| bundleName | Read-only | string | Yes | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.|
| abilityName | Read-only | string | Yes | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.| | Name | Type | Mandatory | Description |
| uri | Read-only | string | No | Resource ID. | | -------------- | ---------------------------------------- | ---- | ---------------------------------------- |
| shortName | Read-only | string | No | Short name of the **ElementName**. | | want | [Want](js-apis-application-Want.md) | Yes | Want that contains the bundle name. |
| extensionFlags | number | Yes | Extension ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
| callback | AsyncCallback<Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)>> | Yes | Callback used to return the Extension ability information. |
**Example**
```js
let extensionFlags = 0;
let userId = 100;
let want = {
bundleName : "com.example.myapplication",
abilityName : "com.example.myapplication.MainAbility"
};
bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, userId, (err, data) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
}
console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
## bundle.queryExtensionAbilityInfosByWant<sup>9+</sup>
queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void;
Obtains the Extension ability information based on a given want. This API uses an asynchronous callback to return the result.
**Required permissions**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO
**System capability**
SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory | Description |
| -------------- | ---------------------------------------- | ---- | ---------------------------------------- |
| want | [Want](js-apis-application-Want.md) | Yes | Want that contains the bundle name. |
| extensionFlags | number | Yes | Extension ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback | AsyncCallback<Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)>> | Yes | Callback used to return the Extension ability information. |
**Example**
```js
let extensionFlags = 0;
let want = {
bundleName : "com.example.myapplication",
abilityName : "com.example.myapplication.MainAbility"
};
bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
}
console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
## InstallErrorCode ## InstallErrorCode
...@@ -1181,6 +1364,7 @@ Enumerates bundle flags. ...@@ -1181,6 +1364,7 @@ Enumerates bundle flags.
| GET_APPLICATION_INFO_WITH_PERMISSION | 0x00000008 | Obtains the application information with the permission information. | | GET_APPLICATION_INFO_WITH_PERMISSION | 0x00000008 | Obtains the application information with the permission information. |
| GET_BUNDLE_WITH_REQUESTED_PERMISSION | 0x00000010 | Obtains the bundle information with the information about the required permissions. | | GET_BUNDLE_WITH_REQUESTED_PERMISSION | 0x00000010 | Obtains the bundle information with the information about the required permissions. |
| GET_ABILITY_INFO_WITH_METADATA<sup>8+</sup> | 0x00000020 | Obtains the ability metadata information. | | GET_ABILITY_INFO_WITH_METADATA<sup>8+</sup> | 0x00000020 | Obtains the ability metadata information. |
| GET_BUNDLE_WITH_EXTENSION_ABILITY<sup>9+</sup> | 0x00000020 | Obtains the bundle information with the Extension ability information.|
| GET_APPLICATION_INFO_WITH_METADATA<sup>8+</sup> | 0x00000040 | Obtains the application metadata information. | | GET_APPLICATION_INFO_WITH_METADATA<sup>8+</sup> | 0x00000040 | Obtains the application metadata information. |
| GET_ABILITY_INFO_SYSTEMAPP_ONLY<sup>8+</sup> | 0x00000080 | Obtains the ability information of system applications.| | GET_ABILITY_INFO_SYSTEMAPP_ONLY<sup>8+</sup> | 0x00000080 | Obtains the ability information of system applications.|
| GET_ABILITY_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000100 | Obtains information about disabled abilities. | | GET_ABILITY_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000100 | Obtains information about disabled abilities. |
...@@ -1197,174 +1381,6 @@ Describes the bundle options. ...@@ -1197,174 +1381,6 @@ Describes the bundle options.
| ------ | ------ | ---- | ---- | ---------------------------- | | ------ | ------ | ---- | ---- | ---------------------------- |
| userId | number | Yes | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.| | userId | number | Yes | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
## BundleInfo
Describes the application bundle information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable | Writable | Description |
| --------------------------------- | ---------------------------- | ---- | ---- | --------------------- |
| name | string | Yes | No | Bundle name. |
| type | string | Yes | No | Bundle type. |
| appId | string | Yes | No | ID of the application to which the bundle belongs. |
| uid | number | Yes | No | UID of the application to which the bundle belongs. |
| installTime | number | Yes | No | Time when the HAP file was installed. |
| updateTime | number | Yes | No | Time when the HAP file was updated. |
| appInfo | ApplicationInfo | Yes | No | Application configuration information. |
| abilityInfos | Array\<AbilityInfo> | Yes | No | Ability configuration information. |
| reqPermissions | Array\<string> | Yes | No | Array of the permissions to request from the system. |
| reqPermissionDetails | Array\<ReqPermissionDetail> | Yes | No | Detailed information of the permissions to request from the system.|
| vendor | string | Yes | No | Vendor of the bundle. |
| versionCode | number | Yes | No | Version number of the bundle. |
| versionName | string | Yes | No | Version description of the bundle. |
| compatibleVersion | number | Yes | No | Earliest SDK version required for running the bundle. |
| targetVersion | number | Yes | No | Latest SDK version required for running the bundle. |
| isCompressNativeLibs | boolean | Yes | No | Whether to compress the native library of the bundle. The default value is **true**. |
| hapModuleInfos | Array\<HapModuleInfo> | Yes | No | Module configuration information. |
| entryModuleName | string | Yes | No | Name of the entry module. |
| cpuAbi | string | Yes | No | cpuAbi information of the bundle. |
| isSilentInstallation | string | Yes | No | Whether to install the bundle in silent mode. |
| minCompatibleVersionCode | number | Yes | No | Earliest version compatible with the bundle in the distributed scenario. |
| entryInstallationFree | boolean | Yes | No | Whether installation-free is supported for the entry module. |
| reqPermissionStates<sup>8+</sup> | Array\<number> | Yes | No | Permission grant state. |
## ApplicationInfo
Describes the application information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable | Writable | Description |
| -------------------------- | ---------------------------------- | ---- | ---- | --------------------- |
| name | string | Yes | No | Application name. |
| description | string | Yes | No | Application description. |
| descriptionId | number | Yes | No | Application description ID. |
| systemApp | boolean | Yes | No | Whether the application is a system application. The default value is **false**. |
| enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. |
| label | string | Yes | No | Application label. |
| labelId | string | Yes | No | Application label ID. |
| icon | string | Yes | No | Application icon. |
| iconId | string | Yes | No | Application icon ID. |
| process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used.|
| supportedModes | number | Yes | No | Running modes supported by the application. |
| moduleSourceDirs | Array\<string> | Yes | No | Relative paths for storing application resources. |
| permissions | Array\<string> | Yes | No | Permissions required for accessing the application. |
| moduleInfos | Array\<ModuleInfo> | Yes | No | Application module information. |
| entryDir | string | Yes | No | Path for storing application files. |
| codePath<sup>8+</sup> | string | Yes | No | Installation directory of the application. |
| metaData<sup>8+</sup> | Map<string, Array\<CustomizeData>> | Yes | No | Custom metadata of the application. |
| removable<sup>8+</sup> | boolean | Yes | No | Whether the application is removable. |
| accessTokenId<sup>8+</sup> | number | Yes | No | Access token ID of the application. |
| uid<sup>8+</sup> | number | Yes | No | UID of the application. |
## ModuleInfo
Describes the module information of the application.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable | Writable | Description |
| --------------- | ------ | ---- | ---- | ---- |
| moduleName | string | Yes | No | Module name.|
| moduleSourceDir | string | Yes | No | Installation directory.|
## CustomizeData
Describes the custom metadata.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable | Writable | Description |
| ------------------ | ------ | ---- | ---- | -------- |
| name | string | Yes | Yes | Custom metadata name.|
| value | string | Yes | Yes | Custom metadata value. |
| extra<sup>8+</sup> | string | Yes | Yes | Custom resources. |
## HapModuleInfo
Describes the HAP module information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable | Writable | Description |
| --------------------------------- | ---------------------------- | ---- | ---- | ------------------ |
| name | string | Yes | No | Module name. |
| description | string | Yes | No | Module description. |
| descriptionId | number | Yes | No | Module description ID. |
| icon | string | Yes | No | Module icon. |
| label | string | Yes | No | Module label. |
| labelId | number | Yes | No | Module label ID. |
| iconId | number | Yes | No | Module icon ID. |
| backgroundImg | string | Yes | No | Module background image. |
| supportedModes | number | Yes | No | Modes supported by the module. |
| reqCapabilities | Array\<string> | Yes | No | Capabilities required for module running. |
| deviceTypes | Array\<string> | Yes | No | An array of supported device types. |
| abilityInfo | Array\<AbilityInfo> | Yes | No | Ability information. |
| moduleName | string | Yes | No | Module name. |
| mainAbilityName | string | Yes | No | Name of the entry ability. |
| installationFree | boolean | Yes | No | Whether installation-free is supported. |
## ReqPermissionDetail
Describes the detailed information of the permissions to request from the system.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable | Writable | Description |
| --------- | --------- | ---- | ---- | ---------- |
| name | string | Yes | Yes | Name of the permission to request. |
| reason | string | Yes | Yes | Reason for requesting the permission. |
| usedScene | UsedScene | Yes | Yes | Application scenario and timing for using the permission.|
## UsedScene
Describes the application scenario and timing for using the permission.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable | Writable | Description |
| --------- | -------------- | ---- | ---- | ---------------- |
| abilities | Array\<string> | Yes | Yes | Abilities that use the permission.|
| when | string | Yes | Yes | Time when the permission is used. |
## AbilityInfo
Describes the ability information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable | Writable | Description |
| --------------------- | --------------------- | ---- | ---- | ------------------------ |
| bundleName | string | Yes | No | Application bundle name. |
| name | string | Yes | No | Ability name. |
| label | string | Yes | No | Ability name visible to users. |
| description | string | Yes | No | Ability description. |
| icon | string | Yes | No | Index of the ability icon resource file. |
| descriptionId | number | Yes | No | Ability description ID. |
| iconId | number | Yes | No | Ability icon ID. |
| moduleName | string | Yes | No | Name of the HAP file to which the ability belongs. |
| process | string | Yes | No | Process in which this ability runs. If this parameter is not set, the bundle name is used by default.|
| targetAbility | string | Yes | No | Target ability that the ability alias points to. |
| backgroundModes | number | Yes | No | Background service mode of the ability. |
| isVisible | boolean | Yes | No | Whether the ability can be called by other applications. |
| formEnabled | boolean | Yes | No | Whether the ability provides the service widget capability. |
| type | AbilityType | Yes | No | Ability type. |
| orientation | DisplayOrientation | Yes | No | Ability display orientation. |
| launchMode | LaunchMode | Yes | No | Ability launch mode. |
| permissions | Array\<string> | Yes | No | Permissions required for other applications to call the ability.|
| deviceTypes | Array\<string> | Yes | No | Device types supported by the ability. |
| deviceCapabilities | Array\<string> | Yes | No | Device capabilities required for the ability. |
| readPermission | string | Yes | No | Permission required for reading the ability data. |
| writePermission | string | Yes | No | Permission required for writing data to the ability. |
| applicationInfo | ApplicationInfo | Yes | No | Application configuration information. |
| uri | string | Yes | No | URI of the ability. |
| labelId | number | Yes | No | Ability label ID. |
| subType | AbilitySubType | Yes | No | Subtype of the template that can be used by the ability. |
| metaData<sup>8+</sup> | Array\<CustomizeData> | Yes | No | Custom information of the ability. |
| enabled<sup>8+</sup> | boolean | Yes | No | Whether the ability is enabled. |
## AbilityType ## AbilityType
...@@ -1414,6 +1430,37 @@ Enumerates ability subtypes. ...@@ -1414,6 +1430,37 @@ Enumerates ability subtypes.
| UNSPECIFIED | 0 | Undefined ability subtype. | | UNSPECIFIED | 0 | Undefined ability subtype. |
| CA | 1 | Ability that has a UI.| | CA | 1 | Ability that has a UI.|
## ExtensionAbilityType<sup>9+</sup>
Enumerates Extension ability types.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Description |
| ------------------------------ | ---- | ------------------------- |
| FORM<sup>9+</sup> | 0 | Form included. |
| WORK_SCHEDULER<sup>9+</sup> | 1 | Work scheduler included.|
| INPUT_METHOD<sup>9+</sup> | 2 | Input method included. |
| SERVICE<sup>9+</sup> | 3 | Service included. |
| ACCESSIBILITY<sup>9+</sup> | 4 | Accessibility included. |
| DATA_SHARE<sup>9+</sup> | 5 | Data sharing included.|
| FILE_SHARE<sup>9+</sup> | 6 | File sharing included.|
| STATIC_SUBSCRIBER<sup>9+</sup> | 7 | Subscribers included. |
| WALLPAPER<sup>9+</sup> | 8 | Wallpaper included. |
| UNSPECIFIED<sup>9+</sup> | 9 | Unspecified type. |
## ExtensionFlag<sup>9+</sup>
Enumerates Extension flags.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Default Value | Description |
| ---------------------------------------- | ---------- | ------------------------------ |
| GET_EXTENSION_INFO_DEFAULT<sup>9+</sup> | 0x00000000 | Obtains the default Extension ability information. |
| GET_EXTENSION_INFO_WITH_PERMISSION<sup>9+</sup> | 0x00000002 | Obtains the Extension ability information that carries permission information. |
| GET_EXTENSION_INFO_WITH_APPLICATION<sup>9+</sup> | 0x00000004 | Obtains the Extension ability information that carries application information. |
| GET_EXTENSION_INFO_WITH_METADATA<sup>9+</sup> | 0x00000020 | Obtains the Extension ability information that carries metadata information.|
## ColorMode ## ColorMode
...@@ -1427,7 +1474,6 @@ Enumerates color modes. ...@@ -1427,7 +1474,6 @@ Enumerates color modes.
| DARK_MODE | 0 | Dark mode.| | DARK_MODE | 0 | Dark mode.|
| LIGHT_MODE | 1 | Light mode.| | LIGHT_MODE | 1 | Light mode.|
## GrantStatus ## GrantStatus
Enumerates permission grant states. Enumerates permission grant states.
......
# AbilityInfo
> **NOTE**<br/>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> API version 9 is a canary version for trial use. The APIs of this version may be unstable.
Provides the ability information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description |
| --------------------- | -------------------------------------------------------- | ---- | ---- | ----------------------------------------- |
| bundleName | string | Yes | No | Bundle name of the application. |
| name | string | Yes | No | Ability name. |
| label | string | Yes | No | Ability name visible to users. |
| description | string | Yes | No | Ability description. |
| icon | string | Yes | No | Index of the ability icon resource file. |
| descriptionId | number | Yes | No | Ability description ID. |
| iconId | number | Yes | No | Ability icon ID. |
| moduleName | string | Yes | No | Name of the HAP file to which the ability belongs. |
| process | string | Yes | No | Process in which the ability runs. If this parameter is not set, the bundle name is used.|
| targetAbility | string | Yes | No | Target ability that the ability alias points to. |
| backgroundModes | number | Yes | No | Background service mode of the ability. |
| isVisible | boolean | Yes | No | Whether the ability can be called by other applications. |
| formEnabled | boolean | Yes | No | Whether the ability provides the service widget capability. |
| type | AbilityType | Yes | No | Ability type. |
| orientation | DisplayOrientation | Yes | No | Ability display orientation. |
| launchMode | LaunchMode | Yes | No | Ability launch mode. |
| permissions | Array\<string> | Yes | No | Permissions required for other applications to call the ability.|
| deviceTypes | Array\<string> | Yes | No | Device types supported by the ability. |
| deviceCapabilities | Array\<string> | Yes | No | Device capabilities required for the ability. |
| readPermission | string | Yes | No | Permission required for reading the ability data. |
| writePermission | string | Yes | No | Permission required for writing data to the ability. |
| applicationInfo | ApplicationInfo | Yes | No | Application configuration information. |
| uri | string | Yes | No | URI of the ability. |
| labelId | number | Yes | No | Ability label ID. |
| subType | AbilitySubType | Yes | No | Subtype of the template that can be used by the ability. |
| metaData<sup>8+</sup> | Array\<[CustomizeData](js-apis-bundle-CustomizeData.md)> | Yes | No | Custom metadata of the ability. |
| metaData<sup>9+</sup> | Array\<[Metadata](js-apis-bundle-Metadata.md)> | Yes | No | Metadata of the ability. |
| enabled<sup>8+</sup> | boolean | Yes | No | Whether the ability is enabled. |
# ApplicationInfo
> **NOTE**<br>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> API version 9 is a canary version for trial use. The APIs of this version may be unstable.
Provides the application information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description |
| -------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------ |
| name | string | Yes | No | Application name. |
| description | string | Yes | No | Application description. |
| descriptionId | number | Yes | No | Application description ID. |
| systemApp | boolean | Yes | No | Whether the application is a system application. The default value is **false**. |
| enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. |
| label | string | Yes | No | Application label. |
| labelId | string | Yes | No | Application label ID. |
| icon | string | Yes | No | Application icon. |
| iconId | string | Yes | No | Application icon ID. |
| process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used.|
| supportedModes | number | Yes | No | Running modes supported by the application. |
| moduleSourceDirs | Array\<string> | Yes | No | Relative paths for storing application resources. |
| permissions | Array\<string> | Yes | No | Permissions required for accessing the application. |
| moduleInfos | Array\<[ModuleInfo](js-apis-bundle-ModuleInfo.md)> | Yes | No | Application module information. |
| entryDir | string | Yes | No | Path for storing application files. |
| codePath<sup>8+</sup> | string | Yes | No | Installation directory of the application. |
| metaData<sup>8+</sup> | Map\<string, Array\<[CustomizeData](js-apis-bundle-CustomizeData.md)>> | Yes | No | Custom metadata of the application. |
| metaData<sup>9+</sup> | Map\<string, Array\<[Metadata](js-apis-bundle-Metadata.md)>> | Yes | No | Metadata of the application. |
| removable<sup>8+</sup> | boolean | Yes | No | Whether the application is removable. |
| accessTokenId<sup>8+</sup> | number | Yes | No | Access token ID of the application. |
| uid<sup>8+</sup> | number | Yes | No | UID of the application. |
| entityType<sup>8+</sup> | string | Yes | No | Entity type of the application. |
# BundleInfo
> **NOTE**<br>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> API version 9 is a canary version for trial use. The APIs of this version may be unstable.
Provides the application bundle information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description |
| --------------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------ |
| name | string | Yes | No | Bundle name. |
| type | string | Yes | No | Bundle type. |
| appId | string | Yes | No | ID of the application to which the bundle belongs. |
| uid | number | Yes | No | UID of the application to which the bundle belongs. |
| installTime | number | Yes | No | Time when the HAP file was installed. |
| updateTime | number | Yes | No | Time when the HAP file was updated. |
| appInfo | ApplicationInfo | Yes | No | Application configuration information. |
| abilityInfos | Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes | No | Ability configuration information. |
| reqPermissions | Array\<string> | Yes | No | Permissions to request from the system for running the application. |
| reqPermissionDetails | Array\<[ReqPermissionDetail](#ReqPermissionDetail)> | Yes | No | Detailed information of the permissions to request from the system.|
| vendor | string | Yes | No | Vendor of the bundle. |
| versionCode | number | Yes | No | Version number of the bundle. |
| versionName | string | Yes | No | Version description of the bundle. |
| compatibleVersion | number | Yes | No | Earliest SDK version required for running the bundle. |
| targetVersion | number | Yes | No | Latest SDK version required for running the bundle. |
| isCompressNativeLibs | boolean | Yes | No | Whether to compress the native library of the bundle. The default value is **true**. |
| hapModuleInfos | Array\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | Yes | No | Module configuration information. |
| entryModuleName | string | Yes | No | Name of the entry module. |
| cpuAbi | string | Yes | No | cpuAbi information of the bundle. |
| isSilentInstallation | string | Yes | No | Whether the application can be installed in silent mode. |
| minCompatibleVersionCode | number | Yes | No | Earliest version compatible with the bundle in the distributed scenario. |
| entryInstallationFree | boolean | Yes | No | Whether installation-free is supported for the entry module. |
| reqPermissionStates<sup>8+</sup> | Array\<number> | Yes | No | Permission grant state. |
| extensionAbilityInfo<sup>9+</sup> | Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)> | Yes | No | Extension ability information. |
## ReqPermissionDetail
Provides the detailed information of the permissions to request from the system.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description |
| --------------------- | ----------------------- | ---- | ---- | -------------------- |
| name | string | Yes | Yes | Name of the permission to request. |
| reason | string | Yes | Yes | Reason for requesting the permission. |
| usedScene | [UsedScene](#usedscene) | Yes | Yes | Application scenario and timing for using the permission.|
## UsedScene
Describes the application scenario and timing for using the permission.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description |
| --------- | -------------- | ---- | ---- | ------------------------- |
| abilities | Array\<string> | Yes | Yes | Abilities that use the permission.|
| when | string | Yes | Yes | Time when the permission is used. |
# CustomizeData
> **NOTE**<br>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides custom metadata.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description |
| ------------------ | ------ | ---- | ---- | ---------------- |
| name | string | Yes | Yes | Custom metadata name.|
| value | string | Yes | Yes | Custom metadata value. |
| extra<sup>8+</sup> | string | Yes | Yes | Custom metadata resources. |
# ExtensionAbilityInfo
> **NOTE**<br>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> API version 9 is a canary version for trial use. The APIs of this version may be unstable.
Provides the Extension ability information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description |
| -------------------- | ---------------------------------------------------- | ---- | ---- | -------------------------------------------------- |
| bundleName | string | Yes | No | Bundle name of the application. |
| moduleName | string | Yes | No | Name of the HAP file to which the Extension ability belongs. |
| name | string | Yes | No | Name of the Extension ability. |
| labelId | number | Yes | No | Label ID of the Extension ability. |
| descriptionId | number | Yes | No | Description ID of the Extension ability. |
| iconId | number | Yes | No | Icon ID of the Extension ability. |
| isVisible | boolean | Yes | No | Whether the Extension ability can be called by other applications. |
| extensionAbilityType | bundle.ExtensionAbilityType | Yes | No | Type of the Extension ability. |
| permissions | Array\<string> | Yes | No | Permissions required for other applications to call the Extension ability.|
| applicationInfo | ApplicationInfo | Yes | No | Application information of the Extension ability. |
| metaData | Array\<[Metadata](js-apis-bundle-Metadata.md)> | Yes | No | Metadata of the Extension ability. |
| enabled | boolean | Yes | No | Whether the Extension ability is enabled. |
| readPermission | string | Yes | No | Permission required for reading the Extension ability data. |
| writePermission | string | Yes | No | Permission required for writing data to the Extension ability. |
# HapModuleInfo
> **NOTE**<br>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> API version 9 is a canary version for trial use. The APIs of this version may be unstable.
Provides the HAP module information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description |
| --------------------------------- | ------------------------------------------------------------ | ---- | ---- | -------------------- |
| name | string | Yes | No | Module name. |
| description | string | Yes | No | Module description. |
| descriptionId | number | Yes | No | Module description ID. |
| icon | string | Yes | No | Module icon. |
| label | string | Yes | No | Module label. |
| labelId | number | Yes | No | Module label ID. |
| iconId | number | Yes | No | Module icon ID. |
| backgroundImg | string | Yes | No | Module background image. |
| supportedModes | number | Yes | No | Running modes supported by the module. |
| reqCapabilities | Array\<string> | Yes | No | Capabilities required for module running. |
| deviceTypes | Array\<string> | Yes | No | Device types supported by the module. |
| abilityInfo | Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes | No | Ability information. |
| moduleName | string | Yes | No | Module name. |
| mainAbilityName | string | Yes | No | Name of the main ability. |
| installationFree | boolean | Yes | No | Whether installation-free is supported. |
| mainElementName<sup>9+</sup> | string | Yes | No | Information about the main ability. |
| extensionAbilityInfo<sup>9+</sup> | Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)> | Yes | No | Information about the Extension ability.|
| metadata<sup>9+</sup> | Array\<[Metadata](js-apis-bundle-Metadata.md)> | Yes | No | Metadata of the ability. |
# Metadata
> **NOTE**<br>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> API version 9 is a canary version for trial use. The APIs of this version may be unstable.
Provides the metadata information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description |
| -------- | ------ | ---- | ---- | ---------- |
| name | string | Yes | Yes | Metadata name.|
| value | string | Yes | Yes | Metadata value. |
| resource | string | Yes | Yes | Metadata resource.|
# ModuleInfo
> **NOTE**<br>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides the module information of the application.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description |
| --------------- | ------ | ---- | ---- | -------- |
| moduleName | string | Yes | No | Module name.|
| moduleSourceDir | string | Yes | No | Installation directory.|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册