From c004b7293480b32b009266a661410efa0991d4d1 Mon Sep 17 00:00:00 2001 From: Gloria Date: Thu, 9 Mar 2023 19:15:26 +0800 Subject: [PATCH] Update docs against 15645 Signed-off-by: wusongqing --- .../reference/apis/js-apis-Bundle.md | 16 +-- .../reference/apis/js-apis-bundleManager.md | 118 ++++++++++++++++-- .../reference/apis/js-apis-bundleMonitor.md | 4 +- .../reference/apis/js-apis-installer.md | 3 +- .../reference/apis/js-apis-system-package.md | 2 - 5 files changed, 122 insertions(+), 21 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-Bundle.md b/en/application-dev/reference/apis/js-apis-Bundle.md index e3f7e1a1d1..8c9e825557 100644 --- a/en/application-dev/reference/apis/js-apis-Bundle.md +++ b/en/application-dev/reference/apis/js-apis-Bundle.md @@ -156,7 +156,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> +getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise\\> Obtains the information of all bundles of the specified user. This API uses a promise to return the result. @@ -199,7 +199,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>): void +getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback\\>): void Obtains the information of all bundles of the current user. This API uses an asynchronous callback to return the result. @@ -236,7 +236,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>): void +getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback\\>): void Obtains the information of all bundles of the specified user. This API uses an asynchronous callback to return the result. @@ -822,7 +822,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> +getAllApplicationInfo(bundleFlags: number, userId?: number): Promise\\> Obtains the information about all applications of the specified user. This API uses a promise to return the result. @@ -864,7 +864,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>): void +getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback\\>): 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> +queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise\\> 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>): void +queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\\>): 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>): void; +queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback\\>): void; Obtains the ability information based on given Want. This API uses an asynchronous callback to return the result. diff --git a/en/application-dev/reference/apis/js-apis-bundleManager.md b/en/application-dev/reference/apis/js-apis-bundleManager.md index cac8e51923..1cef53613b 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager.md @@ -2215,7 +2215,7 @@ try { ### bundleManager.getProfileByAbility -getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback>): void; +getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback\\>): 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>; +getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise\\>; 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>): void; +getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback\\>): 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>; +getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise\\>; 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. @@ -2658,7 +2658,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. @@ -2709,6 +2708,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'; @@ -2726,7 +2761,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. @@ -2742,7 +2776,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** @@ -2777,6 +2811,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'; @@ -2789,3 +2859,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.| diff --git a/en/application-dev/reference/apis/js-apis-bundleMonitor.md b/en/application-dev/reference/apis/js-apis-bundleMonitor.md index 11f54832d6..b1601cfc66 100644 --- a/en/application-dev/reference/apis/js-apis-bundleMonitor.md +++ b/en/application-dev/reference/apis/js-apis-bundleMonitor.md @@ -33,7 +33,7 @@ For details, see [Permission Levels](../../security/accesstoken-overview.md). ## bundleMonitor.on -on(type: BundleChangedEvent, callback: callback\): void; +on(type: BundleChangedEvent, callback: Callback\): void; Subscribes to bundle installation, uninstall, and update events. @@ -66,7 +66,7 @@ try { ## bundleMonitor.off -off(type: BundleChangedEvent, callback?: callback\): void; +off(type: BundleChangedEvent, callback?: Callback\): void; Unsubscribes from bundle installation, uninstall, and update events. diff --git a/en/application-dev/reference/apis/js-apis-installer.md b/en/application-dev/reference/apis/js-apis-installer.md index 4478dff76f..bd6f57d3dc 100644 --- a/en/application-dev/reference/apis/js-apis-installer.md +++ b/en/application-dev/reference/apis/js-apis-installer.md @@ -174,7 +174,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** @@ -283,7 +282,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. | diff --git a/en/application-dev/reference/apis/js-apis-system-package.md b/en/application-dev/reference/apis/js-apis-system-package.md index 5c562892d8..9644d0fa26 100644 --- a/en/application-dev/reference/apis/js-apis-system-package.md +++ b/en/application-dev/reference/apis/js-apis-system-package.md @@ -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** -- GitLab