From 86996ca15c83267d45b669e55db31855cc7c355d Mon Sep 17 00:00:00 2001 From: zhaogan Date: Fri, 25 Nov 2022 01:39:54 +0000 Subject: [PATCH] =?UTF-8?q?Issue:=20#I631GP=20Description:=20=E5=8C=85?= =?UTF-8?q?=E7=AE=A1=E7=90=86API=E6=95=B4=E6=94=B9=E8=B5=84=E6=96=99?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20Sig:=20SIG=5FApplicaitonFramework=20Featur?= =?UTF-8?q?e=20or=20Bugfix:=20Feature=20Binary=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhaogan --- .../reference/apis/js-apis-bundleManager.md | 695 +++++++++--------- .../reference/apis/js-apis-bundleMonitor.md | 34 +- .../apis/js-apis-defaultAppManager.md | 43 +- .../apis/js-apis-distributedBundle.md | 116 ++- .../reference/apis/js-apis-freeInstall.md | 92 +-- .../reference/apis/js-apis-installer.md | 68 +- .../apis/js-apis-launcherBundleManager.md | 101 ++- .../reference/apis/js-apis-zlib.md | 103 +-- 8 files changed, 649 insertions(+), 603 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md index 66a3bcad64..831e412913 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md @@ -14,10 +14,10 @@ import bundleManager from '@ohos.bundle.bundleManager' | 权限 | 权限等级 | 描述 | | ------------------------------------------ | ------------ | ------------------| -| ohos.permission.GET_BUNDLE_INFO | normal | 查询指定应用信息 | -| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | 可查询所有应用信息 | -| ohos.permission.REMOVE_CACHE_FILES | system_basic | 清理应用缓存 | -|ohos.permission.CHANGE_ABILITY_ENABLED_STATE| system_basic | 设置禁用使能所需的权限 | +| ohos.permission.GET_BUNDLE_INFO | normal | 查询指定应用信息。 | +| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | 可查询所有应用信息。 | +| ohos.permission.REMOVE_CACHE_FILES | system_basic | 清理应用缓存。 | +|ohos.permission.CHANGE_ABILITY_ENABLED_STATE| system_basic | 设置禁用使能所需的权限。 | 权限等级参考[权限等级说明](../../security/accesstoken-overview.md#权限等级说明)。 @@ -25,63 +25,73 @@ import bundleManager from '@ohos.bundle.bundleManager' ### BundleFlag +包信息标志,指示需要获取的包信息的内容。 + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 | 名称 | 值 | 说明 | | ----------------------------------------- | ---------- | ------------------------------------------------------------ | -| GET_BUNDLE_INFO_DEFAULT | 0x00000000 | 用于获取默认bundleInfo,获取的bundleInfo不包含signatureInfo、applicationInfo、hapModuleInfo、ability、extensionAbility和permission的信息 | -| GET_BUNDLE_INFO_WITH_APPLICATION | 0x00000001 | 用于获取包含applicationInfo的bundleInfo,获取的bundleInfo不包含signatureInfo、hapModuleInfo、ability、extensionAbility和permission的信息 | -| GET_BUNDLE_INFO_WITH_HAP_MODULE | 0x00000002 | 用于获取包含hapModuleInfo的bundleInfo,获取的bundleInfo不包含signatureInfo、applicationInfo、ability、extensionAbility和permission的信息 | -| GET_BUNDLE_INFO_WITH_ABILITY | 0x00000004 | 用于获取包含ability的bundleInfo,获取的bundleInfo不包含signatureInfo、applicationInfo、extensionAbility和permission的信息。它不能单独使用,需要与GET_BUNDLE_INFO_WITH_HAP_MODULE一起使用 | +| GET_BUNDLE_INFO_DEFAULT | 0x00000000 | 用于获取默认bundleInfo,获取的bundleInfo不包含signatureInfo、applicationInfo、hapModuleInfo、ability、extensionAbility和permission的信息。 | +| GET_BUNDLE_INFO_WITH_APPLICATION | 0x00000001 | 用于获取包含applicationInfo的bundleInfo,获取的bundleInfo不包含signatureInfo、hapModuleInfo、ability、extensionAbility和permission的信息。 | +| GET_BUNDLE_INFO_WITH_HAP_MODULE | 0x00000002 | 用于获取包含hapModuleInfo的bundleInfo,获取的bundleInfo不包含signatureInfo、applicationInfo、ability、extensionAbility和permission的信息。 | +| GET_BUNDLE_INFO_WITH_ABILITY | 0x00000004 | 用于获取包含ability的bundleInfo,获取的bundleInfo不包含signatureInfo、applicationInfo、extensionAbility和permission的信息。它不能单独使用,需要与GET_BUNDLE_INFO_WITH_HAP_MODULE一起使用。 | | GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY | 0x00000008 | 用于获取包含extensionAbility的bundleInfo,获取的bundleInfo不包含signatureInfo、applicationInfo、ability 和permission的信息。它不能单独使用,需要与GET_BUNDLE_INFO_WITH_HAP_MODULE一起使用。 | -| GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION | 0x00000010 | 用于获取包含permission的bundleInfo。获取的bundleInfo不包含signatureInfo、applicationInfo、hapModuleInfo、extensionAbility和ability的信息 | -| GET_BUNDLE_INFO_WITH_METADATA | 0x00000020 | 用于获取applicationInfo、moduleInfo和abilityInfo中包含的metadata。它不能单独使用,它需要与GET_BUNDLE_INFO_WITH_APPLICATION、GET_BUNDLE_INFO_WITH_HAP_MODULE、GET_BUNDLE_INFO_WITH_ABILITY、GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY一起使用 | -| GET_BUNDLE_INFO_WITH_DISABLE | 0x00000040 | 用于获取application被禁用的BundleInfo和被禁用的Ability信息。获取的bundleInfo不包含signatureInfo、applicationInfo、hapModuleInfo、ability、extensionAbility和permission的信息 | -| GET_BUNDLE_INFO_WITH_SIGNATURE_INFO | 0x00000080 | 用于获取包含signatureInfo的bundleInfo。获取的bundleInfo不包含applicationInfo、hapModuleInfo、extensionAbility、ability和permission的信息 | +| GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION | 0x00000010 | 用于获取包含permission的bundleInfo。获取的bundleInfo不包含signatureInfo、applicationInfo、hapModuleInfo、extensionAbility和ability的信息。 | +| GET_BUNDLE_INFO_WITH_METADATA | 0x00000020 | 用于获取applicationInfo、moduleInfo和abilityInfo中包含的metadata。它不能单独使用,它需要与GET_BUNDLE_INFO_WITH_APPLICATION、GET_BUNDLE_INFO_WITH_HAP_MODULE、GET_BUNDLE_INFO_WITH_ABILITY、GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY一起使用。 | +| GET_BUNDLE_INFO_WITH_DISABLE | 0x00000040 | 用于获取application被禁用的BundleInfo和被禁用的Ability信息。获取的bundleInfo不包含signatureInfo、applicationInfo、hapModuleInfo、ability、extensionAbility和permission的信息。 | +| GET_BUNDLE_INFO_WITH_SIGNATURE_INFO | 0x00000080 | 用于获取包含signatureInfo的bundleInfo。获取的bundleInfo不包含applicationInfo、hapModuleInfo、extensionAbility、ability和permission的信息。 | ### ApplicationFlag +应用信息标志,指示需要获取的应用信息的内容。 + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 **系统接口:** 系统接口,不支持三方应用调用。 | 名称 | 值 | 说明 | | ------------------------------------ | ---------- | ------------------------------------------------------------ | -| GET_APPLICATION_INFO_DEFAULT | 0x00000000 | 用于获取默认的applicationInfo,获取的applicationInfo不包含permission和metadata信息 | -| GET_APPLICATION_INFO_WITH_PERMISSION | 0x00000001 | 用于获取包含permission的applicationInfo | -| GET_APPLICATION_INFO_WITH_METADATA | 0x00000002 | 用于获取包含metadata的applicationInfo | -| GET_APPLICATION_INFO_WITH_DISABLE | 0x00000004 | 用于获取包含禁用应用程序的applicationInfo | +| GET_APPLICATION_INFO_DEFAULT | 0x00000000 | 用于获取默认的applicationInfo,获取的applicationInfo不包含permission和metadata信息。 | +| GET_APPLICATION_INFO_WITH_PERMISSION | 0x00000001 | 用于获取包含permission的applicationInfo。 | +| GET_APPLICATION_INFO_WITH_METADATA | 0x00000002 | 用于获取包含metadata的applicationInfo。 | +| GET_APPLICATION_INFO_WITH_DISABLE | 0x00000004 | 用于获取包含禁用应用程序的applicationInfo。 | ### AbilityFlag +功能组件信息标志,指示需要获取的功能组件信息的内容。 + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 **系统接口:** 系统接口,不支持三方应用调用。 | 名称 | 值 | 说明 | | --------------------------------- | ---------- | ------------------------------------------------------------ | -| GET_ABILITY_INFO_DEFAULT | 0x00000000 | 用于获取默认abilityInfo,获取的abilityInfo不包含permission、metadata和禁用的abilityInfo | -| GET_ABILITY_INFO_WITH_PERMISSION | 0x00000001 | 用于获取包含permission的abilityInfo | -| GET_ABILITY_INFO_WITH_APPLICATION | 0x00000002 | 用于获取包含applicationInfo的abilityInfo | -| GET_ABILITY_INFO_WITH_METADATA | 0x00000004 | 用于获取包含metadata的abilityInfo | -| GET_ABILITY_INFO_WITH_DISABLE | 0x00000008 | 用于获取包含禁用的abilityInfo的abilityInfo | -| GET_ABILITY_INFO_ONLY_SYSTEM_APP | 0x00000010 | 用于仅为系统应用程序获取abilityInfo | +| GET_ABILITY_INFO_DEFAULT | 0x00000000 | 用于获取默认abilityInfo,获取的abilityInfo不包含permission、metadata和禁用的abilityInfo。 | +| GET_ABILITY_INFO_WITH_PERMISSION | 0x00000001 | 用于获取包含permission的abilityInfo。 | +| GET_ABILITY_INFO_WITH_APPLICATION | 0x00000002 | 用于获取包含applicationInfo的abilityInfo。 | +| GET_ABILITY_INFO_WITH_METADATA | 0x00000004 | 用于获取包含metadata的abilityInfo。 | +| GET_ABILITY_INFO_WITH_DISABLE | 0x00000008 | 用于获取包含禁用的abilityInfo的abilityInfo。 | +| GET_ABILITY_INFO_ONLY_SYSTEM_APP | 0x00000010 | 用于仅为系统应用程序获取abilityInfo。 | ### ExtensionAbilityFlag +扩展组件信息标志,指示需要获取的扩展组件信息的内容。 + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 **系统接口:** 系统接口,不支持三方应用调用。 | 名称 | 值 | 说明 | | ------------------------------------------- | ---------- | ------------------------------------------------------------ | -| GET_EXTENSION_ABILITY_INFO_DEFAULT | 0x00000000 | 用于获取默认extensionAbilityInfo。获取的extensionAbilityInfo不包含permission、metadata 和禁用的abilityInfo | -| GET_EXTENSION_ABILITY_INFO_WITH_PERMISSION | 0x00000001 | 用于获取包含permission的extensionAbilityInfo | -| GET_EXTENSION_ABILITY_INFO_WITH_APPLICATION | 0x00000002 | 用于获取包含applicationInfo的extensionAbilityInfo | -| GET_EXTENSION_ABILITY_INFO_WITH_METADATA | 0x00000004 | 用于获取包含metadata的extensionAbilityInfo | +| GET_EXTENSION_ABILITY_INFO_DEFAULT | 0x00000000 | 用于获取默认extensionAbilityInfo。获取的extensionAbilityInfo不包含permission、metadata 和禁用的abilityInfo。 | +| GET_EXTENSION_ABILITY_INFO_WITH_PERMISSION | 0x00000001 | 用于获取包含permission的extensionAbilityInfo。 | +| GET_EXTENSION_ABILITY_INFO_WITH_APPLICATION | 0x00000002 | 用于获取包含applicationInfo的extensionAbilityInfo。 | +| GET_EXTENSION_ABILITY_INFO_WITH_METADATA | 0x00000004 | 用于获取包含metadata的extensionAbilityInfo。 | ### ExtensionAbilityType +指示扩展组件的类型。 + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 | 名称 | 值 | 说明 | @@ -105,64 +115,74 @@ import bundleManager from '@ohos.bundle.bundleManager' ### PermissionGrantState +指示权限授予信息。 + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 | 名称 | 值 | 说明 | |:----------------:|:---:|:---:| -| PERMISSION_DENIED| -1 | 拒绝授予权限 | -| PERMISSION_GRANTED | 0 | 授予权限 | +| PERMISSION_DENIED| -1 | 拒绝授予权限。 | +| PERMISSION_GRANTED | 0 | 授予权限。 | ### SupportWindowMode +标识该组件所支持的窗口模式。 + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 | 名称 | 值 | 说明 | |:----------------:|:---:|:---:| -| FULL_SCREEN | 0 | 窗口支持全屏显示 | -| SPLIT | 1 | 窗口支持分屏显示 | -| FLOATING | 2 | 支持窗口化显示 | +| FULL_SCREEN | 0 | 窗口支持全屏显示。 | +| SPLIT | 1 | 窗口支持分屏显示。 | +| FLOATING | 2 | 支持窗口化显示。 | ### LaunchType +指示组件的启动方式。 + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 | 名称 | 值 | 说明 | |:----------------:|:---:|:---:| -| SINGLETON | 0 | ability的启动模式,表示单实例 | -| STANDARD | 1 | ability的启动模式,表示普通多实例 | -| SPECIFIED | 2 | ability的启动模式,表示该ability内部根据业务自己置顶多实例 | +| SINGLETON | 0 | ability的启动模式,表示单实例。 | +| STANDARD | 1 | ability的启动模式,表示普通多实例。 | +| SPECIFIED | 2 | ability的启动模式,表示该ability内部根据业务自己置顶多实例。 | ### AbilityType +指示Ability组件的类型。 + **模型约束:** 仅可在FA模型下使用 **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 | 名称 | 值 | 说明 | | :-----: | ---- | :--------------------------------------------------------: | -| PAGE | 1 | 表示基于Page模板开发的FA,用于提供与用户交互的能力 | -| SERVICE | 2 | 表示基于Service模板开发的PA,用于提供后台运行任务的能力 | -| DATA | 3 | 表示基于Data模板开发的PA,用于对外部提供统一的数据访问对象 | +| PAGE | 1 | 表示基于Page模板开发的FA,用于提供与用户交互的能力。 | +| SERVICE | 2 | 表示基于Service模板开发的PA,用于提供后台运行任务的能力。 | +| DATA | 3 | 表示基于Data模板开发的PA,用于对外部提供统一的数据访问对象。 | ### DisplayOrientation +标识该Ability的显示模式。该标签仅适用于page类型的Ability。 + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 | 名称 |值 |说明 | |:----------------------------------|---|---| -| UNSPECIFIED |0 |表示未定义方向模式,由系统判定 | -| LANDSCAPE |1 |表示横屏显示模式 | -| PORTRAIT |2 |表示竖屏显示模式 | -| FOLLOW_RECENT |3 |表示跟随上一个显示模式 | -| LANDSCAPE_INVERTED |4 |表示反向横屏显示模式 | -| PORTRAIT_INVERTED |5 |表示反向竖屏显示模式 | -| AUTO_ROTATION |6 |表示传感器自动旋转模式 | -| AUTO_ROTATION_LANDSCAPE |7 |表示传感器自动横向旋转模式 | -| AUTO_ROTATION_PORTRAIT |8 |表示传感器自动竖向旋转模式 | -| AUTO_ROTATION_RESTRICTED |9 |表示受开关控制的自动旋转模式 | -| AUTO_ROTATION_LANDSCAPE_RESTRICTED |10|表述受开关控制的自动横向旋转模式| -| AUTO_ROTATION_PORTRAIT_RESTRICTED |11|表示受开关控制的自动竖向旋转模式| -| LOCKED |12|表示锁定模式| +| UNSPECIFIED |0 |表示未定义方向模式,由系统判定。 | +| LANDSCAPE |1 |表示横屏显示模式。 | +| PORTRAIT |2 |表示竖屏显示模式。 | +| FOLLOW_RECENT |3 |表示跟随上一个显示模式。 | +| LANDSCAPE_INVERTED |4 |表示反向横屏显示模式。 | +| PORTRAIT_INVERTED |5 |表示反向竖屏显示模式。 | +| AUTO_ROTATION |6 |表示传感器自动旋转模式。 | +| AUTO_ROTATION_LANDSCAPE |7 |表示传感器自动横向旋转模式。 | +| AUTO_ROTATION_PORTRAIT |8 |表示传感器自动竖向旋转模式。 | +| AUTO_ROTATION_RESTRICTED |9 |表示受开关控制的自动旋转模式。 | +| AUTO_ROTATION_LANDSCAPE_RESTRICTED |10|表述受开关控制的自动横向旋转模式。| +| AUTO_ROTATION_PORTRAIT_RESTRICTED |11|表示受开关控制的自动竖向旋转模式。| +| LOCKED |12|表示锁定模式。| ## 方法 @@ -178,18 +198,20 @@ getBundleInfoForSelf(bundleFlags: [number](#bundleflag)): Promise\<[BundleInfo]( | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | --------------------- | -| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息 | +| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息。 | **返回值:** | 类型 | 说明 | | ----------------------------------------------------------- | ------------------------------------- | -| Promise\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | Promise对象,返回当前应用的BundleInfo | +| Promise\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | Promise对象,返回当前应用的BundleInfo。| **错误码:** 错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 +**示例:** + ```ts import bundleManager from '@ohos.bundle.bundleManager' let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT; @@ -216,8 +238,8 @@ getBundleInfoForSelf(bundleFlags: [number](#bundleflag), callback: AsyncCallback | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | --------------------- | -| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息 | -| callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的当前应用的BundleInfo;否则为错误对象 | +| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息。 | +| callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的当前应用的BundleInfo;否则为错误对象。 | **错误码:** @@ -258,10 +280,10 @@ getBundleInfo(bundleName: string, bundleFlags: number, userId: number, callback: | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ---------------------------- | -| bundleName | string | 是 | 表示要查询的应用程序包名称 | -| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息| -| userId | number | 是 | 表示用户ID | -| callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的bundleInfo;否则为错误对象 | +| bundleName | string | 是 | 表示要查询的应用程序包名称。 | +| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息。| +| userId | number | 是 | 表示用户ID。 | +| callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的bundleInfo;否则为错误对象。 | **错误码:** @@ -269,9 +291,9 @@ getBundleInfo(bundleName: string, bundleFlags: number, userId: number, callback: | 错误码ID | 错误信息 | | -------- | ------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700004 | The specified userId is not found | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700004 | The specified userId is not found. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -295,7 +317,7 @@ try { } ``` -``` +```ts // 额外获取ApplicationInfo中的metadata import bundleManager from '@ohos.bundle.bundleManager' let bundleName = 'com.example.myapplication'; @@ -331,9 +353,9 @@ getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\< | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ---------------------------- | -| bundleName | string | 是 | 表示要查询的应用程序包名称 | -| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息| -| callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的BundleInfo;否则为错误对象 | +| bundleName | string | 是 | 表示要查询的应用程序包名称。 | +| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息。| +| callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的BundleInfo;否则为错误对象。 | **错误码:** @@ -341,8 +363,8 @@ getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\< | 错误码ID | 错误信息 | | -------- | ------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -381,24 +403,24 @@ getBundleInfo(bundleName: string, bundleFlags: [number](#bundleflag), userId?: n | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ---------------------------- | -| bundleName | string | 是 | 表示要查询的应用程序包名称 | -| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息 | -| userId | number | 否 | 表示用户ID | +| bundleName | string | 是 | 表示要查询的应用程序包名称。 | +| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息。 | +| userId | number | 否 | 表示用户ID。 | **返回值:** | 类型 | 说明 | | ----------------------------------------------------------- | --------------------------- | -| Promise\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | Promise对象,返回BundleInfo | +| Promise\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | Promise对象,返回BundleInfo。 | **错误码:** 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 | 错误码ID | 错误信息 | | -------- | --------------------------------------| -| 17700001 | The specified bundleName is not found | -| 17700004 | The specified userId is not found | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700004 | The specified userId is not found. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -453,10 +475,10 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), use | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------ | ---- | ---------------------------- | -| bundleName | string | 是 | 表示要查询的应用程序包名称 | -| appFlags | [number](#applicationflag) | 是 | 指定返回的ApplicationInfo所包含的信息 | -| userId | number | 是 | 表示用户ID | -| callback | AsyncCallback\<[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的ApplicationInfo;否则为错误对象 | +| bundleName | string | 是 | 表示要查询的应用程序包名称。 | +| appFlags | [number](#applicationflag) | 是 | 指定返回的ApplicationInfo所包含的信息。 | +| userId | number | 是 | 表示用户ID。 | +| callback | AsyncCallback\<[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的ApplicationInfo;否则为错误对象。 | **错误码:** @@ -464,9 +486,9 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), use | 错误码ID | 错误信息 | | -------- | --------------------------------------| -| 17700001 | The specified bundleName is not found | -| 17700004 | The specified userId is not found | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700004 | The specified userId is not found. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -505,9 +527,9 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), cal | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------ | ---- | ---------------------------- | -| bundleName | string | 是 | 表示要查询的应用程序包名称 | -| appFlags | [number](#applicationflag) | 是 | 指定返回的ApplicationInfo所包含的信息 | -| callback | AsyncCallback\<[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的ApplicationInfo;否则为错误对象 | +| bundleName | string | 是 | 表示要查询的应用程序包名称。 | +| appFlags | [number](#applicationflag) | 是 | 指定返回的ApplicationInfo所包含的信息。 | +| callback | AsyncCallback\<[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的ApplicationInfo;否则为错误对象。 | **错误码:** @@ -515,8 +537,8 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), cal | 错误码ID | 错误信息 | | -------- | --------------------------------------| -| 17700001 | The specified bundleName is not found | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -554,15 +576,15 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), use | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------ | ---- | ---------------------------- | -| bundleName | string | 是 | 表示要查询的应用程序包名称 | -| appFlags | [number](#applicationflag) | 是 | 指定返回的ApplicationInfo所包含的信息 | -| userId | number | 否 | 表示用户ID | +| bundleName | string | 是 | 表示要查询的应用程序包名称。 | +| appFlags | [number](#applicationflag) | 是 | 指定返回的ApplicationInfo所包含的信息。 | +| userId | number | 否 | 表示用户ID。 | **返回值:** | 类型 | 说明 | | ------------------------------------------------------------ | -------------------------------- | -| Promise\<[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)> | Promise对象,返回ApplicationInfo | +| Promise\<[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)> | Promise对象,返回ApplicationInfo。 | **错误码:** @@ -570,9 +592,9 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), use | 错误码ID | 错误信息 | | -------- | ------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700004 | The specified userId is not found | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700004 | The specified userId is not found. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -609,9 +631,9 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), userId: number, callback: A | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | -------------------------------------------------- | -| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息 | -| userId | number | 是 | 表示用户ID | -| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象 | +| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息。 | +| userId | number | 是 | 表示用户ID。 | +| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象。 | **错误码:** @@ -619,7 +641,7 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), userId: number, callback: A | 错误码ID | 错误信息 | | -------- | --------------------------------- | -| 17700004 | The specified userId is not found | +| 17700004 | The specified userId is not found. | **示例:** @@ -657,8 +679,8 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), callback: AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象 | +| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息。 | +| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象。 | **错误码:** @@ -699,14 +721,14 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), userId?: number): Promise> | Promise对象,返回Array\ | +| Promise> | Promise对象,返回Array\。 | **错误码:** @@ -714,7 +736,7 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), userId?: number): Promise> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象 | +| appFlags | [number](#applicationflag) | 是 | 指定返回的ApplicationInfo所包含的信息。 | +| userId | number | 是 | 表示用户ID。 | +| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象。 | **错误码:** @@ -759,7 +781,7 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), userId: number, call | 错误码ID | 错误信息 | | -------- | ---------------------------------- | -| 17700004 | The specified userId is not found | +| 17700004 | The specified userId is not found. | **示例:** @@ -797,8 +819,8 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), callback: AsyncCallb | 参数名 | 类型 | 必填 | 说明 | | -------- | ------ | ---- | ----------------------------------------------------------- | -| appFlags | [number](#applicationflag) | 是 | 指定返回的ApplicationInfo所包含的信息 | -| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象 | +| appFlags | [number](#applicationflag) | 是 | 指定返回的ApplicationInfo所包含的信息。 | +| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象。 | **错误码:** @@ -839,14 +861,14 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), userId?: number): Pr | 参数名 | 类型 | 必填 | 说明 | | -------- | ------ | ---- | ---------------------------------------------------------- | -| appFlags | [number](#applicationflag) | 是 | 指定返回的ApplicationInfo所包含的信息 | -| userId | number | 否 | 表示用户ID | +| appFlags | [number](#applicationflag) | 是 | 指定返回的ApplicationInfo所包含的信息。 | +| userId | number | 否 | 表示用户ID。 | **返回值:** | 类型 | 说明 | | ------------------------------------------------------------ | ---------------------------------------- | -| Promise> | Promise对象,返回Array\ | +| Promise> | Promise对象,返回Array\。 | **错误码:** @@ -854,7 +876,7 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), userId?: number): Pr | 错误码ID | 错误信息 | | -------- | ---------------------------------- | -| 17700004 | The specified userId is not found | +| 17700004 | The specified userId is not found. | **示例:** @@ -890,10 +912,10 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), userId: numbe | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------ | ---- | ------------------------------------------------------- | -| want | Want | 是 | 表示包含要查询的应用程序包名称的Want | -| abilityFlags | [number](#abilityflag) | 是 | 指定返回的AbilityInfo所包含的信息 | -| userId | number | 是 | 表示用户ID | -| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象 | +| want | Want | 是 | 表示包含要查询的应用程序包名称的Want。 | +| abilityFlags | [number](#abilityflag) | 是 | 指定返回的AbilityInfo所包含的信息。 | +| userId | number | 是 | 表示用户ID。 | +| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象。 | **错误码:** @@ -901,11 +923,11 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), userId: numbe | 错误码ID | 错误信息 | | -------- | -------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700003 | The specified ability is not found | -| 17700004 | The specified userId is invalid | -| 17700026 | The specified bundle is disabled | -| 17700029 | The specified ability is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700003 | The specified ability is not found. | +| 17700004 | The specified userId is invalid. | +| 17700026 | The specified bundle is disabled. | +| 17700029 | The specified ability is disabled. | **示例:** @@ -947,9 +969,9 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), callback: Asy | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------ | ---- | -------------------------------------------------------| -| want | Want | 是 | 表示包含要查询的应用程序包名称的Want | -| abilityFlags | [number](#abilityflag) | 是 | 指定返回的AbilityInfo所包含的信息 | -| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象 | +| want | Want | 是 | 表示包含要查询的应用程序包名称的Want。 | +| abilityFlags | [number](#abilityflag) | 是 | 指定返回的AbilityInfo所包含的信息。 | +| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象。 | **错误码:** @@ -957,10 +979,10 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), callback: Asy | 错误码ID | 错误信息 | | -------- | -------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700003 | The specified ability is not found | -| 17700026 | The specified bundle is disabled | -| 17700029 | The specified ability is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700003 | The specified ability is not found. | +| 17700026 | The specified bundle is disabled. | +| 17700029 | The specified ability is disabled. | **示例:** @@ -1001,15 +1023,15 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), userId?: numb | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------ | ---- | ------------------------------------------------------- | -| want | Want | 是 | 表示包含要查询的应用程序包名称的Want | -| abilityFlags | [number](#abilityflag) | 是 | 表示指定返回的AbilityInfo所包含的信息 | -| userId | number | 否 | 表示用户ID | +| want | Want | 是 | 表示包含要查询的应用程序包名称的Want。 | +| abilityFlags | [number](#abilityflag) | 是 | 表示指定返回的AbilityInfo所包含的信息。 | +| userId | number | 否 | 表示用户ID。 | **返回值:** | 类型 | 说明 | | ------------------------------------------------------------ | ------------------------------------ | -| Promise> | Promise对象,返回Array\ | +| Promise> | Promise对象,返回Array\。 | **错误码:** @@ -1017,11 +1039,11 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), userId?: numb | 错误码ID | 错误信息 | | -------- | ------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700003 | The specified ability is not found | -| 17700004 | The specified userId is invalid | -| 17700026 | The specified bundle is disabled | -| 17700029 | The specified ability is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700003 | The specified ability is not found. | +| 17700004 | The specified userId is invalid. | +| 17700026 | The specified bundle is disabled. | +| 17700029 | The specified ability is disabled. | **示例:** @@ -1080,11 +1102,11 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp | 参数名 | 类型 | 必填 | 说明 | | --------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| want | Want | 是 | 表示包含要查询的应用程序包名称的Want | -| extensionAbilityType | [ExtensionAbilityType](#extensionabilitytype) | 是 | 标识extensionAbility的类型 | -| extensionAbilityFlags | [number](#extensionabilityflag) | 是 | 表示用于指定将返回的ExtensionInfo对象中包含的信息的标志 | -| userId | number | 是 | 表示用户ID | -| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到Array\;否则为错误对象 | +| want | Want | 是 | 表示包含要查询的应用程序包名称的Want。 | +| extensionAbilityType | [ExtensionAbilityType](#extensionabilitytype) | 是 | 标识extensionAbility的类型。 | +| extensionAbilityFlags | [number](#extensionabilityflag) | 是 | 表示用于指定将返回的ExtensionInfo对象中包含的信息的标志。 | +| userId | number | 是 | 表示用户ID。 | +| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到Array\;否则为错误对象。 | **错误码:** @@ -1092,10 +1114,10 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp | 错误码ID | 错误信息 | | -------- | ------------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700003 | The specified extensionAbility is not found | -| 17700004 | The specified userId is invalid | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700003 | The specified extensionAbility is not found. | +| 17700004 | The specified userId is invalid. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -1138,10 +1160,10 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp | 参数名 | 类型 | 必填 | 说明 | | --------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| want | Want | 是 | 表示包含要查询的应用程序包名称的Want | -| extensionAbilityType | [ExtensionAbilityType](#extensionabilitytype) | 是 | 标识extensionAbility的类型 | -| extensionAbilityFlags | [number](#extensionabilityflag) | 是 | 表示用于指定将返回的ExtensionInfo对象中包含的信息的标志 | -| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到Array\;否则为错误对象 | +| want | Want | 是 | 表示包含要查询的应用程序包名称的Want。 | +| extensionAbilityType | [ExtensionAbilityType](#extensionabilitytype) | 是 | 标识extensionAbility的类型。 | +| extensionAbilityFlags | [number](#extensionabilityflag) | 是 | 表示用于指定将返回的ExtensionInfo对象中包含的信息的标志。 | +| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到Array\;否则为错误对象。 | **错误码:** @@ -1149,9 +1171,9 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp | 错误码ID | 错误信息 | | -------- | ------------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700003 | The specified extensionAbility is not found | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700003 | The specified extensionAbility is not found. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -1193,16 +1215,16 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp | 参数名 | 类型 | 必填 | 说明 | | --------------------- | --------------------------------------------- | ---- | ------------------------------------------------------- | -| want | Want | 是 | 表示包含要查询的应用程序包名称的Want | -| extensionAbilityType | [ExtensionAbilityType](#extensionabilitytype) | 是 | 标识extensionAbility的类型 | -| extensionAbilityFlags | [number](#extensionabilityflag) | 是 | 表示用于指定将返回的ExtensionInfo对象中包含的信息的标志 | -| userId | number | 否 | 表示用户ID | +| want | Want | 是 | 表示包含要查询的应用程序包名称的Want。 | +| extensionAbilityType | [ExtensionAbilityType](#extensionabilitytype) | 是 | 标识extensionAbility的类型。 | +| extensionAbilityFlags | [number](#extensionabilityflag) | 是 | 表示用于指定将返回的ExtensionInfo对象中包含的信息的标志。 | +| userId | number | 否 | 表示用户ID。 | **返回值:** | 类型 | 说明 | | ------------------------------------------------------------ | --------------------------------------------- | -| Promise> | Promise对象,返回Array\ | +| Promise> | Promise对象,返回Array\。 | **错误码:** @@ -1210,10 +1232,10 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp | 错误码ID | 错误信息 | | -------- | --------------------------------------| -| 17700001 | The specified bundleName is not found | -| 17700003 | The specified extensionAbility is not found | -| 17700004 | The specified userId is invalid | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700003 | The specified extensionAbility is not found. | +| 17700004 | The specified userId is invalid. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -1275,8 +1297,8 @@ getBundleNameByUid(uid: number, callback: AsyncCallback\): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------- | ---- | ------------------------------------------------------------ | -| uid | number | 是 | 表示应用程序的UID | -| callback | AsyncCallback\ | 是 | 回调函数,当获取成功时,err为null,data为获取到的BundleName;否则为错误对象 | +| uid | number | 是 | 表示应用程序的UID。 | +| callback | AsyncCallback\ | 是 | 回调函数,当获取成功时,err为null,data为获取到的BundleName;否则为错误对象。 | **错误码:** @@ -1284,7 +1306,7 @@ getBundleNameByUid(uid: number, callback: AsyncCallback\): void; | 错误码ID | 错误信息 | | -------- | --------------------- | -| 17700021 | The uid is not found | +| 17700021 | The uid is not found. | **示例:** @@ -1320,13 +1342,13 @@ getBundleNameByUid(uid: number): Promise\; | 参数名 | 类型 | 必填 | 说明 | | ---- | ------ | ---- | ------------------ | -| uid | number | 是 | 表示应用程序的UID | +| uid | number | 是 | 表示应用程序的UID。 | **返回值:** | 类型 | 说明 | | ---------------- | --------------------------- | -| Promise\ | Promise对象,返回bundleName | +| Promise\ | Promise对象,返回bundleName。 | **错误码:** @@ -1334,7 +1356,7 @@ getBundleNameByUid(uid: number): Promise\; | 错误码ID | 错误信息 | | -------- | ---------------------| -| 17700021 | The uid is not found | +| 17700021 | The uid is not found. | **示例:** @@ -1368,9 +1390,9 @@ getBundleArchiveInfo(hapFilePath: string, bundleFlags: [number](#bundleflag), ca | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ----------------------------------------------------------- | -| hapFilePath | string | 是 | 表示存储HAP的路径,路径应该是当前应用程序数据目录的相对路径 | -| bundleFlags | [number](#bundleflag) | 是 | 表示用于指定要返回的BundleInfo对象中包含的信息的标志 | -| callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的BundleInfo;否则为错误对象 | +| hapFilePath | string | 是 | 表示存储HAP的路径,路径应该是当前应用程序数据目录的相对路径。 | +| bundleFlags | [number](#bundleflag) | 是 | 表示用于指定要返回的BundleInfo对象中包含的信息的标志。 | +| callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的BundleInfo;否则为错误对象。 | **错误码:** @@ -1378,7 +1400,7 @@ getBundleArchiveInfo(hapFilePath: string, bundleFlags: [number](#bundleflag), ca | 错误码ID | 错误信息 | | -------- | --------------------------- | -| 17700022 | The hapFilePath is invalid | +| 17700022 | The hapFilePath is invalid. | **示例:** @@ -1416,14 +1438,14 @@ getBundleArchiveInfo(hapFilePath: string, bundleFlags: [number](#bundleflag)): | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ------------------------------------------------------------ | -| hapFilePath | string | 是 | 表示存储HAP的路径,路径应该是当前应用程序数据目录的相对路径 | -| bundleFlags | [number](#bundleflag) | 是 | 表示用于指定要返回的BundleInfo对象中包含的信息的标志 | +| hapFilePath | string | 是 | 表示存储HAP的路径,路径应该是当前应用程序数据目录的相对路径。 | +| bundleFlags | [number](#bundleflag) | 是 | 表示用于指定要返回的BundleInfo对象中包含的信息的标志。 | **返回值:** | 类型 | 说明 | | ----------------------------------------------------------- | --------------------------- | -| Promise\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | Promise对象,返回BundleInfo | +| Promise\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | Promise对象,返回BundleInfo。 | **错误码:** @@ -1431,7 +1453,7 @@ getBundleArchiveInfo(hapFilePath: string, bundleFlags: [number](#bundleflag)): | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 17700022 | The hapFilePath is invalid | +| 17700022 | The hapFilePath is invalid. | **示例:** @@ -1467,8 +1489,8 @@ cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback\): void; | 参数名 | 类型 | 必填 | 说明 | | ---------- | -------------------- | ---- | ------------------------------------------------------------ | -| bundleName | string | 是 | 表示要清理其缓存数据的应用程序的bundleName | -| callback | AsyncCallback\ | 是 | 回调函数,当清理应用缓存目录数据成功,err为null,否则为错误对象 | +| bundleName | string | 是 | 表示要清理其缓存数据的应用程序的bundleName。 | +| callback | AsyncCallback\ | 是 | 回调函数,当清理应用缓存目录数据成功,err为null,否则为错误对象。 | **错误码:** @@ -1476,8 +1498,8 @@ cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback\): void; | 错误码ID | 错误信息 | | -------- | ------------------------------------------------------------ | -| 17700001 | The specified bundleName is not found | -| 17700030 | The specified bundleName does not support cleaning cache files | +| 17700001 | The specified bundleName is not found. | +| 17700030 | The specified bundleName does not support cleaning cache files. | **示例:** @@ -1514,13 +1536,13 @@ cleanBundleCacheFiles(bundleName: string): Promise\; | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------ | ---- | ------------------------------------------ | -| bundleName | string | 是 | 表示要清理其缓存数据的应用程序的bundleName | +| bundleName | string | 是 | 表示要清理其缓存数据的应用程序的bundleName。 | **返回值:** | 类型 | 说明 | | -------------- | ------------------------------------------------------------ | -| Promise\ | Promise对象,返回true表示清理应用缓存目录数据成功,返回false表示清理应用缓存目录数据失败 | +| Promise\ | Promise对象,返回true表示清理应用缓存目录数据成功,返回false表示清理应用缓存目录数据失败。 | **错误码:** @@ -1528,8 +1550,8 @@ cleanBundleCacheFiles(bundleName: string): Promise\; | 错误码ID | 错误信息 | | -------- | ---------------------------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700030 | The specified bundle does not support cleaning cache files | +| 17700001 | The specified bundleName is not found. | +| 17700030 | The specified bundle does not support cleaning cache files. | **示例:** @@ -1564,9 +1586,9 @@ setApplicationEnabled(bundleName: string, isEnabled: boolean, callback: AsyncCal | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------- | ---- | ------------------------------------- | -| bundleName | string | 是 | 指定应用的bundleName | -| isEnabled | boolean | 是 | 值为true表示使能,值为false表示禁用 | -| callback | AsyncCallback\ | 是 | 回调函数,当设置应用禁用使能状态成功时,err为null,否则为错误对象 | +| bundleName | string | 是 | 指定应用的bundleName。 | +| isEnabled | boolean | 是 | 值为true表示使能,值为false表示禁用。 | +| callback | AsyncCallback\ | 是 | 回调函数,当设置应用禁用使能状态成功时,err为null,否则为错误对象。 | **错误码:** @@ -1574,7 +1596,7 @@ setApplicationEnabled(bundleName: string, isEnabled: boolean, callback: AsyncCal | 错误码ID | 错误信息 | | -------- | -------------------------------------- | -| 17700001 | The specified bundleName is not found | +| 17700001 | The specified bundleName is not found. | **示例:** @@ -1611,14 +1633,14 @@ setApplicationEnabled(bundleName: string, isEnabled: boolean): Promise\; | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------- | ---- | ------------------------------------- | -| bundleName | string | 是 | 表示应用程序的bundleName | -| isEnabled | boolean | 是 | 值为true表示使能,值为false表示禁用 | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| isEnabled | boolean | 是 | 值为true表示使能,值为false表示禁用。 | **返回值:** | 类型 | 说明 | | -------------- | ------------------------------------ | -| Promise\ | Promise对象。无返回结果的Promise对象 | +| Promise\ | Promise对象。无返回结果的Promise对象。 | **错误码:** @@ -1626,7 +1648,7 @@ setApplicationEnabled(bundleName: string, isEnabled: boolean): Promise\; | 错误码ID | 错误信息 | | -------- | -------------------------------------- | -| 17700001 | The specified bundleName is not found | +| 17700001 | The specified bundleName is not found. | **示例:** @@ -1661,9 +1683,9 @@ setAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), isE | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------- | ---- | ------------------------------------- | -| info | [AbilityInfo](js-apis-bundleManager-abilityInfo.md) | 是 | 需要被设置的组件 | -| isEnabled| boolean | 是 | 值为true表示使能,值为false表示禁用 | -| callback | AsyncCallback\ | | 回调函数,当设置组件禁用使能状态成功时,err为null,否则为错误对象 | +| info | [AbilityInfo](js-apis-bundleManager-abilityInfo.md) | 是 | 需要被设置的组件。 | +| isEnabled| boolean | 是 | 值为true表示使能,值为false表示禁用。 | +| callback | AsyncCallback\ | 是 | 回调函数,当设置组件禁用使能状态成功时,err为null,否则为错误对象。 | **错误码:** @@ -1671,8 +1693,8 @@ setAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), isE | 错误码ID | 错误信息 | | -------- | ---------------------------------------| -| 17700001 | The specified bundleName is not found | -| 17700003 | The specified abilityInfo is not found | +| 17700001 | The specified bundleName is not found. | +| 17700003 | The specified abilityInfo is not found. | **示例:** @@ -1722,14 +1744,14 @@ setAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), isE | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------- | ---- | ------------------------------------- | -| info | [AbilityInfo](js-apis-bundleManager-abilityInfo.md) | 是 | 需要被设置的组件 | -| isEnabled| boolean | 是 | 值为true表示使能,值为false表示禁用 | +| info | [AbilityInfo](js-apis-bundleManager-abilityInfo.md) | 是 | 需要被设置的组件。 | +| isEnabled| boolean | 是 | 值为true表示使能,值为false表示禁用。 | **返回值:** | 类型 | 说明 | | -------------- | --------------------------------- | -| Promise\ | Promise对象。无返回结果的Promise对象 | +| Promise\ | Promise对象。无返回结果的Promise对象。 | **错误码:** @@ -1737,8 +1759,8 @@ setAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), isE | 错误码ID | 错误信息 | | -------- | -------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700003 | The specified abilityInfo is not found | +| 17700001 | The specified bundleName is not found. | +| 17700003 | The specified abilityInfo is not found. | **示例:** @@ -1784,8 +1806,8 @@ isApplicationEnabled(bundleName: string, callback: AsyncCallback\): voi | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------ | ---- | -------------------------- | -| bundleName | string | 是 | 表示应用程序的bundleName | -| callback | AsyncCallback\ | 是 | 回调函数,返回true表示当前应用为使能状态,返回false表示应用为禁用状态 | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| callback | AsyncCallback\ | 是 | 回调函数,返回true表示当前应用为使能状态,返回false表示应用为禁用状态。 | **错误码:** @@ -1793,7 +1815,7 @@ isApplicationEnabled(bundleName: string, callback: AsyncCallback\): voi | 错误码ID | 错误信息 | | -------- | -------------------------------------- | -| 17700001 | The specified bundleName is not found | +| 17700001 | The specified bundleName is not found. | **示例:** @@ -1828,7 +1850,7 @@ isApplicationEnabled(bundleName: string): Promise\; | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------ | ---- | -------------------------- | -| bundleName | string | 是 | 表示应用程序的bundleName | +| bundleName | string | 是 | 表示应用程序的bundleName。 | **返回值:** @@ -1842,7 +1864,7 @@ isApplicationEnabled(bundleName: string): Promise\; | 错误码ID | 错误信息 | | -------- | -------------------------------------- | -| 17700001 | The specified bundleName is not found | +| 17700001 | The specified bundleName is not found. | **示例:** @@ -1875,8 +1897,8 @@ isAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), call | 参数名 | 类型 | 必填 | 说明 | | ---- | ----------- | ---- | --------------------------- | -| info | [AbilityInfo](js-apis-bundleManager-abilityInfo.md) | 是 | 表示关于检查ability的信息 | -| callback | AsyncCallback\ | 是 | 回调函数,返回true表示当前应用组件为使能状态,返回false表示应用组件为禁用状态 | +| info | [AbilityInfo](js-apis-bundleManager-abilityInfo.md) | 是 | 表示关于检查ability的信息。 | +| callback | AsyncCallback\ | 是 | 回调函数,返回true表示当前应用组件为使能状态,返回false表示应用组件为禁用状态。 | **错误码:** @@ -1884,8 +1906,8 @@ isAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), call | 错误码ID | 错误信息 | | -------- | --------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700003 | The specified abilityName is not found | +| 17700001 | The specified bundleName is not found. | +| 17700003 | The specified abilityName is not found. | **示例:** @@ -1933,7 +1955,7 @@ isAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md)): Pro | 参数名 | 类型 | 必填 | 说明 | | ---- | ----------- | ---- | --------------------------- | -| info | [AbilityInfo](js-apis-bundleManager-abilityInfo.md) | 是 | 表示关于检查ability的信息 | +| info | [AbilityInfo](js-apis-bundleManager-abilityInfo.md) | 是 | 表示关于检查ability的信息。 | **返回值:** @@ -1947,8 +1969,8 @@ isAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md)): Pro | 错误码ID | 错误信息 | | -------- | --------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700003 | The specified abilityName is not found | +| 17700001 | The specified bundleName is not found. | +| 17700003 | The specified abilityName is not found. | **示例:** @@ -1996,9 +2018,9 @@ getLaunchWantForBundle(bundleName: string, userId: number, callback: AsyncCallba | 参数名 | 类型 | 必填 | 说明 | | ---------- | -------------------- | ---- | ------------------------------------------------------------ | -| bundleName | string | 是 | 表示应用程序的bundleName | -| userId | number | 是 | 表示用户ID | -| callback | AsyncCallback\ | 是 | 回调函数,当获取成功时,err为null,data为获取到的Want;否则为错误对象 | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| userId | number | 是 | 表示用户ID。 | +| callback | AsyncCallback\ | 是 | 回调函数,当获取成功时,err为null,data为获取到的Want;否则为错误对象。 | **错误码:** @@ -2006,9 +2028,9 @@ getLaunchWantForBundle(bundleName: string, userId: number, callback: AsyncCallba | 错误码ID | 错误信息 | | -------- | --------------------------------------| -| 17700001 | The specified bundleName is not found | -| 17700004 | The specified userId is not found | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700004 | The specified userId is not found. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -2046,8 +2068,8 @@ getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | ---------- | -------------------- | ---- | ------------------------------------------------------------ | -| bundleName | string | 是 | 表示应用程序的bundleName | -| callback | AsyncCallback\ | 是 | 回调函数,当获取成功时,err为null,data为获取到的Want;否则为错误对象 | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| callback | AsyncCallback\ | 是 | 回调函数,当获取成功时,err为null,data为获取到的Want;否则为错误对象。 | **错误码:** @@ -2055,8 +2077,8 @@ getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | --------------------------------------| -| 17700001 | The specified bundleName is not found | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -2091,16 +2113,16 @@ getLaunchWantForBundle(bundleName: string, userId?: number): Promise\; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ---------- | ------ | ---- | ------------------------ | -| bundleName | string | 是 | 表示应用程序的bundleName | -| userId | number | 否 | 表示用户ID| +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ------ | ---- | ------------------------- | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| userId | number | 否 | 表示用户ID。 | **返回值:** | 类型 | 说明 | | -------------- | ------------------------- | -| Promise\ | Promise对象,返回Want对象 | +| Promise\ | Promise对象,返回Want对象。 | **错误码:** @@ -2108,9 +2130,9 @@ getLaunchWantForBundle(bundleName: string, userId?: number): Promise\; | 错误码ID | 错误信息 | | -------- | --------------------------------------| -| 17700001 | The specified bundleName is not found | -| 17700004 | The specified userId is not found | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700004 | The specified userId is not found. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -2142,10 +2164,10 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName: strin | 参数名 | 类型 | 必填 | 说明 | | ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | -| moduleName | string | 是 | 表示应用程序的moduleName | -| abilityName | string | 是 | 表示应用程序的abilityName | -| metadataName | string | 是 | 表示应用程序的metadataName | -| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象 | +| moduleName | string | 是 | 表示应用程序的moduleName。 | +| abilityName | string | 是 | 表示应用程序的abilityName。 | +| metadataName | string | 是 | 表示应用程序的metadataName。 | +| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象。 | **错误码:** @@ -2153,11 +2175,11 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName: strin | 错误码ID | 错误信息 | | -------- | ------------------------------------------------------------ | -| 17700002 | The specified moduleName is not existed | -| 17700003 | The specified abilityName is not existed | -| 17700024 | The specified metadataName is not existed or the profile is not json-format | -| 17700026 | The specified bundle is disabled | -| 17700029 | The specified ability is disabled | +| 17700002 | The specified moduleName is not existed. | +| 17700003 | The specified abilityName is not existed. | +| 17700024 | The specified metadataName is not existed or the profile is not json-format. | +| 17700026 | The specified bundle is disabled. | +| 17700029 | The specified ability is disabled. | **示例:** @@ -2192,15 +2214,15 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName?: stri | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------ | ---- | -------------------------- | -| moduleName | string | 是 | 表示应用程序的moduleName | -| abilityName | string | 是 | 表示应用程序的abilityName | -| metadataName | string | 否 | 表示应用程序的metadataName | +| moduleName | string | 是 | 表示应用程序的moduleName。 | +| abilityName | string | 是 | 表示应用程序的abilityName。 | +| metadataName | string | 否 | 表示应用程序的metadataName。 | **返回值:** | 类型 | 说明 | | ----------------------- | ------------------------------- | -| Promise> | Promise对象,返回Array\ | +| Promise> | Promise对象,返回Array\。 | **错误码:** @@ -2208,11 +2230,11 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName?: stri | 错误码ID | 错误信息 | | -------- | ------------------------------------------------------------ | -| 17700002 | The specified moduleName is not existed | -| 17700003 | The specified abilityName is not existed | -| 17700024 | The specified metadataName is not existed or the profile is not json-format | -| 17700026 | The specified bundle is disabled | -| 17700029 | The specified ability is disabled | +| 17700002 | The specified moduleName is not existed. | +| 17700003 | The specified abilityName is not existed. | +| 17700024 | The specified metadataName is not existed or the profile is not json-format. | +| 17700026 | The specified bundle is disabled. | +| 17700029 | The specified ability is disabled. | **示例:** @@ -2220,7 +2242,6 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName?: stri import bundleManager from '@ohos.bundle.bundleManager' let moduleName = 'entry'; let abilityName = 'MainAbility'; -let metadataName = 'com.example.myapplication.metadata'; try { bundleManager.getProfileByAbility(moduleName, abilityName).then((data) => { @@ -2231,7 +2252,13 @@ try { } catch (error) { console.error('getProfileByAbility failed. Cause: ' + error.message); } +``` +```ts +import bundleManager from '@ohos.bundle.bundleManager' +let moduleName = 'entry'; +let abilityName = 'MainAbility'; +let metadataName = 'com.example.myapplication.metadata'; try { bundleManager.getProfileByAbility(moduleName, abilityName, metadataName).then((data) => { console.info('getProfileByAbility successfully. Data: ' + JSON.stringify(data)); @@ -2255,10 +2282,10 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m | 名称 | 类型 | 必填 | 说明 | | -------------------- | ----------------------------- | ---- | ------------------------------------------------------------ | -| moduleName | string | 是 | 表示应用程序的moduleName | -| extensionAbilityName | string | 是 | 表示应用程序的extensionAbilityName | -| metadataName | string | 是 | 表示应用程序的metadataName | -| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象 | +| moduleName | string | 是 | 表示应用程序的moduleName。 | +| extensionAbilityName | string | 是 | 表示应用程序的extensionAbilityName。 | +| metadataName | string | 是 | 表示应用程序的metadataName。 | +| callback | AsyncCallback> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象。 | **错误码:** @@ -2266,10 +2293,10 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m | 错误码ID | 错误信息 | | -------- | ------------------------------------------------------------ | -| 17700002 | The specified moduleName is not existed | -| 17700003 | The specified extensionAbilityName is not existed | -| 17700024 | The specified metadataName is not existed or the profile is not json-format | -| 17700026 | The specified bundle is disabled | +| 17700002 | The specified moduleName is not existed. | +| 17700003 | The specified extensionAbilityName is not existed. | +| 17700024 | The specified metadataName is not existed or the profile is not json-format. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -2304,15 +2331,15 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m | 名称 | 类型 | 必填 | 说明 | | -------------------- | ------ | ---- | ---------------------------------- | -| moduleName | string | 是 | 表示应用程序的moduleName | -| extensionAbilityName | string | 是 | 表示应用程序的extensionAbilityName | -| metadataName | string | 否 | 表示应用程序的metadataName | +| moduleName | string | 是 | 表示应用程序的moduleName。 | +| extensionAbilityName | string | 是 | 表示应用程序的extensionAbilityName。 | +| metadataName | string | 否 | 表示应用程序的metadataName。 | **返回值:** | 类型 | 说明 | | ----------------------- | ----------------------------------- | -| Promise> | Promise对象,返回Array\对象 | +| Promise> | Promise对象,返回Array\对象。 | **错误码:** @@ -2320,10 +2347,10 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m | 错误码ID | 错误信息 | | -------- | ------------------------------------------------------------ | -| 17700002 | The specified moduleName is not existed | -| 17700003 | The specified extensionAbilityName is not existed | -| 17700024 | The specified metadataName is not existed or the profile is not json-format | -| 17700026 | The specified bundle is disabled | +| 17700002 | The specified moduleName is not existed. | +| 17700003 | The specified extensionAbilityName is not existed. | +| 17700024 | The specified metadataName is not existed or the profile is not json-format. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -2370,8 +2397,8 @@ getPermissionDef(permissionName: string, callback: AsyncCallback\<[PermissionDef | 名称 | 类型 | 必填 | 说明 | | -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| permissionName | string | 是 | 表示权限名称 | -| callback | AsyncCallback\<[PermissionDef](js-apis-bundleManager-permissionDef.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象 | +| permissionName | string | 是 | 表示权限名称。 | +| callback | AsyncCallback\<[PermissionDef](js-apis-bundleManager-permissionDef.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\;否则为错误对象。 | **错误码:** @@ -2379,7 +2406,7 @@ getPermissionDef(permissionName: string, callback: AsyncCallback\<[PermissionDef | 错误码ID | 错误信息 | | -------- | ------------------------------------- | -| 17700006 | The specified permission is not found | +| 17700006 | The specified permission is not found. | **示例:** @@ -2415,13 +2442,13 @@ getPermissionDef(permissionName: string): Promise\<[PermissionDef](js-apis-bundl | 名称 | 类型 | 必填 | 说明 | | -------------- | ------ | ---- | -------------- | -| permissionName | string | 是 | 表示权限参数名 | +| permissionName | string | 是 | 表示权限参数名。 | **返回值:** | 类型 | 说明 | | ------------------------------------------------------------ | ------------------------------------------ | -| Promise\<[PermissionDef](js-apis-bundleManager-permissionDef.md)> | Promise对象,返回Array\对象 | +| Promise\<[PermissionDef](js-apis-bundleManager-permissionDef.md)> | Promise对象,返回Array\对象。 | **错误码:** @@ -2429,7 +2456,7 @@ getPermissionDef(permissionName: string): Promise\<[PermissionDef](js-apis-bundl | 错误码ID | 错误信息 | | -------- | ------------------------------------- | -| 17700006 | The specified permission is not found | +| 17700006 | The specified permission is not found. | **示例:** @@ -2463,10 +2490,10 @@ getAbilityLabel(bundleName: string, moduleName: string, abilityName: string, cal | 参数名 | 类型 | 必填 | 说明 | | ----------- | ---------------------- | ---- | ------------------------------------------------------------ | -| bundleName | string | 是 | 表示应用程序的bundleName | -| moduleName | string | 是 | 表示应用程序的moduleName | -| abilityName | string | 是 | 表示应用程序的abilityName | -| callback | AsyncCallback\ | 是 | 回调函数,当获取成功时,err为null,data为获指定组件的Label值;否则为错误对象 | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| moduleName | string | 是 | 表示应用程序的moduleName。 | +| abilityName | string | 是 | 表示应用程序的abilityName。 | +| callback | AsyncCallback\ | 是 | 回调函数,当获取成功时,err为null,data为获指定组件的Label值;否则为错误对象。 | **错误码:** @@ -2474,11 +2501,11 @@ getAbilityLabel(bundleName: string, moduleName: string, abilityName: string, cal | 错误码ID | 错误信息 | | -------- | -------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700002 | The specified moduleName is not found | -| 17700003 | The specified abilityName is not found | -| 17700026 | The specified bundle is disabled | -| 17700029 | The specified ability is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified moduleName is not found. | +| 17700003 | The specified abilityName is not found. | +| 17700026 | The specified bundle is disabled. | +| 17700029 | The specified ability is disabled. | **示例:** @@ -2517,15 +2544,15 @@ getAbilityLabel(bundleName: string, moduleName: string, abilityName: string): Pr | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ------------------------- | -| bundleName | string | 是 | 表示应用程序的bundleName | -| moduleName | string | 是 | 表示应用程序的moduleName | -| abilityName | string | 是 | 表示应用程序的abilityName | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| moduleName | string | 是 | 表示应用程序的moduleName。 | +| abilityName | string | 是 | 表示应用程序的abilityName。 | **返回值:** | 类型 | 说明 | | ---------------- | ----------------------------------- | -| Promise\ | Promise对象,返回指定组件的Lablel值 | +| Promise\ | Promise对象,返回指定组件的Lablel值。 | **错误码:** @@ -2533,11 +2560,11 @@ getAbilityLabel(bundleName: string, moduleName: string, abilityName: string): Pr | 错误码ID | 错误信息 | | -------- | --------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700002 | The specified moduleName is not found | -| 17700003 | The specified abilityName is not found | -| 17700026 | The specified bundle is disabled | -| 17700029 | The specified ability is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified moduleName is not found. | +| 17700003 | The specified abilityName is not found. | +| 17700026 | The specified bundle is disabled. | +| 17700029 | The specified ability is disabled. | **示例:** @@ -2574,10 +2601,10 @@ getAbilityIcon(bundleName: string, moduleName: string, abilityName: string, call | 参数名 | 类型 | 必填 | 说明 | | ----------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | -| bundleName | string | 是 | 表示应用程序的bundleName | -| moduleName | string | 是 | 表示应用程序的moduleName | -| abilityName | string | 是 | 表示应用程序的abilityName | -| callback | AsyncCallback<[image.PixelMap](js-apis-image.md#pixelmap7)> | 是 | 回调函数,当获取成功时,err为null,data为指定组件icon的PixelMap对象;否则为错误对象 | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| moduleName | string | 是 | 表示应用程序的moduleName。 | +| abilityName | string | 是 | 表示应用程序的abilityName。 | +| callback | AsyncCallback<[image.PixelMap](js-apis-image.md#pixelmap7)> | 是 | 回调函数,当获取成功时,err为null,data为指定组件icon的PixelMap对象;否则为错误对象。 | **错误码:** @@ -2585,11 +2612,11 @@ getAbilityIcon(bundleName: string, moduleName: string, abilityName: string, call | 错误码ID | 错误信息 | | -------- | -------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700002 | The specified moduleName is not found | -| 17700003 | The specified abilityName is not found | -| 17700026 | The specified bundle is disabled | -| 17700029 | The specified ability is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified moduleName is not found. | +| 17700003 | The specified abilityName is not found. | +| 17700026 | The specified bundle is disabled. | +| 17700029 | The specified ability is disabled. | **示例:** @@ -2628,15 +2655,15 @@ getAbilityIcon(bundleName: string, moduleName: string, abilityName: string): Pro | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ------------------------- | -| bundleName | string | 是 | 表示应用程序的bundleName | -| moduleName | string | 是 | 表示应用程序的moduleName | -| abilityName | string | 是 | 表示应用程序的abilityName | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| moduleName | string | 是 | 表示应用程序的moduleName。 | +| abilityName | string | 是 | 表示应用程序的abilityName。 | **返回值:** | 类型 | 说明 | | ----------------------------------------------------- | ------------------------------------------- | -| Promise<[image.PixelMap](js-apis-image.md#pixelmap7)> | Promise对象,返回指定组件icon的PixelMap对象 | +| Promise<[image.PixelMap](js-apis-image.md#pixelmap7)> | Promise对象,返回指定组件icon的PixelMap对象。 | **错误码:** @@ -2644,11 +2671,11 @@ getAbilityIcon(bundleName: string, moduleName: string, abilityName: string): Pro | 错误码ID | 错误信息 | | -------- | -------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700002 | The specified moduleName is not found | -| 17700003 | The specified abilityName is not found | -| 17700026 | The specified bundle is disabled | -| 17700029 | The specified ability is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified moduleName is not found. | +| 17700003 | The specified abilityName is not found. | +| 17700026 | The specified bundle is disabled. | +| 17700029 | The specified ability is disabled. | **示例:** @@ -2685,15 +2712,15 @@ getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: num | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ----------------------------------------------------------| -| bundleName | string | 是 | 表示应用程序的bundleName | -| applicationFlags | [number](#applicationflag) | 是 | 表示用于指定将返回的ApplicationInfo对象中包含的信息 | -| userId | number | 是 | 表示用户ID | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| applicationFlags | [number](#applicationflag) | 是 | 表示用于指定将返回的ApplicationInfo对象中包含的信息。 | +| userId | number | 是 | 表示用户ID。 | **返回值:** | 类型 | 说明 | | --------------- | ------------------------- | -| [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | 返回ApplicationInfo对象 | +| [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | 返回ApplicationInfo对象。 | **错误码:** @@ -2701,9 +2728,9 @@ getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: num | 错误码ID | 错误信息 | | -------- | -------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700004 | The specified userId is not found | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700004 | The specified userId is not found. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -2737,14 +2764,14 @@ getApplicationInfoSync(bundleName: string, applicationFlags: number) : [Applicat | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ----------------------------------------------------------| -| bundleName | string | 是 | 表示应用程序的bundleName | -| applicationFlags | [number](#applicationflag) | 是 | 表示用于指定将返回的ApplicationInfo对象中包含的信息 | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| applicationFlags | [number](#applicationflag) | 是 | 表示用于指定将返回的ApplicationInfo对象中包含的信息。 | **返回值:** | 类型 | 说明 | | --------------- | ------------------------- | -| [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | 返回ApplicationInfo对象 | +| [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | 返回ApplicationInfo对象。 | **错误码:** @@ -2752,8 +2779,8 @@ getApplicationInfoSync(bundleName: string, applicationFlags: number) : [Applicat | 错误码ID | 错误信息 | | -------- | -------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -2786,15 +2813,15 @@ getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag), userId | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | -------------------------------------------------------- | -| bundleName | string | 是 | 表示应用程序的bundleName | -| bundleFlags | [number](#bundleflag) | 是 | 表示用于指定将返回的BundleInfo对象中包含的信息的标志 | -| userId | number | 是 | 表示用户ID | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| bundleFlags | [number](#bundleflag) | 是 | 表示用于指定将返回的BundleInfo对象中包含的信息的标志。 | +| userId | number | 是 | 表示用户ID。 | **返回值:** | 类型 | 说明 | | ---------- | -------------------- | -| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | 返回BundleInfo对象 | +| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | 返回BundleInfo对象。 | **错误码:** @@ -2802,9 +2829,9 @@ getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag), userId | 错误码ID | 错误信息 | | -------- | ------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700004 | The specified userId is not found | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700004 | The specified userId is not found. | +| 17700026 | The specified bundle is disabled. | **示例:** @@ -2838,14 +2865,14 @@ getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [Bund | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | -------------------------------------------------------- | -| bundleName | string | 是 | 表示应用程序的bundleName | -| bundleFlags | [number](#bundleflag) | 是 | 表示用于指定将返回的BundleInfo对象中包含的信息的标志 | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| bundleFlags | [number](#bundleflag) | 是 | 表示用于指定将返回的BundleInfo对象中包含的信息的标志。 | **返回值:** | 类型 | 说明 | | ---------- | -------------------- | -| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | 返回BundleInfo对象 | +| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | 返回BundleInfo对象。 | **错误码:** @@ -2853,8 +2880,8 @@ getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [Bund | 错误码ID | 错误信息 | | -------- | ------------------------------------- | -| 17700001 | The specified bundleName is not found | -| 17700026 | The specified bundle is disabled | +| 17700001 | The specified bundleName is not found. | +| 17700026 | The specified bundle is disabled. | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md b/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md index a4fb1b82be..49b782bf50 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md @@ -2,13 +2,13 @@ 本模块提供监听应用安装,卸载,更新的能力。 -> **说明:** +> **说明:** > > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 -```javascript +```ts import bundleMonitor from '@ohos.bundle.bundleMonitor'; ``` @@ -28,8 +28,8 @@ import bundleMonitor from '@ohos.bundle.bundleMonitor'; | 名称 | 类型 | 可读 | 可写 | 说明 | | ---------- | ------ | ---- | ---- | -------------------------- | -| bundleName | string | 是 | 否 | 应用状态发生变化的应用包名 | -| userId | number | 是 | 否 | 应用状态发生变化的用户id | +| bundleName | string | 是 | 否 | 应用状态发生变化的应用包名。 | +| userId | number | 是 | 否 | 应用状态发生变化的用户id。 | ## bundleMonitor.on @@ -47,19 +47,16 @@ on(type: BundleChangedEvent, callback: Callback\): void; | 参数名 | 类型 | 必填 | 说明 | | ---------------------------- | -------- | ---- | ------------------ | -| BundleChangedEvent | string | 是 | 注册监听的事件类型 | -| Callback\ | callback | 是 | 注册监听的回调函数 | +| BundleChangedEvent | string | 是 | 注册监听的事件类型。 | +| Callback\ | callback | 是 | 注册监听的回调函数。 | -**相关错误码** +**错误码:** -| 错误码ID | 错误信息 | -| -------- | --------------------------- | -| 201 | Permission denied. | -| 401 | The parameter check failed. | +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 **示例:** -```js +```ts import bundleMonitor from '@ohos.bundle.bundleMonitor'; try { @@ -87,19 +84,16 @@ off(type: BundleChangedEvent, callback?: Callback\): void; | 参数名 | 类型 | 必填 | 说明 | | ---------------------------- | -------- | ---- | ---------------------------------------------------------- | -| BundleChangedEvent | string | 是 | 注销监听的事件类型 | -| Callback\ | callback | 否 | 注销监听的回调函数,当为空时表示注销当前事件的所有callback | +| BundleChangedEvent | string | 是 | 注销监听的事件类型。 | +| Callback\ | callback | 是 | 注销监听的回调函数,当为空时表示注销当前事件的所有callback。 | -**相关错误码** +**错误码:** -| 错误码ID | 错误信息 | -| -------- | --------------------------- | -| 201 | Permission denied. | -| 401 | The parameter check failed. | +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 **示例:** -```js +```ts import bundleMonitor from '@ohos.bundle.bundleMonitor'; try { diff --git a/zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md b/zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md index 9c2722a220..d361c9959a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md @@ -11,6 +11,16 @@ ``` import defaultAppMgr from '@ohos.bundle.defaultAppManager'; ``` + +## 权限列表 + +| 权限 | 权限等级 | 描述 | +| --------------------------------------- | ----------- | ---------------- | +| ohos.permission.GET_DEFAULT_APPLICATION | system_core | 默认应用相关权限。 | + +权限等级参考[权限等级说明](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/accesstoken-overview.md#%E6%9D%83%E9%99%90%E7%AD%89%E7%BA%A7%E8%AF%B4%E6%98%8E) + + ## defaultAppMgr.ApplicationType 应用类型 @@ -48,9 +58,14 @@ isDefaultApplication(type: string): Promise\ | ------------------------- | ------------------ | | Promise\ | Promise形式返回当前应用是否是默认应用,true表示是默认应用,false表示不是默认应用。 | +**错误码:** + +错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + + **示例:** -```js +```ts import defaultAppMgr from '@ohos.bundle.defaultAppManager'; defaultAppMgr.isDefaultApplication(defaultAppMgr.ApplicationType.BROWSER) .then((data) => { @@ -75,6 +90,10 @@ isDefaultApplication(type: string, callback: AsyncCallback\): void | type | string | 是 | 要查询的应用类型,取[ApplicationType](#defaultappmgrapplicationtype)中的值。 | | callback | AsyncCallback\ | 是 | 程序启动作为入参的回调函数,返回当前应用是否是默认应用,true表示是默认应用,false表示不是默认应用。 | +**错误码:** + +错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + **示例:** ```js @@ -115,6 +134,8 @@ getDefaultApplication(type: string, userId?: number): Promise\ **错误码:** +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------------- | | 17700004 | The specified user id is not found. | @@ -164,6 +185,8 @@ getDefaultApplication(type: string, userId: number, callback: AsyncCallback\) : void **错误码:** +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------------- | | 17700004 | The specified user id is not found. | @@ -273,6 +298,8 @@ setDefaultApplication(type: string, elementName: ElementName, userId?: number): **错误码:** +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------------- | | 17700004 | The specified user id is not found. | @@ -338,6 +365,8 @@ setDefaultApplication(type: string, elementName: ElementName, userId: number, ca **错误码:** +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------------- | | 17700004 | The specified user id is not found. | @@ -396,6 +425,8 @@ setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCal **错误码:** +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------------- | | 17700004 | The specified user id is not found. | @@ -404,7 +435,7 @@ setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCal **示例:** -```js +```ts import defaultAppMgr from '@ohos.bundle.defaultAppManager'; defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, { bundleName: "com.test.app", @@ -452,6 +483,8 @@ resetDefaultApplication(type: string, userId?: number): Promise\ **错误码:** +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 17700004 | The specified user id is not found. | @@ -501,6 +534,8 @@ resetDefaultApplication(type: string, userId: number, callback: AsyncCallback\) : void; **错误码:** +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 17700004 | The specified user id is not found. | @@ -556,7 +593,7 @@ resetDefaultApplication(type: string, callback: AsyncCallback\) : void; **示例:** -```js +```ts import defaultAppMgr from '@ohos.bundle.defaultAppManager'; defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, (err, data) => { if (err) { diff --git a/zh-cn/application-dev/reference/apis/js-apis-distributedBundle.md b/zh-cn/application-dev/reference/apis/js-apis-distributedBundle.md index 16c77d725c..4609135f3f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-distributedBundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-distributedBundle.md @@ -22,7 +22,7 @@ SystemCapability.BundleManager.DistributedBundleFramework | 权限 | 权限等级 | 说明 | | ------------------------------------------ | ------------ | ------------------ | -| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | 可查询所有应用信息 | +| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | 可查询所有应用信息。 | 权限等级参考[权限等级说明](../../security/accesstoken-overview.md#权限等级说明)。 @@ -49,19 +49,16 @@ getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback\; 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 -| 错误码ID | 错误信息 | -|---------------|-------------------------| -| 201 | Permission denied.| -| 401 | The parameter check failed. | -| 801 | Capability not supported. | -| 17700001 | The specified bundle name is not found | +| 错误码ID | 错误信息 | +|----------|-------------------------| +| 17700001 | The specified bundle name is not found. | | 17700003 | The specified ability name is not found. | -| 17700007 | The specified device id is not found. | +| 17700007 | The specified device id is not found. | | 17700027 | The distributed service is not running. | **示例:** -```js +```ts try { distributedBundle.getRemoteAbilityInfo( { @@ -153,26 +147,23 @@ getRemoteAbilityInfo(elementNames: Array\, callback: AsyncCallback\ | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| elementNames | Array<[ElementName](js-apis-bundleManager-elementName.md)> | 是 | ElementName信息,最大数组长度为10 | +| elementNames | Array<[ElementName](js-apis-bundleManager-elementName.md)> | 是 | ElementName信息,最大数组长度为10。 | | callback | AsyncCallback\> | 是 | 回调函数,调用成功返回err为null,data为RemoteAbilityInfo数组对象;否则返回错误对象。 | **错误码:** 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 -| 错误码ID | 错误信息 | -|---------------|-------------------------| -| 201 | Permission denied.| -| 401 | The parameter check failed. | -| 801 | Capability not supported. | -| 17700001 | The specified bundle name is not found | +| 错误码ID | 错误信息 | +|----------|-------------------------| +| 17700001 | The specified bundle name is not found. | | 17700003 | The specified ability name is not found. | -| 17700007 | The specified device id is not found. | +| 17700007 | The specified device id is not found. | | 17700027 | The distributed service is not running. | **示例:** -```js +```ts try { distributedBundle.getRemoteAbilityInfo( [ @@ -214,7 +205,7 @@ getRemoteAbilityInfo(elementNames: Array\): Promise\ | 是 | ElementName信息,最大数组长度为10。 | +| elementNames | Array<[ElementName](js-apis-bundleManager-elementName.md)> | 是 | ElementName信息,最大数组长度为10。 | **返回值:** @@ -226,19 +217,16 @@ getRemoteAbilityInfo(elementNames: Array\): Promise\ | 是 | 回调函数,操作成功返回err为null,data为RemoteAbilityInfo对象;否则为错误对象。 | **错误码:** 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 -| 错误码ID | 错误信息 | -|---------------|-------------------------| -| 201 | Permission denied.| -| 401 | The parameter check failed. | -| 801 | Capability not supported. | -| 17700001 | The specified bundle name is not found | +| 错误码ID | 错误信息 | +|----------|-------------------------| +| 17700001 | The specified bundle name is not found. | | 17700003 | The specified ability name is not found. | -| 17700007 | The specified device id is not found. | +| 17700007 | The specified device id is not found. | | 17700027 | The distributed service is not running. | **示例:** -```js +```ts try { distributedBundle.getRemoteAbilityInfo( { @@ -334,7 +319,7 @@ getRemoteAbilityInfo(elementName: ElementName, locale: string): Promise\, locale: string, callback | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------------------------------------------------------------ | ---- | -------------------------------------------------- | -| elementNames | Array<[ElementName](js-apis-bundleManager-elementName.md)> | 是 | ElementName信息,最大数组长度为10 | -| locale | string |是 | 语言地区 | +| elementNames | Array<[ElementName](js-apis-bundleManager-elementName.md)> | 是 | ElementName信息,最大数组长度为10。 | +| locale | string |是 | 语言地区。 | | callback | AsyncCallback\> | 是 | 回调函数,调用成功返回err为null,data为RemoteAbilityInfo数组对象;否则返回错误对象。 | **错误码:** @@ -401,17 +383,14 @@ getRemoteAbilityInfo(elementNames: Array\, locale: string, callback | 错误码ID | 错误信息 | |---------------|-------------------------| -| 201 | Permission denied.| -| 401 | The parameter check failed. | -| 801 | Capability not supported. | -| 17700001 | The specified bundle name is not found | +| 17700001 | The specified bundle name is not found. | | 17700003 | The specified ability name is not found. | -| 17700007 | The specified device id is not found. | +| 17700007 | The specified device id is not found. | | 17700027 | The distributed service is not running. | **示例:** -```js +```ts try { distributedBundle.getRemoteAbilityInfo( [ @@ -454,7 +433,7 @@ getRemoteAbilityInfo(elementNames: Array\, locale: string): Promise | 参数名 | 类型 | 必填 | 说明 | | ------------ | --------------------------------------------------- | ---- | ----------------------- | | elementNames | Array<[ElementName](js-apis-bundleManager-elementName.md)> | 是 | ElementName信息,最大数组长度为10。 | -| locale | string |是 | 语言地区 | +| locale | string |是 | 语言地区。 | **返回值:** @@ -466,19 +445,16 @@ getRemoteAbilityInfo(elementNames: Array\, locale: string): Promise 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 -| 错误码ID | 错误信息 | -|---------------|-------------------------| -| 201 | Permission denied.| -| 401 | The parameter check failed. | -| 801 | Capability not supported. | -| 17700001 | The specified bundle name is not found | +| 错误码ID | 错误信息 | +|----------|-------------------------| +| 17700001 | The specified bundle name is not found. | | 17700003 | The specified ability name is not found. | -| 17700007 | The specified device id is not found. | +| 17700007 | The specified device id is not found. | | 17700027 | The distributed service is not running. | **示例:** -```js +```ts try { distributedBundle.getRemoteAbilityInfo( [ diff --git a/zh-cn/application-dev/reference/apis/js-apis-freeInstall.md b/zh-cn/application-dev/reference/apis/js-apis-freeInstall.md index 0e168f117f..eef03ac00d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-freeInstall.md +++ b/zh-cn/application-dev/reference/apis/js-apis-freeInstall.md @@ -18,8 +18,8 @@ import freeInstall from '@ohos.bundle.freeInstall'; | 权限 | 权限等级 | 描述 | | ------------------------------------------ | ------------ | ------------------ | -| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | 可查询所有应用信息 | -| ohos.permission.INSTALL_BUNDLE | system_core | 可安装、卸载应用 | +| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | 可查询所有应用信息。 | +| ohos.permission.INSTALL_BUNDLE | system_core | 可安装、卸载应用。 | 权限等级参考[权限等级说明](../../security/accesstoken-overview.md#权限等级说明)。 ## UpgradeFlag @@ -28,11 +28,11 @@ import freeInstall from '@ohos.bundle.freeInstall'; **系统能力:** SystemCapability.BundleManager.BundleFramework.FreeInstall -| 名称 | 值 | 说明 | -| ----------------------------- | ---- | ---------------- | -| NOT_UPGRADE | 0 | 模块无需升级 | -| SINGLE_UPGRADE | 1 | 单个模块需要升级 | -| RELATION_UPGRADE | 2 | 关系模块需要升级 | +| 名称 | 值 | 说明 | +| ---------------- | ---- | ---------------- | +| NOT_UPGRADE | 0 | 模块无需升级。 | +| SINGLE_UPGRADE | 1 | 单个模块需要升级。 | +| RELATION_UPGRADE | 2 | 关系模块需要升级。 | ## BundlePackFlag @@ -66,18 +66,15 @@ setHapModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: Upg | bundleName | string | 是 | 应用程序包名称。 | | moduleName | string | 是 | 应用程序模块名称。 | | upgradeFlag | [UpgradeFlag](#upgradeflag) | 是 | 仅供内部系统使用标志位 | -| callback | AsyncCallback\ | 是 | 回调函数。当函数调用成功,err为null,否则为错误对象 | +| callback | AsyncCallback\ | 是 | 回调函数。当函数调用成功,err为null,否则为错误对象。 | **错误码:** 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 -| 错误码ID | 错误信息 | -|---------------|-------------------------| -| 201 | Permission denied.| -| 401 | The parameter check failed. | -| 801 | Capability not supported. | -| 17700001 | The specified bundle name is not found | +| 错误码ID | 错误信息 | +|----------|---------------------------------------- | +| 17700001 | The specified bundle name is not found. | | 17700002 | The specified module name is not found. | **示例:** @@ -118,24 +115,21 @@ setHapModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: Upg | ----------- | --------------------------- | ---- | ---------------------- | | bundleName | string | 是 | 应用程序包名称。 | | moduleName | string | 是 | 应用程序模块名称。 | -| upgradeFlag | [UpgradeFlag](#upgradeflag) | 是 | 仅供内部系统使用标志位 | +| upgradeFlag | [UpgradeFlag](#upgradeflag) | 是 | 仅供内部系统使用标志位。| **返回值:** | 类型 | 说明 | | ------------- | ------------------------------------ | -| Promise\ | Promise对象。无返回结果的Promise对象 | +| Promise\ | Promise对象。无返回结果的Promise对象。 | **错误码:** 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 -| 错误码ID | 错误信息 | -|---------------|-------------------------| -| 201 | Permission denied.| -| 401 | The parameter check failed. | -| 801 | Capability not supported. | -| 17700001 | The specified bundle name is not found | +| 错误码ID | 错误信息 | +|----------|----------------------------------------| +| 17700001 | The specified bundle name is not found. | | 17700002 | The specified module name is not found. | **示例:** @@ -180,12 +174,9 @@ isHapModuleRemovable(bundleName: string, moduleName: string, callback: AsyncCall 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 -| 错误码ID | 错误信息 | -|---------------|-------------------------| -| 201 | Permission denied.| -| 401 | The parameter check failed. | -| 801 | Capability not supported. | -| 17700001 | The specified bundle name is not found | +| 错误码ID | 错误信息 | +|----------|----------------------------------------| +| 17700001 | The specified bundle name is not found. | | 17700002 | The specified module name is not found. | **示例:** @@ -236,12 +227,9 @@ isHapModuleRemovable(bundleName: string, moduleName: string): Promise\; 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 -| 错误码ID | 错误信息 | -|---------------|-------------------------| -| 201 | Permission denied.| -| 401 | The parameter check failed. | -| 801 | Capability not supported. | -| 17700001 | The specified bundle name is not found | +| 错误码ID | 错误信息 | +|----------|----------------------------------------| +| 17700001 | The specified bundle name is not found. | | 17700002 | The specified module name is not found. | **示例:** @@ -278,19 +266,16 @@ getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag, callback: | 参数名 | 类型 | 必填 | 说明 | | -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | bundleName | string | 是 | 应用程序包名称。 | -| bundlePackFlag | [BundlePackFlag](#bundlepackflag) | 是 | 指示要查询的应用包标志 | +| bundlePackFlag | [BundlePackFlag](#bundlepackflag) | 是 | 指示要查询的应用包标志。 | | callback | AsyncCallback<[BundlePackInfo](js-apis-bundleManager-packInfo.md)> | 是 | 回调函数。当函数调用成功,err为null,data为获取到的BundlePackInfo信息。否则为错误对象。 | **错误码:** 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 -| 错误码ID | 错误信息 | -|---------------|-------------------------| -| 201 | Permission denied.| -| 401 | The parameter check failed. | -| 801 | Capability not supported. | -| 17700001 | The specified bundle name is not found | +| 错误码ID | 错误信息 | +|----------|----------------------------------------| +| 17700001 | The specified bundle name is not found. | **示例:** @@ -327,7 +312,7 @@ getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag): Promise\ | 参数名 | 类型 | 必填 | 说明 | | -------------- | --------------------------------- | ---- | ---------------------- | | bundleName | string | 是 | 应用程序包名称。 | -| bundlePackFlag | [BundlePackFlag](#bundlepackflag) | 是 | 指示要查询的应用包标志 | +| bundlePackFlag | [BundlePackFlag](#bundlepackflag) | 是 | 指示要查询的应用包标志。| **返回值:** @@ -339,12 +324,9 @@ getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag): Promise\ 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 -| 错误码ID | 错误信息 | -|---------------|-------------------------| -| 201 | Permission denied.| -| 401 | The parameter check failed. | -| 801 | Capability not supported. | -| 17700001 | The specified bundle name is not found | +| 错误码ID | 错误信息 | +|----------|----------------------------------------| +| 17700001 | The specified bundle name is not found. | **示例:** @@ -383,12 +365,7 @@ getDispatchInfo(callback: AsyncCallback\): void; **错误码:** -以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 - -| 错误码ID | 错误信息 | -|---------------|-------------------------| -| 201 | Permission denied.| -| 801 | Capability not supported. | +错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 **示例:** @@ -427,12 +404,7 @@ getDispatchInfo(): Promise\; **错误码:** -以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 - -| 错误码ID | 错误信息 | -|---------------|-------------------------| -| 201 | Permission denied.| -| 801 | Capability not supported. | +错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-installer.md b/zh-cn/application-dev/reference/apis/js-apis-installer.md index 47b19faffb..b7372b8c38 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-installer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-installer.md @@ -15,7 +15,7 @@ import installer from '@ohos.bundle.installer'; | 权限 | 权限等级 | 描述 | | ------------------------------ | ----------- | ---------------- | -| ohos.permission.INSTALL_BUNDLE | system_core | 可安装、卸载应用 | +| ohos.permission.INSTALL_BUNDLE | system_core | 可安装、卸载应用。 | 权限等级参考[权限等级说明](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/accesstoken-overview.md#%E6%9D%83%E9%99%90%E7%AD%89%E7%BA%A7%E8%AF%B4%E6%98%8E) @@ -33,7 +33,7 @@ getBundleInstaller(callback: AsyncCallback\): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| callback | AsyncCallback\<[BundleInstaller](js-apis-installer.md#BundleInstaller)> | 是 | 回调函数,获取BundleInstaller对象,err为undefined,data为获取到的BundleInstaller对象;否则为错误对象 | +| callback | AsyncCallback\<[BundleInstaller](js-apis-installer.md#BundleInstaller)> | 是 | 回调函数,获取BundleInstaller对象,err为undefined,data为获取到的BundleInstaller对象;否则为错误对象。 | **错误码:** @@ -70,7 +70,7 @@ getBundleInstaller(): Promise\; **返回值:** | 类型 | 说明 | | ------------------------------------------------------------ | ------------------------------------ | -| Promise\<[BundleInstaller](js-apis-installer.md#BundleInstaller)> | Promise对象,返回BundleInstaller对象 | +| Promise\<[BundleInstaller](js-apis-installer.md#BundleInstaller)> | Promise对象,返回BundleInstaller对象。 | **错误码:** @@ -107,9 +107,9 @@ install(hapFilePaths: Array<string>, installParam: InstallParam, callback: | 参数名 | 类型 | 必填 | 说明 | | --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | -| hapFilePaths | Array<string> | 是 | 存储应用程序包的路径。路径应该是当前应用程序中存放HAP包的数据目录。当传入的路径是一个目录时, 该目录下只能放同一个应用的HAP包,且这些HAP包的签名需要保持一致 | -| installParam | [InstallParam](#installparam) | 是 | 指定安装所需的其他参数 | -| callback | AsyncCallback<void> | 是 | 回调函数,安装应用成功,err为undefined,否则为错误对象 | +| hapFilePaths | Array<string> | 是 | 存储应用程序包的路径。路径应该是当前应用程序中存放HAP包的数据目录。当传入的路径是一个目录时, 该目录下只能放同一个应用的HAP包,且这些HAP包的签名需要保持一致。 | +| installParam | [InstallParam](#installparam) | 是 | 指定安装所需的其他参数。 | +| callback | AsyncCallback<void> | 是 | 回调函数,安装应用成功,err为undefined,否则为错误对象。 | **错误码:** @@ -117,15 +117,15 @@ install(hapFilePaths: Array<string>, installParam: InstallParam, callback: | 错误码ID | 错误信息 | | -------- | ------------------------------------------------------ | -| 17700004 | The specified userId is not existed | -| 17700010 | To parse file of config.json or module.json failed | -| 17700011 | To verify signature failed | -| 17700012 | Invalid hap file path or too large file size | -| 17700015 | Multiple haps have inconsistent configured information | -| 17700016 | No disk space left for installation | -| 17700017 | Downgrade installation is prohibited | -| 17700101 | The system service is excepted | -| 17700103 | I/O operation is failed | +| 17700004 | The specified userId is not existed. | +| 17700010 | To parse file of config.json or module.json failed. | +| 17700011 | To verify signature failed. | +| 17700012 | Invalid hap file path or too large file size. | +| 17700015 | Multiple haps have inconsistent configured information. | +| 17700016 | No disk space left for installation. | +| 17700017 | Downgrade installation is prohibited. | +| 17700101 | The system service is excepted. | +| 17700103 | I/O operation is failed. | **示例:** @@ -171,9 +171,9 @@ uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallbac | 参数名 | 类型 | 必填 | 说明 | | ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | -| bundleName | string | 是 | 包名 | -| installParam | [InstallParam](#installparam) | 是 | 指定安装所需的其他参数 | -| callback | AsyncCallback<void> | 是 | 回调函数,卸载应用成功,err为undefined,否则为错误对象 | +| bundleName | string | 是 | 待卸载应用的包名。 | +| installParam | [InstallParam](#installparam) | 是 | 指定安装所需的其他参数。 | +| callback | AsyncCallback<void> | 是 | 回调函数,卸载应用成功,err为undefined,否则为错误对象。 | **错误码:** @@ -181,9 +181,9 @@ uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallbac | 错误码ID | 错误信息 | | -------- | ------------------------------------------------------------ | -| 17700004 | The specified userId is not existed | -| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled | -| 17700101 | The system service is excepted | +| 17700004 | The specified userId is not existed. | +| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | +| 17700101 | The system service is excepted. | **示例:** @@ -229,9 +229,9 @@ recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback& | 参数名 | 类型 | 必填 | 说明 | | ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | -| bundleName | string | 是 | 包名 | -| installParam | [InstallParam](#installparam) | 是 | 指定安装所需的其他参数 | -| callback | AsyncCallback<void> | 是 | 回调函数,回滚应用成功,err为undefined,否则为错误对象 | +| bundleName | string | 是 | 待恢复应用的包名。 | +| installParam | [InstallParam](#installparam) | 是 | 指定安装所需的其他参数。 | +| callback | AsyncCallback<void> | 是 | 回调函数,回滚应用成功,err为undefined,否则为错误对象。 | **错误码:** @@ -239,7 +239,7 @@ recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback& | 错误码ID | 错误信息 | | -------- | ----------------------------------- | -| 17700004 | The specified userId is not existed | +| 17700004 | The specified userId is not existed. | **示例:** @@ -271,7 +271,7 @@ try { ## HashParam -应用程序安装卸载信息 +应用程序安装卸载哈希参数信息。 **系统能力:** SystemCapability.BundleManager.BundleFramework.Core @@ -279,12 +279,12 @@ try { | 参数名 | 类型 | 说明 | | ---------- | ------ | ---------------- | -| moduleName | string | 应用程序模块名称 | -| hashValue | string | 哈希值 | +| moduleName | string | 应用程序模块名称。 | +| hashValue | string | 哈希值。 | ## InstallParam -应用程序安装卸载信息 +应用程序安装、卸载或恢复需指定的参数信息。 **系统能力:** SystemCapability.BundleManager.BundleFramework.Core @@ -292,8 +292,8 @@ try { | 参数名 | 类型 | 说明 | | ------------------------------ | ------------------------------ | ------------------ | -| userId | number | 指示用户id,可使用[queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#queryosaccountlocalidfromprocess9)获取当前进程所在用户 | -| installFlag | number | 指示安装标志,枚举值:0:应用初次安装,1:应用覆盖安装 | -| isKeepData | boolean | 卸载时是否保留数据目录 | -| hashParams | Array<[HashParam](#hashparam)> | 哈希值参数 | -| crowdtestDeadline| number | 测试包的被杀死时间 | \ No newline at end of file +| userId | number | 指示用户id,可使用[queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#queryosaccountlocalidfromprocess9)获取当前进程所在用户。 | +| installFlag | number | 指示安装标志,枚举值:0:应用初次安装,1:应用覆盖安装。 | +| isKeepData | boolean | 卸载时是否保留数据目录。 | +| hashParams | Array<[HashParam](#hashparam)> | 哈希值参数。 | +| crowdtestDeadline| number |[众测](https://developer.huawei.com/consumer/cn/agconnect/crowd-test/)截止日期。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-launcherBundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-launcherBundleManager.md index a3a0ace1ea..f50d97b35c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-launcherBundleManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-launcherBundleManager.md @@ -2,18 +2,18 @@ 本模块支持launcher应用所需的查询能力,支持[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md)、[ShortcutInfo](js-apis-bundleManager-shortcutInfo.md)信息的查询。 -> **说明:** +> **说明:** > > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 -```typescript +```ts import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; ``` -## launcherBundlemanager.**getLauncherAbilityInfo9+** +## launcherBundlemanager.getLauncherAbilityInfo9+ getLauncherAbilityInfo(bundleName: string, userId: number, callback: AsyncCallback>) : void; @@ -36,18 +36,20 @@ getLauncherAbilityInfo(bundleName: string, userId: number, callback: AsyncCallba | 类型 | 说明 | | ----------------------------------- | --------------------------------------------------- | -| AsyncCallback\> | callback形式返回bundle包含的[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md)信息 | +| AsyncCallback\> | callback形式返回bundle包含的[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md)信息。 | + +**错误码:** -**相关错误码** +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 -| 错误码 | 错误信息(此处仅提供错误抛出的关键信息) | +| 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 17700001 | The specified bundle name is not found. | -| 17700004 | The specified user id is not found. | +| 17700004 | The specified userId is not found. | **示例:** -```typescript +```ts import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; try { @@ -62,6 +64,8 @@ try { } ``` +## launcherBundlemanager.getLauncherAbilityInfo9+ + getLauncherAbilityInfo(bundleName: string, userId: number) : Promise>; 查询指定bundleName及用户的[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md)。 @@ -76,21 +80,23 @@ getLauncherAbilityInfo(bundleName: string, userId: number) : Promise> | Promise形式返回bundle包含的[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md)信息 | +| Promise\> | Promise形式返回bundle包含的[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md)信息。 | + +**错误码:** -**相关错误码** +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 -| 错误码 | 错误信息(此处仅提供错误抛出的关键信息) | +| 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 17700001 | The specified bundle name is not found. | -| 17700004 | The specified user id is not found. | +| 17700004 | The specified userId is not found. | **示例:** @@ -130,17 +136,19 @@ getAllLauncherAbilityInfo(userId: number, callback: AsyncCallback> | callback形式返回指定用户下所有应用的[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md) | +| AsyncCallback\> | callback形式返回指定用户下所有应用的[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md)。 | -**相关错误码** +**错误码:** -| 错误码 | 错误信息(此处仅提供错误抛出的关键信息) | +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | | -------- | ---------------------------------------- | -| 17700004 | The specified user id is not found. | +| 17700004 | The specified userId is not found. | 示例: -```typescript +```ts import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; try { @@ -149,11 +157,12 @@ try { console.log(`errData is errCode:${errData.code} message:${errData.message}`); } console.log("data is " + JSON.stringify(data)); - }) + }); } catch (errData) { console.log(`errData is errCode:${errData.code} message:${errData.message}`); } ``` +## launcherBundlemanager.getAllLauncherAbilityInfo9+ getAllLauncherAbilityInfo(userId: number) : Promise>; @@ -175,11 +184,19 @@ getAllLauncherAbilityInfo(userId: number) : Promise> | Promise形式返回指定用户下所有应用的[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md) | +| Promise\> | Promise形式返回指定用户下所有应用的[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md)。 | -示例: +**错误码:** -```typescript +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17700004 | The specified userId is not found. | + +**示例:** + +```ts import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; try { @@ -187,7 +204,7 @@ try { console.log("data is " + JSON.stringify(data)); }).catch (errData => { console.log(`errData is errCode:${errData.code} message:${errData.message}`); - }) + }); } catch (errData) { console.log(`errData is errCode:${errData.code} message:${errData.message}`); } @@ -197,7 +214,7 @@ try { getShortcutInfo(bundleName :string, callback: AsyncCallback>) : void; -查询当前用户下指定应用的[ShortcutInfo](js-apis-bundleManager-shortcutInfo.md) +查询当前用户下指定应用的[ShortcutInfo](js-apis-bundleManager-shortcutInfo.md)。 **需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED @@ -213,11 +230,19 @@ getShortcutInfo(bundleName :string, callback: AsyncCallback> | callback形式返回当前用户下指定应用的[ShortcutInfo](js-apis-bundleManager-shortcutInfo.md) | +| AsyncCallback\> | callback形式返回当前用户下指定应用的[ShortcutInfo](js-apis-bundleManager-shortcutInfo.md)。 | -示例: +**错误码:** -```typescript +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17700001 | The specified bundle name is not found. | + +**示例:** + +```ts import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; try { @@ -226,14 +251,18 @@ try { console.log(`errData is errCode:${errData.code} message:${errData.message}`); } console.log("data is " + JSON.stringify(data)); - }) + }); } catch (errData) { console.log(`errData is errCode:${errData.code} message:${errData.message}`); } ``` +## launcherBundlemanager.getShortcutInfo9+ + getShortcutInfo(bundleName : string) : Promise>; +查询当前用户下指定应用的[ShortcutInfo](js-apis-bundleManager-shortcutInfo.md)。 + **需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED **系统接口:** 此接口为系统接口 @@ -248,11 +277,19 @@ getShortcutInfo(bundleName : string) : Promise> | Promise形式返回当前用户下指定应用的[ShortcutInfo](js-apis-bundleManager-shortcutInfo.md) | +| Promise\> | Promise形式返回当前用户下指定应用的[ShortcutInfo](js-apis-bundleManager-shortcutInfo.md)。 | -示例: +**错误码:** -```typescript +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17700001 | The specified bundle name is not found. | + +**示例:** + +```ts import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; try { @@ -260,7 +297,7 @@ try { console.log("data is " + JSON.stringify(data)); }).catch (errData => { console.log(`errData is errCode:${errData.code} message:${errData.message}`); - }) + }); } catch (errData) { console.log(`errData is errCode:${errData.code} message:${errData.message}`); } diff --git a/zh-cn/application-dev/reference/apis/js-apis-zlib.md b/zh-cn/application-dev/reference/apis/js-apis-zlib.md index dea1c2781c..b43bd4d673 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-zlib.md +++ b/zh-cn/application-dev/reference/apis/js-apis-zlib.md @@ -2,7 +2,7 @@ 本模块提供压缩解压缩文件的能力 -> **说明:** +> **说明:** > > 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -25,9 +25,9 @@ zipFile(inFile: string, outFile: string, options: Options): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------------------- | ---- | ------------------------------------------------------------ | -| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,对应的路径参考[FA模型](js-apis-Context.md),[Stage模型](js-apis-application-context.md) | -| outFile | string | 是 | 指定压缩结果的文件路径(文件的扩展名zip) | -| options | [Options](#options) | 否 | 压缩的可选参数 | +| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,对应的路径参考[FA模型](js-apis-Context.md),[Stage模型](js-apis-application-context.md)。 | +| outFile | string | 是 | 指定压缩结果的文件路径(文件的扩展名zip)。 | +| options | [Options](#options) | 否 | 压缩的可选参数。 | **返回值:** @@ -38,7 +38,7 @@ zipFile(inFile: string, outFile: string, options: Options): Promise<void> **示例1:** ```typescript -//【压缩文件 例子1】 +//【压缩文件 例子1】 import zlib from '@ohos.zlib'; let inFile = '/xxx/filename.xxx'; let outFile = '/xxx/xxx.zip'; @@ -89,9 +89,9 @@ unzipFile(inFile:string, outFile:string, options: Options): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------------------- | ---- | ------------------------------------------------------------ | -| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,对应的路径参考[FA模型](js-apis-Context.md),[stage模型](js-apis-application-context.md) | -| outFile | string | 是 | 指定的解压文件路径 | -| options | [Options](#options) | 否 | 解压的可选参数 | +| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,对应的路径参考[FA模型](js-apis-Context.md),[stage模型](js-apis-application-context.md)。 | +| outFile | string | 是 | 指定的解压文件路径。 | +| options | [Options](#options) | 否 | 解压的可选参数。 | **返回值:** @@ -102,7 +102,7 @@ unzipFile(inFile:string, outFile:string, options: Options): Promise<void> **示例:** ```typescript -// 【解压缩 例子1】 +// 【解压缩 例子1】 import zlib from '@ohos.zlib'; let inFile = '/xx/xxx.zip'; let outFile = '/xxx'; @@ -131,16 +131,16 @@ compressFile(inFile: string, outFile: string, options: Options, callback: AsyncC | 参数名 | 类型 | 必填 | 说明 | | ----------------------- | ------------------- | ---- | ------------------------------------------------------------ | -| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,对应的路径参考[FA模型](js-apis-Context.md),[stage模型](js-apis-application-context.md) | -| outFile | string | 是 | 指定的解压文件路径 | -| options | [Options](#options) | 是 | 压缩的配置参数 | -| AsyncCallback<**void**> | callback | 否 | 压缩时的回调函数 | +| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,对应的路径参考[FA模型](js-apis-Context.md),[stage模型](js-apis-application-context.md)。 | +| outFile | string | 是 | 指定的解压文件路径。 | +| options | [Options](#options) | 是 | 压缩的配置参数。 | +| AsyncCallback<**void**> | callback | 否 | 压缩时的回调函数。 | **相关错误码** +以下错误码的详细介绍请参见[ohos.zlib错误码](../errorcodes/errorcode-zlib.md)。 | 错误码ID | 错误信息 | -| -------- | -------------------------------------- | -| 401 | wrong param type | +| -------- | --------------------------------------| | 900001 | The Input source file is invalid. | | 900002 | The Input destination file is invalid. | @@ -179,15 +179,16 @@ compressFile(inFile: string, outFile: string, options: Options): Promise\; | 参数名 | 类型 | 必填 | 说明 | | ------- | ------------------- | ---- | ------------------------------------------------------------ | -| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,对应的路径参考[FA模型](js-apis-Context.md),[stage模型](js-apis-application-context.md) | -| outFile | string | 是 | 指定的解压文件路径 | -| options | [Options](#options) | 是 | 压缩的配置参数 | +| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,对应的路径参考[FA模型](js-apis-Context.md),[stage模型](js-apis-application-context.md)。 | +| outFile | string | 是 | 指定的解压文件路径。 | +| options | [Options](#options) | 是 | 压缩的配置参数。 | **相关错误码** +以下错误码的详细介绍请参见[ohos.zlib错误码](../errorcodes/errorcode-zlib.md)。 + | 错误码ID | 错误信息 | -| -------- | -------------------------------------- | -| 401 | wrong param type | +| -------- | ------------------------------------- | | 900001 | The Input source file is invalid. | | 900002 | The Input destination file is invalid. | @@ -228,16 +229,17 @@ decompressFile(inFile: string, outFile: string, options: Options, callback: Asyn | 参数名 | 类型 | 必填 | 说明 | | ----------------------- | ------------------- | ---- | ------------------------------------------------------------ | -| inFile | string | 是 | 指定的待解压缩文件的文件路径,对应的路径参考[FA模型](js-apis-Context.md),[stage模型](js-apis-application-context.md) | -| outFile | string | 是 | 指定的解压后的目录路径 | -| options | [Options](#options) | 是 | 解压的配置参数 | -| AsyncCallback<**void**> | callback | 否 | 解压是的回调函数 | +| inFile | string | 是 | 指定的待解压缩文件的文件路径,对应的路径参考[FA模型](js-apis-Context.md),[stage模型](js-apis-application-context.md)。 | +| outFile | string | 是 | 指定的解压后的目录路径。 | +| options | [Options](#options) | 是 | 解压的配置参数。 | +| AsyncCallback<**void**> | callback | 否 | 解压是的回调函数。 | **相关错误码** -| 错误码ID | 错误信息 | -| -------- | -------------------------------------- | -| 401 | wrong param type | +以下错误码的详细介绍请参见[ohos.zlib错误码](../errorcodes/errorcode-zlib.md)。 + +| 错误码ID | 错误信息 +| -------- | --------------------------------------| | 900001 | The Input source file is invalid. | | 900002 | The Input destination file is invalid. | @@ -276,15 +278,16 @@ decompressFile(inFile: string, outFile: string, options: Options): Promise\