提交 89fd2d98 编写于 作者: X xsz233 提交者: ShiZhe Xu

modify bundle api reference

Signed-off-by: Nxsz233 <xushizhe@huawei.com>
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/api_doc.iml" filepath="$PROJECT_DIR$/.idea/api_doc.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
...@@ -8,19 +8,19 @@ During the compilation, select a build form factor based on the site requirement ...@@ -8,19 +8,19 @@ During the compilation, select a build form factor based on the site requirement
| Build Form Factor | Development Board| Main Chip| Kernel| System Type| | Build Form Factor | Development Board| Main Chip| Kernel| System Type|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| [neptune100](https://gitee.com/openharmony/vendor_hihope/blob/master/neptune_iotlink_demo/config.json) | neptune100 | WinnerMicro | LiteOS-M | Mini | | [neptune100](https://gitee.com/openharmony/vendor_hihope/blob/master/neptune_iotlink_demo/config.json) | neptune100 | WinnerMicro | LiteOS-M | Mini |
| [rk3568](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/config.json) | rk3568 | Rockchip | Linux | standard | | [rk3568](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/config.json) | rk3568 | Rockchip | Linux | Standard |
| [rk3568_Mini_system](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568_Mini_system/config.json) | rk3568 | Rockchip | Linux | Standard | | [rk3568_mini_system](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568_mini_system/config.json) | rk3568 | Rockchip | Linux | Standard |
| [bearpi_hm_micro](https://gitee.com/openharmony/vendor_bearpi/blob/master/bearpi_hm_micro/config.json) | bearpi_hm_micro | STM32MP1xx | LiteOS-A | small | | [bearpi_hm_micro](https://gitee.com/openharmony/vendor_bearpi/blob/master/bearpi_hm_micro/config.json) | bearpi_hm_micro | STM32MP1xx | LiteOS-A | small |
| [bearpi_hm_nano](https://gitee.com/openharmony/vendor_bearpi/blob/master/bearpi_hm_nano/config.json) | bearpi_hm_nano | Hi3861V100 | LiteOS-M | Mini | | [bearpi_hm_nano](https://gitee.com/openharmony/vendor_bearpi/blob/master/bearpi_hm_nano/config.json) | bearpi_hm_nano | Hi3861V100 | LiteOS-M | Mini |
| [wifiiot_hispark_pegasus](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_pegasus/config.json) | hispark_pegasus | Hi3861V100 | LiteOS-M | Mini | | [wifiiot_hispark_pegasus](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_pegasus/config.json) | hispark_pegasus | Hi3861V100 | LiteOS-M | Mini |
| [ipcamera_hispark_aries](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_aries/config.json) | hispark_aries | Hi3518EV300 | LiteOS-A | Small | | [ipcamera_hispark_aries](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_aries/config.json) | hispark_aries | Hi3518EV300 | LiteOS-A | Small |
| [ipcamera_hispark_taurus](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_taurus/config.json) | hispark_taurus | Hi3516DV300 | LiteOS-A | Small | | [ipcamera_hispark_taurus](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_taurus/config.json) | hispark_taurus | Hi3516DV300 | LiteOS-A | Small |
| [ipcamera_hispark_taurus_Linux](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_taurus_Linux/config.json) | hispark_taurus | Hi3516DV300 | Linux | Small | | [ipcamera_hispark_taurus_linux](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_taurus_linux/config.json) | hispark_taurus | Hi3516DV300 | Linux | Small |
| [hispark_taurus_Standard](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_taurus_Standard/config.json) | hispark_taurus | Hi3516DV300 | Linux | Standard | | [hispark_taurus_standard](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_taurus_standard/config.json) | hispark_taurus | Hi3516DV300 | Linux | Standard |
| [watchos](https://gitee.com/openharmony/vendor_hisilicon/blob/master/watchos/config.json) | hispark_taurus | Hi3516DV300 | Linux | Standard | | [watchos](https://gitee.com/openharmony/vendor_hisilicon/blob/master/watchos/config.json) | hispark_taurus | Hi3516DV300 | Linux | Standard |
| [hispark_phoenix](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_phoenix/config.json) | hispark_phoenix | Hi3751V350 | Linux | Standard | | [hispark_phoenix](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_phoenix/config.json) | hispark_phoenix | Hi3751V350 | Linux | Standard |
| [hispark_taurus_Mini_system](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_taurus_Mini_system/config.json) | hispark_taurus | Hi3516DV300 | LiteOS-A | Mini | | [hispark_taurus_mini_system](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_taurus_mini_system/config.json) | hispark_taurus | Hi3516DV300 | LiteOS-A | Mini |
| [hispark_pegasus_Mini_system](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_pegasus_Mini_system/config.json) | hispark_pegasus | Hi3861V100 | LiteOS-M | Mini | | [hispark_pegasus_mini_system](https://gitee.com/openharmony/vendor_hisilicon/blob/master/hispark_pegasus_mini_system/config.json) | hispark_pegasus | Hi3861V100 | LiteOS-M | Mini |
| [gr5515_sk_iotlink_demo](https://gitee.com/openharmony/vendor_goodix/blob/master/gr5515_sk_iotlink_demo/config.json) | gr5515_sk | GR551x | LiteOS-M | Mini | | [gr5515_sk_iotlink_demo](https://gitee.com/openharmony/vendor_goodix/blob/master/gr5515_sk_iotlink_demo/config.json) | gr5515_sk | GR551x | LiteOS-M | Mini |
| [gr5515_sk_xts_demo](https://gitee.com/openharmony/vendor_goodix/blob/master/gr5515_sk_xts_demo/config.json) | gr5515_sk | GR551x | LiteOS-M | Mini | | [gr5515_sk_xts_demo](https://gitee.com/openharmony/vendor_goodix/blob/master/gr5515_sk_xts_demo/config.json) | gr5515_sk | GR551x | LiteOS-M | Mini |
| [wifi_demo](https://gitee.com/openharmony/vendor_asrmicro/blob/master/wifi_demo/config.json) | dev_wifi_a | ASR582X | LiteOS-M | Mini | | [wifi_demo](https://gitee.com/openharmony/vendor_asrmicro/blob/master/wifi_demo/config.json) | dev_wifi_a | ASR582X | LiteOS-M | Mini |
...@@ -28,17 +28,17 @@ During the compilation, select a build form factor based on the site requirement ...@@ -28,17 +28,17 @@ During the compilation, select a build form factor based on the site requirement
| [display_demo](https://gitee.com/openharmony/vendor_bestechnic/blob/master/display_demo/config.json) | v200zr | BES2600 | LiteOS-M | Mini | | [display_demo](https://gitee.com/openharmony/vendor_bestechnic/blob/master/display_demo/config.json) | v200zr | BES2600 | LiteOS-M | Mini |
| [xts_demo](https://gitee.com/openharmony/vendor_bestechnic/blob/master/xts_demo/config.json) | v200zr | BES2600 | LiteOS-M | Mini | | [xts_demo](https://gitee.com/openharmony/vendor_bestechnic/blob/master/xts_demo/config.json) | v200zr | BES2600 | LiteOS-M | Mini |
| [iotlink_demo](https://gitee.com/openharmony/vendor_bestechnic/blob/master/iotlink_demo/config.json) | v200zr | BES2600 | LiteOS-M | Mini | | [iotlink_demo](https://gitee.com/openharmony/vendor_bestechnic/blob/master/iotlink_demo/config.json) | v200zr | BES2600 | LiteOS-M | Mini |
| [Mini_distributed_music_player](https://gitee.com/openharmony/vendor_bestechnic/blob/master/Mini_distributed_music_player/config.json) | v200zr | BES2600 | LiteOS-M | Mini | | [mini_distributed_music_player](https://gitee.com/openharmony/vendor_bestechnic/blob/master/mini_distributed_music_player/config.json) | v200zr | BES2600 | LiteOS-M | Mini |
| [niobe407](https://gitee.com/openharmony/vendor_talkweb/blob/master/niobe407/config.json) | niobe407 | STM32F4xx | LiteOS-M | Mini | | [niobe407](https://gitee.com/openharmony/vendor_talkweb/blob/master/niobe407/config.json) | niobe407 | STM32F4xx | LiteOS-M | Mini |
| [QEMU_Mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/QEMU_Mini_system_demo/config.json) | arm_mps2_an386 | QEMU | LiteOS-M | Mini | | [qemu_mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_mini_system_demo/config.json) | arm_mps2_an386 | QEMU | LiteOS-M | Mini |
| [QEMU_csky_Mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/QEMU_csky_Mini_system_demo/config.json) | SmartL_E802 | QEMU | LiteOS-M | Mini | | [qemu_csky_mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_csky_mini_system_demo/config.json) | SmartL_E802 | QEMU | LiteOS-M | Mini |
| [QEMU_cm55_Mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/QEMU_cm55_Mini_system_demo/config.json) | arm_mps3_an547 | QEMU | LiteOS-M | Mini | | [qemu_cm55_mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_cm55_mini_system_demo/config.json) | arm_mps3_an547 | QEMU | LiteOS-M | Mini |
| [QEMU_xtensa_Mini_system_demo](https://gitee.com/Rockchip/vendor_ohemu/blob/master/QEMU_xtensa_Mini_system_demo/config.json) | esp32 | QEMU | LiteOS-M | Mini | | [qemu_xtensa_mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_xtensa_mini_system_demo/config.json) | esp32 | QEMU | LiteOS-M | Mini |
| [QEMU_riscv_Mini_system_demo](https://gitee.com/Rockchip/vendor_ohemu/blob/master/QEMU_riscv32_Mini_system_demo/config.json) | ricsv32_virt | QEMU | LiteOS-M | Mini | | [qemu_riscv_mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_riscv32_mini_system_demo/config.json) | ricsv32_virt | QEMU | LiteOS-M | Mini |
| [QEMU_ca7_Mini_system_demo](https://gitee.com/Rockchip/vendor_ohemu/blob/master/QEMU_ca7_Mini_system_demo/config.json) | arm_virt | QEMU | LiteOS-A | Small | | [qemu_ca7_mini_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_ca7_mini_system_demo/config.json) | arm_virt | QEMU | LiteOS-A | Small |
| [QEMU_Small_system_demo](https://gitee.com/Rockchip/vendor_ohemu/blob/master/QEMU_Small_system_demo/config.json) | arm_virt | QEMU | LiteOS-A | Small | | [qemu_small_system_demo](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_small_system_demo/config.json) | arm_virt | QEMU | LiteOS-A | Small |
| [QEMU_arm_Linux_min](https://gitee.com/Rockchip/vendor_ohemu/blob/master/QEMU_arm_Linux_min/config.json) | QEMU-arm-Linux | QEMU | Linux | Standard | | [qemu_arm_inux_min](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_arm_linux_min/config.json) | qemu-arm-linux | QEMU | Linux | Standard |
| [QEMU_arm_Linux_headless](https://gitee.com/Rockchip/vendor_ohemu/blob/master/QEMU_arm_Linux_headless/config.json) | QEMU-arm-Linux | QEMU | Linux | Standard | | [qemu_arm_linux_headless](https://gitee.com/openharmony/vendor_ohemu/blob/master/qemu_arm_linux_headless/config.json) | qemu-arm-linux | QEMU | Linux | Standard |
| [iotlink_demo](https://gitee.com/Rockchip/vendor_Chipsea/blob/master/iotlink_demo/config.json) | cst85_wblink | Chipsea | LiteOS-M | Mini | | [iotlink_demo](https://gitee.com/openharmony/vendor_chipsea/blob/master/iotlink_demo/config.json) | cst85_wblink | Chipsea | LiteOS-M | Mini |
| [dsoftbus_demo](https://gitee.com/Rockchip/vendor_Chipsea/blob/master/dsoftbus_demo/config.json) | cst85_wblink | Chipsea | LiteOS-M | Mini | | [dsoftbus_demo](https://gitee.com/openharmony/vendor_chipsea/blob/master/dsoftbus_demo/config.json) | cst85_wblink | Chipsea | LiteOS-M | Mini |
| [xts_demo](https://gitee.com/Rockchip/vendor_Chipsea/blob/master/xts_demo/config.json) | cst85_wblink | Chipsea | LiteOS-M | Mini | | [xts_demo](https://gitee.com/openharmony/vendor_chipsea/blob/master/xts_demo/config.json) | cst85_wblink | Chipsea | LiteOS-M | Mini |
...@@ -115,6 +115,6 @@ Next ...@@ -115,6 +115,6 @@ Next
Congratulations! You have finished all steps! Proceed to develop samples to better familiarize yourself with OpenHarmony development: Congratulations! You have finished all steps! Proceed to develop samples to better familiarize yourself with OpenHarmony development:
- [LED Peripheral Control](guide/device-wlan-led-control.md) - [LED Peripheral Control](../guide/device-wlan-led-control.md)
- [Third-Party SDK Integration](guide/device-wlan-sdk.md) - [Third-Party SDK Integration](../guide/device-wlan-sdk.md)
...@@ -249,6 +249,7 @@ ...@@ -249,6 +249,7 @@
- [@ohos.runningLock (Runninglock锁)](js-apis-runninglock.md) - [@ohos.runningLock (Runninglock锁)](js-apis-runninglock.md)
- [@ohos.sensor (传感器)](js-apis-sensor.md) - [@ohos.sensor (传感器)](js-apis-sensor.md)
- [@ohos.settings (设置数据项名称)](js-apis-settings.md) - [@ohos.settings (设置数据项名称)](js-apis-settings.md)
- [@ohos.systemCapability (系统能力)](js-apis-system-capability.md)
- [@ohos.systemParameterV9 (系统属性)](js-apis-system-parameterV9.md) - [@ohos.systemParameterV9 (系统属性)](js-apis-system-parameterV9.md)
- [@ohos.thermal (热管理)](js-apis-thermal.md) - [@ohos.thermal (热管理)](js-apis-thermal.md)
- [@ohos.update (升级)](js-apis-update.md) - [@ohos.update (升级)](js-apis-update.md)
......
...@@ -46,7 +46,7 @@ SystemCapability.BundleManager.DistributedBundleFramework ...@@ -46,7 +46,7 @@ SystemCapability.BundleManager.DistributedBundleFramework
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ----------- | ------------------------------------------------------------ | ---- | -------------------------------------------------- | | ----------- | ------------------------------------------------------------ | ---- | -------------------------------------------------- |
| elementName | [ElementName](js-apis-bundle-ElementName.md) | 是 | 获得的ElementName信息。 | | elementName | [ElementName](js-apis-bundle-ElementName.md) | 是 | 获得的ElementName信息。 |
| callback | AsyncCallback<[RemoteAbilityInfo](js-apis-bundle-remoteAbilityInfo.md)> | 是 | 程序启动作为入参的回调函数,返回远程基本能力信息。 | | callback | AsyncCallback<[RemoteAbilityInfo](js-apis-bundle-remoteAbilityInfo.md)> | 是 | 程序启动作为入参的回调函数,返回远程基本能力信息。 |
...@@ -75,7 +75,7 @@ SystemCapability.BundleManager.DistributedBundleFramework ...@@ -75,7 +75,7 @@ SystemCapability.BundleManager.DistributedBundleFramework
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ----------- | -------------------------------------------- | ---- | ----------------------- | | ----------- | -------------------------------------------- | ---- | ----------------------- |
| elementName | [ElementName](js-apis-bundle-ElementName.md) | 是 | 获得的ElementName信息。 | | elementName | [ElementName](js-apis-bundle-ElementName.md) | 是 | 获得的ElementName信息。 |
...@@ -107,7 +107,7 @@ SystemCapability.BundleManager.DistributedBundleFramework ...@@ -107,7 +107,7 @@ SystemCapability.BundleManager.DistributedBundleFramework
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------------------------------------------------------------ | ---- | -------------------------------------------------- | | ------------ | ------------------------------------------------------------ | ---- | -------------------------------------------------- |
| elementNames | Array<[ElementName](js-apis-bundle-ElementName.md)> | 是 | ElementName信息,最大数组长度为10。 | | elementNames | Array<[ElementName](js-apis-bundle-ElementName.md)> | 是 | ElementName信息,最大数组长度为10。 |
| callback | AsyncCallback< Array<[RemoteAbilityInfo](js-apis-bundle-remoteAbilityInfo.md)>> | 是 | 程序启动作为入参的回调函数,返回远程基本能力信息。 | | callback | AsyncCallback< Array<[RemoteAbilityInfo](js-apis-bundle-remoteAbilityInfo.md)>> | 是 | 程序启动作为入参的回调函数,返回远程基本能力信息。 |
...@@ -136,7 +136,7 @@ SystemCapability.BundleManager.DistributedBundleFramework ...@@ -136,7 +136,7 @@ SystemCapability.BundleManager.DistributedBundleFramework
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------------ | --------------------------------------------------- | ---- | ----------------------- | | ------------ | --------------------------------------------------- | ---- | ----------------------- |
| elementNames | Array<[ElementName](js-apis-bundle-ElementName.md)> | 是 | ElementName信息,最大数组长度为10。 | | elementNames | Array<[ElementName](js-apis-bundle-ElementName.md)> | 是 | ElementName信息,最大数组长度为10。 |
......
...@@ -39,7 +39,7 @@ setDisposedStatus(appId: string, disposedWant: Want): Promise\<void> ...@@ -39,7 +39,7 @@ setDisposedStatus(appId: string, disposedWant: Want): Promise\<void>
| ------------------------- | ------------------ | | ------------------------- | ------------------ |
| Promise\<void> | Promise对象。无返回结果的Promise对象。 | | Promise\<void> | Promise对象。无返回结果的Promise对象。 |
**错误码** **错误码**
以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md) 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
...@@ -85,7 +85,7 @@ setDisposedStatus(appId: string, disposedWant: Want, callback: AsyncCallback\<vo ...@@ -85,7 +85,7 @@ setDisposedStatus(appId: string, disposedWant: Want, callback: AsyncCallback\<vo
| disposedWant | Want | 是 | 对应用的处置意图。 | | disposedWant | Want | 是 | 对应用的处置意图。 |
| callback | AsyncCallback\<void> | 是 | 回调函数,当设置处置状态成功,err为undefined,否则为错误对象。 | | callback | AsyncCallback\<void> | 是 | 回调函数,当设置处置状态成功,err为undefined,否则为错误对象。 |
**错误码** **错误码**
以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md) 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
...@@ -136,7 +136,7 @@ getDisposedStatus(appId: string): Promise\<Want>; ...@@ -136,7 +136,7 @@ getDisposedStatus(appId: string): Promise\<Want>;
| ------------------------- | ------------------ | | ------------------------- | ------------------ |
| Promise\<Want> | Promise对象,返回应用的处置状态。 | | Promise\<Want> | Promise对象,返回应用的处置状态。 |
**错误码** **错误码**
以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md) 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
...@@ -180,7 +180,7 @@ getDisposedStatus(appId: string, callback: AsyncCallback\<Want>): void; ...@@ -180,7 +180,7 @@ getDisposedStatus(appId: string, callback: AsyncCallback\<Want>): void;
| appId | string | 是 | 要查询的应用的appId<br> appId是应用的唯一标识,由应用的包名和签名信息决定,获取方法参见[获取应用的appId](#获取应用的appid)。 | | appId | string | 是 | 要查询的应用的appId<br> appId是应用的唯一标识,由应用的包名和签名信息决定,获取方法参见[获取应用的appId](#获取应用的appid)。 |
| callback | AsyncCallback\<Want> | 是 | 回调函数。当获取应用的处置状态成功时,err为undefined,data为获取到的处置状态;否则为错误对象。 | | callback | AsyncCallback\<Want> | 是 | 回调函数。当获取应用的处置状态成功时,err为undefined,data为获取到的处置状态;否则为错误对象。 |
**错误码** **错误码**
以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md) 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
...@@ -230,7 +230,7 @@ deleteDisposedStatus(appId: string): Promise\<void> ...@@ -230,7 +230,7 @@ deleteDisposedStatus(appId: string): Promise\<void>
| ------------------------- | ------------------ | | ------------------------- | ------------------ |
| Promise\<void> | Promise对象,无返回结果的Promise对象 | | Promise\<void> | Promise对象,无返回结果的Promise对象 |
**错误码** **错误码**
以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md) 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
...@@ -274,7 +274,7 @@ deleteDisposedStatus(appId: string, callback: AsyncCallback\<void>) : void ...@@ -274,7 +274,7 @@ deleteDisposedStatus(appId: string, callback: AsyncCallback\<void>) : void
| appId | string | 是 | 要查询的应用的appId。<br> appId是应用的唯一标识,由应用的包名和签名信息决定,获取方法参见[获取应用的appId](#获取应用的appid)。 | | appId | string | 是 | 要查询的应用的appId。<br> appId是应用的唯一标识,由应用的包名和签名信息决定,获取方法参见[获取应用的appId](#获取应用的appid)。 |
| callback | AsyncCallback\<void> | 是 | 回调函数,当设置处置状态成功时,err返回undefined。否则回调函数返回具体错误对象。 | | callback | AsyncCallback\<void> | 是 | 回调函数,当设置处置状态成功时,err返回undefined。否则回调函数返回具体错误对象。 |
**错误码** **错误码**
以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md) 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
......
...@@ -13,6 +13,26 @@ Buffer对象用于表示固定长度的字节序列,是专门存放二进制数 ...@@ -13,6 +13,26 @@ Buffer对象用于表示固定长度的字节序列,是专门存放二进制数
import buffer from '@ohos.buffer'; import buffer from '@ohos.buffer';
``` ```
## BufferEncoding
表示支持的编码格式字符串。
**系统能力:** SystemCapability.Utils.Lang
| 编码格式 | 说明 |
| ------- | -------------------- |
| ascii | 表示ascii格式。 |
| utf8 | 表示utf8格式。 |
| utf-8 | 表示utf8格式。 |
| utf16le | 表示utf16小端序格式。 |
| ucs2 | 表示utf16小端序格式。 |
| ucs-2 | 表示utf16小端序格式。 |
| base64 | 表示base64格式。 |
| base64url | 表示base64格式。 |
| latin1 | 表示ascii格式。 |
| binary | 表示二进制格式。 |
| hex | 表示十六进制格式。 |
## Buffer ## Buffer
### 属性 ### 属性
...@@ -73,7 +93,7 @@ alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): ...@@ -73,7 +93,7 @@ alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding):
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| size | number | 是 | 指定的Buffer实例长度,单位:字节。 | | size | number | 是 | 指定的Buffer实例长度,单位:字节。 |
| fill | string&nbsp;\|&nbsp;Buffer&nbsp;\|&nbsp;number | 否 | 预填充的值,默认值: 0 | | fill | string&nbsp;\|&nbsp;Buffer&nbsp;\|&nbsp;number | 否 | 预填充的值,默认值: 0 |
| encoding | BufferEncoding | 否 | 编码方式(当`fill`为string时,才有意义)。 默认值: 'utf-8' | | encoding | [BufferEncoding](#bufferencoding) | 否 | 编码方式(当`fill`为string时,才有意义)。 默认值: 'utf-8' |
**返回值:** **返回值:**
...@@ -181,7 +201,7 @@ byteLength(string: string | Buffer | TypedArray | DataView | ArrayBuffer | Share ...@@ -181,7 +201,7 @@ byteLength(string: string | Buffer | TypedArray | DataView | ArrayBuffer | Share
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| string | string&nbsp;\|&nbsp;Buffer&nbsp;\|&nbsp;TypedArray&nbsp;\|&nbsp;DataView&nbsp;\|&nbsp;ArrayBuffer&nbsp;\|&nbsp;SharedArrayBuffer | 是 | 指定字符串。 | | string | string&nbsp;\|&nbsp;Buffer&nbsp;\|&nbsp;TypedArray&nbsp;\|&nbsp;DataView&nbsp;\|&nbsp;ArrayBuffer&nbsp;\|&nbsp;SharedArrayBuffer | 是 | 指定字符串。 |
| encoding | BufferEncoding | 否 | 编码方式。 默认值: 'utf-8' | | encoding | [BufferEncoding](#bufferencoding) | 否 | 编码方式。 默认值: 'utf-8' |
**返回值:** **返回值:**
...@@ -469,7 +489,7 @@ from(string: String, encoding?: BufferEncoding): Buffer ...@@ -469,7 +489,7 @@ from(string: String, encoding?: BufferEncoding): Buffer
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| string | String | 是 | 字符串 | | string | String | 是 | 字符串 |
| encoding | BufferEncoding | 否 | 编码格式。 默认值: 'utf-8'。 | | encoding | [BufferEncoding](#bufferencoding) | 否 | 编码格式。 默认值: 'utf-8'。 |
**返回值:** **返回值:**
...@@ -739,7 +759,7 @@ fill(value: string | Buffer | Uint8Array | number, offset?: number, end?: number ...@@ -739,7 +759,7 @@ fill(value: string | Buffer | Uint8Array | number, offset?: number, end?: number
| value | string&nbsp;\|&nbsp;Buffer&nbsp;\|&nbsp;Uint8Array&nbsp;\|&nbsp;number | 是 | 用于填充的值。 | | value | string&nbsp;\|&nbsp;Buffer&nbsp;\|&nbsp;Uint8Array&nbsp;\|&nbsp;number | 是 | 用于填充的值。 |
| offset | number | 否 | 起始偏移量。 默认值: 0。 | | offset | number | 否 | 起始偏移量。 默认值: 0。 |
| end | number | 否 | 结束偏移量(不包括在内)。 默认值: buf.length。 | | end | number | 否 | 结束偏移量(不包括在内)。 默认值: buf.length。 |
| encoding | BufferEncoding | 否 | 字符编码格式(`value`为string才有意义)。 默认值: 'utf-8'。 | | encoding | [BufferEncoding](#bufferencoding) | 否 | 字符编码格式(`value`为string才有意义)。 默认值: 'utf-8'。 |
**返回值:** **返回值:**
...@@ -785,7 +805,7 @@ includes(value: string | number | Buffer | Uint8Array, byteOffset?: number, enco ...@@ -785,7 +805,7 @@ includes(value: string | number | Buffer | Uint8Array, byteOffset?: number, enco
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | string&nbsp;\|&nbsp;number&nbsp;\|&nbsp;Buffer&nbsp;\|&nbsp;Uint8Array | 是 | 要搜索的内容。 | | value | string&nbsp;\|&nbsp;number&nbsp;\|&nbsp;Buffer&nbsp;\|&nbsp;Uint8Array | 是 | 要搜索的内容。 |
| byteOffset | number | 否 | 字节偏移量。 如果为负数,则从末尾开始计算偏移量。 默认值: 0。 | | byteOffset | number | 否 | 字节偏移量。 如果为负数,则从末尾开始计算偏移量。 默认值: 0。 |
| encoding | BufferEncoding | 否 | 字符编码格式。 默认值: 'utf-8'。 | | encoding | [BufferEncoding](#bufferencoding) | 否 | 字符编码格式。 默认值: 'utf-8'。 |
**返回值:** **返回值:**
...@@ -824,7 +844,7 @@ indexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encod ...@@ -824,7 +844,7 @@ indexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encod
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | string&nbsp;\|&nbsp;number&nbsp;\|&nbsp;Buffer&nbsp;\|&nbsp;Uint8Array | 是 | 要搜索的内容。 | | value | string&nbsp;\|&nbsp;number&nbsp;\|&nbsp;Buffer&nbsp;\|&nbsp;Uint8Array | 是 | 要搜索的内容。 |
| byteOffset | number | 否 | 字节偏移量。 如果为负数,则从末尾开始计算偏移量。 默认值: 0。 | | byteOffset | number | 否 | 字节偏移量。 如果为负数,则从末尾开始计算偏移量。 默认值: 0。 |
| encoding | BufferEncoding | 否 | 字符编码格式。 默认值: 'utf-8'。 | | encoding | [BufferEncoding](#bufferencoding) | 否 | 字符编码格式。 默认值: 'utf-8'。 |
**返回值:** **返回值:**
...@@ -894,7 +914,7 @@ lastIndexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, e ...@@ -894,7 +914,7 @@ lastIndexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, e
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | string&nbsp;\|&nbsp;number&nbsp;\|&nbsp;Buffer&nbsp;\|&nbsp;Uint8Array | 是 | 要搜索的内容。 | | value | string&nbsp;\|&nbsp;number&nbsp;\|&nbsp;Buffer&nbsp;\|&nbsp;Uint8Array | 是 | 要搜索的内容。 |
| byteOffset | number | 否 | 字节偏移量。 如果为负数,则从末尾开始计算偏移量。 默认值: 0。 | | byteOffset | number | 否 | 字节偏移量。 如果为负数,则从末尾开始计算偏移量。 默认值: 0。 |
| encoding | BufferEncoding | 否 | 字符编码格式。 默认值: 'utf-8'。 | | encoding | [BufferEncoding](#bufferencoding) | 否 | 字符编码格式。 默认值: 'utf-8'。 |
**返回值:** **返回值:**
...@@ -2196,7 +2216,7 @@ for (let value of buf1.values()) { ...@@ -2196,7 +2216,7 @@ for (let value of buf1.values()) {
### write ### write
write(str: string, offset?: number, length?: number, encoding?: BufferEncoding): number write(str: string, offset?: number, length?: number, encoding?: string): number
从buf的offset偏移写入指定编码的字符串str,写入的字节长度为length 从buf的offset偏移写入指定编码的字符串str,写入的字节长度为length
...@@ -2209,7 +2229,7 @@ write(str: string, offset?: number, length?: number, encoding?: BufferEncoding): ...@@ -2209,7 +2229,7 @@ write(str: string, offset?: number, length?: number, encoding?: BufferEncoding):
| str | string | 是 | 要写入Buffer的字符串。 | | str | string | 是 | 要写入Buffer的字符串。 |
| offset | number | 否 | 偏移量。 默认值: 0。 | | offset | number | 否 | 偏移量。 默认值: 0。 |
| length | number | 否 | 最大字节长度。 默认值: (buf.length - offset)。| | length | number | 否 | 最大字节长度。 默认值: (buf.length - offset)。|
| encoding | BufferEncoding | 否 | 字符编码。 默认值: 'utf-8'。 | | encoding | string | 否 | 字符编码。 默认值: 'utf-8'。 |
**返回值:** **返回值:**
......
...@@ -25,7 +25,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -25,7 +25,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | | --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
| bundleFilePaths | Array&lt;string&gt; | 是 | 指示存储hap包的沙箱路径。沙箱路径的获取方法参见[获取应用的沙箱路径](#获取应用的沙箱路径)| | bundleFilePaths | Array&lt;string&gt; | 是 | 指示存储hap包的沙箱路径。沙箱路径的获取方法参见[获取应用的沙箱路径](#获取应用的沙箱路径)|
| param | [InstallParam](#installparamdeprecated) | 是 | 指定安装所需的其他参数。 | | param | [InstallParam](#installparamdeprecated) | 是 | 指定安装所需的其他参数。 |
...@@ -75,7 +75,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -75,7 +75,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | | ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
| bundleName | string | 是 | 包名 | | bundleName | string | 是 | 包名 |
| param | [InstallParam](#installparamdeprecated) | 是 | 指定卸载所需的其他参数。 | | param | [InstallParam](#installparamdeprecated) | 是 | 指定卸载所需的其他参数。 |
...@@ -124,7 +124,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -124,7 +124,7 @@ SystemCapability.BundleManager.BundleFramework
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | | ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
| bundleName | string | 是 | 应用包名。 | | bundleName | string | 是 | 应用包名。 |
| param | [InstallParam](#installparamdeprecated) | 是 | 指定应用恢复所需的其他参数。 | | param | [InstallParam](#installparamdeprecated) | 是 | 指定应用恢复所需的其他参数。 |
......
...@@ -206,10 +206,6 @@ getBundleInfoForSelf(bundleFlags: [number](#bundleflag)): Promise\<[BundleInfo]( ...@@ -206,10 +206,6 @@ getBundleInfoForSelf(bundleFlags: [number](#bundleflag)): Promise\<[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 ```ts
...@@ -241,10 +237,6 @@ getBundleInfoForSelf(bundleFlags: [number](#bundleflag), callback: AsyncCallback ...@@ -241,10 +237,6 @@ getBundleInfoForSelf(bundleFlags: [number](#bundleflag), callback: AsyncCallback
| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息。 | | bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息。 |
| callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的当前应用的BundleInfo;否则为错误对象。 | | callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的当前应用的BundleInfo;否则为错误对象。 |
**错误码:**
以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
**示例:** **示例:**
```ts ```ts
...@@ -292,7 +284,7 @@ getBundleInfo(bundleName: string, bundleFlags: number, userId: number, callback: ...@@ -292,7 +284,7 @@ getBundleInfo(bundleName: string, bundleFlags: number, userId: number, callback:
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ------------------------------------- | | -------- | ------------------------------------- |
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
**示例:** **示例:**
...@@ -364,6 +356,7 @@ getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\< ...@@ -364,6 +356,7 @@ getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ------------------------------------- | | -------- | ------------------------------------- |
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700004 | The specified user ID is not found. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
**示例:** **示例:**
...@@ -419,7 +412,7 @@ getBundleInfo(bundleName: string, bundleFlags: [number](#bundleflag), userId?: n ...@@ -419,7 +412,7 @@ getBundleInfo(bundleName: string, bundleFlags: [number](#bundleflag), userId?: n
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | --------------------------------------| | -------- | --------------------------------------|
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
**示例:** **示例:**
...@@ -487,10 +480,10 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), use ...@@ -487,10 +480,10 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), use
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | --------------------------------------| | -------- | --------------------------------------|
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
**示例:** **示例:**
```ts ```ts
import bundleManager from '@ohos.bundle.bundleManager' import bundleManager from '@ohos.bundle.bundleManager'
...@@ -538,6 +531,7 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), cal ...@@ -538,6 +531,7 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), cal
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | --------------------------------------| | -------- | --------------------------------------|
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700004 | The specified user ID is not found. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
**示例:** **示例:**
...@@ -593,7 +587,7 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), use ...@@ -593,7 +587,7 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), use
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ------------------------------------- | | -------- | ------------------------------------- |
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
**示例:** **示例:**
...@@ -641,7 +635,7 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), userId: number, callback: A ...@@ -641,7 +635,7 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), userId: number, callback: A
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | --------------------------------- | | -------- | --------------------------------- |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found. |
**示例:** **示例:**
...@@ -686,6 +680,10 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), callback: AsyncCallback<Arr ...@@ -686,6 +680,10 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), callback: AsyncCallback<Arr
错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md) 错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
| 错误码ID | 错误信息 |
| -------- | ---------------------------------- |
| 17700004 | The specified user ID is not found. |
**示例:** **示例:**
```ts ```ts
...@@ -736,7 +734,7 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), userId?: number): Promise<A ...@@ -736,7 +734,7 @@ getAllBundleInfo(bundleFlags: [number](#bundleflag), userId?: number): Promise<A
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ---------------------------------- | | -------- | ---------------------------------- |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found. |
**示例:** **示例:**
...@@ -781,7 +779,7 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), userId: number, call ...@@ -781,7 +779,7 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), userId: number, call
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ---------------------------------- | | -------- | ---------------------------------- |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found. |
**示例:** **示例:**
...@@ -826,6 +824,10 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), callback: AsyncCallb ...@@ -826,6 +824,10 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), callback: AsyncCallb
错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md) 错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
| 错误码ID | 错误信息 |
| -------- | ---------------------------------- |
| 17700004 | The specified user ID is not found. |
**示例:** **示例:**
```ts ```ts
...@@ -876,7 +878,7 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), userId?: number): Pr ...@@ -876,7 +878,7 @@ getAllApplicationInfo(appFlags: [number](#applicationflag), userId?: number): Pr
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ---------------------------------- | | -------- | ---------------------------------- |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found. |
**示例:** **示例:**
...@@ -981,6 +983,7 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), callback: Asy ...@@ -981,6 +983,7 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), callback: Asy
| -------- | -------------------------------------- | | -------- | -------------------------------------- |
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700003 | The specified ability is not found. | | 17700003 | The specified ability is not found. |
| 17700004 | The specified userId is invalid. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
| 17700029 | The specified ability is disabled. | | 17700029 | The specified ability is disabled. |
...@@ -1040,7 +1043,7 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), userId?: numb ...@@ -1040,7 +1043,7 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), userId?: numb
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ------------------------------------- | | -------- | ------------------------------------- |
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700003 | The specified ability is not found. | | 17700003 | The specified extensionAbility is not found. |
| 17700004 | The specified userId is invalid. | | 17700004 | The specified userId is invalid. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
| 17700029 | The specified ability is disabled. | | 17700029 | The specified ability is disabled. |
...@@ -1169,10 +1172,11 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp ...@@ -1169,10 +1172,11 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp
以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md) 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ------------------------------------------- | | -------- | -------------------------------------------- |
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700003 | The specified extensionAbility is not found. | | 17700003 | The specified extensionAbility is not found. |
| 17700004 | The specified userId is invalid. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
**示例:** **示例:**
...@@ -1499,7 +1503,7 @@ cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback\<void>): void; ...@@ -1499,7 +1503,7 @@ cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback\<void>): void;
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ |
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700030 | The specified bundleName does not support cleaning cache files. | | 17700030 | The specified bundle does not support clearing of cache files. |
**示例:** **示例:**
...@@ -2029,7 +2033,7 @@ getLaunchWantForBundle(bundleName: string, userId: number, callback: AsyncCallba ...@@ -2029,7 +2033,7 @@ getLaunchWantForBundle(bundleName: string, userId: number, callback: AsyncCallba
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | --------------------------------------| | -------- | --------------------------------------|
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
**示例:** **示例:**
...@@ -2078,6 +2082,7 @@ getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\<Want>): void ...@@ -2078,6 +2082,7 @@ getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\<Want>): void
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | --------------------------------------| | -------- | --------------------------------------|
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700004 | The specified user ID is not found |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
**示例:** **示例:**
...@@ -2131,7 +2136,7 @@ getLaunchWantForBundle(bundleName: string, userId?: number): Promise\<Want>; ...@@ -2131,7 +2136,7 @@ getLaunchWantForBundle(bundleName: string, userId?: number): Promise\<Want>;
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | --------------------------------------| | -------- | --------------------------------------|
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
**示例:** **示例:**
...@@ -2177,7 +2182,7 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName: strin ...@@ -2177,7 +2182,7 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName: strin
| -------- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ |
| 17700002 | The specified moduleName is not existed. | | 17700002 | The specified moduleName is not existed. |
| 17700003 | The specified abilityName is not existed. | | 17700003 | The specified abilityName is not existed. |
| 17700024 | The specified metadataName is not existed or the profile is not json-format. | | 17700024 | Failed to get the profile because there is no profile in the HAP. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
| 17700029 | The specified ability is disabled. | | 17700029 | The specified ability is disabled. |
...@@ -2232,7 +2237,7 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName?: stri ...@@ -2232,7 +2237,7 @@ getProfileByAbility(moduleName: string, abilityName: string, metadataName?: stri
| -------- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ |
| 17700002 | The specified moduleName is not existed. | | 17700002 | The specified moduleName is not existed. |
| 17700003 | The specified abilityName is not existed. | | 17700003 | The specified abilityName is not existed. |
| 17700024 | The specified metadataName is not existed or the profile is not json-format. | | 17700024 | Failed to get the profile because there is no profile in the HAP. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
| 17700029 | The specified ability is disabled. | | 17700029 | The specified ability is disabled. |
...@@ -2280,11 +2285,11 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m ...@@ -2280,11 +2285,11 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m
**参数:** **参数:**
| 名称 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------------- | ----------------------------- | ---- | ------------------------------------------------------------ | | -------------------- | ----------------------------- | ---- | ------------------------------------------------------------ |
| moduleName | string | 是 | 表示应用程序的moduleName。 | | moduleName | string | 是 | 表示应用程序的moduleName。 |
| extensionAbilityName | string | 是 | 表示应用程序的extensionAbilityName。 | | extensionAbilityName | string | 是 | 表示应用程序的extensionAbilityName。 |
| metadataName | string | 是 | 表示应用程序的metadataName。 | | metadataName | string | 是 | 表示应用程序的metadataName。 |
| callback | AsyncCallback<Array\<string>> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\<string>;否则为错误对象。 | | callback | AsyncCallback<Array\<string>> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\<string>;否则为错误对象。 |
**错误码:** **错误码:**
...@@ -2295,7 +2300,7 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m ...@@ -2295,7 +2300,7 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m
| -------- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ |
| 17700002 | The specified moduleName is not existed. | | 17700002 | The specified moduleName is not existed. |
| 17700003 | The specified extensionAbilityName is not existed. | | 17700003 | The specified extensionAbilityName is not existed. |
| 17700024 | The specified metadataName is not existed or the profile is not json-format. | | 17700024 | Failed to get the profile because there is no profile in the HAP. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
**示例:** **示例:**
...@@ -2329,7 +2334,7 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m ...@@ -2329,7 +2334,7 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m
**参数:** **参数:**
| 名称 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------------- | ------ | ---- | ---------------------------------- | | -------------------- | ------ | ---- | ---------------------------------- |
| moduleName | string | 是 | 表示应用程序的moduleName。 | | moduleName | string | 是 | 表示应用程序的moduleName。 |
| extensionAbilityName | string | 是 | 表示应用程序的extensionAbilityName。 | | extensionAbilityName | string | 是 | 表示应用程序的extensionAbilityName。 |
...@@ -2349,7 +2354,7 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m ...@@ -2349,7 +2354,7 @@ getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, m
| -------- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ |
| 17700002 | The specified moduleName is not existed. | | 17700002 | The specified moduleName is not existed. |
| 17700003 | The specified extensionAbilityName is not existed. | | 17700003 | The specified extensionAbilityName is not existed. |
| 17700024 | The specified metadataName is not existed or the profile is not json-format. | | 17700024 | Failed to get the profile because there is no profile in the HAP. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
**示例:** **示例:**
...@@ -2395,9 +2400,9 @@ getPermissionDef(permissionName: string, callback: AsyncCallback\<[PermissionDef ...@@ -2395,9 +2400,9 @@ getPermissionDef(permissionName: string, callback: AsyncCallback\<[PermissionDef
**参数:** **参数:**
| 名称 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| permissionName | string | 是 | 表示权限名称。 | | permissionName | string | 是 | 表示权限名称。 |
| callback | AsyncCallback\<[PermissionDef](js-apis-bundleManager-permissionDef.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\<PermissionDef>;否则为错误对象。 | | callback | AsyncCallback\<[PermissionDef](js-apis-bundleManager-permissionDef.md)> | 是 | 回调函数,当获取成功时,err为null,data为获取到的Array\<PermissionDef>;否则为错误对象。 |
**错误码:** **错误码:**
...@@ -2440,7 +2445,7 @@ getPermissionDef(permissionName: string): Promise\<[PermissionDef](js-apis-bundl ...@@ -2440,7 +2445,7 @@ getPermissionDef(permissionName: string): Promise\<[PermissionDef](js-apis-bundl
**参数:** **参数:**
| 名称 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------ | ---- | -------------- | | -------------- | ------ | ---- | -------------- |
| permissionName | string | 是 | 表示权限参数名。 | | permissionName | string | 是 | 表示权限参数名。 |
...@@ -2830,7 +2835,7 @@ getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag), userId ...@@ -2830,7 +2835,7 @@ getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag), userId
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ------------------------------------- | | -------- | ------------------------------------- |
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700004 | The specified userId is not found. | | 17700004 | The specified user ID is not found. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
**示例:** **示例:**
...@@ -2881,6 +2886,7 @@ getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [Bund ...@@ -2881,6 +2886,7 @@ getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [Bund
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ------------------------------------- | | -------- | ------------------------------------- |
| 17700001 | The specified bundleName is not found. | | 17700001 | The specified bundleName is not found. |
| 17700004 | The specified user ID is not found. |
| 17700026 | The specified bundle is disabled. | | 17700026 | The specified bundle is disabled. |
**示例:** **示例:**
......
...@@ -138,7 +138,7 @@ getDefaultApplication(type: string, userId?: number): Promise\<BundleInfo> ...@@ -138,7 +138,7 @@ getDefaultApplication(type: string, userId?: number): Promise\<BundleInfo>
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ----------------------------------------- | | -------- | ----------------------------------------- |
| 17700004 | The specified user id is not found. | | 17700004 | The specified user ID is not found. |
| 17700023 | The specified default app does not exist. | | 17700023 | The specified default app does not exist. |
| 17700025 | The specified type is invalid. | | 17700025 | The specified type is invalid. |
...@@ -189,7 +189,7 @@ getDefaultApplication(type: string, userId: number, callback: AsyncCallback\<Bun ...@@ -189,7 +189,7 @@ getDefaultApplication(type: string, userId: number, callback: AsyncCallback\<Bun
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ----------------------------------------- | | -------- | ----------------------------------------- |
| 17700004 | The specified user id is not found. | | 17700004 | The specified user ID is not found. |
| 17700023 | The specified default app does not exist. | | 17700023 | The specified default app does not exist. |
| 17700025 | The specified type is invalid. | | 17700025 | The specified type is invalid. |
...@@ -240,7 +240,7 @@ getDefaultApplication(type: string, callback: AsyncCallback\<BundleInfo>) : void ...@@ -240,7 +240,7 @@ getDefaultApplication(type: string, callback: AsyncCallback\<BundleInfo>) : void
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ----------------------------------------- | | -------- | ----------------------------------------- |
| 17700004 | The specified user id is not found. | | 17700004 | The specified user ID is not found. |
| 17700023 | The specified default app does not exist. | | 17700023 | The specified default app does not exist. |
| 17700025 | The specified type is invalid. | | 17700025 | The specified type is invalid. |
...@@ -304,9 +304,9 @@ setDefaultApplication(type: string, elementName: ElementName, userId?: number): ...@@ -304,9 +304,9 @@ setDefaultApplication(type: string, elementName: ElementName, userId?: number):
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ---------------------------------------------- | | -------- | ---------------------------------------------- |
| 17700004 | The specified user id is not found. | | 17700004 | The specified user ID is not found. |
| 17700025 | The specified type is invalid. | | 17700025 | The specified type is invalid. |
| 17700028 | The specified ability and type does not match. | | 17700028 | The specified ability does not match the type. |
**示例:** **示例:**
...@@ -371,9 +371,9 @@ setDefaultApplication(type: string, elementName: ElementName, userId: number, ca ...@@ -371,9 +371,9 @@ setDefaultApplication(type: string, elementName: ElementName, userId: number, ca
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ---------------------------------------------- | | -------- | ---------------------------------------------- |
| 17700004 | The specified user id is not found. | | 17700004 | The specified user ID is not found. |
| 17700025 | The specified type is invalid. | | 17700025 | The specified type is invalid. |
| 17700028 | The specified ability and type does not match. | | 17700028 | The specified ability does not match the type. |
**示例:** **示例:**
...@@ -431,9 +431,9 @@ setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCal ...@@ -431,9 +431,9 @@ setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCal
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ---------------------------------------------- | | -------- | ---------------------------------------------- |
| 17700004 | The specified user id is not found. | | 17700004 | The specified user ID is not found. |
| 17700025 | The specified type is invalid. | | 17700025 | The specified type is invalid. |
| 17700028 | The specified ability and type does not match. | | 17700028 | The specified ability does not match the type. |
**示例:** **示例:**
...@@ -489,7 +489,7 @@ resetDefaultApplication(type: string, userId?: number): Promise\<void> ...@@ -489,7 +489,7 @@ resetDefaultApplication(type: string, userId?: number): Promise\<void>
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 17700004 | The specified user id is not found. | | 17700004 | The specified user ID is not found. |
| 17700025 | The specified type is invalid. | | 17700025 | The specified type is invalid. |
**示例:** **示例:**
...@@ -540,7 +540,7 @@ resetDefaultApplication(type: string, userId: number, callback: AsyncCallback\<v ...@@ -540,7 +540,7 @@ resetDefaultApplication(type: string, userId: number, callback: AsyncCallback\<v
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 17700004 | The specified user id is not found. | | 17700004 | The specified user ID is not found. |
| 17700025 | The specified type is invalid. | | 17700025 | The specified type is invalid. |
**示例:** **示例:**
...@@ -590,7 +590,7 @@ resetDefaultApplication(type: string, callback: AsyncCallback\<void>) : void; ...@@ -590,7 +590,7 @@ resetDefaultApplication(type: string, callback: AsyncCallback\<void>) : void;
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 17700004 | The specified user id is not found. | | 17700004 | The specified user ID is not found. |
| 17700025 | The specified type is invalid. | | 17700025 | The specified type is invalid. |
**示例:** **示例:**
......
# DispatchInfo
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
调度信息类
## DispatchInfo
**系统能力**: 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.FreeInstall
**系统API:**此接口为系统接口,三方应用不支持调用
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------------ | ------ | ---- | ---- | ------------------------ |
| version | string | 是 | 否 | 包含dispatchInfo版本信息 |
| dispatchAPIVersion | string | 是 | 否 | 包含免安装接口版本号 |
...@@ -53,7 +53,7 @@ getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback\<RemoteAb ...@@ -53,7 +53,7 @@ getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback\<RemoteAb
|----------|--------------------------------------| |----------|--------------------------------------|
| 17700001 | The specified bundle name is not found. | | 17700001 | The specified bundle name is not found. |
| 17700003 | The specified ability 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. | | 17700027 | The distributed service is not running. |
**示例:** **示例:**
...@@ -109,7 +109,7 @@ getRemoteAbilityInfo(elementName: ElementName): Promise\<RemoteAbilityInfo>; ...@@ -109,7 +109,7 @@ getRemoteAbilityInfo(elementName: ElementName): Promise\<RemoteAbilityInfo>;
|----------|-------------------------| |----------|-------------------------|
| 17700001 | The specified bundle name is not found. | | 17700001 | The specified bundle name is not found. |
| 17700003 | The specified ability 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. | | 17700027 | The distributed service is not running. |
**示例:** **示例:**
...@@ -158,7 +158,7 @@ getRemoteAbilityInfo(elementNames: Array\<ElementName>, callback: AsyncCallback\ ...@@ -158,7 +158,7 @@ getRemoteAbilityInfo(elementNames: Array\<ElementName>, callback: AsyncCallback\
|----------|-------------------------| |----------|-------------------------|
| 17700001 | The specified bundle name is not found. | | 17700001 | The specified bundle name is not found. |
| 17700003 | The specified ability 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. | | 17700027 | The distributed service is not running. |
**示例:** **示例:**
...@@ -221,7 +221,7 @@ getRemoteAbilityInfo(elementNames: Array\<ElementName>): Promise\<Array\<RemoteA ...@@ -221,7 +221,7 @@ getRemoteAbilityInfo(elementNames: Array\<ElementName>): Promise\<Array\<RemoteA
|----------|-------------------------| |----------|-------------------------|
| 17700001 | The specified bundle name is not found. | | 17700001 | The specified bundle name is not found. |
| 17700003 | The specified ability 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. | | 17700027 | The distributed service is not running. |
**示例:** **示例:**
...@@ -278,7 +278,7 @@ getRemoteAbilityInfo(elementName: ElementName, locale: string, callback: AsyncCa ...@@ -278,7 +278,7 @@ getRemoteAbilityInfo(elementName: ElementName, locale: string, callback: AsyncCa
|----------|-------------------------| |----------|-------------------------|
| 17700001 | The specified bundle name is not found. | | 17700001 | The specified bundle name is not found. |
| 17700003 | The specified ability 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. | | 17700027 | The distributed service is not running. |
**示例:** **示例:**
...@@ -335,7 +335,7 @@ getRemoteAbilityInfo(elementName: ElementName, locale: string): Promise\<RemoteA ...@@ -335,7 +335,7 @@ getRemoteAbilityInfo(elementName: ElementName, locale: string): Promise\<RemoteA
|----------|-------------------------| |----------|-------------------------|
| 17700001 | The specified bundle name is not found. | | 17700001 | The specified bundle name is not found. |
| 17700003 | The specified ability 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. | | 17700027 | The distributed service is not running. |
**示例:** **示例:**
...@@ -385,7 +385,7 @@ getRemoteAbilityInfo(elementNames: Array\<ElementName>, locale: string, callback ...@@ -385,7 +385,7 @@ getRemoteAbilityInfo(elementNames: Array\<ElementName>, locale: string, callback
|---------------|-------------------------| |---------------|-------------------------|
| 17700001 | The specified bundle name is not found. | | 17700001 | The specified bundle name is not found. |
| 17700003 | The specified ability 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. | | 17700027 | The distributed service is not running. |
**示例:** **示例:**
...@@ -449,7 +449,7 @@ getRemoteAbilityInfo(elementNames: Array\<ElementName>, locale: string): Promise ...@@ -449,7 +449,7 @@ getRemoteAbilityInfo(elementNames: Array\<ElementName>, locale: string): Promise
|----------|-------------------------| |----------|-------------------------|
| 17700001 | The specified bundle name is not found. | | 17700001 | The specified bundle name is not found. |
| 17700003 | The specified ability 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. | | 17700027 | The distributed service is not running. |
**示例:** **示例:**
......
...@@ -115,17 +115,17 @@ install(hapFilePaths: Array&lt;string&gt;, installParam: InstallParam, callback: ...@@ -115,17 +115,17 @@ install(hapFilePaths: Array&lt;string&gt;, installParam: InstallParam, callback:
以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md) 以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------ | | -------- | ------------------------------------------------------------ |
| 17700004 | The specified userId is not existed. | | 17700004 | The specified user ID is not found. |
| 17700010 | To parse file of config.json or module.json failed. | | 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
| 17700011 | To verify signature failed. | | 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
| 17700012 | Invalid hap file path or too large file size. | | 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
| 17700015 | Multiple haps have inconsistent configured information. | | 17700015 | Failed to install the HAPs because they have different configuration information. |
| 17700016 | No disk space left for installation. | | 17700016 | Failed to install the HAP because of insufficient system disk space. |
| 17700017 | Downgrade installation is prohibited. | | 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
| 17700101 | The system service is excepted. | | 17700101 | The system service is excepted. |
| 17700103 | I/O operation is failed. | | 17700103 | I/O operation is failed. |
**示例:** **示例:**
...@@ -181,9 +181,9 @@ uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallbac ...@@ -181,9 +181,9 @@ uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallbac
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ |
| 17700004 | The specified userId is not existed. | | 17700004 | The specified user ID is not found. |
| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | | 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
| 17700101 | The system service is excepted. | | 17700101 | The system service is excepted. |
**示例:** **示例:**
...@@ -239,7 +239,7 @@ recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback& ...@@ -239,7 +239,7 @@ recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback&
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 17700004 | The specified userId is not existed. | | 17700004 | The specified user ID is not found. |
**示例:** **示例:**
......
...@@ -27,7 +27,7 @@ getLauncherAbilityInfo(bundleName: string, userId: number, callback: AsyncCallba ...@@ -27,7 +27,7 @@ getLauncherAbilityInfo(bundleName: string, userId: number, callback: AsyncCallba
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | -------------- | | ---------- | ------ | ---- | -------------- |
| bundleName | string | 是 | 应用程序包名称。 | | bundleName | string | 是 | 应用程序包名称。 |
| userId | number | 是 | 被查询的用户id。| | userId | number | 是 | 被查询的用户id。|
...@@ -78,7 +78,7 @@ getLauncherAbilityInfo(bundleName: string, userId: number) : Promise<Array\<[Lau ...@@ -78,7 +78,7 @@ getLauncherAbilityInfo(bundleName: string, userId: number) : Promise<Array\<[Lau
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | -------------- | | ---------- | ------ | ---- | -------------- |
| bundleName | string | 是 | 应用程序包名称。| | bundleName | string | 是 | 应用程序包名称。|
| userId | number | 是 | 被查询的用户id。 | | userId | number | 是 | 被查询的用户id。 |
...@@ -128,7 +128,7 @@ getAllLauncherAbilityInfo(userId: number, callback: AsyncCallback<Array\<[Launch ...@@ -128,7 +128,7 @@ getAllLauncherAbilityInfo(userId: number, callback: AsyncCallback<Array\<[Launch
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------- | | ------ | ------ | ---- | -------------- |
| userId | number | 是 | 被查询的用户id。 | | userId | number | 是 | 被查询的用户id。 |
...@@ -176,7 +176,7 @@ getAllLauncherAbilityInfo(userId: number) : Promise<Array\<[LauncherAbilityInfo] ...@@ -176,7 +176,7 @@ getAllLauncherAbilityInfo(userId: number) : Promise<Array\<[LauncherAbilityInfo]
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------- | | ------ | ------ | ---- | -------------- |
| userId | number | 是 | 被查询的用户id。 | | userId | number | 是 | 被查询的用户id。 |
...@@ -222,7 +222,7 @@ getShortcutInfo(bundleName :string, callback: AsyncCallback<Array\<[ShortcutInfo ...@@ -222,7 +222,7 @@ getShortcutInfo(bundleName :string, callback: AsyncCallback<Array\<[ShortcutInfo
**系统能力:** SystemCapability.BundleManager.BundleFramework.Launcher **系统能力:** SystemCapability.BundleManager.BundleFramework.Launcher
| 参数名 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | -------------- | | ---------- | ------ | ---- | -------------- |
| bundleName | string | 是 | 应用程序包名称。 | | bundleName | string | 是 | 应用程序包名称。 |
...@@ -269,7 +269,7 @@ getShortcutInfo(bundleName : string) : Promise<Array\<[ShortcutInfo](js-apis-bun ...@@ -269,7 +269,7 @@ getShortcutInfo(bundleName : string) : Promise<Array\<[ShortcutInfo](js-apis-bun
**系统能力:** SystemCapability.BundleManager.BundleFramework.Launcher **系统能力:** SystemCapability.BundleManager.BundleFramework.Launcher
| 参数名 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | -------------- | | ---------- | ------ | ---- | -------------- |
| bundleName | string | 是 | 应用程序包名称。 | | bundleName | string | 是 | 应用程序包名称。 |
......
...@@ -150,7 +150,7 @@ getFirst(): T ...@@ -150,7 +150,7 @@ getFirst(): T
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
......
# 系统能力
系统能力(SystemCapability,简称SysCap),指操作系统中每一个相对独立的特性。不同的设备对应不同的系统能力集,每个系统能力对应多个接口。开发者可根据系统能力来判断是否可以使用某接口。本模块提供接口可查询系统能力的集合。
> **说明:**
> - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> - 本模块接口为系统接口。
## 导入模块
```ts
import systemcapability from '@ohos.systemCapability'
```
## systemcapability.querySystemCapabilities
querySystemCapabilities(callback: AsyncCallback<string>): void;
获取系统能力集合的字符串,并调用回调函数。
**系统能力:** SystemCapability.Developtools.Syscap
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<string> | 是 | 回调函数 |
**示例:**
```ts
try {
systemcapability.querySystemCapabilities(function (err, data) {
if (err == undefined) {
console.log("get system capabilities:" + data)
} else {
console.log(" get system capabilities err:" + err.code)
}});
}catch(e){
console.log("get unexpected error: " + e);
}
```
## systemcapability.querySystemCapabilities
querySystemCapabilities(): Promise&lt;string&gt;
获取系统能力的集合。
**系统能力:** SystemCapability.Startup.SystemInfo
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;string&gt; | Promise示例,用于异步获取结果。 |
**示例:**
```ts
try {
var p = systemcapability.querySystemCapabilities();
p.then(function (value) {
console.log("get system capabilities: " + value);
}).catch(function (err) {
console.log("get system capabilities error: " + err.code);
});
}catch(e){
console.log("get unexpected error: " + e);
}
```
> **说明:**
> - 以上接口所返回的system capability集合形式均为编码后的数字字符串形式。
...@@ -30,21 +30,21 @@ constructor() ...@@ -30,21 +30,21 @@ constructor()
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------- | -------------------- | | ---------------------- | -------------------- |
| [FaceAuthManager](#faceauthmanager) | 人脸认证管理器对象 | | [FaceAuthManager](#faceauthmanager) | 人脸认证管理器对象 |
**示例:** **示例:**
```js ```js
import userIAM_faceAuth from '@ohos.userIAM.faceAuth'; import userIAM_faceAuth from '@ohos.userIAM.faceAuth';
let faceAuthManager = new userIAM_faceAuth.FaceAuthManager(); let faceAuthManager = new userIAM_faceAuth.FaceAuthManager();
``` ```
### setSurfaceId ### setSurfaceId
setSurfaceId(surfaceId: string): void; setSurfaceId(surfaceId: string): void;
设置录入流程中人脸预览界面 [XComponent](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid) 持有 Surface 的 ID 该接口仅用于在录入人脸时,设置人脸预览界面 [XComponent](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid) 持有 Surface 的 ID,需要配合[人脸录入接口](./js-apis-osAccount.md#addcredential8)来使用
**系统能力:** SystemCapability.UserIAM.UserAuth.FaceAuth **系统能力:** SystemCapability.UserIAM.UserAuth.FaceAuth
...@@ -56,17 +56,28 @@ setSurfaceId(surfaceId: string): void; ...@@ -56,17 +56,28 @@ setSurfaceId(surfaceId: string): void;
| -------------- | ---------------------------------- | ---- | -------------------------- | | -------------- | ---------------------------------- | ---- | -------------------------- |
| surfaceId | string | 是 | [XComponent](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid) 持有 Surface 的 ID。 | | surfaceId | string | 是 | [XComponent](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid) 持有 Surface 的 ID。 |
以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errcode-useriam.md)
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ------- |
| 201 | Permission verification failed. |
| 202 | The caller is not a system application. |
| 12700001 | The operation is failed. |
**示例:** **示例:**
```js ```js
import faceAuth from '@ohos.userIAM.faceAuth'; import userIAM_faceAuth from '@ohos.userIAM.faceAuth';
let surfaceId = "123456"; // 该surfaceId应该从XComponent控件获取,此处仅用作示例。
let manager = new faceAuth.FaceAuthManager(); let surfaceId = "123456";
try { let manager = new userIAM_faceAuth.FaceAuthManager();
manager.setSurfaceId(surfaceId); try {
console.info("set surface id success"); manager.setSurfaceId(surfaceId);
} catch (e) { console.info("set surface id success");
console.error("set surface id failed, error = " + e); } catch (e) {
} console.error("set surface id failed, error = " + e);
``` }
```
...@@ -30,7 +30,9 @@ Worker构造函数的选项信息,用于为Worker添加其他信息。 ...@@ -30,7 +30,9 @@ Worker构造函数的选项信息,用于为Worker添加其他信息。
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| ---- | -------- | ---- | ---- | -------------- | | ---- | -------- | ---- | ---- | -------------- |
| type | classic \| module | 是 | 是 | Worker执行脚本的模式类型,默认为classic类型,暂不支持module类型。 |
| name | string | 是 | 是 | Worker的名称。 | | name | string | 是 | 是 | Worker的名称。 |
| shared | boolean | 是 | 是 | 暂不支持共享Worker功能。 |
## ThreadWorker<sup>9+</sup> ## ThreadWorker<sup>9+</sup>
......
...@@ -26,8 +26,8 @@ zipFile(inFile: string, outFile: string, options: Options): Promise&lt;void&gt; ...@@ -26,8 +26,8 @@ zipFile(inFile: string, outFile: string, options: Options): Promise&lt;void&gt;
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------- | ---- | ------------------------------------------------------------ | | ------- | ------------------- | ---- | ------------------------------------------------------------ |
| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,对应的路径参考[FA模型](js-apis-Context.md)[Stage模型](js-apis-application-context.md)。 | | inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,对应的路径参考[FA模型](js-apis-Context.md)[Stage模型](js-apis-application-context.md)。 |
| outFile | string | 是 | 指定压缩结果的文件路径(文件的扩展名zip)。 | | outFile | string | 是 | 指定压缩结果的文件路径(文件的扩展名zip)。 |
| options | [Options](#options) | 否 | 压缩的可选参数。 | | options | [Options](#options) | 是 | 压缩的可选参数。 |
**返回值:** **返回值:**
...@@ -90,8 +90,8 @@ unzipFile(inFile:string, outFile:string, options: Options): Promise&lt;void&gt; ...@@ -90,8 +90,8 @@ unzipFile(inFile:string, outFile:string, options: Options): Promise&lt;void&gt;
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------- | ---- | ------------------------------------------------------------ | | ------- | ------------------- | ---- | ------------------------------------------------------------ |
| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,对应的路径参考[FA模型](js-apis-Context.md)[stage模型](js-apis-application-context.md)。 | | inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,对应的路径参考[FA模型](js-apis-Context.md)[stage模型](js-apis-application-context.md)。 |
| outFile | string | 是 | 指定的解压文件路径。 | | outFile | string | 是 | 指定的解压文件路径。 |
| options | [Options](#options) | 否 | 解压的可选参数。 | | options | [Options](#options) | 是 | 解压的可选参数。 |
**返回值:** **返回值:**
...@@ -318,11 +318,11 @@ try { ...@@ -318,11 +318,11 @@ try {
**系统能力:** SystemCapability.BundleManager.Zlib **系统能力:** SystemCapability.BundleManager.Zlib
| 参数名 | 类型 | 必填 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | ---------------- | ---- | --------------------------------------------------------- | | -------- | ---------------- | ---- | ---- | ---------------------------------------------------------- |
| level | CompressLeve | 否 | 参考[zip.CompressLevel枚举定义](#zipcompresslevel)。 | | level | CompressLeve | 是 | 否 | 参考[zip.CompressLevel枚举定义](#zipcompresslevel)。 |
| memLevel | MemLevel | 否 | 参考[zip.MemLevel枚举定义](#zipmemlevel)。 | | memLevel | MemLevel | 是 | 否 | 参考[zip.MemLevel枚举定义](#zipmemlevel)。 |
| strategy | CompressStrategy | 否 | 参考[zip.CompressStrategy枚举定义](#zipcompressstrategy)。 | | strategy | CompressStrategy | 是 | 否 | 参考[zip.CompressStrategy枚举定义](#zipcompressstrategy)。 |
## zip.CompressLevel ## zip.CompressLevel
......
# 用户认证错误码
## 201 权限验证失败
具体参见[通用错误码](./errorcode-universal.md)
## 202 调用方不是一个系统应用
具体参见[通用错误码](./errorcode-universal.md)
## 401 参数不正确
具体参见[通用错误码](./errorcode-universal.md)
## 12500002 一般的操作错误
**错误信息**
General operation error.
**可能原因**
1. NAPI层解析参数出错。
2. 用户认证服务的进程没有启动。
3. IPC通信的proxy客户端写数据出错。
4. IPC通信的stub服务端解析数据出错。
5. 获取driver服务出错。
**处理步骤**
重启设备,重新调用接口。
## 12500005 认证类型不支持
**错误信息**
The authentication type is not supported.
**可能原因**
1. 传入的认证类型参数不支持,例如调用userAuth模块的getAvailableStatus接口时传入的参数不是FACE或FINGERPRINT类型,则会返回12500005错误码。
2. 传入的认证类型参数在本设备上不支持,例如在没有部署指纹传感器的设备上发起指纹认证,则会返回12500005错误码。
**处理步骤**
请检查传入的认证类型参数,重新调用接口。
## 12500006 认证信任等级不支持
**错误信息**
The authentication trust level is not supported.
**可能原因**
1. 调用userAuth模块的getAvailableStatus或getAuthInstance接口时,传入的authTrustLevel参数不在[ATL1, ATL2, ATL3, ATL4]范围内。
2. 当前的设备不支持该认证信任等级,例如在只部署了2D摄像头的设备上发起支付级别的人脸认证,则会返回12500006错误码。
**处理步骤**
检查传入的authTrustLevel是否在合理范围,如果在合理范围,则是当前的设备不支持该认证信任等级。
## 12500010 该类型的凭据没有录入
**错误信息**
The type of credential has not been enrolled.
**可能原因**
例如调用userAuth模块的getAvailableStatus接口,传入的authType参数为FACE,但是当前的设备没有录入人脸凭据,则会返回12500010错误码。
调用start接口发起人脸认证,但是目前的设备没有录入人脸凭据,则会返回12500010错误码。
**处理步骤**
检查是否录入该类型的凭据,如果没有录入,则需要成功录入该类型凭据后再调用相关接口。
## 12700001 人脸录入过程中的操作失败
**错误信息**
The operation is failed.
**可能原因**
1. 例如调用faceAuth模块的setSurfaceId接口时,人脸认证服务未启动,则会返回12700001错误码。
2. IPC通信的proxy客户端写数据出错。
3. IPC通信的stub服务端解析数据出错。
4. 人脸driver层调用出错。
**处理步骤**
主要检查人脸认证服务的进程是否启动。
# 用户认证开发指导 # 用户认证开发指导
> **说明:** > **说明:**
> 该开发指导需匹配API Version 8或以上版本的SDK使用。 > 该开发指导需配合API version 9版本的SDK使用。
## 场景介绍 ## 场景介绍
当前用户认证支持2D人脸识别、3D人脸识别,可应用于设备解锁、应用登录、支付等身份认证场景。 当前用户认证支持人脸识别和指纹识别,可应用于设备解锁、应用登录、支付等身份认证场景。
## 接口说明 ## 接口说明
userIAM_userAuth模块提供了用户认证的相关方法,包括检测认证能力、认证和取消认证等,用户可以使用人脸等生物特征信息进行认证操作。具体接口说明可以查阅[API参考](../reference/apis/js-apis-useriam-userauth.md) userIAM_userAuth模块提供了用户认证的相关方法,包括查询认证能力、发起认证和取消认证等,用户可以使用人脸、指纹等生物特征信息进行认证操作。具体接口说明可以查阅[API参考文档](../reference/apis/js-apis-useriam-userauth.md)
在执行认证前,需要检查设备是否支持该认证能力,具体指认证类型、认证等级。如果不支持,需要考虑使用其他认证能力。 在执行认证前,需要指定[认证类型](../reference/apis/js-apis-useriam-userauth.md#userauthtype8)[认证等级](../reference/apis/js-apis-useriam-userauth.md#authtrustlevel8),查询设备是否支持该认证能力。
**表1** 用户认证开放能力列表 **表1** 用户认证开放能力列表
| 接口名 | 功能描述 | | 接口名称 | 功能描述 |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ---------- | ----------------------- |
| getVersion() : number | 获取认证对象的版本信息。 | | getVersion() : number | 获取认证对象的版本信息。 |
| getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel) : number | 根据指定的认证类型、认证等级,检测当前设备是否支持相应的认证能力。 | | getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel): void | 根据指定的认证类型、认证等级,检测当前设备是否支持相应的认证能力。 |
| auth(challenge: Uint8Array, authType: UserAuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array | 执行用户认证,使用callback方式作为异步方法。 | | getAuthInstance(challenge : Uint8Array, authType : UserAuthType, authTrustLevel : AuthTrustLevel): AuthInstance | 获取AuthInstance对象,用于执行用户身份认证。 |
| cancelAuth(contextID : Uint8Array) : number | 通过contextID取消本次认证操作。 | | on(name : AuthEventKey, callback : AuthEvent) : void | 订阅指定类型的用户认证事件。 |
| off(name : AuthEventKey) : void | 取消订阅特定类型的认证事件。 |
## 开发步骤 | start: void | 执行用户认证。 |
| cancel: void | 取消本次认证操作。 |
开发前请完成以下准备工作:
## 获取认证对象的版本信息
1. 在应用配置权限文件中,增加ohos.permission.ACCESS_BIOMETRIC的权限声明。
2. 在使用用户认证能力的代码文件中增加import userIAM_userAuth from '@ohos.userIAM.userAuth'。 ### 开发步骤
开发过程: 1. 申请权限。调用[getVersion](../reference/apis/js-apis-useriam-userauth.md#useriam_userauthgetversion9)接口,需要在module.json5文件的requestPermissions对象中配置ohos.permission.ACCESS_BIOMETRIC权限。更多配置信息[应用包结构配置文件的说明](../quick-start/stage-structure.md)
1. 获取Authenticator的单例对象,代码示例如下: 2. 调用[getVersion](../reference/apis/js-apis-useriam-userauth.md#useriam_userauthgetversion9)接口获取版本信息。
```js ```js
let auth = new userIAM_userAuth.UserAuth(); import userIAM_userAuth from '@ohos.userIAM.userAuth';
```
// 获取版本信息
2. (可选)获取认证对象的版本信息,代码示例如下: try {
let version = userIAM_userAuth.getVersion();
```js console.info("auth version = " + version);
let auth = new userIAM_userAuth.UserAuth(); } catch (error) {
let version = auth.getVersion(); console.info("get version failed, error = " + error);
console.info("auth version = " + version); }
``` ```
3. 根据指定的认证类型、认证等级,检测当前设备是否支持相应的认证能力,代码示例如下: ## 查询当前设备是否支持相应的认证能力
```js ### 开发步骤
let auth = new userIAM_userAuth.UserAuth();
let checkCode = auth.getAvailableStatus(userIAM_userAuth.UserAuthType.FACE, userIAM_userAuth.AuthTrustLevel.ATL1); 1. 申请权限。调用[getAvailableStatus](../reference/apis/js-apis-useriam-userauth.md#useriam_userauthgetavailablestatus9)接口,需要在module.json5文件的requestPermissions对象中配置ohos.permission.ACCESS_BIOMETRIC权限。更多配置信息[应用包结构配置文件的说明](../quick-start/stage-structure.md)
if (checkCode == userIAM_userAuth.ResultCode.SUCCESS) {
console.info("check auth support success"); 2. 指定[认证类型](../reference/apis/js-apis-useriam-userauth.md#userauthtype8)[认证等级](../reference/apis/js-apis-useriam-userauth.md#authtrustlevel8),调用[getAvailableStatus](../reference/apis/js-apis-useriam-userauth.md#useriam_userauthgetavailablestatus9)接口查询当前的设备是否支持相应的认证能力。
// 此处添加支持指定类型认证的逻辑
} else { ```js
console.error("check auth support fail, code = " + checkCode); import userIAM_userAuth from '@ohos.userIAM.userAuth';
// 此处添加不支持指定类型认证的逻辑
} // 查询认证能力是否支持
``` try {
userIAM_userAuth.getAvailableStatus(userIAM_userAuth.UserAuthType.FACE, userIAM_userAuth.AuthTrustLevel.ATL1);
4. 执行认证操作,代码示例如下: console.info("current auth trust level is supported");
} catch (error) {
```js console.info("current auth trust level is not supported, error = " + error);
let auth = new userIAM_userAuth.UserAuth(); }
auth.auth(null, userIAM_userAuth.UserAuthType.FACE, userIAM_userAuth.AuthTrustLevel.ATL1, { ```
onResult: (result, extraInfo) => {
try { ## 执行认证操作并请阅认证结果
console.info("auth onResult result = " + result);
console.info("auth onResult extraInfo = " + JSON.stringify(extraInfo)); ### 开发步骤
if (result == userIAM_userAuth.ResultCode.SUCCESS) {
// 此处添加认证成功逻辑 1. 申请权限。调用[start](../reference/apis/js-apis-useriam-userauth.md#start9)接口,需要在module.json5文件的requestPermissions对象中配置ohos.permission.ACCESS_BIOMETRIC权限。更多配置信息[应用包结构配置文件的说明](../quick-start/stage-structure.md)
} else {
// 此处添加认证失败逻辑 2. 指定challenge、[认证类型](../reference/apis/js-apis-useriam-userauth.md#userauthtype8)[认证等级](../reference/apis/js-apis-useriam-userauth.md#authtrustlevel8),获取认证对象。
}
} catch (e) { 3. 调用[on](../reference/apis/js-apis-useriam-userauth.md#on9)接口订阅认证结果。
console.info("auth onResult error = " + e);
} 4. 调用[start](../reference/apis/js-apis-useriam-userauth.md#start9)接口发起认证,通过[callback](../reference/apis/js-apis-useriam-userauth.md#callback9)回调返回认证结果。
},
5. 调用[off](../reference/apis/js-apis-useriam-userauth.md#off9)接口取消订阅认证结果。
onAcquireInfo: (module, acquire, extraInfo) => {
try { ```js
console.info("auth onAcquireInfo module = " + module); import userIAM_userAuth from '@ohos.userIAM.userAuth';
console.info("auth onAcquireInfo acquire = " + acquire);
console.info("auth onAcquireInfo extraInfo = " + JSON.stringify(extraInfo)); let challenge = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
} catch (e) { let authType = userIAM_userAuth.UserAuthType.FACE;
console.info("auth onAcquireInfo error = " + e); let authTrustLevel = userIAM_userAuth.AuthTrustLevel.ATL1;
}
} // 获取认证对象
}); let auth;
``` try {
auth = userIAM_userAuth.getAuthInstance(challenge, authType, authTrustLevel);
5. 认证过程中取消认证,代码示例如下: console.log("get auth instance success");
} catch (error) {
```js console.log("get auth instance failed" + error);
let auth = new userIAM_userAuth.UserAuth(); }
// contextId通过auth接口获取
let contextId = auth.auth(null, userIAM_userAuth.UserAuthType.FACE, userIAM_userAuth.AuthTrustLevel.ATL1, { // 订阅认证结果
onResult: (result, extraInfo) => { try {
console.info("auth onResult result = " + result); auth.on("result", {
}, callback: (result: userIAM_userAuth.AuthResultInfo) => {
console.log("authV9 result " + result.result);
onAcquireInfo: (module, acquire, extraInfo) => { console.log("authV9 token " + result.token);
console.info("auth onAcquireInfo module = " + module); console.log("authV9 remainAttempts " + result.remainAttempts);
} console.log("authV9 lockoutDuration " + result.lockoutDuration);
}); }
let cancelCode = auth.cancel(contextId); });
if (cancelCode == userIAM_userAuth.ResultCode.SUCCESS) { console.log("subscribe authentication event success");
console.info("cancel auth success"); } catch (error) {
} else { console.log("subscribe authentication event failed " + error);
console.error("cancel auth fail"); }
}
``` // 开始认证
try {
auth.start();
console.info("authV9 start auth success");
} catch (error) {
console.info("authV9 start auth failed, error = " + error);
}
// 取消订阅认证结果
try {
auth.off("result");
console.info("cancel subscribe authentication event success");
} catch (error) {
console.info("cancel subscribe authentication event failed, error = " + error);
}
```
## 执行认证操作并订阅认证过程中的提示信息
### 开发步骤
1. 申请权限。调用[start](../reference/apis/js-apis-useriam-userauth.md#start9)接口,需要在module.json5文件的requestPermissions对象中配置ohos.permission.ACCESS_BIOMETRIC权限。更多配置信息[应用包结构配置文件的说明](../quick-start/stage-structure.md)
2. 指定challenge、[认证类型](../reference/apis/js-apis-useriam-userauth.md#userauthtype8)[认证等级](../reference/apis/js-apis-useriam-userauth.md#authtrustlevel8),获取认证对象。
3. 调用[on](../reference/apis/js-apis-useriam-userauth.md#on9)接口订阅认证过程中的提示信息。
4. 调用[start](../reference/apis/js-apis-useriam-userauth.md#start9)接口发起认证,通过[callback](../reference/apis/js-apis-useriam-userauth.md#callback9)回调返回认证过程中的提示信息。
5. 调用[off](../reference/apis/js-apis-useriam-userauth.md#off9)接口取消订阅认证过程中的提示信息。
```js
import userIAM_userAuth from '@ohos.userIAM.userAuth';
let challenge = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
let authType = userIAM_userAuth.UserAuthType.FACE;
let authTrustLevel = userIAM_userAuth.AuthTrustLevel.ATL1;
// 获取认证对象
let auth;
try {
auth = userIAM_userAuth.getAuthInstance(challenge, authType, authTrustLevel);
console.log("get auth instance success");
} catch (error) {
console.log("get auth instance failed" + error);
}
// 订阅认证过程中的提示信息
try {
auth.on("tip", {
callback : (result : userIAM_userAuth.TipInfo) => {
switch (result.tip) {
case userIAM_userAuth.FaceTips.FACE_AUTH_TIP_TOO_BRIGHT:
// do something;
case userIAM_userAuth.FaceTips.FACE_AUTH_TIP_TOO_DARK:
// do something;
default:
// do others
}
}
});
console.log("subscribe authentication event success");
} catch (error) {
console.log("subscribe authentication event failed " + error);
}
// 开始认证
try {
auth.start();
console.info("authV9 start auth success");
} catch (error) {
console.info("authV9 start auth failed, error = " + error);
}
// 取消订阅认证过程中的提示信息
try {
auth.off("tip");
console.info("cancel subscribe tip information success");
} catch (error) {
console.info("cancel subscribe tip information failed, error = " + error);
}
```
## 认证过程中取消认证
### 开发步骤
1. 申请权限。调用[cancel](../reference/apis/js-apis-useriam-userauth.md#cancel9)接口,需要在module.json5文件的requestPermissions对象中配置ohos.permission.ACCESS_BIOMETRIC权限。更多配置信息[应用包结构配置文件的说明](../quick-start/stage-structure.md)
2. 指定challenge、[认证类型](../reference/apis/js-apis-useriam-userauth.md#userauthtype8)[认证等级](../reference/apis/js-apis-useriam-userauth.md#authtrustlevel8),获取认证对象。
3. 调用[start](../reference/apis/js-apis-useriam-userauth.md#start9)接口发起认证。
4. 通过调用[cancel](../reference/apis/js-apis-useriam-userauth.md#cancel9)接口取消本次认证。
```js
import userIAM_userAuth from '@ohos.userIAM.userAuth';
let challenge = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
let authType = userIAM_userAuth.UserAuthType.FACE;
let authTrustLevel = userIAM_userAuth.AuthTrustLevel.ATL1;
// 获取认证对象
let auth;
try {
auth = userIAM_userAuth.getAuthInstance(challenge, authType, authTrustLevel);
console.log("get auth instance success");
} catch (error) {
console.log("get auth instance failed" + error);
}
// 开始认证
try {
auth.start();
console.info("authV9 start auth success");
} catch (error) {
console.info("authV9 start auth failed, error = " + error);
}
// 取消认证
try {
auth.cancel();
console.info("cancel auth success");
} catch (error) {
console.info("cancel auth failed, error = " + error);
}
```
# 用户认证开发概述 # 用户认证开发概述
提供用户认证能力,可应用于设备解锁、支付、应用登录等身份认证场景。 ## 用户认证模块的定义
当前用户认证能力提供2D人脸识别、3D人脸识别两种人脸识别能力,设备具备哪种识别能力,取决于设备的硬件能力和技术实现 用户认证模块提供用户认证能力,对应用开发者而言,可使用该模块进行用户身份认证,用于设备解锁、支付、应用登录等身份认证场景
3D人脸识别技术识别率、防伪能力都优于2D人脸识别技术,但具有3D人脸能力(比如3D结构光、3D TOF等)的设备才可以使用3D人脸识别技术 当前用户认证提供人脸识别和指纹识别能力,设备具备哪种识别能力,取决于当前设备的硬件能力和技术实现
## 基本概念 ## 基本概念
人脸识别:基于人的脸部特征信息进行身份识别的一种生物特征识别技术,用摄像机或摄像头采集含有人脸的图像或视频流,并自动在图像中检测和跟踪人脸,进而对检测到的人脸进行脸部识别,通常也叫做人像识别、面部识别、人脸认证。 - 人脸识别:基于人的脸部特征信息进行身份识别的一种生物特征识别技术,用摄像机或摄像头采集含有人脸的图像或视频流,并自动在图像中检测和跟踪人脸,进而对检测到的人脸进行脸部识别,通常也叫做人像识别、面部识别、人脸认证。
- 指纹识别:基于人的指尖皮肤纹路进行身份识别的一种生物特征识别技术。当用户触摸指纹采集器件时,器件感知并获取到用户的指纹图像,然后传输到指纹识别模块进行一定的处理后与用户预先注册的指纹信息进行比对,从而识别出用户身份。
## 运作机制 ## 运作机制
人脸识别会在摄像头和TEE(Trusted Execution Environment)之间建立安全通道,人脸图像信息通过安全通道传递到TEE中,由于人脸图像信息从REE(Rich Execution Environment)侧无法获取,从而避免了恶意软件从REE侧进行攻击。对人脸图像采集、特征提取、活体检测、特征比对等处理完全在TEE中,基于TrustZone进行安全隔离,外部的人脸框架只负责人脸的认证发起和处理认证结果等数据,不涉及人脸数据本身。 人脸或指纹识别过程中,特征采集器件和TEE(Trusted Execution Environment)之间会建立安全通道,将采集的生物特征信息直接通过安全通道传递到TEE中,从而避免了恶意软件从REE(Rich Execution Environment)侧进行攻击。传输到TEE中的生物特征数据从活体检测、特征提取、特征存储、特征比对到特征销毁等处理都完全在TEE中完成,基于TrustZone进行安全隔离,提供API的服务框架只负责管理认证请求和处理认证结果等数据,不涉及生物特征数据本身。
人脸特征数据通过TEE的安全存储区进行存储,采用高强度的密码算法对人脸特征数据进行加密和完整性保护,外部无法获取到加密人脸特征数据的密钥,保证用户的人脸特征数据不会泄露。本能力采集和存储的人脸特征数据不会在用户未授权的情况下被传出TEE,这意味着,用户未授权时,无论是系统应用还是三方应用都无法获得人脸特征数据,也无法将人脸特征数据传送或备份到任何外部存储介质。 用户注册的生物特征数据在TEE的安全存储区进行存储,采用高强度的密码算法进行加密和完整性保护,外部无法获取到加密生物特征数据的密钥,保证了用户生物特征数据的安全性。本能力采集和存储的生物特征数据不会在用户未授权的情况下被传出TEE。这意味着,用户未授权时,无论是系统应用还是三方应用都无法获得人脸和指纹等特征数据,也无法将这些特征数据传送或备份到任何外部存储介质。
## 约束与限制 ## 约束与限制
- 当前版本提供的用户认证能力只包含人脸识别,且只支持本地认证,不提供认证界面。 - 当前版本提供的用户认证能力包含人脸识别和指纹识别,且只支持本地认证,不提供认证界面。
- 要求设备上具备摄像器件,且人脸图像像素大于100*100。 - 要求设备上具备相应的生物特征采集器,且对于人脸识别要求人脸图像分辨率大于100*100。
- 要求设备上具有TEE安全环境,人脸特征信息高强度加密保存在TEE中。 - 要求设备上具有TEE安全环境,人脸和指纹等生物特征信息高强度加密保存在TEE中。
- 对于面部特征相似的人、面部特征不断发育的儿童,人脸特征匹配率有所不同。如果对此担忧,可考虑其他认证方式。 - 对于面部特征相似的人、面部特征不断发育的儿童,人脸特征匹配率有所不同。如果对此担忧,可考虑其他认证方式。
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
人脸识别功能是端侧设备不可或缺的一部分,为设备提供一种用户认证能力,可应用于设备解锁、支付、应用登录等身份认证场景。它是基于人的脸部特征信息进行身份识别的一种生物特征识别技术,用摄像机或摄像头采集含有人脸的图像或视频流,并自动在图像中检测和跟踪人脸,进而对检测到的人脸进行脸部识别,通常也叫做人像识别、面部识别、人脸认证。人脸识别功能整体框架如图1。 人脸识别功能是端侧设备不可或缺的一部分,为设备提供一种用户认证能力,可应用于设备解锁、支付、应用登录等身份认证场景。它是基于人的脸部特征信息进行身份识别的一种生物特征识别技术,用摄像机或摄像头采集含有人脸的图像或视频流,并自动在图像中检测和跟踪人脸,进而对检测到的人脸进行脸部识别,通常也叫做人像识别、面部识别、人脸认证。人脸识别功能整体框架如图1。
基于HDF(Hardware Driver Foundation)驱动框架开发的Face_auth驱动,能够屏蔽硬件器件差异,为上层用户认证框架和Face_auth服务提供稳定的人脸识别基础能力接口,包括人脸识别执行器列表查询、执行器信息查询、指定人脸模板ID查询模板信息、用户认证框架和执行器间的人脸模板信息对账、人脸的录入,删除,认证和识别等。 基于HDF(Hardware Driver Foundation)驱动框架开发的Face_auth驱动,能够屏蔽硬件器件差异,为上层用户认证框架和Face_auth服务提供稳定的人脸识别基础能力接口,包括人脸识别执行器列表查询、执行器信息查询、指定人脸模板ID查询模板信息、用户认证框架和执行器间的人脸模板信息对账、人脸录入、删除、认证和识别等。
**图1** 人脸识别功能整体框架 **图1** 人脸识别功能整体框架
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
- 执行器安全等级 - 执行器安全等级
执行器提供能力时运行环境所达到的安全级别。 执行器提供能力时所在运行环境达到的安全级别。
- 执行器角色 - 执行器角色
...@@ -51,6 +51,22 @@ ...@@ -51,6 +51,22 @@
用户认证框架统一管理用户身份和凭据ID的映射关系,执行器对接到用户认证框架时,会读取用户身份认证框架内保存的该执行器的模板ID列表,执行器需要与自己维护的模板ID列表进行比对,并删除冗余信息。 用户认证框架统一管理用户身份和凭据ID的映射关系,执行器对接到用户认证框架时,会读取用户身份认证框架内保存的该执行器的模板ID列表,执行器需要与自己维护的模板ID列表进行比对,并删除冗余信息。
- HAPs
HAPs(OpenHarmony Ability Packages),广义上指可以安装在OpenHarmony上的应用包,本章节中仅代表Face_auth驱动的上层应用。
- IDL接口
接口定义语言(Interface Definition Language)通过IDL编译器编译后,能够生成与编程语言相关的文件:客户端桩文件,服务器框架文件。本文主要是通过IDL接口生成的客户端和服务端来实现Face_auth服务和驱动的通信,详细使用方法可参考[IDL简介](https://gitee.com/openharmony/ability_idl_tool/blob/master/README.md)
- IPC通信
IPC(Inter Process Communication),进程间通信是指两个进程的数据之间产生交互,详细原理可参考[IPC通信简介](https://gitee.com/openharmony/communication_ipc/blob/master/README_zh.md)
- HDI
HDI(Hardware Device Interface),硬件设备接口,位于基础系统服务层和设备驱动层之间,是提供给硬件系统服务开发者使用的、统一的硬件设备功能抽象接口,其目的是为系统服务屏蔽底层硬件设备差异,具体可参考[HDI规范](../../design/hdi-design-specifications.md)
### 运作机制 ### 运作机制
Face_auth驱动的主要工作是为上层用户认证框架和Face_auth服务提供稳定的人脸识别基础能力,保证设备上人脸识别功能可以正常运行。 Face_auth驱动的主要工作是为上层用户认证框架和Face_auth服务提供稳定的人脸识别基础能力,保证设备上人脸识别功能可以正常运行。
...@@ -74,24 +90,28 @@ Face_auth驱动的主要工作是为上层用户认证框架和Face_auth服务 ...@@ -74,24 +90,28 @@ Face_auth驱动的主要工作是为上层用户认证框架和Face_auth服务
### 接口说明 ### 接口说明
注:以下接口列举的为IDL接口描述生成的对应C++语言函数接口,接口声明见idl文件(/drivers/interface/face_auth/v1_0/)。
在本文中,人脸凭据的录入、认证、识别和删除相关的HDI接口如表1所示,表2中的回调函数分别用于人脸执行器返回操作结果给框架和返回操作过程中的提示信息给上层应用。
**表1** 接口功能介绍 **表1** 接口功能介绍
| 接口名 | 功能介绍 | | 接口名称 | 功能介绍 |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ----------------------------------- | ---------------------------------- |
| GetExecutorList(std::vector<sptr<IExecutor>>& executorList) | 获取执行器列表。 | | GetExecutorList(std::vector<sptr<IExecutor>>& executorList) | 获取执行器列表。 |
| GetExecutorInfo(ExecutorInfo& info) | 获取执行器信息,包括执行器类型、执行器角色、认证类型、安全等级、执行器公钥等信息,用于向用户认证框架注册执行器。 | | GetExecutorInfo(ExecutorInfo& info) | 获取执行器信息,包括执行器类型、执行器角色、认证类型、安全等级、执行器公钥等信息,用于向用户认证框架注册执行器。 |
| GetTemplateInfo(uint64_t templateId, TemplateInfo& info) | 获取指定人脸模板ID的模板信息。 | | GetTemplateInfo(uint64_t templateId, TemplateInfo& info) | 获取指定人脸模板ID的模板信息。 |
| OnRegisterFinish(const std::vector<uint64_t>& templateIdList,<br/> const std::vector<uint8_t>& frameworkPublicKey, const std::vector<uint8_t>& extraInfo) | 执行器注册成功后,获取用户认证框架的公钥信息;获取用户认证框架的人脸模板列表用于对账。 | | OnRegisterFinish(const std::vector<uint64_t>& templateIdList,<br/> const std::vector<uint8_t>& frameworkPublicKey, const std::vector<uint8_t>& extraInfo) | 执行器注册成功后,获取用户认证框架的公钥信息;获取用户认证框架的人脸模板列表用于对账。 |
| Enroll(uint64_t scheduleId, const std::vector<uint8_t>& extraInfo,<br/> const sptr<IExecutorCallback>& callbackObj) | 录入人脸模板。 | | Enroll(uint64_t scheduleId, const std::vector<uint8_t>& extraInfo,<br/> const sptr<IExecutorCallback>& callbackObj) | 录入人脸模板。 |
| Authenticate(uint64_t scheduleId, const std::vector<uint64_t>& templateIdList,<br/> const std::vector<uint8_t>& extraInfo, const sptr<IExecutorCallback>& callbackObj) | 认证人脸模板。 | | Authenticate(uint64_t scheduleId, const std::vector<uint64_t>& templateIdList,<br/> const std::vector<uint8_t>& extraInfo, const sptr<IExecutorCallback>& callbackObj) | 认证人脸模板。 |
| Identify(uint64_t scheduleId, const std::vector<uint8_t>& extraInfo,<br/> const sptr<IExecutorCallback>& callbackObj) | 识别人脸模板。 | | Identify(uint64_t scheduleId, const std::vector<uint8_t>& extraInfo,<br/> const sptr<IExecutorCallback>& callbackObj) | 识别人脸模板。 |
| Delete(const std::vector<uint64_t>& templateIdList) | 删除人脸模板。 | | Delete(const std::vector<uint64_t>& templateIdList) | 删除人脸模板。 |
| Cancel(uint64_t scheduleId) | 通过scheduleId取消指定录入、认证、识别操作。 | | Cancel(uint64_t scheduleId) | 通过scheduleId取消指定录入、认证、识别操作。 |
| SendCommand(int32_t commandId, const std::vector<uint8_t>& extraInfo,<br/> const sptr<IExecutorCallback>& callbackObj) | 人脸认证服务向Face_auth驱动传递参数的通用接口。 | | SendCommand(int32_t commandId, const std::vector<uint8_t>& extraInfo,<br/> const sptr<IExecutorCallback>& callbackObj) | 人脸认证服务向Face_auth驱动传递参数的通用接口。 |
**表2** 回调函数介绍 **表2** 回调函数介绍
| 接口名 | 功能介绍 | | 接口名 | 功能介绍 |
| ------------------------------------------------------------ | ------------------------ | | ------------------------------------------------------------ | ------------------------ |
| IExecutorCallback::OnResult(int32_t code, const std::vector<uint8_t>& extraInfo) | 返回操作的最终结果。 | | IExecutorCallback::OnResult(int32_t code, const std::vector<uint8_t>& extraInfo) | 返回操作的最终结果。 |
| IExecutorCallback::OnTip(int32_t code, const std::vector<uint8_t>& extraInfo) | 返回操作的过程交互信息。 | | IExecutorCallback::OnTip(int32_t code, const std::vector<uint8_t>& extraInfo) | 返回操作的过程交互信息。 |
...@@ -102,15 +122,15 @@ Face_auth驱动的主要工作是为上层用户认证框架和Face_auth服务 ...@@ -102,15 +122,15 @@ Face_auth驱动的主要工作是为上层用户认证框架和Face_auth服务
```undefined ```undefined
// drivers/peripheral/face_auth // drivers/peripheral/face_auth
├── BUILD.gn # 编译脚本 ├── BUILD.gn # 编译脚本
├── bundle.json # 组件描述文件 ├── bundle.json # 组件描述文件
└── hdi_service # Face_auth驱动实现 └── hdi_service # Face_auth驱动实现
├── BUILD.gn # 编译脚本 ├── BUILD.gn # 编译脚本
├── include # 头文件 ├── include # 头文件
└── src └── src # 源文件
├── executor_impl.cpp # 认证、录入等功能接口实现 ├── executor_impl.cpp # 认证、录入等功能接口实现
├── face_auth_interface_driver.cpp # Face_auth驱动入口 ├── face_auth_interface_driver.cpp # Face_auth驱动入口
└── face_auth_interface_service.cpp # 获取执行器列表接口实现 └── face_auth_interface_service.cpp # 获取执行器列表接口实现
``` ```
下面结合DEMO实例介绍驱动开发的具体步骤。 下面结合DEMO实例介绍驱动开发的具体步骤。
...@@ -423,66 +443,59 @@ Face_auth驱动的主要工作是为上层用户认证框架和Face_auth服务 ...@@ -423,66 +443,59 @@ Face_auth驱动的主要工作是为上层用户认证框架和Face_auth服务
驱动开发完成后,通过[用户认证API接口](../../application-dev/reference/apis/js-apis-useriam-userauth.md)开发JS应用,基于Hi3516DV300平台验证。认证和取消功能验证的JS测试代码如下: 驱动开发完成后,通过[用户认证API接口](../../application-dev/reference/apis/js-apis-useriam-userauth.md)开发JS应用,基于Hi3516DV300平台验证。认证和取消功能验证的JS测试代码如下:
```js ```js
// API version 8 // API version 9
import userIAM_userAuth from '@ohos.userIAM.userAuth'; import userIAM_userAuth from '@ohos.userIAM.userAuth';
let auth = new userIAM_userAuth.UserAuth();
let challenge = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
export default { let authType = userIAM_userAuth.UserAuthType.FACE;
getVersion() { let authTrustLevel = userIAM_userAuth.AuthTrustLevel.ATL1;
console.info("start get version");
let version = this.auth.getVersion(); // 获取认证对象
console.info("auth version = " + version); let auth;
}, try {
auth = userIAM_userAuth.getAuthInstance(challenge, authType, authTrustLevel);
startAuth() { console.log("get auth instance success");
console.info("start auth"); } catch (error) {
this.auth.auth(null, userIAM_userAuth.UserAuthType.FACE, userIAM_userAuth.AuthTrustLevel.ATL1, { console.log("get auth instance failed" + error);
onResult: (result, extraInfo) => { }
try {
console.info("auth onResult result = " + result); // 订阅认证结果
console.info("auth onResult extraInfo = " + JSON.stringify(extraInfo)); try {
if (result == userIAM_userAuth.ResultCode.SUCCESS) { auth.on("result", {
// 此处添加认证成功逻辑 callback: (result: userIAM_userAuth.AuthResultInfo) => {
} else { console.log("authV9 result " + result.result);
// 此处添加认证失败逻辑 console.log("authV9 token " + result.token);
} console.log("authV9 remainAttempts " + result.remainAttempts);
} catch (e) { console.log("authV9 lockoutDuration " + result.lockoutDuration);
console.info("auth onResult error = " + e);
}
},
onAcquireInfo: (module, acquire, extraInfo) => {
try {
console.info("auth onAcquireInfo module = " + module);
console.info("auth onAcquireInfo acquire = " + acquire);
console.info("auth onAcquireInfo extraInfo = " + JSON.stringify(extraInfo));
} catch (e) {
console.info("auth onAcquireInfo error = " + e);
}
}
});
},
cancelAuth() {
console.info("start cancel auth");
// contextId通过auth接口获取
let contextId = auth.auth(null, userIAM_userAuth.UserAuthType.FACE, userIAM_userAuth.AuthTrustLevel.ATL1, {
onResult: (result, extraInfo) => {
console.info("auth onResult result = " + result);
},
onAcquireInfo: (module, acquire, extraInfo) => {
console.info("auth onAcquireInfo module = " + module);
} }
}); });
let cancelCode = this.auth.cancel(contextId); console.log("subscribe authentication event success");
if (cancelCode == userIAM_userAuth.ResultCode.SUCCESS) { } catch (error) {
console.info("cancel auth success"); console.log("subscribe authentication event failed " + error);
} else {
console.error("cancel auth fail");
}
} }
}
```
// 开始认证
try {
auth.start();
console.info("authV9 start auth success");
} catch (error) {
console.info("authV9 start auth failed, error = " + error);
}
// 取消认证
try {
auth.cancel();
console.info("cancel auth success");
} catch (error) {
console.info("cancel auth failed, error = " + error);
}
// 取消订阅认证结果
try {
auth.off("result");
console.info("cancel subscribe authentication event success");
} catch (error) {
console.info("cancel subscribe authentication event failed, error = " + error);
}
```
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
- 执行器安全等级 - 执行器安全等级
执行器提供能力时运行环境所达到的安全级别。 执行器提供能力时所在运行环境达到的安全级别。
- 执行器角色 - 执行器角色
...@@ -53,15 +53,19 @@ ...@@ -53,15 +53,19 @@
- HAPs - HAPs
HAPs(OpenHarmony Ability Packages),本章节中仅代表Fingerprint_auth驱动的上层应用。 HAPs(OpenHarmony Ability Packages),广义上指可以安装在OpenHarmony上的应用包,本章节中仅代表Fingerprint_auth驱动的上层应用。
- IDL接口 - IDL接口
接口定义语言(Interface Definition Language)通过IDL编译器编译后,能够生成与编程语言相关的文件:客户端桩文件,服务器框架文件。本文主要是通过IDL接口实现Fingerprint_auth服务和驱动的通信 接口定义语言(Interface Definition Language)通过IDL编译器编译后,能够生成与编程语言相关的文件:客户端桩文件,服务器框架文件。本文主要是通过IDL接口生成的客户端和服务端来实现Fingerprint_auth服务和驱动的通信,详细使用方法可参考[IDL简介](https://gitee.com/openharmony/ability_idl_tool/blob/master/README.md)
- IPC通信 - IPC通信
IPC(Inter Process Communication),进程间通信是指两个进程的数据之间产生交互。 IPC(Inter Process Communication),进程间通信是指两个进程的数据之间产生交互,详细原理可参考[IPC通信简介](https://gitee.com/openharmony/communication_ipc/blob/master/README_zh.md)
- HDI
HDI(Hardware Device Interface),硬件设备接口,位于基础系统服务层和设备驱动层之间,是提供给硬件系统服务开发者使用的、统一的硬件设备功能抽象接口,其目的是为系统服务屏蔽底层硬件设备差异,具体可参考[HDI规范](../../design/hdi-design-specifications.md)
### 运作机制 ### 运作机制
...@@ -84,24 +88,27 @@ Fingerprint_auth驱动的主要工作是为上层用户认证框架和Fingerprin ...@@ -84,24 +88,27 @@ Fingerprint_auth驱动的主要工作是为上层用户认证框架和Fingerprin
### 接口说明 ### 接口说明
注:以下接口列举的为IDL接口描述生成的对应C++语言函数接口,接口声明见idl文件(/drivers/interface/fingerprint_auth/v1_0/)。
在本文中,指纹凭据的录入、认证、识别和删除相关的HDI接口如表1所示,表2中的回调函数分别用于指纹执行器返回操作结果给框架和返回操作过程中的提示信息给上层应用。
**表1** 接口功能介绍 **表1** 接口功能介绍
| 接口名 | 功能介绍 | | 接口名称 | 功能介绍 |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | -------------------------------- | ----------------------------------- |
| GetExecutorList(std::vector<sptr<IExecutor>>& executorList) | 获取执行器列表。 | | GetExecutorList(std::vector<sptr<IExecutor>>& executorList) | 获取执行器列表。 |
| GetExecutorInfo(ExecutorInfo& info) | 获取执行器信息,包括执行器类型、执行器角色、认证类型、安全等级、执行器公钥等信息,用于向用户认证框架注册执行器。 | | GetExecutorInfo(ExecutorInfo& info) | 获取执行器信息,包括执行器类型、执行器角色、认证类型、安全等级、执行器公钥等信息,用于向用户认证框架注册执行器。 |
| GetTemplateInfo(uint64_t templateId, TemplateInfo& info) | 获取指定模板ID的模板信息。 | | GetTemplateInfo(uint64_t templateId, TemplateInfo& info) | 获取指定模板ID的模板信息。 |
| OnRegisterFinish(const std::vector<uint64_t>& templateIdList,<br/> const std::vector<uint8_t>& frameworkPublicKey, const std::vector<uint8_t>& extraInfo) | 执行器注册成功后,获取用户认证框架的公钥信息;获取用户认证框架的模板列表用于对账。 | | OnRegisterFinish(const std::vector<uint64_t>& templateIdList,<br/> const std::vector<uint8_t>& frameworkPublicKey, const std::vector<uint8_t>& extraInfo) | 执行器注册成功后,获取用户认证框架的公钥信息;获取用户认证框架的模板列表用于对账。 |
| Enroll(uint64_t scheduleId, const std::vector<uint8_t>& extraInfo,<br/> const sptr<IExecutorCallback>& callbackObj) | 录入指纹模板。 | | Enroll(uint64_t scheduleId, const std::vector<uint8_t>& extraInfo,<br/> const sptr<IExecutorCallback>& callbackObj) | 录入指纹模板。 |
| Authenticate(uint64_t scheduleId, const std::vector<uint64_t>& templateIdList,<br/> const std::vector<uint8_t>& extraInfo, const sptr<IExecutorCallback>& callbackObj) | 认证指纹模板。 | | Authenticate(uint64_t scheduleId, const std::vector<uint64_t>& templateIdList,<br/> const std::vector<uint8_t>& extraInfo, const sptr<IExecutorCallback>& callbackObj) | 认证指纹模板。 |
| Identify(uint64_t scheduleId, const std::vector<uint8_t>& extraInfo,<br/> const sptr<IExecutorCallback>& callbackObj) | 识别指纹模板。 | | Identify(uint64_t scheduleId, const std::vector<uint8_t>& extraInfo,<br/> const sptr<IExecutorCallback>& callbackObj) | 识别指纹模板。 |
| Delete(const std::vector<uint64_t>& templateIdList) | 删除指纹模板。 | | Delete(const std::vector<uint64_t>& templateIdList) | 删除指纹模板。 |
| Cancel(uint64_t scheduleId) | 通过scheduleId取消指定录入、认证、识别操作。 | | Cancel(uint64_t scheduleId) | 通过scheduleId取消指定录入、认证、识别操作。 |
| SendCommand(int32_t commandId, const std::vector<uint8_t>& extraInfo,<br/> const sptr<IExecutorCallback>& callbackObj) | 指纹认证服务向Fingerprint_auth驱动传递参数的通用接口。 | | SendCommand(int32_t commandId, const std::vector<uint8_t>& extraInfo,<br/> const sptr<IExecutorCallback>& callbackObj) | 指纹认证服务向Fingerprint_auth驱动传递参数的通用接口。 |
**表2** 回调函数介绍 **表2** 回调函数介绍
| 接口名 | 功能介绍 | | 接口名 | 功能介绍 |
| ------------------------------------------------------------ | ------------------------ | | ------------------------------------------------------------ | ------------------------ |
| IExecutorCallback::OnResult(int32_t code, const std::vector<uint8_t>& extraInfo) | 返回操作的最终结果。 | | IExecutorCallback::OnResult(int32_t code, const std::vector<uint8_t>& extraInfo) | 返回操作的最终结果。 |
| IExecutorCallback::OnTip(int32_t code, const std::vector<uint8_t>& extraInfo) | 返回操作的过程交互信息。 | | IExecutorCallback::OnTip(int32_t code, const std::vector<uint8_t>& extraInfo) | 返回操作的过程交互信息。 |
...@@ -112,15 +119,15 @@ Fingerprint_auth驱动的主要工作是为上层用户认证框架和Fingerprin ...@@ -112,15 +119,15 @@ Fingerprint_auth驱动的主要工作是为上层用户认证框架和Fingerprin
```undefined ```undefined
// drivers/peripheral/fingerprint_auth // drivers/peripheral/fingerprint_auth
├── BUILD.gn # 编译脚本 ├── BUILD.gn # 编译脚本
├── bundle.json # 组件描述文件 ├── bundle.json # 组件描述文件
└── hdi_service # Fingerprint_auth驱动实现 └── hdi_service # Fingerprint_auth驱动实现
├── BUILD.gn # 编译脚本 ├── BUILD.gn # 编译脚本
├── include # 头文件 ├── include # 头文件
└── src └── src # 源文件
├── executor_impl.cpp # 认证、录入等功能接口实现 ├── executor_impl.cpp # 认证、录入等功能接口实现
├── fingerprint_auth_interface_driver.cpp # Fingerprint_auth驱动入口 ├── fingerprint_auth_interface_driver.cpp # Fingerprint_auth驱动入口
└── fingerprint_auth_interface_service.cpp # 获取执行器列表接口实现 └── fingerprint_auth_interface_service.cpp # 获取执行器列表接口实现
``` ```
下面结合DEMO实例介绍驱动开发的具体步骤。 下面结合DEMO实例介绍驱动开发的具体步骤。
...@@ -433,47 +440,59 @@ Fingerprint_auth驱动的主要工作是为上层用户认证框架和Fingerprin ...@@ -433,47 +440,59 @@ Fingerprint_auth驱动的主要工作是为上层用户认证框架和Fingerprin
驱动开发完成后,开发者可以通过[用户认证API接口](../../application-dev/reference/apis/js-apis-useriam-userauth.md)开发JS应用,JS应用通过Fingerprint_auth服务调用Fingerprint_auth驱动,从而验证驱动开发是否符合预期。基于Hi3516DV300平台验证,认证功能验证的JS测试代码如下: 驱动开发完成后,开发者可以通过[用户认证API接口](../../application-dev/reference/apis/js-apis-useriam-userauth.md)开发JS应用,JS应用通过Fingerprint_auth服务调用Fingerprint_auth驱动,从而验证驱动开发是否符合预期。基于Hi3516DV300平台验证,认证功能验证的JS测试代码如下:
```js ```js
// API version 8 // API version 9
import userIAM_userAuth from '@ohos.userIAM.userAuth'; import userIAM_userAuth from '@ohos.userIAM.userAuth';
let auth = new userIAM_userAuth.UserAuth();
let challenge = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
export default { let authType = userIAM_userAuth.UserAuthType.FINGERPRINT;
getVersion() { let authTrustLevel = userIAM_userAuth.AuthTrustLevel.ATL1;
console.info("start get version");
let version = this.auth.getVersion(); // 获取认证对象
console.info("auth version = " + version); let auth;
}, try {
auth = userIAM_userAuth.getAuthInstance(challenge, authType, authTrustLevel);
startAuth() { console.log("get auth instance success");
console.info("start auth"); } catch (error) {
// auth是开发者可以调用的API接口,开发者可以指定认证类型为FINGERPRINT,从而验证驱动是否向框架注册成功以及认证接口实现是否符合预期,result即为认证结果。 console.log("get auth instance failed" + error);
this.auth.auth(null, userIAM_userAuth.UserAuthType.FINGERPRINT, userIAM_userAuth.AuthTrustLevel.ATL1, { }
onResult: (result, extraInfo) => {
try { // 订阅认证结果
console.info("auth onResult result = " + result); try {
console.info("auth onResult extraInfo = " + JSON.stringify(extraInfo)); auth.on("result", {
if (result == userIAM_userAuth.ResultCode.SUCCESS) { callback: (result: userIAM_userAuth.AuthResultInfo) => {
// 此处添加认证成功逻辑 console.log("authV9 result " + result.result);
} else { console.log("authV9 token " + result.token);
// 此处添加认证失败逻辑 console.log("authV9 remainAttempts " + result.remainAttempts);
} console.log("authV9 lockoutDuration " + result.lockoutDuration);
} catch (e) {
console.info("auth onResult error = " + e);
}
},
onAcquireInfo: (module, acquire, extraInfo) => {
try {
console.info("auth onAcquireInfo module = " + module);
console.info("auth onAcquireInfo acquire = " + acquire);
console.info("auth onAcquireInfo extraInfo = " + JSON.stringify(extraInfo));
} catch (e) {
console.info("auth onAcquireInfo error = " + e);
}
} }
}); });
console.log("subscribe authentication event success");
} catch (error) {
console.log("subscribe authentication event failed " + error);
} }
}
```
// 开始认证
try {
auth.start();
console.info("authV9 start auth success");
} catch (error) {
console.info("authV9 start auth failed, error = " + error);
}
// 取消认证
try {
auth.cancel();
console.info("cancel auth success");
} catch (error) {
console.info("cancel auth failed, error = " + error);
}
// 取消订阅认证结果
try {
auth.off("result");
console.info("cancel subscribe authentication event success");
} catch (error) {
console.info("cancel subscribe authentication event failed, error = " + error);
}
```
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
- 执行器安全等级 - 执行器安全等级
执行器提供能力时运行环境所达到的安全级别。 执行器提供能力时所在运行环境达到的安全级别。
- 执行器角色 - 执行器角色
...@@ -52,6 +52,18 @@ ...@@ -52,6 +52,18 @@
用户认证框架统一管理用户身份和凭据ID的映射关系,执行器对接到用户认证框架时,会读取用户身份认证框架内保存的该执行器的模板ID列表,执行器需要与自己维护的模板ID列表进行比对,并删除冗余信息。 用户认证框架统一管理用户身份和凭据ID的映射关系,执行器对接到用户认证框架时,会读取用户身份认证框架内保存的该执行器的模板ID列表,执行器需要与自己维护的模板ID列表进行比对,并删除冗余信息。
- IDL接口
接口定义语言(Interface Definition Language)通过IDL编译器编译后,能够生成与编程语言相关的文件:客户端桩文件,服务器框架文件。本文主要是通过IDL接口生成的客户端和服务端来实现Pin_auth服务和驱动的通信,详细使用方法可参考[IDL简介](https://gitee.com/openharmony/ability_idl_tool/blob/master/README.md)
- IPC通信
IPC(Inter Process Communication),进程间通信是指两个进程的数据之间产生交互,详细原理可参考[IPC通信简介](https://gitee.com/openharmony/communication_ipc/blob/master/README_zh.md)
- HDI
HDI(Hardware Device Interface),硬件设备接口,位于基础系统服务层和设备驱动层之间,是提供给硬件系统服务开发者使用的、统一的硬件设备功能抽象接口,其目的是为系统服务屏蔽底层硬件设备差异,具体可参考[HDI规范](../../design/hdi-design-specifications.md)
### 运作机制 ### 运作机制
Pin_auth驱动的主要工作是为上层用户认证框架和Pin_auth服务提供稳定的口令认证的基础能力,保证口令认证的功能可以正常运行。开发者可基于HDF框架对不同芯片进行各自驱动的开发以及HDI层接口的调用。 Pin_auth驱动的主要工作是为上层用户认证框架和Pin_auth服务提供稳定的口令认证的基础能力,保证口令认证的功能可以正常运行。开发者可基于HDF框架对不同芯片进行各自驱动的开发以及HDI层接口的调用。
...@@ -61,7 +73,7 @@ Pin_auth驱动的主要工作是为上层用户认证框架和Pin_auth服务提 ...@@ -61,7 +73,7 @@ Pin_auth驱动的主要工作是为上层用户认证框架和Pin_auth服务提
![image](figures/pin_auth服务与驱动交互.png "pin_auth服务与驱动交互") ![image](figures/pin_auth服务与驱动交互.png "pin_auth服务与驱动交互")
### 约束与限制 ### 约束与限制
口令认证的实现需要在TEE安全环境中实现,口令凭据等数据的密信息需要在安全环境中存储。 口令认证的实现需要在TEE安全环境中实现,口令凭据等数据的密信息需要在安全环境中存储。
## 开发指导 ## 开发指导
### 场景介绍 ### 场景介绍
...@@ -69,24 +81,27 @@ Pin_auth驱动的主要工作是为上层用户认证框架和Pin_auth服务提 ...@@ -69,24 +81,27 @@ Pin_auth驱动的主要工作是为上层用户认证框架和Pin_auth服务提
### 接口说明 ### 接口说明
注:以下接口列举的为IDL接口描述生成的对应C++语言函数接口,接口声明见idl文件(/drivers/interface/pin_auth/v1_0/)。
在本文中,口令凭据的录入、认证和删除相关的HDI接口如表1所示,表2中的回调函数分别用于口令执行器返回操作结果给框架和获取用户输入的口令信息。
**表1** 接口功能介绍 **表1** 接口功能介绍
| 接口名 | 功能介绍 | | 接口名称 | 功能介绍 |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------- | ------------------------------------------- |
| GetExecutorList(std::vector<sptr<IExecutor>>& executorList) | 获取执行器列表。 | | GetExecutorList(std::vector<sptr<IExecutor>>& executorList) | 获取执行器列表。 |
| GetExecutorInfo(ExecutorInfo& info) | 获取执行器信息。 | | GetExecutorInfo(ExecutorInfo& info) | 获取执行器信息。 |
| GetTemplateInfo(uint64_t templateId, TemplateInfo& info) | 获取指定templateId的模板信息。 | | GetTemplateInfo(uint64_t templateId, TemplateInfo& info) | 获取指定templateId的模板信息。 |
| OnRegisterFinish(const std::vector<uint64_t>& templateIdList,<br/>const std::vector<uint8_t>& frameworkPublicKey,<br/>const std::vector<uint8_t>& extraInfo) | 执行器注册成功后,获取用户认证框架的公钥信息;获取用户认证框架的template 列表用于对账。 | | OnRegisterFinish(const std::vector<uint64_t>& templateIdList,<br/>const std::vector<uint8_t>& frameworkPublicKey,<br/>const std::vector<uint8_t>& extraInfo) | 执行器注册成功后,获取用户认证框架的公钥信息;获取用户认证框架的template 列表用于对账。 |
| OnSetData(uint64_t scheduleId, uint64_t authSubType, <br/>const std::vector<uint8_t> &data) | 用于回调传pin码认证的子类型和脱敏数据。 | | OnSetData(uint64_t scheduleId, uint64_t authSubType, <br/>const std::vector<uint8_t> &data) | 回调函数,返回用户录入的口令子类型和录入的口令脱敏数据。 |
| Enroll(uint64_t scheduleId, const std::vector<uint8_t>& extraInfo,<br/>const sptr<IExecutorCallback>& callbackObj) | 录入pin码。 | | Enroll(uint64_t scheduleId, const std::vector<uint8_t>& extraInfo,<br/>const sptr<IExecutorCallback>& callbackObj) | 录入pin码。 |
| Authenticate(uint64_t scheduleId, uint64_t templateId, const std::vector<uint8_t>& extraInfo, const sptr<IExecutorCallback>& callbackObj) | pin码认证。 | | Authenticate(uint64_t scheduleId, uint64_t templateId, const std::vector<uint8_t>& extraInfo, const sptr<IExecutorCallback>& callbackObj) | pin码认证。 |
| Delete(uint64_t templateId) | 删除pin码模板。 | | Delete(uint64_t templateId) | 删除pin码模板。 |
| Cancel(uint64_t scheduleId) | 通过scheduleId取消指定操作。 | | Cancel(uint64_t scheduleId) | 通过scheduleId取消指定操作。 |
| SendCommand(int32_t commandId, const std::vector<uint8_t>& extraInfo,<br/>const sptr<IExecutorCallback>& callbackObj) | 预留接口。 | | SendCommand(int32_t commandId, const std::vector<uint8_t>& extraInfo,<br/>const sptr<IExecutorCallback>& callbackObj) | 预留接口。 |
**表2** 回调函数介绍 **表2** 回调函数介绍
| 接口名 | 功能介绍 | | 接口名 | 功能介绍 |
| ------------------------------------------------------------ | -------------------- | | ------------------------------------------------------------ | -------------------- |
| IExecutorCallback::OnResult(int32_t code, const std::vector<uint8_t>& extraInfo) | 返回操作的最终结果。 | | IExecutorCallback::OnResult(int32_t code, const std::vector<uint8_t>& extraInfo) | 返回操作的最终结果。 |
| IExecutorCallback::OnGetData(uint64_t scheduleId, const std::vector<uint8_t>& salt,<br/> uint64_t authSubType)| 返回获取pin码数据信息。 | | IExecutorCallback::OnGetData(uint64_t scheduleId, const std::vector<uint8_t>& salt,<br/> uint64_t authSubType)| 返回获取pin码数据信息。 |
...@@ -97,21 +112,21 @@ Pin_auth驱动的主要工作是为上层用户认证框架和Pin_auth服务提 ...@@ -97,21 +112,21 @@ Pin_auth驱动的主要工作是为上层用户认证框架和Pin_auth服务提
```text ```text
// drivers/peripheral/pin_auth // drivers/peripheral/pin_auth
├── BUILD.gn # 编译脚本 ├── BUILD.gn # 编译脚本
├── bundle.json # 组件描述文件 ├── bundle.json # 组件描述文件
├── test # 测试用例 ├── test # 测试用例
└── hdi_service # Pin_auth驱动实现 └── hdi_service # Pin_auth驱动实现
├── BUILD.gn # 编译脚本 ├── BUILD.gn # 编译脚本
├── adaptor # 相关算法实现 ├── adaptor # 相关算法实现
├── common # 公共接口实现 ├── common # 公共接口实现
├── database # 数据库实现 ├── database # 数据库实现
├── main # 口令相关功能实现入口 ├── main # 口令相关功能实现入口
└── service # Pin_auth驱动实现入口 └── service # Pin_auth驱动实现入口
├── inc # 头文件 ├── inc # 头文件
└── src └── src # 源文件
├── executor_impl.cpp # 认证、录入等功能接口实现 ├── executor_impl.cpp # 认证、录入等功能接口实现
├── pin_auth_interface_driver.cpp # Pin_auth驱动入口 ├── pin_auth_interface_driver.cpp # Pin_auth驱动入口
└── pin_auth_interface_service.cpp # 获取执行器列表接口实现 └── pin_auth_interface_service.cpp # 获取执行器列表接口实现
``` ```
下面结合DEMO实例介绍驱动开发的具体步骤。 下面结合DEMO实例介绍驱动开发的具体步骤。
......
...@@ -28,7 +28,7 @@ New IP载荷传输效率,相比IPv4提高最少1%,相比IPv6提高最少2.33 ...@@ -28,7 +28,7 @@ New IP载荷传输效率,相比IPv4提高最少1%,相比IPv6提高最少2.33
## 可变长报头格式 ## 可变长报头格式
New IP WiFi灵活极简报文头如下图所示,通过LLC Header中的EtherType = 0xEADD标识New IP报文。Bitmap是一组由0和1组成的二进制序列,每个二进制位的数值用于表示特定目标字段的存在性 New IP WiFi灵活极简报文头如下图所示,通过LLC Header中的EtherType = 0xEADD标识New IP报文。Bitmap是一组由0和1组成的二进制序列,每个二进制位的数值用于表示New IP报头中是否携带某个字段,即New IP报文头可以由用户根据业务场景自行定制报头中携带哪些字段
![zh-cn_image-20220915140627223](figures/zh-cn_image-20220915140627223.png) ![zh-cn_image-20220915140627223](figures/zh-cn_image-20220915140627223.png)
...@@ -89,23 +89,31 @@ New IP支持可变长地址(IPv4/IPv6地址长度固定),支持自解析 ...@@ -89,23 +89,31 @@ New IP支持可变长地址(IPv4/IPv6地址长度固定),支持自解析
## New IP配置指导 ## New IP配置指导
启用New IP,需要通过编译内核时打开相应的配置项及依赖,New IP相关CONFIG如下: ### New IP使能
```c 目前只有rk3568开发板Linux 5.10内核上支持New IP内核协议栈,在rk3568开发板内核模块配置文件中搜索NEWIP,将其修改成“CONFIG_XXX=y”即可,New IP相关CONFIG如下。
```
# kernel/linux/config/linux-5.10/arch/arm64/configs/rk3568_standard_defconfig
CONFIG_NEWIP=y // 使能New IP内核协议栈 CONFIG_NEWIP=y // 使能New IP内核协议栈
CONFIG_NEWIP_HOOKS=y // 使能New IP内核侵入式修改插桩函数注册,使能New IP的同时必须使用New IP HOOKS功能 CONFIG_NEWIP_HOOKS=y // 使能New IP内核侵入式修改插桩函数注册,使能New IP的同时必须使用New IP HOOKS功能
VENDOR_HOOKS=y // 使能内核插桩基础框架(New IP依赖此配置项,rk3568开发板已默认开启)
``` ```
另有部分CONFIG被依赖: 代码编译完成后,通过下面命令可以确认New IP协议栈代码是否使能成功。
```c ```
VENDOR_HOOKS=y // 使能内核插桩基础框架 find out/ -name *nip*.o
...
out/kernel/OBJ/linux-5.10/net/newip/nip_addrconf_core.o
out/kernel/OBJ/linux-5.10/net/newip/nip_hdr_decap.o
out/kernel/OBJ/linux-5.10/net/newip/nip_addr.o
out/kernel/OBJ/linux-5.10/net/newip/nip_checksum.o
out/kernel/OBJ/linux-5.10/net/newip/tcp_nip_output.o
...
``` ```
备注: 备注:OpenHarmony linux内核要求所有原生内核代码侵入式修改,都要修改成插桩方式。例如下面IPv4,IPv6协议栈公共流程中增加New IP处理时,不能直接调用New IP函数,需要在公共流程中增加插桩点,New IP使能后在模块初始化时将xx功能函数注册到对应的函数指针上,下面公共流程就可以通过函数指针的形式调用到New IP的函数。
1. 只在Linux 5.10内核上支持New IP内核协议栈。
2. OpenHarmony linux内核要求所有原生内核代码侵入式修改,都要修改成插桩方式。
```c ```c
/* 将New IP ehash函数注册到内核 */ /* 将New IP ehash函数注册到内核 */
...@@ -142,24 +150,12 @@ static u32 sk_ehashfn(const struct sock *sk) ...@@ -142,24 +150,12 @@ static u32 sk_ehashfn(const struct sock *sk)
} }
``` ```
### New IP禁用
在rk3568开发板内核模块配置文件中搜索NEWIP,将其“CONFIG_NEWIP=y”和“CONFIG_NEWIP_HOOKS=y”删除或使用#注释掉即可。
代码编译完成后,通过下面命令可以确认New IP协议栈代码是否使能成功。
```c
find out/ -name *nip*.o
out/rk3568/obj/third_party/glib/glib/glib_source/guniprop.o
out/kernel/OBJ/linux-5.10/net/newip/nip_addrconf_core.o
out/kernel/OBJ/linux-5.10/net/newip/nip_hdr_decap.o
out/kernel/OBJ/linux-5.10/net/newip/nip_addr.o
out/kernel/OBJ/linux-5.10/net/newip/nip_checksum.o
out/kernel/OBJ/linux-5.10/net/newip/tcp_nip_output.o
...
``` ```
# kernel/linux/config/linux-5.10/arch/arm64/configs/rk3568_standard_defconfig
禁用New IP内核协议栈,删除CONFIG_NEWIP使能开关,删除out/kernel目录后重新编译。
```c
# CONFIG_NEWIP is not set # CONFIG_NEWIP is not set
# CONFIG_NEWIP_HOOKS is not set # CONFIG_NEWIP_HOOKS is not set
``` ```
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册