提交 a1290f84 编写于 作者: G Gloria

Update docs against 15610+14639+13979

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 0fd5ad6d
......@@ -157,7 +157,7 @@ bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => {
> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead.
getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise<Array\<BundleInfo>>
getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise\<Array\<BundleInfo\>\>
Obtains the information of all bundles of the specified user. This API uses a promise to return the result.
......@@ -201,7 +201,7 @@ bundle.getAllBundleInfo(bundleFlag, userId)
> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead.
getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback<Array\<BundleInfo>>): void
getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback\<Array\<BundleInfo\>\>): void
Obtains the information of all bundles of the current user. This API uses an asynchronous callback to return the result.
......@@ -238,7 +238,7 @@ bundle.getAllBundleInfo(bundleFlag, (err, data) => {
> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead.
getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback<Array\<BundleInfo>>): void
getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback\<Array\<BundleInfo\>\>): void
Obtains the information of all bundles of the specified user. This API uses an asynchronous callback to return the result.
......@@ -823,7 +823,7 @@ bundle.getPermissionDef(permissionName).then((data) => {
> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo) instead.
getAllApplicationInfo(bundleFlags: number, userId?: number): Promise<Array\<ApplicationInfo>>
getAllApplicationInfo(bundleFlags: number, userId?: number): Promise\<Array\<ApplicationInfo\>\>
Obtains the information about all applications of the specified user. This API uses a promise to return the result.
......@@ -865,7 +865,7 @@ bundle.getAllApplicationInfo(bundleFlags, userId)
> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo) instead.
getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback<Array\<ApplicationInfo>>): void
getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<ApplicationInfo\>\>): void
Obtains the information about all applications. This API uses an asynchronous callback to return the result.
......@@ -1320,7 +1320,7 @@ bundle.isApplicationEnabled(bundleName, (err, data) => {
> This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead.
queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise<Array\<AbilityInfo>>
queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise\<Array\<AbilityInfo\>\>
Obtains the ability information based on given Want. This API uses a promise to return the result.
......@@ -1371,7 +1371,7 @@ bundle.queryAbilityByWant(want, bundleFlags, userId)
> This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead.
queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback<Array\<AbilityInfo>>): void
queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<AbilityInfo\>\>): void
Obtains the ability information of the specified user based on given Want. This API uses an asynchronous callback to return the result.
......@@ -1416,7 +1416,7 @@ bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => {
> This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead.
queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback<Array\<AbilityInfo>>): void;
queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback\<Array\<AbilityInfo\>\>): void;
Obtains the ability information based on given Want. This API uses an asynchronous callback to return the result.
......
......@@ -2215,7 +2215,7 @@ try {
### bundleManager.getProfileByAbility
getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback<Array\<string>>): void;
getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback\<Array\<string\>\>): void;
Obtains the JSON strings of the configuration file based on the given module ame, ability name, and metadata name. This API uses an asynchronous callback to return the result.
......@@ -2266,7 +2266,7 @@ try {
### bundleManager.getProfileByAbility
getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise<Array\<string>>;
getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise\<Array\<string\>\>;
Obtains the JSON strings of the configuration file based on the given module ame, ability name, and metadata name. This API uses a promise to return the result.
......@@ -2336,7 +2336,7 @@ try {
### bundleManager.getProfileByExtensionAbility
getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback<Array\<string>>): void;
getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback\<Array\<string\>\>): void;
Obtains the JSON strings of the configuration file based on the given module ame, Extension ability name, and metadata name. This API uses an asynchronous callback to return the result.
......@@ -2386,7 +2386,7 @@ try {
### bundleManager.getProfileByExtensionAbility
getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise<Array\<string>>;
getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise\<Array\<string\>\>;
Obtains the JSON strings of the configuration file based on the given module ame, Extension ability name, and metadata name. This API uses a promise to return the result.
......@@ -2659,7 +2659,6 @@ try {
### bundleManager.getApplicationInfoSync
getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md);
getApplicationInfoSync(bundleName: string, applicationFlags: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md);
Synchronously obtains the application information based on the given bundle name, application flags, and user ID.
......@@ -2710,6 +2709,42 @@ try {
}
```
### bundleManager.getApplicationInfoSync
getApplicationInfoSync(bundleName: string, applicationFlags: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md);
Synchronously obtains the application information based on the given bundle name and application flags.
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ---------------- | -------------------------- | ---- | ----------------------------------------------------- |
| bundleName | string | Yes | Bundle name. |
| applicationFlags | [number](#applicationflag) | Yes | Type of the application information to obtain.|
**Return value**
| Type | Description |
| ----------------------------------------------------------- | ------------------------- |
| [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | Application information obtained.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | -------------------------------------- |
| 17700001 | The specified bundleName is not found. |
| 17700026 | The specified bundle is disabled. |
**Example**
```ts
import bundleManager from '@ohos.bundle.bundleManager';
import hilog from '@ohos.hilog';
......@@ -2727,7 +2762,6 @@ try {
### bundleManager.getBundleInfoSync
getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag), userId: number): [BundleInfo](js-apis-bundleManager-bundleInfo.md);
getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [BundleInfo](js-apis-bundleManager-bundleInfo.md);
Synchronously obtains the bundle information based on the given bundle name, bundle flags, and user ID.
......@@ -2743,7 +2777,7 @@ Synchronously obtains the bundle information based on the given bundle name, bun
| ----------- | ------ | ---- | -------------------------------------------------------- |
| bundleName | string | Yes | Bundle name. |
| bundleFlags | [number](#bundleflag) | Yes | Type of the bundle information to obtain.|
| userId | number | No | User ID. |
| userId | number | Yes | User ID. |
**Return value**
......@@ -2778,6 +2812,42 @@ try {
}
```
### bundleManager.getBundleInfoSync
getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [BundleInfo](js-apis-bundleManager-bundleInfo.md);
Synchronously obtains the bundle information based on the given bundle name and bundle flags.
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | --------------------- | ---- | ------------------------------------------------------ |
| bundleName | string | Yes | Bundle name. |
| bundleFlags | [number](#bundleflag) | Yes | Type of the bundle information to obtain.|
**Return value**
| Type | Description |
| ------------------------------------------------- | -------------------- |
| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | Bundle information obtained.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | -------------------------------------- |
| 17700001 | The specified bundleName is not found. |
| 17700026 | The specified bundle is disabled. |
**Example**
```ts
import bundleManager from '@ohos.bundle.bundleManager';
import hilog from '@ohos.hilog';
......@@ -2790,3 +2860,37 @@ try {
hilog.error(0x0000, 'testTag', 'getBundleInfoSync failed: %{public}s', err.message);
}
```
## ModuleType
Enumerates the module types.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Value | Description |
| ------- | ---- | -------------------- |
| ENTRY | 1 | Main module of the application. |
| FEATURE | 2 | Dynamic feature module of the application.|
| SHARED | 3 | Dynamic shared library module of the application. |
## BundleType
Enumerates the bundle types.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Value | Description |
| -------------- | ---- | --------------- |
| APP | 0 | The bundle is a common application. |
| ATOMIC_SERVICE | 1 | The bundle is an atomic service.|
## AtomicServiceModuleType
Enumerates the module types of an atomic service.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Value | Description |
| ------ | ---- | --------------------------- |
| NORMAL | 0 | Page package in the atomic service. |
| MAIN | 1 | Landing page package in the atomic service.|
......@@ -16,7 +16,7 @@ import bundleMonitor from '@ohos.bundle.bundleMonitor';
| Permission | Permission Level | Description |
| ------------------------------------ | ----------- | ------------------------------ |
| ohos.permission.LISTEN_BUNDLE_CHANGE | system_core | Permission to listen for bundle installation, uninstall, and updates.|
| ohos.permission.LISTEN_BUNDLE_CHANGE | system_basic | Permission to listen for bundle installation, uninstall, and updates.|
For details, see [Permission Levels](../../security/accesstoken-overview.md).
......@@ -33,7 +33,7 @@ For details, see [Permission Levels](../../security/accesstoken-overview.md).
## bundleMonitor.on
on(type: BundleChangedEvent, callback: callback\<BundleChangedInfo>): void;
on(type: BundleChangedEvent, callback: Callback\<BundleChangedInfo>): void;
Subscribes to bundle installation, uninstall, and update events.
......@@ -66,7 +66,7 @@ try {
## bundleMonitor.off
off(type: BundleChangedEvent, callback?: callback\<BundleChangedInfo>): void;
off(type: BundleChangedEvent, callback?: Callback\<BundleChangedInfo>): void;
Unsubscribes from bundle installation, uninstall, and update events.
......
......@@ -175,7 +175,6 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| -------- | ------------------------------------------------------------ |
| 17700004 | The specified user ID is not found. |
| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
| 17700101 | The system service is excepted. |
**Example**
......@@ -284,7 +283,7 @@ Defines the parameters that need to be specified for bundle installation, uninst
| Name | Type | Mandatory | Description |
| ------------------------------ | ------------------------------ | ------------------ | ------------------ |
| userId | number | Yes | User ID. You can use [queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#queryosaccountlocalidfromprocess9) to obtain the user of the current process.|
| userId | number | Yes | User ID. You can use [queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#getOsAccountLocalId) to obtain the user of the current process.|
| installFlag | number | Yes | Installation flag. The value **0** means initial installation and **1** means overwrite installation.|
| isKeepData | boolean | Yes | Whether to retain the data directory during bundle uninstall.|
| hashParams | Array<[HashParam](#hashparam)> | Yes| Hash parameters. |
......
......@@ -23,8 +23,6 @@ hasInstalled(options: CheckPackageHasInstalledOptions): void
Checks whether an application exists, or whether a native application has been installed.
**Required permissions**: none
**System capability**: SystemCapability.BundleManager.BundleFramework
**Parameters**
......
......@@ -3,9 +3,11 @@
## 17700001 Bundle Name Does Not Exist
**Error Message**
The specified bundle name is not found.
**Description**
When a query API is called, the bundle name passed in does not exist.
**Possible Causes**
......@@ -14,15 +16,18 @@ When a query API is called, the bundle name passed in does not exist.
2. The corresponding bundle is not installed.
**Solution**
1. Check whether the spelling of the bundle name is correct.
2. Check whether the corresponding bundle is installed.
## 17700002 Module Name Does Not Exist
**Error Message**
The specified module name is not found.
**Description**
When a query API or an installation-free API is called, the module name passed in does not exist.
**Possible Causes**
......@@ -36,9 +41,11 @@ When a query API or an installation-free API is called, the module name passed i
## 17700003 Ability Name Does Not Exist
**Error Message**
The specified ability name is not found.
**Description**
When a query API is called, the ability name passed in does not exist.
**Possible Causes**
......@@ -52,9 +59,11 @@ When a query API is called, the ability name passed in does not exist.
## 17700004 User ID Does Not Exist
**Error Message**
The specified user ID is not found.
**Description**
When a user-related API is called, the user ID passed in does not exist.
**Possible Causes**
......@@ -68,23 +77,29 @@ When a user-related API is called, the user ID passed in does not exist.
## 17700005 appId Is an Empty String
**Error Message**
The specified app ID is empty string.
**Description**
When an API of the **appControl** module is called, the application ID passed in does not exist.
**Possible Causes**
**appId** is an empty string.
**Solution**
Check whether **appId** is an empty string.
## 17700006 Permission Does Not Exist
**Error Message**
The specified permission is not found.
**Description**
When the **getPermissionDef** API of the **bundleManager** module is called, the permission passed in does not exist.
**Possible Causes**
......@@ -98,9 +113,11 @@ When the **getPermissionDef** API of the **bundleManager** module is called, the
## 17700007 Incorrect Device ID
**Error Message**
The specified device ID is not found.
**Description**
When an API of the **distributedBundle** module is called, the device ID passed in does not exist.
**Possible Causes**
......@@ -108,23 +125,28 @@ When an API of the **distributedBundle** module is called, the device ID passed
2. The device ID does not exist.
**Solution**
1. Check whether the device ID is correct.
2. Check whether the device ID exists.
## 17700010 Bundle Installation Failure Due to File Parsing Failure
**Error Message**
Failed to install the HAP because the HAP fails to be parsed.
**Description**
When the **install** API of the **installer** module is called, the HAP passed in fails to be parsed.
**Possible Causes**
1. The HAP is not in ZIP format.
2. The configuration file in the HAP is not in JSON format.
3. Necessary fields are missing in the configuration file.
**Solution**
1. Check whether the HAP is in ZIP format.
2. Check whether the configuration file is in [JSON format](../../quick-start/application-configuration-file-overview-stage.md).
3. Check whether an error message is displayed when DevEco Studio compiles the HAP. If necessary fields are missing, an error message will be displayed.
......@@ -132,9 +154,11 @@ When the **install** API of the **installer** module is called, the HAP passed i
## 17700011 Bundle Installation Failure Due to Signature Verification Failure
**Error Message**
Failed to install the HAP because the HAP signature fails to be verified.
**Description**
Calling the **install** API of the **installer** module to install the bundle fails due to signature verification failure.
**Possible Causes**
......@@ -153,9 +177,11 @@ Calling the **install** API of the **installer** module to install the bundle fa
## 17700012 Bundle Installation Failure Due to Invalid File Path or Too Large File
**Error Message**
Failed to install the HAP because the HAP path is invalid or the HAP is too large.
**Description**
Calling the **install** API of the **installer** module to install the bundle fails because the HAP path is invalid or the HAP is too large.
**Possible Causes**
......@@ -171,51 +197,65 @@ Calling the **install** API of the **installer** module to install the bundle fa
## 17700015 Bundle Installation Failure Due to Different Configuration Information of Multiple HAPs
**Error Message**
Failed to install the HAPs because they have different configuration information.
**Description**
Calling the **install** API of the **installer** module to install the bundle fails because the HAPs have different configuration information.
**Possible Causes**
The fields under **app** in the configuration files of these HAPs are inconsistent.
**Solution**
Check whether the fields under **app** are the same.
## 17700016 Bundle Installation Failure Due to Insufficient System Disk Space
**Error Message**
Failed to install the HAP because of insufficient system disk space.
**Description**
Calling the **install** API of the **installer** module to install the bundle fails due to insufficient system disk space.
**Possible Causes**
The system disk space is insufficient.
**Solution**
Check whether the system has sufficient disk space.
## 17700017 Bundle Installation Failure Because the Version to Install is Too Earlier
**Error Message**
Failed to install the HAP since the version of the HAP to install is too early.
**Description**
Calling the **install** API of the **installer** module to install the bundle fails because the version to install is earlier than the version in use.
**Possible Causes**
The version number is earlier than the version in use.
**Solution**
Ensure that the version of the bundle to install is not earlier than the version in use.
## 17700020 Failure to Uninstall Preinstalled Applications
**Error Message**
The preinstalled app cannot be uninstalled.
**Description**
Calling the **uninstall** API of the **installer** module to uninstall a preinstalled application fails.
**Possible Causes**
......@@ -229,9 +269,11 @@ Calling the **uninstall** API of the **installer** module to uninstall a preinst
## 17700021 Invalid UID
**Error Message**
The specified uid is invalid.
**Description**
When the **getBundleNameByUid** API of the **bundleManager** module is called, the UID passed in is invalid.
**Possible Causes**
......@@ -245,9 +287,11 @@ When the **getBundleNameByUid** API of the **bundleManager** module is called, t
## 17700022 Invalid Source File
**Error Message**
The input source file is invalid.
**Description**
When the **getBundleArchiveInfo** API of the **bundleManager** module is called, the HAP path passed in is invalid.
**Possible Causes**
......@@ -261,23 +305,29 @@ When the **getBundleArchiveInfo** API of the **bundleManager** module is called,
## 17700023 Default Application Does Not Exist
**Error Message**
The specified default app does not exist.
**Description**
When the **getDefaultApplication** API of the **defaultAppManager** module is called, the specified default application does not exist.
**Possible Causes**
No default application is set for the device.
**Solution**
Check whether the default application is set on the device.
## 17700024 Configuration File Does Not Exist
**Error Message**
Failed to get the profile because there is no profile in the HAP.
**Description**
When an API for querying the profile is called, the configuration file does not exist
**Possible Causes**
......@@ -291,9 +341,11 @@ When an API for querying the profile is called, the configuration file does not
## 17700025 Invalid Type
**Error Message**
The specified type is invalid.
**Description**
When an API of the **defaultAppManager** module is called, the type passed in is invalid.
**Possible Causes**
......@@ -307,71 +359,113 @@ When an API of the **defaultAppManager** module is called, the type passed in is
## 17700026 Bundle Disabled
**Error Message**
The specified bundle is disabled.
**Description**
When an API for querying bundle information is called, the specified bundle is disabled.
**Possible Causes**
The bundle on the device has been disabled and cannot be queried.
**Solution**
Check whether the bundle on the device is disabled.
## 17700027 Distributed Service Is Not Started
**Error Message**
The distributed service is not running.
**Description**
When an API of the **distributedBundle** module is called, the distributed service is not started.
**Possible Causes**
The device is not networked.
**Solution**
Check whether the device is networked.
## 17700028 Mismatch Between Ability and Type
**Error Message**
The ability does not match the type.
**Description**
When the **setDefaultApplication** API of the **defaultAppManager** module is called, the **ability** and **type** passed in do not match.
**Possible Causes**
The ability and type are misspelled.
**Solution**
Check whether the spellings of ability and type are correct.
## 17700029 Disabled Ability
**Error Message**
The specified ability is disabled.
**Description**
When an API for querying ability information is called, the specified ability is disabled.
**Possible Causes**
The specified ability is disabled.
**Solution**
Check whether the ability is disabled. You can run the [bm commands](../../../readme/bundle-management.md#bm-commands) to query the information.
## 17700030 Failure in Clearing Cache Files
**Error Message**
The specified bundle does not support clearing of cache files.
**Description**
When the **cleanBundleCacheFiles** API of the **bundleManager** module is called, the specified bundle does not support cache file clearing.
**Possible Causes**
The application is a system application and the **AllowAppDataNotCleared** field is configured in the signing certificate.
**Solution**
1. Check whether the application is a system application. You can run the [bm commands](../../../readme/bundle-management.md#bm-commands) to query the application information and check whether the value of **isSystemApp** is **true**.
2. Check whether the **AllowAppDataNotCleared field** is configured for the application. You can run the [bm commands](../../../readme/bundle-management.md#bm-commands) to query the application information and check whether the value of **userDataClearable** is **true**.
<!--no_check-->
## 17700031 HAP Installation Fails Due to Overlay Feature Verification Failure
**Error Message**
Failed to install the HAP because the overlay check of the HAP is failed.
**Description**
The target application and the to-be-installed application with the overlay feature are not preset applications, or the target application or target module is one with the overlay feature.
**Possible Causes**
1. To use the overlay feature between applications, the following conditions must be met:<br>The application with the overlay feature must be a preset application.
2. The target application must be a preset application.
3. The target application cannot be an application with the overlay feature.
4. The target module cannot be a module with the overlay feature.
**Solution**
1. Ensure that the application with the overlay feature is a preset application.
2. Ensure that the target application is a preset application.
3. Ensure that the target application is not an application with the overlay feature.
4. Ensure that the target module is not a module with the overlay feature.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册