提交 839bc08c 编写于 作者: zyjhandsome's avatar zyjhandsome

Merge branch 'master' of https://gitee.com/openharmony/docs

...@@ -15,7 +15,6 @@ Before getting started, you need to understand the following basic concepts: ...@@ -15,7 +15,6 @@ Before getting started, you need to understand the following basic concepts:
**Float16 inference**: a mode in which Float16 is used for inference. Float16, also called half-precision, uses 16 bits to represent a number. **Float16 inference**: a mode in which Float16 is used for inference. Float16, also called half-precision, uses 16 bits to represent a number.
## Available APIs ## Available APIs
APIs involved in MindSpore Lite model inference are categorized into context APIs, model APIs, and tensor APIs. APIs involved in MindSpore Lite model inference are categorized into context APIs, model APIs, and tensor APIs.
### Context APIs ### Context APIs
...@@ -54,6 +53,33 @@ The following figure shows the development process for MindSpore Lite model infe ...@@ -54,6 +53,33 @@ The following figure shows the development process for MindSpore Lite model infe
**Figure 1** Development process for MindSpore Lite model inference **Figure 1** Development process for MindSpore Lite model inference
![how-to-use-mindspore-lite](figures/01.png) ![how-to-use-mindspore-lite](figures/01.png)
Before moving to the main process, you need to reference related header files and compile functions to generate random input.
Example code:
```c
#include <stdlib.h>
#include <stdio.h>
#include "mindspore/model.h"
// Generate random input.
int GenerateInputDataWithRandom(OH_AI_TensorHandleArray inputs) {
for (size_t i = 0; i < inputs.handle_num; ++i) {
float *input_data = (float *)OH_AI_TensorGetMutableData(inputs.handle_list[i]);
if (input_data == NULL) {
printf("MSTensorGetMutableData failed.\n");
return OH_AI_STATUS_LITE_ERROR;
}
int64_t num = OH_AI_TensorGetElementNum(inputs.handle_list[i]);
const int divisor = 10;
for (size_t j = 0; j < num; j++) {
input_data[j] = (float)(rand() % divisor) / divisor; // 0--0.9f
}
}
return OH_AI_STATUS_SUCCESS;
}
```
The development process consists of the following main steps: The development process consists of the following main steps:
1. Prepare the required model. 1. Prepare the required model.
...@@ -101,8 +127,8 @@ The development process consists of the following main steps: ...@@ -101,8 +127,8 @@ The development process consists of the following main steps:
return OH_AI_STATUS_LITE_ERROR; return OH_AI_STATUS_LITE_ERROR;
} }
// Load and build the model. The model type is OH_AI_ModelTypeMindIR. // Load and build the model. The model type is OH_AI_MODELTYPE_MINDIR.
int ret = OH_AI_ModelBuildFromFile(model, argv[1], OH_AI_ModelTypeMindIR, context); int ret = OH_AI_ModelBuildFromFile(model, argv[1], OH_AI_MODELTYPE_MINDIR, context);
if (ret != OH_AI_STATUS_SUCCESS) { if (ret != OH_AI_STATUS_SUCCESS) {
printf("OH_AI_ModelBuildFromFile failed, ret: %d.\n", ret); printf("OH_AI_ModelBuildFromFile failed, ret: %d.\n", ret);
OH_AI_ModelDestroy(&model); OH_AI_ModelDestroy(&model);
...@@ -193,7 +219,7 @@ The development process consists of the following main steps: ...@@ -193,7 +219,7 @@ The development process consists of the following main steps:
dl dl
) )
``` ```
- To use ohos-sdk for cross compilation, you need to set the native toolchain path for the CMake tool as follows: `-DCMAKE_TOOLCHAIN_FILE="/xxx/ohos-sdk/linux/native/build/cmake/ohos.toolchain.cmake"`. - To use ohos-sdk for cross compilation, you need to set the native toolchain path for the CMake tool as follows: `-DCMAKE_TOOLCHAIN_FILE="/xxx/ohos-sdk/linux/native/build/cmake/ohos.toolchain.camke"`.
- The toolchain builds a 64-bit application by default. To build a 32-bit application, add the following configuration: `-DOHOS_ARCH="armeabi-v7a"`. - The toolchain builds a 64-bit application by default. To build a 32-bit application, add the following configuration: `-DOHOS_ARCH="armeabi-v7a"`.
...@@ -213,4 +239,4 @@ The development process consists of the following main steps: ...@@ -213,4 +239,4 @@ The development process consists of the following main steps:
Tensor name: Softmax-65, tensor size is 4004 ,elements num: 1001. Tensor name: Softmax-65, tensor size is 4004 ,elements num: 1001.
output data is: output data is:
0.000018 0.000012 0.000026 0.000194 0.000156 0.001501 0.000240 0.000825 0.000016 0.000006 0.000007 0.000004 0.000004 0.000004 0.000015 0.000099 0.000011 0.000013 0.000005 0.000023 0.000004 0.000008 0.000003 0.000003 0.000008 0.000014 0.000012 0.000006 0.000019 0.000006 0.000018 0.000024 0.000010 0.000002 0.000028 0.000372 0.000010 0.000017 0.000008 0.000004 0.000007 0.000010 0.000007 0.000012 0.000005 0.000015 0.000007 0.000040 0.000004 0.000085 0.000023 0.000018 0.000012 0.000026 0.000194 0.000156 0.001501 0.000240 0.000825 0.000016 0.000006 0.000007 0.000004 0.000004 0.000004 0.000015 0.000099 0.000011 0.000013 0.000005 0.000023 0.000004 0.000008 0.000003 0.000003 0.000008 0.000014 0.000012 0.000006 0.000019 0.000006 0.000018 0.000024 0.000010 0.000002 0.000028 0.000372 0.000010 0.000017 0.000008 0.000004 0.000007 0.000010 0.000007 0.000012 0.000005 0.000015 0.000007 0.000040 0.000004 0.000085 0.000023
``` ```
\ No newline at end of file
# BundleStatusCallback # BundleStatusCallback
The **BundleStatusCallback** module provides bundle callback information, which is obtained through [innerBundleManager.on](js-apis-Bundle-InnerBundleManager.md). The **BundleStatusCallback** module provides callbacks for bundle status changes. The changes can be obtained through [innerBundleManager.on](js-apis-Bundle-InnerBundleManager.md).
> **NOTE** > **NOTE**
> >
> This module is deprecated since API version 9. You are advised to use [bundleMonitor](js-apis-bundleMonitor.md) instead. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## BundleStatusCallback<sup>(deprecated)<sup> ## BundleStatusCallback<sup>(deprecated)<sup>
......
# @ohos.bundle.innerBundleManager # @ohos.bundle.innerBundleManager (innerBundleManager)
The **innerBundleManager** module provides APIs for the **Home Screen** application. The **innerBundleManager** module provides APIs for the **Home Screen** application.
...@@ -22,7 +22,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -22,7 +22,7 @@ SystemCapability.BundleManager.BundleFramework
getLauncherAbilityInfos(bundleName: string, userId: number, callback: AsyncCallback&lt;Array&lt;LauncherAbilityInfo&gt;&gt;) : void; getLauncherAbilityInfos(bundleName: string, userId: number, callback: AsyncCallback&lt;Array&lt;LauncherAbilityInfo&gt;&gt;) : void;
Obtains the launcher ability information based on a given bundle name. This API uses an asynchronous callback to return the result. Obtains the launcher ability information based on a given bundle name. This API uses an asynchronous callback to return the result.
> This API is deprecated since API version 9. You are advised to use [launcherBundleManager#getLauncherAbilityInfo](js-apis-launcherBundleManager.md) instead. > This API is deprecated since API version 9. You are advised to use [launcherBundleManager.getLauncherAbilityInfo](js-apis-launcherBundleManager.md#launcherbundlemanagergetlauncherabilityinfo9) instead.
**Required permissions** **Required permissions**
...@@ -38,11 +38,11 @@ This is a system API and cannot be called by third-party applications. ...@@ -38,11 +38,11 @@ This is a system API and cannot be called by third-party applications.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- | | ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------ |
| bundleName | string | Yes | Bundle name of an application. | | bundleName | string | Yes | Bundle name. |
| userId | number | Yes | User ID. The value must be greater than or equal to 0.| | userId | number | Yes | User ID. The value must be greater than or equal to 0. |
| callback | AsyncCallback\<Array<[LauncherAbilityInfo](js-apis-bundle-LauncherAbilityInfo.md)>> | Yes | Callback used to return an array of the launcher ability information. | | callback | AsyncCallback\<Array<[LauncherAbilityInfo](js-apis-bundle-LauncherAbilityInfo.md)>> | Yes | Callback used to return an array of the launcher ability information.|
## innerBundleManager.getLauncherAbilityInfos<sup>(deprecated)</sup> ## innerBundleManager.getLauncherAbilityInfos<sup>(deprecated)</sup>
...@@ -50,7 +50,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -50,7 +50,7 @@ This is a system API and cannot be called by third-party applications.
getLauncherAbilityInfos(bundleName: string, userId: number) : Promise&lt;Array&lt;LauncherAbilityInfo&gt;&gt; getLauncherAbilityInfos(bundleName: string, userId: number) : Promise&lt;Array&lt;LauncherAbilityInfo&gt;&gt;
Obtains the launcher ability information based on a given bundle name. This API uses a promise to return the result. Obtains the launcher ability information based on a given bundle name. This API uses a promise to return the result.
> This API is deprecated since API version 9. You are advised to use [launcherBundleManager#getLauncherAbilityInfo](js-apis-launcherBundleManager.md) instead. > This API is deprecated since API version 9. You are advised to use [launcherBundleManager.getLauncherAbilityInfo](js-apis-launcherBundleManager.md#launcherbundlemanagergetlauncherabilityinfo9) instead.
**Required permissions** **Required permissions**
...@@ -66,9 +66,9 @@ This is a system API and cannot be called by third-party applications. ...@@ -66,9 +66,9 @@ This is a system API and cannot be called by third-party applications.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | ----------------------------------------------------- | | ---------- | ------ | ---- | ----------------------------- |
| bundleName | string | Yes | Bundle name of an application. | | bundleName | string | Yes | Bundle name. |
| userId | number | Yes | User ID. The value must be greater than or equal to 0.| | userId | number | Yes | User ID. The value must be greater than or equal to 0.|
**Return value** **Return value**
...@@ -82,7 +82,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -82,7 +82,7 @@ This is a system API and cannot be called by third-party applications.
on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback, callback: AsyncCallback&lt;string&gt;) : void; on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback, callback: AsyncCallback&lt;string&gt;) : void;
Registers a callback to receive bundle status changes. This API uses an asynchronous callback to return the result. Registers a callback to receive bundle status changes. This API uses an asynchronous callback to return the result.
> This API is deprecated since API version 9. You are advised to use [bundleMonitor#on](js-apis-bundleMonitor.md) instead. > This API is deprecated since API version 9. You are advised to use [bundleMonitor.on](js-apis-bundleMonitor.md#bundlemonitoron) instead.
**Required permissions** **Required permissions**
...@@ -109,7 +109,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -109,7 +109,7 @@ This is a system API and cannot be called by third-party applications.
on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback) : Promise&lt;string&gt; on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback) : Promise&lt;string&gt;
Registers a callback to receive bundle status changes. This API uses a promise to return the result. Registers a callback to receive bundle status changes. This API uses a promise to return the result.
> This API is deprecated since API version 9. You are advised to use [bundleMonitor#on](js-apis-bundleMonitor.md) instead. > This API is deprecated since API version 9. You are advised to use [bundleMonitor.on](js-apis-bundleMonitor.md#bundlemonitoron) instead.
**Required permissions** **Required permissions**
...@@ -141,7 +141,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -141,7 +141,7 @@ This is a system API and cannot be called by third-party applications.
off(type:"BundleStatusChange", callback: AsyncCallback&lt;string&gt;) : void; off(type:"BundleStatusChange", callback: AsyncCallback&lt;string&gt;) : void;
Deregisters the callback that receives bundle status changes. This API uses an asynchronous callback to return the result. Deregisters the callback that receives bundle status changes. This API uses an asynchronous callback to return the result.
> This API is deprecated since API version 9. You are advised to use [bundleMonitor#off](js-apis-bundleMonitor.md) instead. > This API is deprecated since API version 9. You are advised to use [bundleMonitor.off](js-apis-bundleMonitor.md#bundlemonitoroff) instead.
**Required permissions** **Required permissions**
...@@ -167,7 +167,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -167,7 +167,7 @@ This is a system API and cannot be called by third-party applications.
off(type:"BundleStatusChange") : Promise&lt;string&gt; off(type:"BundleStatusChange") : Promise&lt;string&gt;
Deregisters the callback that receives bundle status changes. This API uses a promise to return the result. Deregisters the callback that receives bundle status changes. This API uses a promise to return the result.
> This API is deprecated since API version 9. You are advised to use [bundleMonitor#off](js-apis-bundleMonitor.md) instead. > This API is deprecated since API version 9. You are advised to use [bundleMonitor.off](js-apis-bundleMonitor.md#bundlemonitoroff) instead.
**Required permissions** **Required permissions**
...@@ -198,7 +198,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -198,7 +198,7 @@ This is a system API and cannot be called by third-party applications.
getAllLauncherAbilityInfos(userId: number, callback: AsyncCallback&lt;Array&lt;LauncherAbilityInfo&gt;&gt;) : void; getAllLauncherAbilityInfos(userId: number, callback: AsyncCallback&lt;Array&lt;LauncherAbilityInfo&gt;&gt;) : void;
Obtains the information about all launcher abilities. This API uses an asynchronous callback to return the result. Obtains the information about all launcher abilities. This API uses an asynchronous callback to return the result.
> This API is deprecated since API version 9. You are advised to use [launcherBundleManager#getAllLauncherAbilityInfo](js-apis-launcherBundleManager.md) instead. > This API is deprecated since API version 9. You are advised to use [launcherBundleManager.getAllLauncherAbilityInfo](js-apis-launcherBundleManager.md#launcherbundlemanagergetalllauncherabilityinfo9) instead.
**Required permissions** **Required permissions**
...@@ -224,7 +224,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -224,7 +224,7 @@ This is a system API and cannot be called by third-party applications.
getAllLauncherAbilityInfos(userId: number) : Promise&lt;Array&lt;LauncherAbilityInfo&gt;&gt; getAllLauncherAbilityInfos(userId: number) : Promise&lt;Array&lt;LauncherAbilityInfo&gt;&gt;
Obtains the information about all launcher abilities. This API uses a promise to return the result. Obtains the information about all launcher abilities. This API uses a promise to return the result.
> This API is deprecated since API version 9. You are advised to use [launcherBundleManager#getAllLauncherAbilityInfo](js-apis-launcherBundleManager.md) instead. > This API is deprecated since API version 9. You are advised to use [launcherBundleManager.getAllLauncherAbilityInfo](js-apis-launcherBundleManager.md#launcherbundlemanagergetalllauncherabilityinfo9) instead.
**Required permissions** **Required permissions**
...@@ -255,7 +255,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -255,7 +255,7 @@ This is a system API and cannot be called by third-party applications.
getShortcutInfos(bundleName :string, callback: AsyncCallback&lt;Array&lt;ShortcutInfo&gt;&gt;) : void; getShortcutInfos(bundleName :string, callback: AsyncCallback&lt;Array&lt;ShortcutInfo&gt;&gt;) : void;
Obtains the shortcut information based on a given bundle name. This API uses an asynchronous callback to return the result. Obtains the shortcut information based on a given bundle name. This API uses an asynchronous callback to return the result.
> This API is deprecated since API version 9. You are advised to use [launcherBundleManager#getShortcutInfo](js-apis-launcherBundleManager.md) instead. > This API is deprecated since API version 9. You are advised to use [launcherBundleManager.getShortcutInfo](js-apis-launcherBundleManager.md#launcherbundlemanagergetshortcutinfo9) instead.
**Required permissions** **Required permissions**
...@@ -273,7 +273,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -273,7 +273,7 @@ This is a system API and cannot be called by third-party applications.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------------------------------------------------------------ | ---- | ---------------------------------------------- | | ---------- | ------------------------------------------------------------ | ---- | ---------------------------------------------- |
| bundleName | string | Yes | Bundle name of an application. | | bundleName | string | Yes | Bundle name. |
| callback | AsyncCallback\<Array<[ShortcutInfo](js-apis-bundle-ShortcutInfo.md)>> | Yes | Callback used to return an array of the shortcut information.| | callback | AsyncCallback\<Array<[ShortcutInfo](js-apis-bundle-ShortcutInfo.md)>> | Yes | Callback used to return an array of the shortcut information.|
## innerBundleManager.getShortcutInfos<sup>(deprecated)</sup> ## innerBundleManager.getShortcutInfos<sup>(deprecated)</sup>
...@@ -281,7 +281,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -281,7 +281,7 @@ This is a system API and cannot be called by third-party applications.
getShortcutInfos(bundleName : string) : Promise&lt;Array&lt;ShortcutInfo&gt;&gt; getShortcutInfos(bundleName : string) : Promise&lt;Array&lt;ShortcutInfo&gt;&gt;
Obtains the shortcut information based on a given bundle name. This API uses a promise to return the result. Obtains the shortcut information based on a given bundle name. This API uses a promise to return the result.
> This API is deprecated since API version 9. You are advised to use [launcherBundleManager#getShortcutInfo](js-apis-launcherBundleManager.md) instead. > This API is deprecated since API version 9. You are advised to use [launcherBundleManager.getShortcutInfo](js-apis-launcherBundleManager.md#launcherbundlemanagergetshortcutinfo9) instead.
**Required permissions** **Required permissions**
...@@ -299,7 +299,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -299,7 +299,7 @@ This is a system API and cannot be called by third-party applications.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | ------------------------ | | ---------- | ------ | ---- | ------------------------ |
| bundleName | string | Yes | Bundle name of an application.| | bundleName | string | Yes | Bundle name.|
**Return value** **Return value**
......
# distributedBundle # @ohos.distributedBundle (Distributed Bundle Management)
The **distributedBundle** module manages distributed bundles. The **distributedBundle** module manages distributed bundles.
...@@ -26,7 +26,7 @@ For details, see [Permission Levels](../../security/accesstoken-overview.md#perm ...@@ -26,7 +26,7 @@ For details, see [Permission Levels](../../security/accesstoken-overview.md#perm
## distributedBundle.getRemoteAbilityInfo<sup>deprecated<sup> ## distributedBundle.getRemoteAbilityInfo<sup>deprecated<sup>
> This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo](js-apis-distributedBundle.md) instead. > This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo(@ohos.bundle.distributedBundleManager)](js-apis-distributedBundleManager.md) instead.
getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback&lt;RemoteAbilityInfo&gt;): void; getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback&lt;RemoteAbilityInfo&gt;): void;
...@@ -55,7 +55,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -55,7 +55,7 @@ This is a system API and cannot be called by third-party applications.
## distributedBundle.getRemoteAbilityInfo<sup>deprecated<sup> ## distributedBundle.getRemoteAbilityInfo<sup>deprecated<sup>
> This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo](js-apis-distributedBundle.md) instead. > This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo(@ohos.bundle.distributedBundleManager)](js-apis-distributedBundleManager.md) instead.
getRemoteAbilityInfo(elementName: ElementName): Promise&lt;RemoteAbilityInfo&gt; getRemoteAbilityInfo(elementName: ElementName): Promise&lt;RemoteAbilityInfo&gt;
...@@ -87,7 +87,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -87,7 +87,7 @@ This is a system API and cannot be called by third-party applications.
## distributedBundle.getRemoteAbilityInfos<sup>deprecated<sup> ## distributedBundle.getRemoteAbilityInfos<sup>deprecated<sup>
> This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo](js-apis-distributedBundle.md) instead. > This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo(@ohos.bundle.distributedBundleManager)](js-apis-distributedBundleManager.md) instead.
getRemoteAbilityInfos(elementNames: Array&lt;ElementName&gt;, callback: AsyncCallback&lt;Array&lt;RemoteAbilityInfo&gt;&gt;): void; getRemoteAbilityInfos(elementNames: Array&lt;ElementName&gt;, callback: AsyncCallback&lt;Array&lt;RemoteAbilityInfo&gt;&gt;): void;
...@@ -116,7 +116,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -116,7 +116,7 @@ This is a system API and cannot be called by third-party applications.
## distributedBundle.getRemoteAbilityInfos<sup>deprecated<sup> ## distributedBundle.getRemoteAbilityInfos<sup>deprecated<sup>
> This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo](js-apis-distributedBundle.md) instead. > This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo(@ohos.bundle.distributedBundleManager)](js-apis-distributedBundleManager.md) instead.
getRemoteAbilityInfos(elementNames: Array&lt;ElementName&gt;): Promise&lt;Array&lt;RemoteAbilityInfo&gt;&gt; getRemoteAbilityInfos(elementNames: Array&lt;ElementName&gt;): Promise&lt;Array&lt;RemoteAbilityInfo&gt;&gt;
......
# AbilityInfo # AbilityInfo
The **AbilityInfo** module provides information about an ability. Unless otherwise specified, the information is obtained through [GET_BUNDLE_DEFAULT](js-apis-Bundle.md). The **AbilityInfo** module provides information about an ability. Unless otherwise specified, the information is obtained through [bundle.getAbilityInfo](js-apis-Bundle.md#bundlegetabilityinfodeprecated).
> **NOTE** > **NOTE**
> >
...@@ -12,32 +12,32 @@ The **AbilityInfo** module provides information about an ability. Unless otherwi ...@@ -12,32 +12,32 @@ The **AbilityInfo** module provides information about an ability. Unless otherwi
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------------------- | -------------------------------------------------------- | ---- | ---- | ----------------------------------------- | | --------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ |
| bundleName | string | Yes | No | Bundle name. | | bundleName | string | Yes | No | Bundle name. |
| name | string | Yes | No | Ability name. | | name | string | Yes | No | Ability name. |
| label | string | Yes | No | Ability name visible to users. | | label | string | Yes | No | Ability name visible to users. |
| description | string | Yes | No | Ability description. | | description | string | Yes | No | Ability description. |
| icon | string | Yes | No | Index of the ability icon resource file. | | icon | string | Yes | No | Index of the ability icon resource file. |
| descriptionId | number | Yes | No | Ability description ID. | | descriptionId | number | Yes | No | ID of the ability description. |
| iconId | number | Yes | No | Ability icon ID. | | iconId | number | Yes | No | ID of the ability icon. |
| moduleName | string | Yes | No | Name of the HAP file to which the ability belongs. | | moduleName | string | Yes | No | Name of the HAP file to which the ability belongs. |
| process | string | Yes | No | Process in which the ability runs. If this parameter is not set, the bundle name is used.| | process | string | Yes | No | Process in which the ability runs. If this parameter is not set, the bundle name is used. |
| targetAbility | string | Yes | No | Target ability that the ability alias points to.<br>This attribute can be used only in the FA model.| | targetAbility | string | Yes | No | Target ability that the ability alias points to.<br>This attribute can be used only in the FA model.|
| backgroundModes | number | Yes | No | Background service mode of the ability.<br>This attribute can be used only in the FA model. | | backgroundModes | number | Yes | No | Background service mode of the ability.<br>This attribute can be used only in the FA model. |
| isVisible | boolean | Yes | No | Whether the ability can be called by other bundles. | | isVisible | boolean | Yes | No | Whether the ability can be called by other bundles. |
| formEnabled | boolean | Yes | No | Whether the ability provides the service widget capability.<br>This attribute can be used only in the FA model.| | formEnabled | boolean | Yes | No | Whether the ability provides the service widget capability.<br>This attribute can be used only in the FA model.|
| type | AbilityType | Yes | No | Ability type.<br>This attribute can be used only in the FA model. | | type | AbilityType | Yes | No | Ability type.<br>This attribute can be used only in the FA model. |
| orientation | [DisplayOrientation](js-apis-Bundle.md#displayorientationdeprecated) | Yes | No | Ability display orientation. | | orientation | [DisplayOrientation](js-apis-Bundle.md#displayorientationdeprecated) | Yes | No | Ability display orientation. |
| launchMode | [LaunchMode](js-apis-Bundle.md#launchmodedeprecated) | Yes | No | Ability launch mode. | | launchMode | [LaunchMode](js-apis-Bundle.md#launchmodedeprecated) | Yes | No | Ability launch mode. |
| permissions | Array\<string> | Yes | No | Permissions required for other applications to call the ability.<br>The value is obtained by passing **GET_ABILITY_INFO_WITH_PERMISSION**.| | permissions | Array\<string> | Yes | No | Permissions required for other applications to call the ability.<br>The value is obtained by passing in GET_ABILITY_INFO_WITH_PERMISSION to [bundle.getAbilityInfo](js-apis-Bundle.md#bundlegetabilityinfodeprecated).|
| deviceTypes | Array\<string> | Yes | No | Device types supported by the ability. | | deviceTypes | Array\<string> | Yes | No | Device types supported by the ability. |
| deviceCapabilities | Array\<string> | Yes | No | Device capabilities required for the ability. | | deviceCapabilities | Array\<string> | Yes | No | Device capabilities required for the ability. |
| readPermission | string | Yes | No | Permission required for reading the ability data.<br>This attribute can be used only in the FA model.| | readPermission | string | Yes | No | Permission required for reading the ability data.<br>This attribute can be used only in the FA model. |
| writePermission | string | Yes | No | Permission required for writing data to the ability.<br>This attribute can be used only in the FA model.| | writePermission | string | Yes | No | Permission required for writing data to the ability.<br>This attribute can be used only in the FA model. |
| applicationInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | Yes | No | Application configuration information.<br>The value is obtained by passing [GET_ABILITY_INFO_WITH_APPLICATION](js-apis-Bundle.md).| | applicationInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | Yes | No | Application configuration information.<br>The value is obtained by passing in GET_ABILITY_INFO_WITH_APPLICATION to [bundle.getAbilityInfo](js-apis-Bundle.md#bundlegetabilityinfodeprecated).|
| uri | string | Yes | No | URI of the ability.<br>This attribute can be used only in the FA model.| | uri | string | Yes | No | URI of the ability.<br>This attribute can be used only in the FA model.|
| labelId | number | Yes | No | Ability label ID. | | labelId | number | Yes | No | ID of the ability label. |
| subType | AbilitySubType | Yes | No | Subtype of the template that can be used by the ability.<br>This attribute can be used only in the FA model.| | subType | AbilitySubType | Yes | No | Subtype of the template that can be used by the ability.<br>This attribute can be used only in the FA model.|
| metadata<sup>8+</sup> | Array\<[CustomizeData](js-apis-bundle-CustomizeData.md)> | Yes | No | Metadata of the ability.<br>The value is obtained by passing **GET_ABILITY_INFO_WITH_METADATA**.| | metadata<sup>8+</sup> | Array\<[CustomizeData](js-apis-bundle-CustomizeData.md)> | Yes | No | Metadata of the ability.<br>The value is obtained by passing in GET_ABILITY_INFO_WITH_METADATA to [bundle.getAbilityInfo](js-apis-Bundle.md#bundlegetabilityinfodeprecated).|
| enabled<sup>8+</sup> | boolean | Yes | No | Whether the ability is enabled. | | enabled<sup>8+</sup> | boolean | Yes | No | Whether the ability is enabled. |
# ApplicationInfo # ApplicationInfo
The **ApplicationInfo** module provides application information. Unless otherwise specified, the information is obtained through [GET_BUNDLE_DEFAULT](js-apis-Bundle.md). The **ApplicationInfo** module provides application information. Unless otherwise specified, the information is obtained through [bundle.getApplicationInfo](js-apis-Bundle.md#bundlegetapplicationinfodeprecated).
> **NOTE** > **NOTE**
> >
...@@ -16,21 +16,21 @@ The **ApplicationInfo** module provides application information. Unless otherwis ...@@ -16,21 +16,21 @@ The **ApplicationInfo** module provides application information. Unless otherwis
|----------------------------|------------------------------------------------------------------------|-----|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| |----------------------------|------------------------------------------------------------------------|-----|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| name | string | Yes | No | Application name. | | name | string | Yes | No | Application name. |
| description | string | Yes | No | Application description. | | description | string | Yes | No | Application description. |
| descriptionId | number | Yes | No | Application description ID. | | descriptionId | number | Yes | No | ID of the application description. |
| systemApp | boolean | Yes | No | Whether the application is a system application. The default value is **false**. | | systemApp | boolean | Yes | No | Whether the application is a system application. The default value is **false**. |
| enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. | | enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. |
| label | string | Yes | No | Application label. | | label | string | Yes | No | Application label. |
| labelId | string | Yes | No | Application label ID. | | labelId | string | Yes | No | ID of the application label. |
| icon | string | Yes | No | Application icon. | | icon | string | Yes | No | Application icon. |
| iconId | string | Yes | No | Application icon ID. | | iconId | string | Yes | No | ID of the application icon. |
| process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used. | | process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used. |
| supportedModes | number | Yes | No | Modes supported by the application. Currently, only the **drive** mode is defined. This attribute applies only to head units. | | supportedModes | number | Yes | No | Modes supported by the application. Currently, only the **drive** mode is defined. This attribute applies only to telematics devices. |
| moduleSourceDirs | Array\<string> | Yes | No | Relative paths for storing application resources. | | moduleSourceDirs | Array\<string> | Yes | No | Relative paths for storing application resources. |
| permissions | Array\<string> | Yes | No | Permissions required for accessing the application.<br>The value is obtained by passing [GET_APPLICATION_INFO_WITH_PERMISSION](js-apis-Bundle.md). | | permissions | Array\<string> | Yes | No | Permissions required for accessing the application.<br>The value is obtained by passing in GET_APPLICATION_INFO_WITH_PERMISSION to [bundle.getApplicationInfo](js-apis-Bundle.md#bundlegetapplicationinfodeprecated). |
| moduleInfos | Array\<[ModuleInfo](js-apis-bundle-ModuleInfo.md)> | Yes | No | Application module information. | | moduleInfos | Array\<[ModuleInfo](js-apis-bundle-ModuleInfo.md)> | Yes | No | Application module information. |
| entryDir | string | Yes | No | Path for storing application files. | | entryDir | string | Yes | No | Path for storing application files. |
| codePath<sup>8+</sup> | string | Yes | No | Installation directory of the application. | | codePath<sup>8+</sup> | string | Yes | No | Installation directory of the application. |
| metaData<sup>8+</sup> | Map\<string, Array\<[CustomizeData](js-apis-bundle-CustomizeData.md)>> | Yes | No | Custom metadata of the application.<br>The value is obtained by passing [GET_APPLICATION_INFO_WITH_METADATA](js-apis-Bundle.md). | | metaData<sup>8+</sup> | Map\<string, Array\<[CustomizeData](js-apis-bundle-CustomizeData.md)>> | Yes | No | Custom metadata of the application.<br>The value is obtained by passing in GET_APPLICATION_INFO_WITH_METADATA to [bundle.getApplicationInfo](js-apis-Bundle.md#bundlegetapplicationinfodeprecated). |
| removable<sup>8+</sup> | boolean | Yes | No | Whether the application is removable. | | removable<sup>8+</sup> | boolean | Yes | No | Whether the application is removable. |
| accessTokenId<sup>8+</sup> | number | Yes | No | Access token ID of the application. | | accessTokenId<sup>8+</sup> | number | Yes | No | Access token ID of the application. |
| uid<sup>8+</sup> | number | Yes | No | UID of the application. | | uid<sup>8+</sup> | number | Yes | No | UID of the application. |
......
# BundleInfo # BundleInfo
The **BundleInfo** module provides bundle information. Unless otherwise specified, the information is obtained through [GET_BUNDLE_DEFAULT](js-apis-Bundle.md). The **BundleInfo** module defines the bundle information, which can be obtained through [bundle.getBundleInfo](js-apis-Bundle.md#bundlegetbundleinfodeprecated).
> **NOTE** > **NOTE**
> >
...@@ -10,33 +10,33 @@ The **BundleInfo** module provides bundle information. Unless otherwise specifie ...@@ -10,33 +10,33 @@ The **BundleInfo** module provides bundle information. Unless otherwise specifie
> This API is deprecated since API version 9. You are advised to use [bundleManager-BundleInfo](js-apis-bundleManager-bundleInfo.md) instead. > This API is deprecated since API version 9. You are advised to use [bundleManager-BundleInfo](js-apis-bundleManager-bundleInfo.md) instead.
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ | | -------------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ |
| name | string | Yes | No | Bundle name. | | name | string | Yes | No | Bundle name. |
| type | string | Yes | No | Bundle type. | | type | string | Yes | No | Bundle type. |
| appId | string | Yes | No | ID of the application to which the bundle belongs. | | appId | string | Yes | No | ID of the application to which the bundle belongs. |
| uid | number | Yes | No | UID of the application to which the bundle belongs. | | uid | number | Yes | No | UID of the application to which the bundle belongs. |
| installTime | number | Yes | No | Time when the HAP file was installed. | | installTime | number | Yes | No | Time when the HAP file was installed. |
| updateTime | number | Yes | No | Time when the HAP file was updated. | | updateTime | number | Yes | No | Time when the HAP file was updated. |
| appInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | Yes | No | Application configuration information. | | appInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | Yes | No | Application configuration information. |
| abilityInfos | Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes | No | Ability configuration information.<br>The value is obtained by passing **GET_BUNDLE_WITH_ABILITIES**.| | abilityInfos | Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes | No | Ability configuration information.<br>The value is obtained by passing in GET_BUNDLE_WITH_ABILITIES to [bundle.getBundleInfo](js-apis-Bundle.md#bundlegetbundleinfodeprecated).|
| reqPermissions | Array\<string> | Yes | No | Permissions to request from the system for running the application.<br>The value is obtained by passing **GET_BUNDLE_WITH_REQUESTED_PERMISSION**.| | reqPermissions | Array\<string> | Yes | No | Permissions to request from the system for running the application.<br>The value is obtained by passing in GET_BUNDLE_WITH_REQUESTED_PERMISSION to [bundle.getBundleInfo](js-apis-Bundle.md#bundlegetbundleinfodeprecated).|
| reqPermissionDetails | Array\<[ReqPermissionDetail](#reqpermissiondetaildeprecated)> | Yes | No | Detailed information of the permissions to request from the system.<br>The value is obtained by passing **GET_BUNDLE_WITH_REQUESTED_PERMISSION**.| | reqPermissionDetails | Array\<[ReqPermissionDetail](#reqpermissiondetaildeprecated)> | Yes | No | Detailed information of the permissions to request from the system.<br>The value is obtained by passing in GET_BUNDLE_WITH_REQUESTED_PERMISSION to [bundle.getBundleInfo](js-apis-Bundle.md#bundlegetbundleinfodeprecated).|
| vendor | string | Yes | No | Vendor of the bundle. | | vendor | string | Yes | No | Vendor of the bundle. |
| versionCode | number | Yes | No | Version number of the bundle. | | versionCode | number | Yes | No | Version number of the bundle. |
| versionName | string | Yes | No | Version description of the bundle. | | versionName | string | Yes | No | Version description of the bundle. |
| compatibleVersion | number | Yes | No | Earliest SDK version required for running the bundle. | | compatibleVersion | number | Yes | No | Earliest SDK version required for running the bundle. |
| targetVersion | number | Yes | No | Latest SDK version required for running the bundle. | | targetVersion | number | Yes | No | Latest SDK version required for running the bundle. |
| isCompressNativeLibs | boolean | Yes | No | Whether to compress the native library of the bundle. The default value is **true**. | | isCompressNativeLibs | boolean | Yes | No | Whether to compress the native library of the bundle. The default value is **true**. |
| hapModuleInfos | Array\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | Yes | No | Module configuration information. | | hapModuleInfos | Array\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | Yes | No | Module configuration information. |
| entryModuleName | string | Yes | No | Name of the entry module. | | entryModuleName | string | Yes | No | Name of the entry module. |
| cpuAbi | string | Yes | No | CPU and ABI information of the bundle. | | cpuAbi | string | Yes | No | CPU and ABI information of the bundle. |
| isSilentInstallation | string | Yes | No | Whether the application can be installed in silent mode. | | isSilentInstallation | string | Yes | No | Whether the application can be installed in silent mode. |
| minCompatibleVersionCode | number | Yes | No | Earliest version compatible with the bundle in the distributed scenario. | | minCompatibleVersionCode | number | Yes | No | Earliest version compatible with the bundle in the distributed scenario. |
| entryInstallationFree | boolean | Yes | No | Whether installation-free is supported for the entry module. | | entryInstallationFree | boolean | Yes | No | Whether installation-free is supported for the entry module. |
| reqPermissionStates<sup>8+</sup> | Array\<number> | Yes | No | Permission grant state. The value **0** means that the request is successful, and **-1** means the opposite. | | reqPermissionStates<sup>8+</sup> | Array\<number> | Yes | No | Permission grant state. The value **0** means that the request is successful, and **-1** means the opposite. |
......
...@@ -8,7 +8,7 @@ The **BundleInstaller** module provides APIs for you to install, uninstall, and ...@@ -8,7 +8,7 @@ The **BundleInstaller** module provides APIs for you to install, uninstall, and
## BundleInstaller.install<sup>(deprecated)<sup> ## BundleInstaller.install<sup>(deprecated)<sup>
> This API is deprecated since API version 9. You are advised to use [install](js-apis-installer.md) instead. > This API is deprecated since API version 9. You are advised to use [@ohos.bundle.installer.install](js-apis-installer.md) instead.
install(bundleFilePaths: Array&lt;string&gt;, param: InstallParam, callback: AsyncCallback&lt;InstallStatus&gt;): void; install(bundleFilePaths: Array&lt;string&gt;, param: InstallParam, callback: AsyncCallback&lt;InstallStatus&gt;): void;
...@@ -26,10 +26,10 @@ SystemCapability.BundleManager.BundleFramework ...@@ -26,10 +26,10 @@ SystemCapability.BundleManager.BundleFramework
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | | --------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| bundleFilePaths | Array&lt;string&gt; | Yes | Sandbox path where the HAP files of the bundle are stored. For details about how to obtain the sandbox path, see [Obtaining the Sandbox Path](#obtaining-the-sandbox-path).| | bundleFilePaths | Array&lt;string&gt; | Yes | Sandbox path where the HAP files of the bundle are stored. For details about how to obtain the sandbox path, see [Obtaining the Sandbox Path](#obtaining-the-sandbox-path).|
| param | [InstallParam](#installparamdeprecated) | Yes | Parameters required for bundle installation. | | param | [InstallParam](#installparamdeprecated) | Yes | Parameters required for bundle installation. |
| callback | AsyncCallback&lt;[InstallStatus](#installstatusdeprecated)&gt; | Yes | Callback used to return the installation status. | | callback | AsyncCallback&lt;[InstallStatus](#installstatusdeprecated)&gt; | Yes | Callback used to return the installation status. |
**Example** **Example**
...@@ -43,7 +43,7 @@ let installParam = { ...@@ -43,7 +43,7 @@ let installParam = {
installFlag: 1, installFlag: 1,
}; };
bundle.getBundleInstaller().then(installer=>{ bundle.getBundleInstaller().then(installer => {
installer.install(hapFilePaths, installParam, err => { installer.install(hapFilePaths, installParam, err => {
if (err) { if (err) {
console.error('install failed:' + JSON.stringify(err)); console.error('install failed:' + JSON.stringify(err));
...@@ -76,10 +76,10 @@ SystemCapability.BundleManager.BundleFramework ...@@ -76,10 +76,10 @@ SystemCapability.BundleManager.BundleFramework
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | | ---------- | ------------------------------------------------------------ | ---- | ---------------------------------------------- |
| bundleName | string | Yes | Bundle name. | | bundleName | string | Yes | Bundle name. |
| param | [InstallParam](#installparamdeprecated) | Yes | Parameters required for bundle uninstall. | | param | [InstallParam](#installparamdeprecated) | Yes | Parameters required for bundle uninstall. |
| callback | AsyncCallback&lt;[InstallStatus](#installstatusdeprecated)&gt; | Yes | Callback used to return the installation status.| | callback | AsyncCallback&lt;[InstallStatus](#installstatusdeprecated)&gt; | Yes | Callback used to return the installation status.|
**Example** **Example**
...@@ -93,7 +93,7 @@ let installParam = { ...@@ -93,7 +93,7 @@ let installParam = {
installFlag: 1, installFlag: 1,
}; };
bundle.getBundleInstaller().then(installer=>{ bundle.getBundleInstaller().then(installer => {
installer.uninstall(bundleName, installParam, err => { installer.uninstall(bundleName, installParam, err => {
if (err) { if (err) {
console.error('uninstall failed:' + JSON.stringify(err)); console.error('uninstall failed:' + JSON.stringify(err));
...@@ -125,10 +125,10 @@ SystemCapability.BundleManager.BundleFramework ...@@ -125,10 +125,10 @@ SystemCapability.BundleManager.BundleFramework
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | | ---------- | ------------------------------------------------------------ | ---- | -------------------------------------------------- |
| bundleName | string | Yes | Bundle name. | | bundleName | string | Yes | Bundle name. |
| param | [InstallParam](#installparamdeprecated) | Yes | Parameters required for bundle recovery. | | param | [InstallParam](#installparamdeprecated) | Yes | Parameters required for bundle recovery. |
| callback | AsyncCallback&lt;[InstallStatus](#installstatusdeprecated)&gt; | Yes | Callback used to return the recovery status.| | callback | AsyncCallback&lt;[InstallStatus](#installstatusdeprecated)&gt; | Yes | Callback used to return the recovery status.|
**Example** **Example**
...@@ -143,7 +143,7 @@ let installParam = { ...@@ -143,7 +143,7 @@ let installParam = {
installFlag: 1, installFlag: 1,
}; };
bundle.getBundleInstaller().then(installer=>{ bundle.getBundleInstaller().then(installer => {
installer.recover(bundleName, installParam, err => { installer.recover(bundleName, installParam, err => {
if (err) { if (err) {
console.error('recover failed:' + JSON.stringify(err)); console.error('recover failed:' + JSON.stringify(err));
...@@ -166,9 +166,9 @@ Describes the parameters required for bundle installation, recovery, or uninstal ...@@ -166,9 +166,9 @@ Describes the parameters required for bundle installation, recovery, or uninstal
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ----------- | ------- | ---- | ---- | ------------------ | | ----------- | ------- | ---- | ---- | ------------------ |
| userId | number | Yes | No | User ID. | | userId | number | Yes | Yes | User ID. The default value is the user ID of the caller.|
| installFlag | number | Yes | No | Installation flag. | | installFlag | number | Yes | Yes | Installation flag.<br>**1** (default): overwrite installation.<br>**16**: installation-free.|
| isKeepData | boolean | Yes | No | Whether data is kept.| | isKeepData | boolean | Yes | Yes | Whether data is kept. The default value is **false**.|
## InstallStatus<sup>(deprecated)<sup> ## InstallStatus<sup>(deprecated)<sup>
...@@ -180,17 +180,17 @@ Describes the bundle installation or uninstall status. ...@@ -180,17 +180,17 @@ Describes the bundle installation or uninstall status.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------ | | ------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------ |
| status | bundle.[InstallErrorCode](js-apis-Bundle.md#installerrorcode) | Yes | No | Installation or uninstall error code. | | status | bundle.[InstallErrorCode](js-apis-Bundle.md#installerrorcode) | Yes | No | Installation or uninstall error code. The value must be defined in [InstallErrorCode](js-apis-Bundle.md#installerrorcode). |
| statusMessage | string | Yes | No | Installation or uninstall status message.| | statusMessage | string | Yes | No | Installation or uninstall status message. <br>**SUCCESS**: install_succeed<br>**STATUS_INSTALL_FAILURE**: Installation failed (no installation file exists).<br>**STATUS_INSTALL_FAILURE_ABORTED**: Installation aborted.<br>**STATUS_INSTALL_FAILURE_INVALID**: Invalid installation parameter.<br>**STATUS_INSTALL_FAILURE_CONFLICT**: Installation conflict. (The basic information of the application to update is inconsistent with that of the existing application.)<br>**STATUS_INSTALL_FAILURE_STORAGE**: Failed to store the bundle information.<br>**STATUS_INSTALL_FAILURE_INCOMPATIBLE**: Installation incompatibility. (A downgrade occurs or the signature information is incorrect.)<br>**STATUS_UNINSTALL_FAILURE**: Uninstallation failed. (The application to be uninstalled is not found.)<br>**STATUS_UNINSTALL_FAILURE_ABORTED**: Uninstallation aborted. (This error code is not in use.)<br>**STATUS_UNINSTALL_FAILURE_ABORTED**: Uninstallation conflict. (Failed to uninstall a system application or end the application process.)<br>**STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT**: Installation failed. (Download timed out.)<br>**STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED**: Installation failed. (Download failed.)<br>**STATUS_RECOVER_FAILURE_INVALID**: Failed to restore the pre-installed application.<br>**STATUS_ABILITY_NOT_FOUND**: Ability not found.<br>**STATUS_BMS_SERVICE_ERROR**: BMS service error.<br>**STATUS_FAILED_NO_SPACE_LEFT**: Insufficient device space.<br>**STATUS_GRANT_REQUEST_PERMISSIONS_FAILED**: Application authorization failed.<br>**STATUS_INSTALL_PERMISSION_DENIED**: No installation permission.<br>**STATUS_UNINSTALL_PERMISSION_DENIED**: No uninstallation permission. |
## Obtaining the Sandbox Path ## Obtaining the Sandbox Path
For the FA model, the sandbox path of a bundle can be obtained using the APIs in [Context](js-apis-inner-app-context.md). For the sage model, the sandbox path can be obtained using the attribute in [Context](js-apis-ability-context.md#abilitycontext). The following describes how to obtain the sandbox path. For the FA model, the sandbox path of a bundle can be obtained using the APIs in [Context](js-apis-inner-app-context.md). For the stage model, the sandbox path can be obtained using the attribute in [Context](js-apis-ability-context.md#abilitycontext). The following describes how to obtain the sandbox path.
**Example** **Example**
``` ts ``` ts
// Stage model // Stage model
import Ability from '@ohos.application.Ability'; import UIAbility from '@ohos.app.ability.UIAbility';
class MainAbility extends Ability { export default class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
let context = this.context; let context = this.context;
let pathDir = context.filesDir; let pathDir = context.filesDir;
......
...@@ -17,7 +17,7 @@ Describes the element name information, which identifies the basic information a ...@@ -17,7 +17,7 @@ Describes the element name information, which identifies the basic information a
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ----------------------- | ---------| ---- | ---- | ------------------------- | | ----------------------- | ---------| ---- | ---- | ------------------------- |
| deviceId | string | Yes | Yes | Device ID. | | deviceId | string | Yes | Yes | Device ID. |
| bundleName | string | Yes | Yes | Bundle name of the application. | | bundleName | string | Yes | Yes | Bundle name. |
| abilityName | string | Yes | Yes | Name of the ability. | | abilityName | string | Yes | Yes | Ability name. |
| uri | string | Yes | Yes | Resource ID. | | uri | string | Yes | Yes | Resource ID. |
| shortName | string | Yes | Yes | Short name of the ability. | | shortName | string | Yes | Yes | Short name of the ability. |
# HapModuleInfo # HapModuleInfo
The **HapModuleInfo** module provides information about an HAP module. Unless otherwise specified, the information is obtained through [GET_BUNDLE_DEFAULT](js-apis-Bundle.md). The **HapModuleInfo** module provides information about an HAP module. Unless otherwise specified, the information is obtained through [bundle.getBundleInfo](js-apis-Bundle.md#bundlegetbundleinfodeprecated).
> **NOTE** > **NOTE**
> >
......
...@@ -8,7 +8,7 @@ The **LauncherAbilityInfo** module provides information about the launcher abili ...@@ -8,7 +8,7 @@ The **LauncherAbilityInfo** module provides information about the launcher abili
## LauncherAbilityInfo<sup>(deprecated)<sup> ## LauncherAbilityInfo<sup>(deprecated)<sup>
> This API is deprecated since API version 9. You are advised to use [LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md) instead. > This API is deprecated since API version 9. You are advised to use [bundleManager-LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md) instead.
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
...@@ -18,7 +18,7 @@ The **LauncherAbilityInfo** module provides information about the launcher abili ...@@ -18,7 +18,7 @@ The **LauncherAbilityInfo** module provides information about the launcher abili
| --------------- | ---------------------------------------------------- | ---- | ---- | -------------------------------------- | | --------------- | ---------------------------------------------------- | ---- | ---- | -------------------------------------- |
| applicationInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | Yes | No | Application information of the launcher ability.| | applicationInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | Yes | No | Application information of the launcher ability.|
| elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | No | Element name of the launcher ability. | | elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | No | Element name of the launcher ability. |
| labelId | number | Yes | No | Label ID of the launcher ability. | | labelId | number | Yes | No | ID of the launcher ability label. |
| iconId | number | Yes | No | Icon ID of the launcher ability. | | iconId | number | Yes | No | ID of the launcher ability icon. |
| userId | number | Yes | No | User ID of the launcher ability. | | userId | number | Yes | No | ID of the launcher ability user. |
| installTime | number | Yes | No | Time when the launcher ability is installed. | | installTime | number | Yes | No | Time when the launcher ability is installed. |
...@@ -10,6 +10,7 @@ The **ModuleInfo** module provides module information of an application. ...@@ -10,6 +10,7 @@ The **ModuleInfo** module provides module information of an application.
> This API is deprecated since API version 9. You are advised to use [bundleManager-HapModuleInfo](js-apis-bundleManager-hapModuleInfo.md) instead. > This API is deprecated since API version 9. You are advised to use [bundleManager-HapModuleInfo](js-apis-bundleManager-hapModuleInfo.md) instead.
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------------- | ------ | ---- | ---- | -------- | | --------------- | ------ | ---- | ---- | -------- |
| moduleName | string | Yes | No | Module name.| | moduleName | string | Yes | No | Module name.|
......
...@@ -18,5 +18,5 @@ The **PermissionDef** module provides permission details defined in the configur ...@@ -18,5 +18,5 @@ The **PermissionDef** module provides permission details defined in the configur
| -------------- | ------ | ---- | ---- | -------------- | | -------------- | ------ | ---- | ---- | -------------- |
| permissionName | string | Yes | No | Name of the permission. | | permissionName | string | Yes | No | Name of the permission. |
| grantMode | number | Yes | No | Grant mode of the permission. The value **0** means that the system automatically grants the permission after the application installation, and **1** means that the application needs to dynamically request the permission from the user.| | grantMode | number | Yes | No | Grant mode of the permission. The value **0** means that the system automatically grants the permission after the application installation, and **1** means that the application needs to dynamically request the permission from the user.|
| labelId | number | Yes | No | Label ID of the permission. | | labelId | number | Yes | No | ID of the permission label. |
| descriptionId | number | Yes | No | Description ID of the permission. | | descriptionId | number | Yes | No | ID of the permission description. |
...@@ -10,9 +10,9 @@ The **shortcutInfo** module defines shortcut information configured in the confi ...@@ -10,9 +10,9 @@ The **shortcutInfo** module defines shortcut information configured in the confi
> This API is deprecated since API version 9. You are advised to use [bundleManager-ShortcutWant](js-apis-bundleManager-shortcutInfo.md) instead. > This API is deprecated since API version 9. You are advised to use [bundleManager-ShortcutWant](js-apis-bundleManager-shortcutInfo.md) instead.
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ------------------------- | ------ | ---- | ---- | -------------------- | | ------------------------- | ------ | ---- | ---- | -------------------- |
...@@ -23,13 +23,12 @@ The **shortcutInfo** module defines shortcut information configured in the confi ...@@ -23,13 +23,12 @@ The **shortcutInfo** module defines shortcut information configured in the confi
> This API is deprecated since API version 9. You are advised to use [bundleManager-ShortcutInfo](js-apis-bundleManager-shortcutInfo.md) instead. > This API is deprecated since API version 9. You are advised to use [bundleManager-ShortcutInfo](js-apis-bundleManager-shortcutInfo.md) instead.
**System capability**: SystemCapability.BundleManager.BundleFramework
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ----------------------- | ------------------------------------------ | ---- | ---- | ---------------------------- | | ----------------------- | ------------------------------------------ | ---- | ---- | ---------------------------- |
| id | string | Yes | No | ID of the application to which the shortcut belongs. | | id | string | Yes | No | ID of the application to which the shortcut belongs. |
| bundleName | string | Yes | No | Name of the bundle that contains the shortcut. | | bundleName | string | Yes | No | Name of the bundle that contains the shortcut.|
| hostAbility | string | Yes | No | Local ability information of the shortcut. | | hostAbility | string | Yes | No | Local ability information of the shortcut. |
| icon | string | Yes | No | Icon of the shortcut. | | icon | string | Yes | No | Icon of the shortcut. |
| iconId<sup>8+</sup> | number | Yes | No | Icon ID of the shortcut. | | iconId<sup>8+</sup> | number | Yes | No | Icon ID of the shortcut. |
...@@ -40,5 +39,3 @@ The **shortcutInfo** module defines shortcut information configured in the confi ...@@ -40,5 +39,3 @@ The **shortcutInfo** module defines shortcut information configured in the confi
| isStatic | boolean | Yes | No | Whether the shortcut is static. | | isStatic | boolean | Yes | No | Whether the shortcut is static. |
| isHomeShortcut | boolean | Yes | No | Whether the shortcut is a home shortcut.| | isHomeShortcut | boolean | Yes | No | Whether the shortcut is a home shortcut.|
| isEnabled | boolean | Yes | No | Whether the shortcut is enabled. | | isEnabled | boolean | Yes | No | Whether the shortcut is enabled. |
<!--no_check-->
\ No newline at end of file
...@@ -19,3 +19,4 @@ The **RemoteAbilityInfo** module provides information about a remote ability. ...@@ -19,3 +19,4 @@ The **RemoteAbilityInfo** module provides information about a remote ability.
| elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | No | Element name information of the ability. | | elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | No | Element name information of the ability. |
| label | string | Yes | No | Ability name. | | label | string | Yes | No | Ability name. |
| icon | string | Yes | No | Icon of the ability.| | icon | string | Yes | No | Icon of the ability.|
# AbilityInfo # AbilityInfo
The **AbilityInfo** module provides information about an ability. Unless otherwise specified, the information is obtained through [GET_ABILITY_INFO_DEFAULT](js-apis-bundleManager.md). The **AbilityInfo** module defines the ability information. A system application can obtain the ability information through [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo). The input parameter [abilityFlags](js-apis-bundleManager.md#abilityflag) specifies the information to be contained in the returned [AbilityInfo](js-apis-bundleManager-abilityInfo.md) object.
> **NOTE** > **NOTE**
> >
...@@ -8,31 +8,31 @@ The **AbilityInfo** module provides information about an ability. Unless otherwi ...@@ -8,31 +8,31 @@ The **AbilityInfo** module provides information about an ability. Unless otherwi
## AbilityInfo ## AbilityInfo
**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------------------- | -------------------------------------------------------- | ---- | ---- | ----------------------------------------- | | --------------------- | -------------------------------------------------------- | ---- | ---- | ------------------------------------------ |
| bundleName | string | Yes | No | Bundle name. | | bundleName | string | Yes | No | Bundle name. |
| moduleName | string | Yes | No | Name of the HAP file to which the ability belongs. | | moduleName | string | Yes | No | Name of the HAP file to which the ability belongs. |
| name | string | Yes | No | Ability name. | | name | string | Yes | No | Ability name. |
| label | string | Yes | No | Ability name visible to users. | | label | string | Yes | No | Ability name visible to users. |
| labelId | number | Yes | No | ID of the ability label. | | labelId | number | Yes | No | ID of the ability label. |
| description | string | Yes | No | Ability description. | | description | string | Yes | No | Ability description. |
| descriptionId | number | Yes | No | ID of the ability description. | | descriptionId | number | Yes | No | ID of the ability description. |
| icon | string | Yes | No | Index of the ability icon resource file. | | icon | string | Yes | No | Index of the ability icon resource file. |
| iconId | number | Yes | No | ID of the ability icon. | | iconId | number | Yes | No | ID of the ability icon. |
| process | string | Yes | No | Process in which the ability runs. If this parameter is not set, the bundle name is used.| | process | string | Yes | No | Process in which the ability runs. If this parameter is not set, the bundle name is used.|
| isVisible | boolean | Yes | No | Whether the ability can be called by other bundles. | | isVisible | boolean | Yes | No | Whether the ability can be called by other bundles. |
| type | [AbilityType](js-apis-bundleManager.md#abilitytype) | Yes | No | Ability type.<br>This attribute can be used only in the FA model. | | type | [AbilityType](js-apis-bundleManager.md#abilitytype) | Yes | No | Ability type.<br>This attribute can be used only in the FA model.|
| orientation | [DisplayOrientation](js-apis-bundleManager.md#displayorientation) | Yes | No | Ability display orientation. | | orientation | [DisplayOrientation](js-apis-bundleManager.md#displayorientation) | Yes | No | Ability display orientation. |
| launchType | [LaunchType](js-apis-bundleManager.md#launchtype) | Yes | No | Ability launch mode. | | launchType | [LaunchType](js-apis-bundleManager.md#launchtype) | Yes | No | Ability launch mode. |
| permissions | Array\<string> | Yes | No | Permissions required for other bundles to call the ability. The information is obtained by using **GET_ABILITY_INFO_WITH_PERMISSION**.| | permissions | Array\<string> | Yes | No | Permissions required for other applications to call the ability. The permissions can be obtained by passing in **GET_ABILITY_INFO_WITH_PERMISSION** to the **abilityFlags** parameter of [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo).|
| readPermission | string | Yes | No | Permission required for reading the ability data.<br>This attribute can be used only in the FA model.| | readPermission | string | Yes | No | Permission required for reading the ability data.<br>This attribute can be used only in the FA model.|
| writePermission | string | Yes | No | Permission required for writing data to the ability.<br>This attribute can be used only in the FA model.| | writePermission | string | Yes | No | Permission required for writing data to the ability.<br>This attribute can be used only in the FA model.|
| uri | string | Yes | No | URI of the ability.<br>This attribute can be used only in the FA model.| | uri | string | Yes | No | URI of the ability.<br>This attribute can be used only in the FA model.|
| deviceTypes | Array\<string> | Yes | No | Device types supported by the ability. | | deviceTypes | Array\<string> | Yes | No | Device types supported by the ability. |
| applicationInfo | [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | Yes | No | Application information. The information is obtained by using **GET_ABILITY_INFO_WITH_APPLICATION**.| | applicationInfo | [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | Yes | No | Application information. The information can be obtained by passing in **GET_ABILITY_INFO_WITH_APPLICATION** to the **abilityFlags** parameter of [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo).|
| metadata | Array\<[Metadata](js-apis-bundleManager-metadata.md)> | Yes | No | Metadata of the ability. The information is obtained by using **GET_ABILITY_INFO_WITH_METADATA**.| | metadata | Array\<[Metadata](js-apis-bundleManager-metadata.md)> | Yes | No | Metadata of the ability. The information can be obtained by passing in **GET_ABILITY_INFO_WITH_METADATA** to the **abilityFlags** parameter of [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo).|
| enabled | boolean | Yes | No | Whether the ability is enabled. | | enabled | boolean | Yes | No | Whether the ability is enabled. |
| supportWindowModes | Array\<[SupportWindowMode](js-apis-bundleManager.md#supportwindowmode)> | Yes | No | Window modes supported by the ability. | | supportWindowModes | Array\<[SupportWindowMode](js-apis-bundleManager.md#supportwindowmode)> | Yes | No | Window modes supported by the ability. |
| windowSize|[WindowSize](#windowsize) | Yes | No | Window size.| | windowSize|[WindowSize](#windowsize) | Yes | No | Window size.|
...@@ -41,7 +41,7 @@ The **AbilityInfo** module provides information about an ability. Unless otherwi ...@@ -41,7 +41,7 @@ The **AbilityInfo** module provides information about an ability. Unless otherwi
Describes the window size. Describes the window size.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| -------------------| ------- | ---- | ---- | ---------------------------------- | | -------------------| ------- | ---- | ---- | ---------------------------------- |
...@@ -50,4 +50,4 @@ Describes the window size. ...@@ -50,4 +50,4 @@ Describes the window size.
| maxWindowWidth | number | Yes | No | Maximum width of the window in free window mode. The unit is vp.| | maxWindowWidth | number | Yes | No | Maximum width of the window in free window mode. The unit is vp.|
| minWindowWidth | number | Yes | No | Minimum width of the window in free window mode. The unit is vp.| | minWindowWidth | number | Yes | No | Minimum width of the window in free window mode. The unit is vp.|
| maxWindowHeight | number | Yes | No | Maximum height of the window in free window mode. The unit is vp.| | maxWindowHeight | number | Yes | No | Maximum height of the window in free window mode. The unit is vp.|
| minWindowHeight | number | Yes | No | Maximum height of the window in free window mode. The unit is vp.| | minWindowHeight | number | Yes | No | Minimum height of the window in free window mode. The unit is vp.|
# ApplicationInfo # ApplicationInfo
The **ApplicationInfo** module provides information about an application. Unless otherwise specified, the information is obtained through [GET_APPLICATION_INFO_DEFAULT](js-apis-bundleManager.md). The **ApplicationInfo** module defines the application information. A system application can obtain its own or others' application information through [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo). The input parameter [appFlags](js-apis-bundleManager.md#applicationflag) specifies the information to be contained in the returned [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) object.
> **NOTE** > **NOTE**
> >
...@@ -9,21 +9,21 @@ The **ApplicationInfo** module provides information about an application. Unless ...@@ -9,21 +9,21 @@ The **ApplicationInfo** module provides information about an application. Unless
## ApplicationInfo ## ApplicationInfo
**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| -------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ | | -------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ |
| name | string | Yes | No | Application name. | | name | string | Yes | No | Application name. |
| description | string | Yes | No | Application description. | | description | string | Yes | No | Application description. |
| descriptionId | number | Yes | No | ID of the application description. | | descriptionId | number | Yes | No | ID of the application description. |
| enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. | | enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. |
| label | string | Yes | No | Application label. | | label | string | Yes | No | Application label. |
| labelId | number | Yes | No | ID of the application label. | | labelId | number | Yes | No | ID of the application label. |
| icon | string | Yes | No | Application icon. | | icon | string | Yes | No | Application icon. |
| iconId | number | Yes | No | ID of the application icon. | | iconId | number | Yes | No | ID of the application icon. |
| process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used. | | process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used. |
| permissions | Array\<string> | Yes | No | Permissions required for accessing the application. The information is obtained by using **GET_APPLICATION_INFO_WITH_PERMISSION**.| | permissions | Array\<string> | Yes | No | Permissions required for accessing the application. The permissions can be obtained by passing in **GET_APPLICATION_INFO_WITH_PERMISSION** to the **appFlags** parameter of [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo).|
| entryDir | string | Yes | No | Path for storing application files. |
| codePath | string | Yes | No | Installation directory of the application. | | codePath | string | Yes | No | Installation directory of the application. |
| metadata | Map\<string, Array\<[Metadata](js-apis-bundleManager-metadata.md)>> | Yes | No | Metadata of the application. The information is obtained by using **GET_APPLICATION_INFO_WITH_METADATA**.| | metadata | Map\<string, Array\<[Metadata](js-apis-bundleManager-metadata.md)>> | Yes | No | Metadata of the application. The information can be obtained by passing in **GET_APPLICATION_INFO_WITH_METADATA** to the **appFlags** parameter of [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo).|
| removable | boolean | Yes | No | Whether the application is removable. | | removable | boolean | Yes | No | Whether the application is removable. |
| accessTokenId | number | Yes | No | Access token ID of the application. | | accessTokenId | number | Yes | No | Access token ID of the application. |
| uid | number | Yes | No | UID of the application. | | uid | number | Yes | No | UID of the application. |
...@@ -32,3 +32,4 @@ The **ApplicationInfo** module provides information about an application. Unless ...@@ -32,3 +32,4 @@ The **ApplicationInfo** module provides information about an application. Unless
| descriptionResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Description resource of the application. | | descriptionResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Description resource of the application. |
| appDistributionType | string | Yes | No | Distribution type of the application signing certificate. The options are **app_gallery**, **enterprise**, **os_integration**, and **crowdtesting**. | | appDistributionType | string | Yes | No | Distribution type of the application signing certificate. The options are **app_gallery**, **enterprise**, **os_integration**, and **crowdtesting**. |
| appProvisionType | string | Yes | No | Type of the application signing certificate file. The options are **debug** and **release**. | | appProvisionType | string | Yes | No | Type of the application signing certificate file. The options are **debug** and **release**. |
| systemApp | boolean | Yes | No | Whether the application is a system application. |
# BundleInfo # BundleInfo
The **BundleInfo** module provides information about a bundle. Unless otherwise specified, the information is obtained through [GET_BUNDLE_INFO_DEFAULT](js-apis-bundle-bundleManager). The **BundleInfo** module defines the bundle information. A system application can obtain its own or others' bundle information through [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo). A third-party application can obtain its own bundle information through [getBundleInfoForSelf](js-apis-bundleManager.md#bundlemanagergetbundleinfoforself). The input parameter [bundleFlags](js-apis-bundleManager.md#bundleflag) specifies the information to be contained in the returned [BundleInfo](js-apis-bundleManager-bundleInfo.md) object.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## BundleInfo ## BundleInfo
**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ | | --------------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ |
| name | string | Yes | No | Bundle name. | | name | string | Yes | No | Bundle name. |
| vendor | string | Yes | No | Vendor of the bundle. | | vendor | string | Yes | No | Vendor of the bundle. |
| versionCode | number | Yes | No | Version number of the bundle. | | versionCode | number | Yes | No | Version number of the bundle. |
| versionName | string | Yes | No | Version description of the bundle. | | versionName | string | Yes | No | Version description of the bundle. |
| minCompatibleVersionCode | number | Yes | No | Earliest version compatible with the bundle in the distributed scenario. | | minCompatibleVersionCode | number | Yes | No | Earliest version compatible with the bundle in the distributed scenario. |
| targetVersion | number | Yes | No | Target API version required for running the bundle. | | targetVersion | number | Yes | No | Target API version required for running the bundle. |
| appInfo | [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | Yes | No | Application information. The information is obtained by using **GET_BUNDLE_INFO_WITH_APPLICATION**. | | appInfo | [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | Yes | No | Application information. The information can be obtained by passing in **GET_BUNDLE_INFO_WITH_APPLICATION** to the **bundleFlags** parameter of [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo). |
| hapModulesInfo | Array\<[HapModuleInfo](js-apis-bundleManager-hapModuleInfo.md)> | Yes | No | Module configuration information. The information is obtained by using **GET_BUNDLE_INFO_WITH_HAP_MODULE**. | | hapModulesInfo | Array\<[HapModuleInfo](js-apis-bundleManager-hapModuleInfo.md)> | Yes | No | Module configuration information. The information can be obtained by passing in **GET_BUNDLE_INFO_WITH_HAP_MODULE** to the **bundleFlags** parameter of [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo). |
| reqPermissionDetails | Array\<[ReqPermissionDetail](#reqpermissiondetail)> | Yes | No | Detailed information of the permissions to request from the system. The information is obtained by using **GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION**.| | reqPermissionDetails | Array\<[ReqPermissionDetail](#reqpermissiondetail)> | Yes | No | Detailed information of the permissions to request from the system. The information can be obtained by passing in **GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION** to the **bundleFlags** parameter of [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo).|
| permissionGrantStates | Array\<[PermissionGrantState](js-apis-bundleManager.md#permissiongrantstate)> | Yes | No | Permission grant state. The information is obtained by using **GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION**. | | permissionGrantStates | Array\<[PermissionGrantState](js-apis-bundleManager.md#permissiongrantstate)> | Yes | No | Permission grant state. The information can be obtained by passing in **GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION** to the **bundleFlags** parameter of [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo). |
| signatureInfo | [SignatureInfo](#signatureinfo) | Yes | No | Signature information of the bundle. The information is obtained by using **GET_BUNDLE_INFO_WITH_SIGNATURE_INFO**. | | signatureInfo | [SignatureInfo](#signatureinfo) | Yes | No | Signature information of the bundle. The information can be obtained by passing in **GET_BUNDLE_INFO_WITH_SIGNATURE_INFO** to the **bundleFlags** parameter of [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo). |
| installTime | number | Yes | No | Time when the bundle was installed. | | installTime | number | Yes | No | Time when the bundle was installed. |
| updateTime | number | Yes | No | Time when the bundle was updated. | | updateTime | number | Yes | No | Time when the bundle was updated. |
...@@ -31,12 +33,12 @@ The **BundleInfo** module provides information about a bundle. Unless otherwise ...@@ -31,12 +33,12 @@ The **BundleInfo** module provides information about a bundle. Unless otherwise
Provides the detailed information of the permissions to request from the system. Provides the detailed information of the permissions to request from the system.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------------------- | ----------------------- | ---- | ---- | ---------------------| | --------------------- | ----------------------- | ---- | ---- | ---------------------|
| name | string | Yes | Yes | Name of the permission to request. | | name | string | Yes | Yes | Name of the permission to request. |
| reason | string | Yes | Yes | Reason for requesting the permission. | | reason | string | Yes | Yes | Reason for requesting the permission. |
| reasonId | number | Yes | Yes | ID of the reason for requesting the permission.| | reasonId | number | Yes | Yes | ID of the reason for requesting the permission.|
| usedScene | [UsedScene](#usedscene) | Yes | Yes | Application scenario and timing for using the permission.| | usedScene | [UsedScene](#usedscene) | Yes | Yes | Application scenario and timing for using the permission.|
...@@ -46,7 +48,7 @@ Provides the detailed information of the permissions to request from the system. ...@@ -46,7 +48,7 @@ Provides the detailed information of the permissions to request from the system.
Describes the application scenario and timing for using the permission. Describes the application scenario and timing for using the permission.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------- | -------------- | ---- | ---- | --------------------------- | | --------- | -------------- | ---- | ---- | --------------------------- |
...@@ -57,7 +59,7 @@ Describes the application scenario and timing for using the permission. ...@@ -57,7 +59,7 @@ Describes the application scenario and timing for using the permission.
Describes the signature information of the bundle. Describes the signature information of the bundle.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------- | -------------- | ---- | ---- | --------------------------- | | --------- | -------------- | ---- | ---- | --------------------------- |
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
The **ElementName** module provides element name information, which can be obtained through [Context.getElementName](js-apis-inner-app-context.md). The **ElementName** module provides element name information, which can be obtained through [Context.getElementName](js-apis-inner-app-context.md).
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -14,7 +13,7 @@ The **ElementName** module provides element name information, which can be obtai ...@@ -14,7 +13,7 @@ The **ElementName** module provides element name information, which can be obtai
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ----------------------- | ---------| ---- | ---- | ------------------------- | | ----------------------- | ---------| ---- | ---- | ------------------------- |
| deviceId | string | Yes | Yes | Device ID. | | deviceId | string | Yes | Yes | Device ID. |
| bundleName | string | Yes | Yes | Bundle name of the application. | | bundleName | string | Yes | Yes | Bundle name. |
| abilityName | string | Yes | Yes | Name of the ability. | | abilityName | string | Yes | Yes | Name of the ability. |
| uri | string | Yes | Yes | Resource ID. | | uri | string | Yes | Yes | Resource ID. |
| shortName | string | Yes | Yes | Short name of the ability. | | shortName | string | Yes | Yes | Short name of the ability. |
......
# ExtensionAbilityInfo # ExtensionAbilityInfo
The **ExtensionAbilityInfo** module provides information about an Extension ability. Unless otherwise specified, all attributes are obtained through [getBundleInfo](js-apis-bundleManager.md), and flags are obtained through [GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY](js-apis-bundleManager.md#bundleflag). The **ExtensionAbilityInfo** module defines the ExtensionAbility information. A system application can obtain its own or others' ExtensionAbility information through [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo). A third-party application can obtain its own ExtensionAbility information through [getBundleInfoForSelf](js-apis-bundleManager.md#bundlemanagergetbundleinfoforself). **GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY** must be passed in to the input parameter [bundleFlags](js-apis-bundleManager.md#bundleflag) to obtain the information.
> **NOTE** > **NOTE**
> >
...@@ -10,19 +10,19 @@ The **ExtensionAbilityInfo** module provides information about an Extension abil ...@@ -10,19 +10,19 @@ The **ExtensionAbilityInfo** module provides information about an Extension abil
**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| -------------------- | ----------------------------------------------------------- | ---- | ---- | -------------------------------------------------- | | -------------------- | ------------------------------------------------------------ | ---- | ---- | ---------------------------------------------------- |
| bundleName | string | Yes | No | Bundle name. | | bundleName | string | Yes | No | Bundle name. |
| moduleName | string | Yes | No | Name of the HAP file to which the Extension ability belongs. | | moduleName | string | Yes | No | Name of the HAP file to which the ExtensionAbility belongs. |
| name | string | Yes | No | Name of the Extension ability. | | name | string | Yes | No | Name of the ExtensionAbility. |
| labelId | number | Yes | No | Label ID of the Extension ability. | | labelId | number | Yes | No | ID of the ExtensionAbility label. |
| descriptionId | number | Yes | No | Description ID of the Extension ability. | | descriptionId | number | Yes | No | ID of the ExtensionAbility description. |
| iconId | number | Yes | No | Icon ID of the Extension ability. | | iconId | number | Yes | No | ID of the ExtensionAbility icon. |
| isVisible | boolean | Yes | No | Whether the Extension ability can be called by other bundles. | | isVisible | boolean | Yes | No | Whether the ExtensionAbility can be called by other bundles. |
| extensionAbilityType | [ExtensionAbilityType](js-apis-bundleManager.md#extensionabilitytype) | Yes | No | Type of the Extension ability. | | extensionAbilityType | [ExtensionAbilityType](js-apis-bundleManager.md#extensionabilitytype) | Yes | No | Type of the ExtensionAbility. |
| permissions | Array\<string> | Yes | No | Permissions required for other bundles to call the Extension ability.| | permissions | Array\<string> | Yes | No | Permissions required for other bundles to call the ExtensionAbility.|
| applicationInfo | [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | Yes | No | Application information of the Extension ability. | | applicationInfo | [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | Yes | No | Application information. |
| metadata | Array\<[Metadata](js-apis-bundleManager-metadata.md)> | Yes | No | Metadata of the Extension ability. | | metadata | Array\<[Metadata](js-apis-bundleManager-metadata.md)> | Yes | No | Metadata of the ExtensionAbility. |
| enabled | boolean | Yes | No | Whether the Extension ability is enabled. | | enabled | boolean | Yes | No | Whether the ExtensionAbility is enabled. |
| readPermission | string | Yes | No | Permission required for reading data from the Extension ability. | | readPermission | string | Yes | No | Permission required for reading data from the ExtensionAbility. |
| writePermission | string | Yes | No | Permission required for writing data to the Extension ability. | | writePermission | string | Yes | No | Permission required for writing data to the ExtensionAbility. |
# HapModuleInfo # HapModuleInfo
The **HapModuleInfo** module defines the HAP module information. A system application can obtain its own or others' HAP module information through [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo). A third-party application can obtain its own HAP module information through [getBundleInfoForSelf](js-apis-bundleManager.md#bundlemanagergetbundleinfoforself). **GET_BUNDLE_INFO_WITH_HAP_MODULE** must be passed in to the input parameter [bundleFlags](js-apis-bundleManager.md#bundleflag) to obtain the information.
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -16,12 +18,11 @@ ...@@ -16,12 +18,11 @@
| label | string | Yes | No | Module label. | | label | string | Yes | No | Module label. |
| labelId | number | Yes | No | ID of the module label. | | labelId | number | Yes | No | ID of the module label. |
| description | string | Yes | No | Module description. | | description | string | Yes | No | Module description. |
| descriptionId | number | Yes | No | ID of the module mescription. | | descriptionId | number | Yes | No | ID of the module description. |
| mainElementName | string | Yes | No | Name of the main ability. | | mainElementName | string | Yes | No | Name of the main ability. |
| abilitiesInfo | Array\<[AbilityInfo](js-apis-bundleManager-abilityInfo.md)> | Yes | No | Ability information. | | abilitiesInfo | Array\<[AbilityInfo](js-apis-bundleManager-abilityInfo.md)> | Yes | No | Ability information. |
| extensionAbilitiesInfo | Array\<[ExtensionAbilityInfo](js-apis-bundleManager-extensionAbilityInfo.md)> | Yes | No | Information about the Extension ability.| | extensionAbilitiesInfo | Array\<[ExtensionAbilityInfo](js-apis-bundleManager-extensionAbilityInfo.md)> | Yes | No | ExtensionAbility information.|
| metadata | Array\<[Metadata](js-apis-bundleManager-metadata.md)> | Yes | No | Metadata of the ability. | | metadata | Array\<[Metadata](js-apis-bundleManager-metadata.md)> | Yes | No | Metadata of the ability. |
| deviceTypes | Array\<string> | Yes | No | Device types supported by the module. | | deviceTypes | Array\<string> | Yes | No | Types of devices where the module can run. |
| installationFree | boolean | Yes | No | Whether installation-free is supported. | | installationFree | boolean | Yes | No | Whether installation-free is supported. |
| hashValue | string | Yes | No | Hash value of the module. | | hashValue | string | Yes | No | Hash value of the module. |
| moduleSourceDir | string | Yes | No | Module path.|
# LauncherAbilityInfo # LauncherAbilityInfo
The **LauncherAbilityInfo** module defines the ability information of the home screen application. The information can be obtained through [bundleManager.getLauncherAbilityInfo](js-apis-launcherBundleManager.md#launcherbundlemanagergetlauncherabilityinfo9).
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## LauncherAbilityInfo ## LauncherAbilityInfo
**System capability**: SystemCapability.BundleManager.BundleFramework.Launcher **System capability**: SystemCapability.BundleManager.BundleFramework.Launcher
...@@ -12,7 +16,7 @@ ...@@ -12,7 +16,7 @@
| --------------- | ----------------------------------------------------------- | ---- | ---- | ------------------------------------ | | --------------- | ----------------------------------------------------------- | ---- | ---- | ------------------------------------ |
| applicationInfo | [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | Yes | No | Application information of the launcher ability.| | applicationInfo | [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | Yes | No | Application information of the launcher ability.|
| elementName | [ElementName](js-apis-bundleManager-elementName.md) | Yes | No | Element name of the launcher ability. | | elementName | [ElementName](js-apis-bundleManager-elementName.md) | Yes | No | Element name of the launcher ability. |
| labelId | number | Yes | No | Label ID of the launcher ability. | | labelId | number | Yes | No | ID of the launcher ability label. |
| iconId | number | Yes | No | Icon ID of the launcher ability. | | iconId | number | Yes | No | ID of the launcher ability icon. |
| userId | number | Yes | No | User ID of the launcher ability. | | userId | number | Yes | No | ID of the launcher ability user. |
| installTime | number | Yes | No | Time when the launcher ability was installed. | | installTime | number | Yes | No | Time when the launcher ability was installed. |
# Metadata # Metadata
The **metadata** module provides the configuration about the module, ability, and Extension ability. The value is of the array type. The configuration is valid only for the current module, ability, or Extension ability. The **Metadata** module provides a metadata object, which can be obtained through [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo). This object is contained in [ApplicationInfo](js-apis-bundleManager-applicationInfo.md), [HapModuleInfo](js-apis-bundleManager-hapModuleInfo.md), [AbilityInfo](js-apis-bundleManager-abilityInfo.md), and [ExtensionAbilityInfo](js-apis-bundleManager-extensionAbilityInfo.md).
> **NOTE** > **NOTE**
> >
The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The **Metadata** module provides the configuration about the module, UIAbility, and ExtensionAbility. The value is of the array type. The configuration is valid only for the current module, UIAbility, or ExtensionAbility.
## Metadata ## Metadata
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| -------- | ------ | ---- | ---- | ---------- | | -------- | ------ | ---- | ---- | ---------- |
| name | string | Yes | Yes | Metadata name.| | name | string | Yes | Yes | Metadata name.|
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
The **PackInfo** module provides information in the **pack.info** file. The information can be obtained using [freeInstall.getBundlePackInfo](js-apis-freeInstall.md). The **PackInfo** module provides information in the **pack.info** file. The information can be obtained using [freeInstall.getBundlePackInfo](js-apis-freeInstall.md).
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -49,10 +48,10 @@ The **PackInfo** module provides information in the **pack.info** file. The info ...@@ -49,10 +48,10 @@ The **PackInfo** module provides information in the **pack.info** file. The info
**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall **System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ---------- | ------------------- | ---- | ---- | ---------------------------------- | | ---------- | ------------------- | ---- | ---- | -------------------------------------- |
| bundleName | string | Yes | No | Bundle name. It uniquely identifies the application.| | bundleName | string | Yes | No | Bundle name. It uniquely identifies an application.|
| version | [Version](#version) | Yes | No | Bundle version. | | version | [Version](#version) | Yes | No | Bundle version. |
## ModuleConfigInfo ## ModuleConfigInfo
...@@ -67,7 +66,7 @@ The **PackInfo** module provides information in the **pack.info** file. The info ...@@ -67,7 +66,7 @@ The **PackInfo** module provides information in the **pack.info** file. The info
| deviceType | Array\<string> | Yes | No | Device types supported by the module. | | deviceType | Array\<string> | Yes | No | Device types supported by the module. |
| distro | [ModuleDistroInfo](#moduledistroinfo) | Yes | No | Distribution information of the module. | | distro | [ModuleDistroInfo](#moduledistroinfo) | Yes | No | Distribution information of the module. |
| abilities | Array\<[ModuleAbilityInfo](#moduleabilityinfo)> | Yes | No | Ability information of the module. | | abilities | Array\<[ModuleAbilityInfo](#moduleabilityinfo)> | Yes | No | Ability information of the module. |
| extensionAbilities | Array\<[ExtensionAbilities](#extensionability)> | Yes | No | Extension ability information of the module.| | extensionAbilities | Array\<[ExtensionAbilities](#extensionability)> | Yes | No | ExtensionAbility information of the module.|
## ModuleDistroInfo ## ModuleDistroInfo
...@@ -103,7 +102,7 @@ The **PackInfo** module provides information in the **pack.info** file. The info ...@@ -103,7 +102,7 @@ The **PackInfo** module provides information in the **pack.info** file. The info
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ----- | ------------------------------------------- | ---- | ---- | ------------------------------------------------------------ | | ----- | ------------------------------------------- | ---- | ---- | ------------------------------------------------------------ |
| name | string | Yes| No| Name of the Extension ability.| | name | string | Yes| No| Name of the ExtensionAbility.|
| forms | Array\<[AbilityFormInfo](#abilityforminfo)> | Yes | No | Widget information.| | forms | Array\<[AbilityFormInfo](#abilityforminfo)> | Yes | No | Widget information.|
## AbilityFormInfo ## AbilityFormInfo
...@@ -132,7 +131,7 @@ The **PackInfo** module provides information in the **pack.info** file. The info ...@@ -132,7 +131,7 @@ The **PackInfo** module provides information in the **pack.info** file. The info
| ----------- | ------ | ---- | ---- | -------------------- | | ----------- | ------ | ---- | ---- | -------------------- |
| releaseType | string | Yes | No | Name of the API version. | | releaseType | string | Yes | No | Name of the API version. |
| compatible | number | Yes | No | Minimum API version.| | compatible | number | Yes | No | Minimum API version.|
| target | number | Yes | No | Target API version. | | target | number | Yes | No | Target API version. |
## Version ## Version
......
# PermissionDef # PermissionDef
The **PermissionDef** module provides permission details defined in the configuration file. The information can be obtained using [bundleManager.getPermissionDef](js-apis-bundleManager.md). The **PermissionDef** module provides permission details defined in the configuration file. The information can be obtained using [bundleManager.getPermissionDef](js-apis-bundleManager.md).
> **NOTE** > **NOTE**
> >
...@@ -16,5 +16,5 @@ The **PermissionDef** module provides permission details defined in the configur ...@@ -16,5 +16,5 @@ The **PermissionDef** module provides permission details defined in the configur
| -------------- | ------ | ---- | ---- | -------------- | | -------------- | ------ | ---- | ---- | -------------- |
| permissionName | string | Yes | No | Name of the permission. | | permissionName | string | Yes | No | Name of the permission. |
| grantMode | number | Yes | No | Grant mode of the permission.| | grantMode | number | Yes | No | Grant mode of the permission.|
| labelId | number | Yes | No | Label ID of the permission. | | labelId | number | Yes | No | ID of the permission label. |
| descriptionId | number | Yes | No | Description ID of the permission. | | descriptionId | number | Yes | No | ID of the permission description. |
...@@ -17,7 +17,7 @@ The **ShortcutInfo** module defines shortcut information configured in the confi ...@@ -17,7 +17,7 @@ The **ShortcutInfo** module defines shortcut information configured in the confi
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ------------------------- | ------ | ---- | ---- | -------------------- | | ------------------------- | ------ | ---- | ---- | -------------------- |
| targetBundle | string | Yes | No | Target bundle name of the shortcut.| | targetBundle | string | Yes | No | Target bundle name of the shortcut.|
| targetModule | string | Yes | No | Target module name of the shortcut. | | targetModule | string | Yes | No | Target module name of the shortcut. |
| targetAbility | string | Yes | No | Target ability name of the shortcut.| | targetAbility | string | Yes | No | Target ability name of the shortcut.|
## ShortcutInfo ## ShortcutInfo
...@@ -28,14 +28,14 @@ The **ShortcutInfo** module defines shortcut information configured in the confi ...@@ -28,14 +28,14 @@ The **ShortcutInfo** module defines shortcut information configured in the confi
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ----------------------- | ------------------------------------------ | ---- | ---- | ---------------------------- | | ----------------------- | ------------------------------------------ | ---- | ---- | ---------------------------- |
| id | string | Yes | No | ID of the application to which the shortcut belongs. | | id | string | Yes | No | ID of the application to which the shortcut belongs. |
| bundleName | string | Yes | No | Name of the bundle that contains the shortcut. | | bundleName | string | Yes | No | Name of the bundle that contains the shortcut.|
| moduleName | string | Yes | No | Module name of the shortcut. | | moduleName | string | Yes | No | Module name of the shortcut. |
| hostAbility | string | Yes | No | Local ability name of the shortcut. | | hostAbility | string | Yes | No | Local ability name of the shortcut. |
| icon | string | Yes | No | Icon of the shortcut. | | icon | string | Yes | No | Icon of the shortcut. |
| iconId | number | Yes | No | Icon ID of the shortcut. | | iconId | number | Yes | No | ID of the shortcut icon. |
| label | string | Yes | No | Label of the shortcut. | | label | string | Yes | No | Label of the shortcut. |
| labelId | number | Yes | No | Label ID of the shortcut. | | labelId | number | Yes | No | ID of the shortcut label. |
| wants | Array\<[ShortcutWant](#shortcutwant)> | Yes | No | Want information required for the shortcut. | | wants | Array\<[ShortcutWant](#shortcutwant)> | Yes | No | Want information required for the shortcut. |
<!--no_check-->
\ No newline at end of file
# @ohos.bundle.bundleManager # @ohos.bundle.bundleManager (bundleManager)
The **bundleManager** module provides APIs for querying information about bundles, applications, abilities, Extension abilities, and more. The **bundleManager** module provides APIs for querying information about bundles, applications, abilities, Extension abilities, and more.
......
# @ohos.bundle.bundleMonitor # @ohos.bundle.bundleMonitor (bundleMonitor)
The **Bundle.bundleMonitor** module provides APIs for listens for bundle installation, uninstall, and updates. The **Bundle.bundleMonitor** module provides APIs for listens for bundle installation, uninstall, and updates.
...@@ -33,7 +33,7 @@ For details, see [Permission Levels](../../security/accesstoken-overview.md). ...@@ -33,7 +33,7 @@ For details, see [Permission Levels](../../security/accesstoken-overview.md).
## bundleMonitor.on ## bundleMonitor.on
on(type: BundleChangedEvent, callback: Callback\<BundleChangedInfo>): void; on(type: BundleChangedEvent, callback: callback\<BundleChangedInfo>): void;
Subscribes to bundle installation, uninstall, and update events. Subscribes to bundle installation, uninstall, and update events.
...@@ -47,8 +47,8 @@ Subscribes to bundle installation, uninstall, and update events. ...@@ -47,8 +47,8 @@ Subscribes to bundle installation, uninstall, and update events.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------------------------- | -------- | ---- | ------------------ | | ---------------------------- | -------- | ---- | ------------------ |
| BundleChangedEvent | string | Yes | Type of the event to subscribe to.| | type| BundleChangedEvent| Yes | Type of the event to subscribe to.|
| Callback\<BundleChangedInfo> | callback | Yes | Callback used for the subscription.| | callback | callback\<BundleChangedInfo>| Yes | Callback used for the subscription.|
**Example** **Example**
...@@ -66,7 +66,7 @@ try { ...@@ -66,7 +66,7 @@ try {
## bundleMonitor.off ## bundleMonitor.off
off(type: BundleChangedEvent, callback?: Callback\<BundleChangedInfo>): void; off(type: BundleChangedEvent, callback?: callback\<BundleChangedInfo>): void;
Unsubscribes from bundle installation, uninstall, and update events. Unsubscribes from bundle installation, uninstall, and update events.
...@@ -80,8 +80,8 @@ Unsubscribes from bundle installation, uninstall, and update events. ...@@ -80,8 +80,8 @@ Unsubscribes from bundle installation, uninstall, and update events.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------------------------- | -------- | ---- | ---------------------------------------------------------- | | ---------------------------- | -------- | ---- | ---------------------------------------------------------- |
| BundleChangedEvent | string | Yes | Type of the event to unsubscribe from. | | type| BundleChangedEvent| Yes | Type of the event to unsubscribe from. |
| Callback\<BundleChangedInfo> | callback | Yes | Callback used for the unsubscription. If this parameter is left empty, all callbacks of the current event are unsubscribed from.| | callback | callback\<BundleChangedInfo>| No | Callback used for the unsubscription. If this parameter is left empty, all callbacks of the current event are unsubscribed from.|
**Example** **Example**
......
...@@ -48,7 +48,7 @@ on(type: 'locationChange', request: LocationRequest, callback: Callback&lt;Locat ...@@ -48,7 +48,7 @@ on(type: 'locationChange', request: LocationRequest, callback: Callback&lt;Locat
Registers a listener for location changes with a location request initiated. The location result is reported through [LocationRequest](#locationrequest). Registers a listener for location changes with a location request initiated. The location result is reported through [LocationRequest](#locationrequest).
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.on('locationChange')](js-apis-geoLocationManager.md#geolocationmanageronlocationchange). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.on('locationChange')](js-apis-geoLocationManager.md#geolocationmanageronlocationchange).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -64,7 +64,6 @@ Registers a listener for location changes with a location request initiated. The ...@@ -64,7 +64,6 @@ Registers a listener for location changes with a location request initiated. The
| callback | Callback&lt;[Location](#location)&gt; | Yes| Callback used to return the location change event.| | callback | Callback&lt;[Location](#location)&gt; | Yes| Callback used to return the location change event.|
**Example** **Example**
```ts ```ts
...@@ -83,7 +82,7 @@ off(type: 'locationChange', callback?: Callback&lt;Location&gt;): void ...@@ -83,7 +82,7 @@ off(type: 'locationChange', callback?: Callback&lt;Location&gt;): void
Unregisters the listener for location changes with the corresponding location request deleted. Unregisters the listener for location changes with the corresponding location request deleted.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.off('locationChange')](js-apis-geoLocationManager.md#geolocationmanagerofflocationchange). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.off('locationChange')](js-apis-geoLocationManager.md#geolocationmanagerofflocationchange).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -117,7 +116,7 @@ on(type: 'locationServiceState', callback: Callback&lt;boolean&gt;): void ...@@ -117,7 +116,7 @@ on(type: 'locationServiceState', callback: Callback&lt;boolean&gt;): void
Registers a listener for location service status change events. Registers a listener for location service status change events.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.on('locationEnabledChange')](js-apis-geoLocationManager.md#geolocationmanageronlocationenabledchange). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.on('locationEnabledChange')](js-apis-geoLocationManager.md#geolocationmanageronlocationenabledchange).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -149,7 +148,7 @@ off(type: 'locationServiceState', callback?: Callback&lt;boolean&gt;): void; ...@@ -149,7 +148,7 @@ off(type: 'locationServiceState', callback?: Callback&lt;boolean&gt;): void;
Unregisters the listener for location service status change events. Unregisters the listener for location service status change events.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.off('locationEnabledChange')](js-apis-geoLocationManager.md#geolocationmanagerofflocationenabledchange). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.off('locationEnabledChange')](js-apis-geoLocationManager.md#geolocationmanagerofflocationenabledchange).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -183,6 +182,7 @@ on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, ca ...@@ -183,6 +182,7 @@ on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, ca
Registers a listener for cached GNSS location reports. Registers a listener for cached GNSS location reports.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.on('cachedGnssLocationsChange')](js-apis-geoLocationManager.md#geolocationmanageroncachedgnsslocationschange). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.on('cachedGnssLocationsChange')](js-apis-geoLocationManager.md#geolocationmanageroncachedgnsslocationschange).
...@@ -218,6 +218,7 @@ off(type: 'cachedGnssLocationsReporting', callback?: Callback&lt;Array&lt;Locati ...@@ -218,6 +218,7 @@ off(type: 'cachedGnssLocationsReporting', callback?: Callback&lt;Array&lt;Locati
Unregisters the listener for cached GNSS location reports. Unregisters the listener for cached GNSS location reports.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.off('cachedGnssLocationsChange')](js-apis-geoLocationManager.md#geolocationmanageroffcachedgnsslocationschange). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.off('cachedGnssLocationsChange')](js-apis-geoLocationManager.md#geolocationmanageroffcachedgnsslocationschange).
...@@ -253,6 +254,7 @@ on(type: 'gnssStatusChange', callback: Callback&lt;SatelliteStatusInfo&gt;): voi ...@@ -253,6 +254,7 @@ on(type: 'gnssStatusChange', callback: Callback&lt;SatelliteStatusInfo&gt;): voi
Registers a listener for GNSS satellite status change events. Registers a listener for GNSS satellite status change events.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.on('satelliteStatusChange')](js-apis-geoLocationManager.md#geolocationmanageronsatellitestatuschange). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.on('satelliteStatusChange')](js-apis-geoLocationManager.md#geolocationmanageronsatellitestatuschange).
...@@ -286,6 +288,7 @@ off(type: 'gnssStatusChange', callback?: Callback&lt;SatelliteStatusInfo&gt;): v ...@@ -286,6 +288,7 @@ off(type: 'gnssStatusChange', callback?: Callback&lt;SatelliteStatusInfo&gt;): v
Unregisters the listener for GNSS satellite status change events. Unregisters the listener for GNSS satellite status change events.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.off('satelliteStatusChange')](js-apis-geoLocationManager.md#geolocationmanageroffsatellitestatuschange). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.off('satelliteStatusChange')](js-apis-geoLocationManager.md#geolocationmanageroffsatellitestatuschange).
...@@ -319,6 +322,7 @@ on(type: 'nmeaMessageChange', callback: Callback&lt;string&gt;): void; ...@@ -319,6 +322,7 @@ on(type: 'nmeaMessageChange', callback: Callback&lt;string&gt;): void;
Registers a listener for GNSS NMEA message change events. Registers a listener for GNSS NMEA message change events.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.on('nmeaMessage')](js-apis-geoLocationManager.md#geolocationmanageronnmeamessage). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.on('nmeaMessage')](js-apis-geoLocationManager.md#geolocationmanageronnmeamessage).
...@@ -352,6 +356,7 @@ off(type: 'nmeaMessageChange', callback?: Callback&lt;string&gt;): void; ...@@ -352,6 +356,7 @@ off(type: 'nmeaMessageChange', callback?: Callback&lt;string&gt;): void;
Unregisters the listener for GNSS NMEA message change events. Unregisters the listener for GNSS NMEA message change events.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.off('nmeaMessage')](js-apis-geoLocationManager.md#geolocationmanageroffnmeamessage). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.off('nmeaMessage')](js-apis-geoLocationManager.md#geolocationmanageroffnmeamessage).
...@@ -386,6 +391,7 @@ on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; ...@@ -386,6 +391,7 @@ on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void;
Registers a listener for status change events of the specified geofence. Registers a listener for status change events of the specified geofence.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.on('gnssFenceStatusChange')](js-apis-geoLocationManager.md#geolocationmanagerongnssfencestatuschange). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.on('gnssFenceStatusChange')](js-apis-geoLocationManager.md#geolocationmanagerongnssfencestatuschange).
...@@ -435,6 +441,7 @@ off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; ...@@ -435,6 +441,7 @@ off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void;
Unregisters the listener for status change events of the specified geofence. Unregisters the listener for status change events of the specified geofence.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.off('gnssFenceStatusChange')](js-apis-geoLocationManager.md#geolocationmanageroffgnssfencestatuschange). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.off('gnssFenceStatusChange')](js-apis-geoLocationManager.md#geolocationmanageroffgnssfencestatuschange).
...@@ -483,7 +490,7 @@ getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback&lt;L ...@@ -483,7 +490,7 @@ getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback&lt;L
Obtains the current location. This API uses an asynchronous callback to return the result. Obtains the current location. This API uses an asynchronous callback to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.getCurrentLocation](js-apis-geoLocationManager.md#geolocationmanagergetcurrentlocation). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.getCurrentLocation](js-apis-geoLocationManager.md#geolocationmanagergetcurrentlocation).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -521,7 +528,7 @@ getCurrentLocation(callback: AsyncCallback&lt;Location&gt;): void ...@@ -521,7 +528,7 @@ getCurrentLocation(callback: AsyncCallback&lt;Location&gt;): void
Obtains the current location. This API uses an asynchronous callback to return the result. Obtains the current location. This API uses an asynchronous callback to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.getCurrentLocation](js-apis-geoLocationManager.md#geolocationmanagergetcurrentlocation). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.getCurrentLocation](js-apis-geoLocationManager.md#geolocationmanagergetcurrentlocation).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -556,7 +563,7 @@ getCurrentLocation(request?: CurrentLocationRequest): Promise&lt;Location&gt; ...@@ -556,7 +563,7 @@ getCurrentLocation(request?: CurrentLocationRequest): Promise&lt;Location&gt;
Obtains the current location. This API uses a promise to return the result. Obtains the current location. This API uses a promise to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.getCurrentLocation](js-apis-geoLocationManager.md#geolocationmanagergetcurrentlocation-2). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.getCurrentLocation](js-apis-geoLocationManager.md#geolocationmanagergetcurrentlocation-2).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -593,7 +600,7 @@ getLastLocation(callback: AsyncCallback&lt;Location&gt;): void ...@@ -593,7 +600,7 @@ getLastLocation(callback: AsyncCallback&lt;Location&gt;): void
Obtains the previous location. This API uses an asynchronous callback to return the result. Obtains the previous location. This API uses an asynchronous callback to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.getLastLocation](js-apis-geoLocationManager.md#geolocationmanagergetlastlocation). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.getLastLocation](js-apis-geoLocationManager.md#geolocationmanagergetlastlocation).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -628,7 +635,7 @@ getLastLocation(): Promise&lt;Location&gt; ...@@ -628,7 +635,7 @@ getLastLocation(): Promise&lt;Location&gt;
Obtains the previous location. This API uses a promise to return the result. Obtains the previous location. This API uses a promise to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.getLastLocation](js-apis-geoLocationManager.md#geolocationmanagergetlastlocation). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.getLastLocation](js-apis-geoLocationManager.md#geolocationmanagergetlastlocation).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -658,7 +665,7 @@ isLocationEnabled(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -658,7 +665,7 @@ isLocationEnabled(callback: AsyncCallback&lt;boolean&gt;): void
Checks whether the location service is enabled. This API uses an asynchronous callback to return the result. Checks whether the location service is enabled. This API uses an asynchronous callback to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.isLocationEnabled](js-apis-geoLocationManager.md#geolocationmanagerislocationenabled). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.isLocationEnabled](js-apis-geoLocationManager.md#geolocationmanagerislocationenabled).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -692,7 +699,7 @@ isLocationEnabled(): Promise&lt;boolean&gt; ...@@ -692,7 +699,7 @@ isLocationEnabled(): Promise&lt;boolean&gt;
Checks whether the location service is enabled. This API uses a promise to return the result. Checks whether the location service is enabled. This API uses a promise to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.isLocationEnabled](js-apis-geoLocationManager.md#geolocationmanagerislocationenabled). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.isLocationEnabled](js-apis-geoLocationManager.md#geolocationmanagerislocationenabled).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -721,7 +728,7 @@ requestEnableLocation(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -721,7 +728,7 @@ requestEnableLocation(callback: AsyncCallback&lt;boolean&gt;): void
Requests to enable the location service. This API uses an asynchronous callback to return the result. Requests to enable the location service. This API uses an asynchronous callback to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.requestEnableLocation](js-apis-geoLocationManager.md#geolocationmanagerrequestenablelocation). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.requestEnableLocation](js-apis-geoLocationManager.md#geolocationmanagerrequestenablelocation).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -755,7 +762,7 @@ requestEnableLocation(): Promise&lt;boolean&gt; ...@@ -755,7 +762,7 @@ requestEnableLocation(): Promise&lt;boolean&gt;
Requests to enable the location service. This API uses a promise to return the result. Requests to enable the location service. This API uses a promise to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.requestEnableLocation](js-apis-geoLocationManager.md#geolocationmanagerrequestenablelocation-1). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.requestEnableLocation](js-apis-geoLocationManager.md#geolocationmanagerrequestenablelocation-1).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -784,7 +791,7 @@ isGeoServiceAvailable(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -784,7 +791,7 @@ isGeoServiceAvailable(callback: AsyncCallback&lt;boolean&gt;): void
Checks whether the (reverse) geocoding service is available. This API uses an asynchronous callback to return the result. Checks whether the (reverse) geocoding service is available. This API uses an asynchronous callback to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.isGeocoderAvailable](js-apis-geoLocationManager.md#geolocationmanagerisgeocoderavailable). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.isGeocoderAvailable](js-apis-geoLocationManager.md#geolocationmanagerisgeocoderavailable).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -818,7 +825,7 @@ isGeoServiceAvailable(): Promise&lt;boolean&gt; ...@@ -818,7 +825,7 @@ isGeoServiceAvailable(): Promise&lt;boolean&gt;
Checks whether the (reverse) geocoding service is available. This API uses a promise to return the result. Checks whether the (reverse) geocoding service is available. This API uses a promise to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.isGeocoderAvailable](js-apis-geoLocationManager.md#geolocationmanagerisgeocoderavailable). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.isGeocoderAvailable](js-apis-geoLocationManager.md#geolocationmanagerisgeocoderavailable).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -847,7 +854,7 @@ getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback ...@@ -847,7 +854,7 @@ getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback
Converts coordinates into geographic description through reverse geocoding. This API uses an asynchronous callback to return the result. Converts coordinates into geographic description through reverse geocoding. This API uses an asynchronous callback to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.getAddressesFromLocation](js-apis-geoLocationManager.md#geolocationmanagergetaddressesfromlocation). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.getAddressesFromLocation](js-apis-geoLocationManager.md#geolocationmanagergetaddressesfromlocation).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -883,7 +890,7 @@ getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise&lt;Array&lt;Ge ...@@ -883,7 +890,7 @@ getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise&lt;Array&lt;Ge
Converts coordinates into geographic description through reverse geocoding. This API uses a promise to return the result. Converts coordinates into geographic description through reverse geocoding. This API uses a promise to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.getAddressesFromLocation](js-apis-geoLocationManager.md#geolocationmanagergetaddressesfromlocation-1). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.getAddressesFromLocation](js-apis-geoLocationManager.md#geolocationmanagergetaddressesfromlocation-1).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -919,7 +926,7 @@ getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback&lt ...@@ -919,7 +926,7 @@ getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback&lt
Converts geographic description into coordinates through geocoding. This API uses an asynchronous callback to return the result. Converts geographic description into coordinates through geocoding. This API uses an asynchronous callback to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.getAddressesFromLocationName](js-apis-geoLocationManager.md#geolocationmanagergetaddressesfromlocationname). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.getAddressesFromLocationName](js-apis-geoLocationManager.md#geolocationmanagergetaddressesfromlocationname).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -955,7 +962,7 @@ getAddressesFromLocationName(request: GeoCodeRequest): Promise&lt;Array&lt;GeoAd ...@@ -955,7 +962,7 @@ getAddressesFromLocationName(request: GeoCodeRequest): Promise&lt;Array&lt;GeoAd
Converts geographic description into coordinates through geocoding. This API uses a promise to return the result. Converts geographic description into coordinates through geocoding. This API uses a promise to return the result.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.getAddressesFromLocationName](js-apis-geoLocationManager.md#geolocationmanagergetaddressesfromlocationname-1). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.getAddressesFromLocationName](js-apis-geoLocationManager.md#geolocationmanagergetaddressesfromlocationname-1).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -992,6 +999,7 @@ getCachedGnssLocationsSize(callback: AsyncCallback&lt;number&gt;): void; ...@@ -992,6 +999,7 @@ getCachedGnssLocationsSize(callback: AsyncCallback&lt;number&gt;): void;
Obtains the number of cached GNSS locations. Obtains the number of cached GNSS locations.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.getCachedGnssLocationsSize](js-apis-geoLocationManager.md#geolocationmanagergetcachedgnsslocationssize). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.getCachedGnssLocationsSize](js-apis-geoLocationManager.md#geolocationmanagergetcachedgnsslocationssize).
...@@ -1027,6 +1035,7 @@ getCachedGnssLocationsSize(): Promise&lt;number&gt;; ...@@ -1027,6 +1035,7 @@ getCachedGnssLocationsSize(): Promise&lt;number&gt;;
Obtains the number of cached GNSS locations. Obtains the number of cached GNSS locations.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.getCachedGnssLocationsSize](js-apis-geoLocationManager.md#geolocationmanagergetcachedgnsslocationssize-1). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.getCachedGnssLocationsSize](js-apis-geoLocationManager.md#geolocationmanagergetcachedgnsslocationssize-1).
...@@ -1057,6 +1066,7 @@ flushCachedGnssLocations(callback: AsyncCallback&lt;boolean&gt;): void; ...@@ -1057,6 +1066,7 @@ flushCachedGnssLocations(callback: AsyncCallback&lt;boolean&gt;): void;
Obtains all cached GNSS locations and clears the GNSS cache queue. Obtains all cached GNSS locations and clears the GNSS cache queue.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.flushCachedGnssLocations](js-apis-geoLocationManager.md#geolocationmanagerflushcachedgnsslocations). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.flushCachedGnssLocations](js-apis-geoLocationManager.md#geolocationmanagerflushcachedgnsslocations).
...@@ -1092,6 +1102,7 @@ flushCachedGnssLocations(): Promise&lt;boolean&gt;; ...@@ -1092,6 +1102,7 @@ flushCachedGnssLocations(): Promise&lt;boolean&gt;;
Obtains all cached GNSS locations and clears the GNSS cache queue. Obtains all cached GNSS locations and clears the GNSS cache queue.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.flushCachedGnssLocations](js-apis-geoLocationManager.md#geolocationmanagerflushcachedgnsslocations-1). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.flushCachedGnssLocations](js-apis-geoLocationManager.md#geolocationmanagerflushcachedgnsslocations-1).
...@@ -1122,6 +1133,7 @@ sendCommand(command: LocationCommand, callback: AsyncCallback&lt;boolean&gt;): v ...@@ -1122,6 +1133,7 @@ sendCommand(command: LocationCommand, callback: AsyncCallback&lt;boolean&gt;): v
Sends an extended command to the location subsystem. Sends an extended command to the location subsystem.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.sendCommand](js-apis-geoLocationManager.md#geolocationmanagersendcommand). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.sendCommand](js-apis-geoLocationManager.md#geolocationmanagersendcommand).
...@@ -1159,6 +1171,7 @@ sendCommand(command: LocationCommand): Promise&lt;boolean&gt;; ...@@ -1159,6 +1171,7 @@ sendCommand(command: LocationCommand): Promise&lt;boolean&gt;;
Sends an extended command to the location subsystem. Sends an extended command to the location subsystem.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.sendCommand](js-apis-geoLocationManager.md#geolocationmanagersendcommand). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.sendCommand](js-apis-geoLocationManager.md#geolocationmanagersendcommand).
...@@ -1193,7 +1206,7 @@ Sends an extended command to the location subsystem. ...@@ -1193,7 +1206,7 @@ Sends an extended command to the location subsystem.
Sets the priority of the location request. Sets the priority of the location request.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.LocationRequestPriority](js-apis-geoLocationManager.md#locationrequestpriority). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.LocationRequestPriority](js-apis-geoLocationManager.md#locationrequestpriority).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -1212,7 +1225,7 @@ Sets the priority of the location request. ...@@ -1212,7 +1225,7 @@ Sets the priority of the location request.
Sets the scenario of the location request. Sets the scenario of the location request.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.LocationRequestScenario](js-apis-geoLocationManager.md#locationrequestscenario). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.LocationRequestScenario](js-apis-geoLocationManager.md#locationrequestscenario).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -1233,7 +1246,7 @@ Sets the priority of the location request. ...@@ -1233,7 +1246,7 @@ Sets the priority of the location request.
Enumerates error codes of the location service. Enumerates error codes of the location service.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. > This API is deprecated since API version 9.
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -1255,7 +1268,7 @@ Enumerates error codes of the location service. ...@@ -1255,7 +1268,7 @@ Enumerates error codes of the location service.
Defines a reverse geocoding request. Defines a reverse geocoding request.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.ReverseGeoCodeRequest](js-apis-geoLocationManager.md#reversegeocoderequest). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.ReverseGeoCodeRequest](js-apis-geoLocationManager.md#reversegeocoderequest).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -1274,7 +1287,7 @@ Defines a reverse geocoding request. ...@@ -1274,7 +1287,7 @@ Defines a reverse geocoding request.
Defines a geocoding request. Defines a geocoding request.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.GeoCodeRequest](js-apis-geoLocationManager.md#geocoderequest). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.GeoCodeRequest](js-apis-geoLocationManager.md#geocoderequest).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -1296,7 +1309,7 @@ Defines a geocoding request. ...@@ -1296,7 +1309,7 @@ Defines a geocoding request.
Defines a geographic location. Defines a geographic location.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.GeoAddress](js-apis-geoLocationManager.md#geoaddress). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.GeoAddress](js-apis-geoLocationManager.md#geoaddress).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -1329,7 +1342,7 @@ Defines a geographic location. ...@@ -1329,7 +1342,7 @@ Defines a geographic location.
Defines a location request. Defines a location request.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.LocationRequest](js-apis-geoLocationManager.md#locationrequest). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.LocationRequest](js-apis-geoLocationManager.md#locationrequest).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -1349,7 +1362,7 @@ Defines a location request. ...@@ -1349,7 +1362,7 @@ Defines a location request.
Defines the current location request. Defines the current location request.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.CurrentLocationRequest](js-apis-geoLocationManager.md#currentlocationrequest). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.CurrentLocationRequest](js-apis-geoLocationManager.md#currentlocationrequest).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
...@@ -1369,6 +1382,7 @@ Defines the current location request. ...@@ -1369,6 +1382,7 @@ Defines the current location request.
Defines the satellite status information. Defines the satellite status information.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.SatelliteStatusInfo](js-apis-geoLocationManager.md#satellitestatusinfo). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.SatelliteStatusInfo](js-apis-geoLocationManager.md#satellitestatusinfo).
...@@ -1391,6 +1405,7 @@ Defines the satellite status information. ...@@ -1391,6 +1405,7 @@ Defines the satellite status information.
Represents a request for reporting cached GNSS locations. Represents a request for reporting cached GNSS locations.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.CachedGnssLocationsRequest](js-apis-geoLocationManager.md#cachedgnsslocationsrequest). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.CachedGnssLocationsRequest](js-apis-geoLocationManager.md#cachedgnsslocationsrequest).
...@@ -1409,6 +1424,7 @@ Represents a request for reporting cached GNSS locations. ...@@ -1409,6 +1424,7 @@ Represents a request for reporting cached GNSS locations.
Defines a GNSS geofence. Currently, only circular geofences are supported. Defines a GNSS geofence. Currently, only circular geofences are supported.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.Geofence](js-apis-geoLocationManager.md#geofence). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.Geofence](js-apis-geoLocationManager.md#geofence).
...@@ -1429,6 +1445,7 @@ Defines a GNSS geofence. Currently, only circular geofences are supported. ...@@ -1429,6 +1445,7 @@ Defines a GNSS geofence. Currently, only circular geofences are supported.
Represents a GNSS geofencing request. Represents a GNSS geofencing request.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.GeofenceRequest](js-apis-geoLocationManager.md#geofencerequest). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.GeofenceRequest](js-apis-geoLocationManager.md#geofencerequest).
...@@ -1448,6 +1465,7 @@ Represents a GNSS geofencing request. ...@@ -1448,6 +1465,7 @@ Represents a GNSS geofencing request.
Defines the privacy statement type. Defines the privacy statement type.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.LocationPrivacyType](js-apis-geoLocationManager.md#locationprivacytype). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.LocationPrivacyType](js-apis-geoLocationManager.md#locationprivacytype).
...@@ -1467,6 +1485,7 @@ Defines the privacy statement type. ...@@ -1467,6 +1485,7 @@ Defines the privacy statement type.
Defines an extended command. Defines an extended command.
> **NOTE** > **NOTE**
>
> This API is supported since API version 8. > This API is supported since API version 8.
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.LocationCommand](js-apis-geoLocationManager.md#locationcommand). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.LocationCommand](js-apis-geoLocationManager.md#locationcommand).
...@@ -1484,7 +1503,7 @@ Defines an extended command. ...@@ -1484,7 +1503,7 @@ Defines an extended command.
Defines a location. Defines a location.
> **NOTE** > **NOTE**<br>
> This API is deprecated since API version 9. You are advised to use [geoLocationManager.Location](js-apis-geoLocationManager.md#location). > This API is deprecated since API version 9. You are advised to use [geoLocationManager.Location](js-apis-geoLocationManager.md#location).
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION
......
# @ohos.hichecker (HiChecker) # @ohos.hichecker (HiChecker)
The **hichecker** module is provided for you to check issues that may be easily ignored during development of OpenHarmony applications (including system-built and third-party applications). Such issues include calling of time-consuming functions by key application threads, event distribution and execution timeout in application processes, and ability resource leakage in application processes. The issues are recorded in logs or lead to process crashes explicitly so that you can find and rectify them. The HiChecker module allows you to check issues that may be easily ignored during development of applications (including system-built and third-party applications). Such issues include calling of time-consuming functions by key application threads, event distribution and execution timeout in application processes, and ability resource leakage in application processes. The issues are recorded in logs or lead to process crashes explicitly so that you can find and rectify them.
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -13,7 +14,7 @@ import hichecker from '@ohos.hichecker'; ...@@ -13,7 +14,7 @@ import hichecker from '@ohos.hichecker';
``` ```
## Constant ## Constants
Provides the constants of all rule types. Provides the constants of all rule types.
...@@ -26,10 +27,8 @@ Provides the constants of all rule types. ...@@ -26,10 +27,8 @@ Provides the constants of all rule types.
| RULE_THREAD_CHECK_SLOW_PROCESS | bigint | Caution rule, which is programmed to detect whether any time-consuming function is invoked. | | RULE_THREAD_CHECK_SLOW_PROCESS | bigint | Caution rule, which is programmed to detect whether any time-consuming function is invoked. |
| RULE_CHECK_ABILITY_CONNECTION_LEAK | bigint | Caution rule, which is programmed to detect whether ability leakage has occurred. | | RULE_CHECK_ABILITY_CONNECTION_LEAK | bigint | Caution rule, which is programmed to detect whether ability leakage has occurred. |
## hichecker.addCheckRule<sup>9+</sup> ## hichecker.addCheckRule<sup>9+</sup>
## hichecker.addRule
addCheckRule(rule: bigint): void addCheckRule(rule: bigint): void
Adds one or more rules. HiChecker detects unexpected operations or gives feedback based on the added rules. Adds one or more rules. HiChecker detects unexpected operations or gives feedback based on the added rules.
...@@ -121,12 +120,10 @@ catch (err) { ...@@ -121,12 +120,10 @@ catch (err) {
## hichecker.addRule<sup>(deprecated)</sup> ## hichecker.addRule<sup>(deprecated)</sup>
## hichecker.addRule addRule(rule: bigint): void
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [hichecker.addCheckRule](#hicheckeraddcheckrule9) instead. > **NOTE**<br>This API is deprecated since API version 9. You are advised to use [hichecker.addCheckRule](#hicheckeraddcheckrule9) instead.
addRule(rule: bigint): void
Adds one or more rules. HiChecker detects unexpected operations or gives feedback based on the added rules. Adds one or more rules. HiChecker detects unexpected operations or gives feedback based on the added rules.
**System capability**: SystemCapability.HiviewDFX.HiChecker **System capability**: SystemCapability.HiviewDFX.HiChecker
......
# Geographic Location # Geographic Location
> **NOTE** > **NOTE**
>
> - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.geolocation`](js-apis-geolocation.md). > - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.geolocation`](js-apis-geolocation.md).
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......
# Network State # @system.network (Network State)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** > **NOTE**
> - The APIs of this module are no longer maintained since API version 7. It is recommended that you use [`@ohos.telephony.observer`](js-apis-observer.md) instead.
> >
> - The APIs of this module are no longer maintained since API version 7. It is recommended that you use [`@ohos.telephony.observer`](js-apis-observer.md) instead.
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......
# @system.request # @system.request (Upload and Download)
The **system.request** module provides applications with basic upload and download capabilities. The **system.request** module provides applications with basic upload and download capabilities.
> **NOTE** > **NOTE**
> - The APIs of this module are deprecated since API version 9. You are advised to use [`@ohos.request`](js-apis-request.md) instead.
> >
> - The APIs of this module are deprecated since API version 9. You are advised to use [`@ohos.request`](js-apis-request.md) instead.
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
| getKVStore&lt;T extends KVStore&gt;(storeId: string, options: Options, callback: AsyncCallback&lt;T&gt;): void<br/>getKVStore&lt;T extends KVStore&gt;(storeId: string, options: Options): Promise&lt;T&gt; | 指定`Options``storeId`,创建并获取指定类型`KVStore`数据库。 | | getKVStore&lt;T extends KVStore&gt;(storeId: string, options: Options, callback: AsyncCallback&lt;T&gt;): void<br/>getKVStore&lt;T extends KVStore&gt;(storeId: string, options: Options): Promise&lt;T&gt; | 指定`Options``storeId`,创建并获取指定类型`KVStore`数据库。 |
| put(key: string, value: Uint8Array\|string\|number\|boolean, callback: AsyncCallback&lt;void&gt;): void<br/>put(key: string, value: Uint8Array\|string\|number\|boolean): Promise&lt;void> | 插入和更新数据。 | | put(key: string, value: Uint8Array\|string\|number\|boolean, callback: AsyncCallback&lt;void&gt;): void<br/>put(key: string, value: Uint8Array\|string\|number\|boolean): Promise&lt;void> | 插入和更新数据。 |
| delete(key: string, callback: AsyncCallback&lt;void&gt;): void<br/>delete(key: string): Promise&lt;void> | 删除数据。 | | delete(key: string, callback: AsyncCallback&lt;void&gt;): void<br/>delete(key: string): Promise&lt;void> | 删除数据。 |
| get(key: string, callback: AsyncCallback&lt;Uint8Array\|string\|boolean\|number&gt;): void<br/>get(key: string): Promise&lt;Uint8Array\|string\|boolean\|number> | 查询数据。 | | get(key: string, callback: AsyncCallback&lt;Uint8Array\|string\|boolean\|number&gt;): void<br/>get(key: string): Promise&lt;Uint8Array\|string\|boolean\|number> | 获取数据。 |
| on(event: 'dataChange', type: SubscribeType, observer: Callback&lt;ChangeNotification&gt;): void<br/>on(event: 'syncComplete', syncCallback: Callback&lt;Array&lt;[string,number]&gt;&gt;): void | 订阅数据库中数据的变化。 | | on(event: 'dataChange', type: SubscribeType, observer: Callback&lt;ChangeNotification&gt;): void<br/>on(event: 'syncComplete', syncCallback: Callback&lt;Array&lt;[string,number]&gt;&gt;): void | 订阅数据库中数据的变化。 |
| sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void | 在手动模式下,触发数据库同步。 | | sync(deviceIdList: string[], mode: SyncMode, delayMs?: number): void | 在手动模式下,触发数据库同步。 |
## 开发步骤 ## 开发步骤
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666).then((data) => { context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666).then((data) => {
console.info('success: ${data}'); console.info('success: ${data}');
}).catch((error) => { }).catch((error) => {
console.info('failed: ${error}'); console.error('failed: ${error}');
}) })
} }
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
context.requestPermissionsFromUser(permissions).then((data) => { context.requestPermissionsFromUser(permissions).then((data) => {
console.log('success: ${data}'); console.log('success: ${data}');
}).catch((error) => { }).catch((error) => {
console.log('failed: ${error}'); console.error('failed: ${error}');
}); });
} }
......
...@@ -25,11 +25,11 @@ hiTraceMeter为开发者提供系统性能打点接口。开发者通过在自 ...@@ -25,11 +25,11 @@ hiTraceMeter为开发者提供系统性能打点接口。开发者通过在自
**性能打点跟踪接口功能介绍:** **性能打点跟踪接口功能介绍:**
| 接口名 | 返回值 | 描述 | | 接口名 | 返回值 | 描述 |
| ---------------------------------------------------------------------------- | --------- | ------------ | | ------------------------------------------------------ | ---- | -------------------------------------------------------------------------------------------------------------------- |
| hiTraceMeter.startTrace(name: string, taskId: number) | void | 标记一个预跟踪耗时任务的开始。如果有多个相同name的任务需要跟踪或者对同一个任务要跟踪多次,并且任务同时被执行,则每次调用startTrace的taskId不相同。如果具有相同name的任务是串行执行的,则taskId可以相同。 | | hiTraceMeter.startTrace(name: string, taskId: number) | void | 标记一个预跟踪耗时任务的开始。taskId是trace中用来表示关联的ID,如果有多个name相同的任务是并行执行的,则每次调用startTrace的taskId不同。如果具有相同name的任务是串行执行的,则taskId可以相同。 |
| hiTraceMeter.finishTrace(name: string, taskId: number) | void | name和taskId必须与流程开始的hiTraceMeter.startTrace对应参数值保持一致。 | | hiTraceMeter.finishTrace(name: string, taskId: number) | void | name和taskId必须与流程开始的hiTraceMeter.startTrace对应参数值保持一致。 |
| hiTraceMeter.traceByValue(name: string, value: number) | void | 用来标记一个预跟踪的数值变量,该变量的数值会不断变化。| | hiTraceMeter.traceByValue(name: string, value: number) | void | 用来标记一个预跟踪的数值变量,该变量的数值会不断变化。 |
## 开发步骤 ## 开发步骤
...@@ -79,5 +79,95 @@ hiTraceMeter为开发者提供系统性能打点接口。开发者通过在自 ...@@ -79,5 +79,95 @@ hiTraceMeter为开发者提供系统性能打点接口。开发者通过在自
} }
``` ```
2. 运行项目,点击应用界面上的运行按钮,即可通过日志信息分析实际业务。 2. 新建一个ArkTs应用工程,在“Project”窗口点击“entry > src > main > ets > pages > index”,打开工程中的“index.ets”文件,在页面执行加载后,在自己的业务中调用hiTraceMeter的接口,进行性能打点跟踪,以任务名name为HITRACE_TAG_APP为例 示例代码如下:
```ts
import hitrace from '@ohos.hiTraceMeter';
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.onClick(() => {
this.message = 'Hello ArkUI';
// 跟踪并行执行的同名任务
hitrace.startTrace("HITRACE_TAG_APP", 1001);
// 业务流程
console.log(`HITRACE_TAG_APP running`);
// 第二个跟踪任务开始,同时第一个跟踪的同名任务还没结束,出现了并行执行,对应接口的taskId需要不同。
hitrace.startTrace("HITRACE_TAG_APP", 1002);
// 业务流程
console.log(`HITRACE_TAG_APP running`);
hitrace.finishTrace("HITRACE_TAG_APP", 1001);
hitrace.finishTrace("HITRACE_TAG_APP", 1002);
// 跟踪串行执行的同名任务,taskId可以不同,也可以相同
hitrace.startTrace("HITRACE_TAG_APP", 1003);
// 业务流程
console.log(`HITRACE_TAG_APP running`);
//第一个跟踪的任务结束
hitrace.finishTrace("HITRACE_TAG_APP", 1003);
// 第二个跟踪任务开始,同名的待跟踪任务串行执行,且taskId不同
hitrace.startTrace("HITRACE_TAG_APP", 1004);
// 业务流程
console.log(`HITRACE_TAG_APP running`);
let traceCount = 3;
hitrace.traceByValue("myTestCount", traceCount);
hitrace.finishTrace("HITRACE_TAG_APP", 1004);
// 第三个跟踪任务开始,同名的待跟踪任务串行执行,且taskId与上一个相同
hitrace.startTrace("HITRACE_TAG_APP", 1004);
// 业务流程
console.log(`HITRACE_TAG_APP running`);
//第三个跟踪的任务结束
hitrace.finishTrace("HITRACE_TAG_APP", 1004);
})
}
.width('100%')
}
.height('100%')
}
}
```
3. 运行项目,点击应用界面上的运行按钮,在shell中依次执行如下命令:
```shell
hdc shell
hitrace --trace_begin app
```
执行抓取trace命令后,先在设备中自己的业务里面调用接口,继续依次执行如下命令:
```shell
hitrace --trace_dump | grep tracing_mark_write
hitrace --trace_finish
```
抓取trace成功的数据如下所示
```
<...>-3310 (-------) [005] .... 351382.921936: tracing_mark_write: S|3310|H:HITRACE_TAG_APP 1001
<...>-3310 (-------) [005] .... 351382.922138: tracing_mark_write: S|3310|H:HITRACE_TAG_APP 1002
<...>-3310 (-------) [005] .... 351382.922165: tracing_mark_write: F|3310|H:HITRACE_TAG_APP 1001
<...>-3310 (-------) [005] .... 351382.922175: tracing_mark_write: F|3310|H:HITRACE_TAG_APP 1002
<...>-3310 (-------) [005] .... 351382.922182: tracing_mark_write: S|3310|H:HITRACE_TAG_APP 1003
<...>-3310 (-------) [005] .... 351382.922203: tracing_mark_write: F|3310|H:HITRACE_TAG_APP 1003
<...>-3310 (-------) [005] .... 351382.922210: tracing_mark_write: S|3310|H:HITRACE_TAG_APP 1004
<...>-3310 (-------) [005] .... 351382.922233: tracing_mark_write: C|3310|H:myTestCount 3
<...>-3310 (-------) [005] .... 351382.922240: tracing_mark_write: F|3310|H:HITRACE_TAG_APP 1004
<...>-3310 (-------) [005] .... 351382.922247: tracing_mark_write: S|3310|H:HITRACE_TAG_APP 1004
<...>-3310 (-------) [005] .... 351382.922266: tracing_mark_write: F|3310|H:HITRACE_TAG_APP 1004
```
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
- 典型页面场景 - 典型页面场景
- [应用市场首页](appgallery-home-page.md) - [应用市场首页](appgallery-home-page.md)
- [音乐专辑页](music-album-page.md) - [音乐专辑页](music-album-page.md)
- [设置应用页面](settings-application-page.md)
- [交互归一](interaction-event-normalization.md) - [交互归一](interaction-event-normalization.md)
- [多态组件](polymorphic-controls.md) - [多态组件](polymorphic-controls.md)
- [资源使用](resource-usage.md) - [资源使用](resource-usage.md)
......
...@@ -6,18 +6,18 @@ ...@@ -6,18 +6,18 @@
设备类型分为default(默认设备)、tablet、tv、wearable等,有多种查询设备类型的方式。 设备类型分为default(默认设备)、tablet、tv、wearable等,有多种查询设备类型的方式。
1. 通过命令行的方式查询设备类型。 1. 通过命令行的方式查询设备类型。
通过命令行查询指定系统参数(const.build.characteristics)进而确定设备类型,详见[系统参数介绍](../../../device-dev/subsystems/subsys-boot-init-sysparam.md) 通过命令行查询指定系统参数(const.product.devicetype)进而确定设备类型,详见[系统参数介绍](../../../device-dev/subsystems/subsys-boot-init-sysparam.md)
```shell ```shell
# 方法一 # 方法一
hdc shell param get "const.build.characteristics" hdc shell param get "const.product.devicetype"
# 方法二 # 方法二
hdc shell cat /etc/param/ohos.para | grep const.build.characteristic hdc shell cat /etc/param/ohos.para | grep const.product.devicetype
``` ```
2. 在应用开发过程中查询设备类型。 2. 在应用开发过程中查询设备类型。
- 通过js接口查询指定系统参数(const.build.characteristics)进而确定设备类型,详见[系统属性](../../reference/apis/js-apis-system-parameter.md) - 通过js接口查询指定系统参数(const.product.devicetype)进而确定设备类型,详见[系统属性](../../reference/apis/js-apis-system-parameter.md)
```typescript ```typescript
import parameter from '@ohos.systemparameter' import parameter from '@ohos.systemparameter'
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
aboutToAppear() { aboutToAppear() {
try { try {
this.deviceType = parameter.getSync("const.build.characteristics") this.deviceType = parameter.getSync("const.product.devicetype")
} catch(e) { } catch(e) {
console.log("getSync unexpected error: " + e) console.log("getSync unexpected error: " + e)
} }
...@@ -179,3 +179,57 @@ hdc shell reboot ...@@ -179,3 +179,57 @@ hdc shell reboot
} }
} }
``` ```
## 如何获取组件的尺寸
实际开发过程中,开发者可能有获取页面中某个组件或某块区域的尺寸的诉求,以便通过手动计算等进行更精确的布局计算及优化。
开发者可以通过[组件区域变化事件](../../reference/arkui-ts/ts-universal-component-area-change-event.md)(即组件显示的尺寸、位置等发生变化时触发的事件)来获取指定组件的尺寸。
如下所示,通过onAreaChange事件获取Row组件(页面中白色区域)的尺寸。
![](figures/onAreaChange.gif)
```
@Entry
@Component
struct OnAreaChangeSample {
@State rate: number = 0.8
@State info: string = ''
// 底部滑块,可以通过拖拽滑块改变容器尺寸
@Builder slider() {
Slider({ value: this.rate * 100, min: 30, max: 80, style: SliderStyle.OutSet })
.blockColor(Color.White)
.width('60%')
.onChange((value: number) => {
this.rate = value / 100;
})
.position({ x: '20%', y: '80%' })
}
build() {
Column() {
Column() {
Row() {
Text(this.info).fontSize(20).lineHeight(22)
}
.borderRadius(12)
.padding(24)
.backgroundColor('#FFFFFF')
.width(this.rate * 100 + '%')
.onAreaChange((oldValue: Area, newValue: Area) => {
this.info = JSON.stringify(newValue)
})
}
this.slider()
}
.width('100%')
.height('100%')
.backgroundColor('#F1F3F5')
.justifyContent(FlexAlign.Center)
}
}
```
...@@ -25,8 +25,9 @@ ...@@ -25,8 +25,9 @@
从第4章开始将从UX设计、系统能力等角度,详尽的解答上述问题。 从第4章开始将从UX设计、系统能力等角度,详尽的解答上述问题。
> **说明:** > **说明:**
>
> - 应用开发不仅包含应用页面开发,还包括应用后端功能开发以及服务器端开发等。 > - 应用开发不仅包含应用页面开发,还包括应用后端功能开发以及服务器端开发等。
> >
> - 本文旨在指导开发者如何在OpenHarmony系统中开发“一多”应用,服务器端开发不在本文探讨范围内。 > - 本文旨在指导开发者如何在OpenHarmony系统中开发“一多”应用,服务器端开发不在本文探讨范围内。
...@@ -34,28 +35,9 @@ ...@@ -34,28 +35,9 @@
为了更好的阅读后面的章节,本小节主要介绍了一些基础知识,方便读者理解内容。 为了更好的阅读后面的章节,本小节主要介绍了一些基础知识,方便读者理解内容。
### 应用程序包结构
OpenHarmony 的应用以APP Pack (Application Package) 形式发布,它是由一个或多个HAP以及描述每个HAP属性的pack.info文件组成。
HAP是OpenHarmony的安装包,一个HAP在工程目录中对应一个Module,由Module编译而来,可分为entry和feature两种类型的HAP。
- **entry**:应用的主模块包。一个APP中,对于同一设备类型,可以有一个或多个entry类型的HAP,来支持该设备类型中不同规格(如API版本、屏幕规格等)的具体设备。
- **feature**:应用的动态特性模块包。一个APP Pack可以包含零个、一个或多个feature类型的HAP。
![zh-cn_image_0000001266965046](figures/zh-cn_image_0000001266965046.png)
> **说明:**
> - Module是开发者开发的相对独立的功能模块,由代码、资源、第三方库及应用配置文件组成,属于IDE开发视图的概念。Module分为entry、feature及har三种类型,相应的可以编译生成entry类型的HAP、feature类型的HAP,以及har包。
>
> - 如果需要了解应用程序包结构更多详情,可以查看[包结构说明](../../quick-start/application-package-structure-stage.md)。
### 方舟开发框架 ### 方舟开发框架
OpenHarmony提供了方舟开发框架(简称:ArkUI),提供开发者进行应用UI开发时所必须的能力。 OpenHarmony提供了[方舟开发框架](../../ui/arkui-overview.md)(简称:ArkUI),提供开发者进行应用UI开发时所必须的能力。
方舟开发框架提供了两种开发范式,分别是基于JS扩展的类Web开发范式(后文中简称为“类Web开发范式”)和基于ArkTS的声明式开发范式(后文中简称为“声明式开发范式”)。 方舟开发框架提供了两种开发范式,分别是基于JS扩展的类Web开发范式(后文中简称为“类Web开发范式”)和基于ArkTS的声明式开发范式(后文中简称为“声明式开发范式”)。
...@@ -63,7 +45,6 @@ OpenHarmony提供了方舟开发框架(简称:ArkUI),提供开发者进 ...@@ -63,7 +45,6 @@ OpenHarmony提供了方舟开发框架(简称:ArkUI),提供开发者进
- **类Web开发范式**:采用经典的HML、CSS、JavaScript三段式开发方式。使用HML标签文件进行布局搭建,使用CSS文件进行样式描述,使用JavaScript文件进行逻辑处理。UI组件与数据之间通过单向数据绑定的方式建立关联,当数据发生变化时,UI界面自动触发更新。此种开发方式,更接近Web前端开发者的使用习惯,快速将已有的Web应用改造成方舟开发框架应用。主要适用于界面较为简单的中小型应用开发。 - **类Web开发范式**:采用经典的HML、CSS、JavaScript三段式开发方式。使用HML标签文件进行布局搭建,使用CSS文件进行样式描述,使用JavaScript文件进行逻辑处理。UI组件与数据之间通过单向数据绑定的方式建立关联,当数据发生变化时,UI界面自动触发更新。此种开发方式,更接近Web前端开发者的使用习惯,快速将已有的Web应用改造成方舟开发框架应用。主要适用于界面较为简单的中小型应用开发。
两种开发范式的对比如下。 两种开发范式的对比如下。
| **开发范式名称** | **语言生态** | **UI更新方式** | **适用场景** | **适用人群** | | **开发范式名称** | **语言生态** | **UI更新方式** | **适用场景** | **适用人群** |
...@@ -72,10 +53,26 @@ OpenHarmony提供了方舟开发框架(简称:ArkUI),提供开发者进 ...@@ -72,10 +53,26 @@ OpenHarmony提供了方舟开发框架(简称:ArkUI),提供开发者进
| 类Web开发范式 | JS语言 | 数据驱动更新 | 界面较为简单的中小型应用和卡片 | Web前端开发人员 | | 类Web开发范式 | JS语言 | 数据驱动更新 | 界面较为简单的中小型应用和卡片 | Web前端开发人员 |
> **说明:** > **说明:**
> - 声明式开发范式占用内存更少,**更推荐开发者选用声明式开发范式来搭建应用UI界面**。 > 声明式开发范式占用内存更少,**更推荐开发者选用声明式开发范式来搭建应用UI界面**。
>
> - 可以查看[方舟开发框架概述](../../ui/arkui-overview.md),了解方舟开发框架更多详情。 ### 应用程序包结构
在进行应用开发时,一个应用通常包含一个或多个Module。Module是OpenHarmony应用/服务的基本功能单元,包含了源代码、资源文件、第三方库及应用/服务配置文件,每一个Module都可以独立进行编译和运行。
Module分为“Ability”和“Library”两种类型:
* “Ability”类型的Module编译后生成HAP包。
* “Library”类型的Module编译后生成HAR包。
OpenHarmony的应用以APP Pack形式发布,其包含一个或多个HAP包。HAP是OpenHarmony应用安装的基本单位,HAP可以分为Entry和Feature两种类型:
* Entry类型的HAP:应用的主模块。在同一个应用中,同一设备类型只支持一个Entry类型的HAP,通常用于实现应用的入口界面、入口图标、主特性功能等。
* Feature类型的HAP:应用的动态特性模块。Feature类型的HAP通常用于实现应用的特性功能,一个应用程序包可以包含一个或多个Feature类型的HAP,也可以不包含。
> **说明:**
> 关于Entry类型的HAP包、Feature类型的HAP包、HAR包以及APP Pack的详细介绍请参考[应用程序包结构说明](../../quick-start/application-package-structure-stage.md) 。
### 部署模型 ### 部署模型
...@@ -85,79 +82,65 @@ OpenHarmony提供了方舟开发框架(简称:ArkUI),提供开发者进 ...@@ -85,79 +82,65 @@ OpenHarmony提供了方舟开发框架(简称:ArkUI),提供开发者进
- **部署模型B**:不同类型的设备上按照一定的工程结构组织方式,通过一次编译生成**不同**的HAP(或HAP组合)。 - **部署模型B**:不同类型的设备上按照一定的工程结构组织方式,通过一次编译生成**不同**的HAP(或HAP组合)。
建议开发者从设备类型及应用功能两个维度,结合具体的业务场景,考虑选择哪种部署模型。但不管采用哪种部署模型,都应该采用一次编译 开发者可以从应用UX设计及应用功能两个维度,结合具体的业务场景,考虑选择哪种部署模型。当然,也可以借助设备类型分类,快速做出判断
**设备类型** 从屏幕尺寸、输入方式及交互距离三个维度考虑,可以将常用类型的设备分为不同泛类:
从屏幕尺寸、交互方式及使用距离三个维度考虑,我们将常用的设备分为三大泛类:
- 默认设备、平板 - 默认设备、平板
- 车机、智慧屏 - 车机、智慧屏
- 智能穿戴 - 智能穿戴
对于相同泛类的设备,优先选择部署模型A,对于不同泛类设备,优先选择部署模型B。 - ……
**应用功能**
- 方舟开发框架提供了丰富的多设备适配能力,相同泛类的设备通常总是可以使用部署模型A。部署模型A需要的开发和维护工作量更小,而且可以保证不同类型设备上体验的一致性。 **对于相同泛类的设备,优先选择部署模型A,对于不同泛类设备,优先选择部署模型B。**
- 仅当同一泛类不同类型设备上规划的功能差异非常大时,才推荐使用部署模型B,如默认设备和平板分别交给两个团队设计、开发和维护等。
一般应用在不同设备上选择部署模型的思路如下:
![zh-cn_image_0000001400300617](figures/zh-cn_image_0000001400300617.png)
> **说明:** > **说明:**
> 页面导航逻辑是指应用内页面之间的跳转关系。假设默认设备上页面A跳转到页面B,平板设备上也是页面A跳转到页面B。因为两种设备屏幕大小不同,默认设备上页面B是覆盖显示在页面A上的,平板设备上页面B是在页面A的右边并且同时显示,但因为都是页面A跳转到页面B,那么我们认为它们的页面导航逻辑相同。 >
> * 应用在不同泛类设备上的UX设计或功能相似时,可以使用部署模型A。
> * 应用在同一泛类不同类型设备上UX设计或功能差异非常大时,可以使用部署模型B,但同时也应审视应用的UX设计及功能规划是否合理。
>
> * 本小节引入部署模型A和部署模型B的概念是为了方便开发者理解。实际上在开发多设备应用时,如果目标设备类型较多,往往是部署模型A和部署模型B混合使用。
>
> * 不管采用哪种部署模型,都应该采用一次编译。
**工程结构** ### 工程结构
“一多”推荐在应用开发过程中使用如下的“三层工程结构”。 “一多”推荐在应用开发过程中使用如下的“三层工程结构”。
- common:公共特性目录,如工具类、公共配置等。 - common(公共能力层):用于存放公共基础能力集合(如工具库、公共配置等)。
- features:功能模块目录,存放应用中相对独立的各个功能的实现(包括该功能相关的UI代码及业务逻辑代码),如帐户管理等。
- product:产品层目录,通过引用common和feature目录中代码的方式做功能和特性的集成,同时也作为主入口 common层不可分割,需编译成一个HAR包,其只可以被products和features依赖,不可以反向依赖
> **说明:** - features(基础特性层):用于存放基础特性集合(如应用中相对独立的各个功能的UI及业务逻辑实现等)。
> features层可横向调用和依赖common层能力;product层不可横向调用,可依赖features层和common层,且不能有反向依赖。
部署模型不同,相应的代码工程结构也有差异。部署模型A和部署模型B的主要差异点集中在product层: 各个feature高内聚、低耦合、可定制,供产品灵活部署。不需要单独部署的feature通常编译为HAR包,供products或其它feature使用。需要单独部署的feature通常编译为Feature类型的HAP包,和products下Entry类型的HAP包进行[组合部署](../../quick-start/multi-hap-objective.md)。features层可以横向调用及依赖common层,同时可以被products层不同设备形态的HAP所依赖,但是不能反向依赖products层。
- 部署模型A可以直接在product目录中做功能和特性集成。 - products(产品定制层):用于针对不同设备形态进行功能和特性集成。
- 部署模型B需要在product目录下再建一级子目录,在不同的子目录中对不同的产品做差异化的功能和特性集成 products层各个子目录各自编译为一个Entry类型的HAP包,作为应用主入口。products层不可以横向调用
部署模型A对应的代码工程结构抽象后一般如下所示: 代码工程结构抽象后一般如下所示:
``` ```
/application /application
├── common # 可选。公共特性目录, har类型的module ├── common # 可选。公共能力层, 编译为HAR包
├── features # 可选。功能模块目录 ├── features # 可选。基础特性层
│ ├── feature1 # 子功能1, har类型的module │ ├── feature1 # 子功能1, 编译为HAR包或Feature类型的HAP包
│ ├── feature2 # 子功能2, har类型的module │ ├── feature2 # 子功能2, 编译为HAR包或Feature类型的HAP包
│ └── ... │ └── ...
└── product # 必选。产品层目录, entry类型的module,编译后为HAP └── products # 必选。产品定制层
``` ├── wearable # 智能穿戴泛类目录, 编译为Entry类型的HAP包
├── default # 默认设备泛类目录, 编译为Entry类型的HAP包
部署模型B对应的代码工程结构抽象后一般如下所示:
```
/application
├── common # 可选。公共特性目录, har类型的module
├── features # 可选。功能模块目录
│ ├── feature1 # 子功能1, har类型的module
│ ├── feature2 # 子功能2, har类型的module
│ └── ...
└── product # 必选。产品层目录
├── wearable # 智能穿戴泛类目录, entry类型的module,编译后为HAP
├── default # 默认设备泛类目录, entry类型的module,编译后为HAP
└── ... └── ...
``` ```
> **说明:** > **说明:**
> 无论是用部署模型A还是部署模型B,在开发阶段,都应考虑**不同类型设备间最大程度的复用代码**,以减少开发及后续维护的工作量。 >
> * 部署模型不同,相应的代码工程结构也有差异。部署模型A和部署模型B的主要差异点集中在product层:部署模型A在product目录下同一子目录中做功能和特性集成;部署模型B在product目录下不同子目录中对不同的产品做差异化的功能和特性集成。
>
>
> * 开发阶段应考虑**不同类型设备间最大程度的复用代码**,以减少开发及后续维护的工作量。
> * 整个代码工程最终构建出一个[APP包](#应用程序包结构),应用以APP包的形式发布到应用市场中。
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
| 自适应布局 | 当外部容器大小发生变化时,元素可以**根据相对关系自动变化**以适应外部容器变化的布局能力。相对关系如占比、固定宽高比、显示优先级等。当前自适应布局能力有7种:[拉伸能力](adaptive-layout.md#拉伸能力)[均分能力](adaptive-layout.md#均分能力)[占比能力](adaptive-layout.md#占比能力)[缩放能力](adaptive-layout.md#缩放能力)[延伸能力](adaptive-layout.md#延伸能力)[隐藏能力](adaptive-layout.md#隐藏能力)[折行能力](adaptive-layout.md#折行能力)。自适应布局能力可以实现界面显示随外部容器大小连续变化。 | | 自适应布局 | 当外部容器大小发生变化时,元素可以**根据相对关系自动变化**以适应外部容器变化的布局能力。相对关系如占比、固定宽高比、显示优先级等。当前自适应布局能力有7种:[拉伸能力](adaptive-layout.md#拉伸能力)[均分能力](adaptive-layout.md#均分能力)[占比能力](adaptive-layout.md#占比能力)[缩放能力](adaptive-layout.md#缩放能力)[延伸能力](adaptive-layout.md#延伸能力)[隐藏能力](adaptive-layout.md#隐藏能力)[折行能力](adaptive-layout.md#折行能力)。自适应布局能力可以实现界面显示随外部容器大小连续变化。 |
| 响应式布局 | 当外部容器大小发生变化时,元素可以**根据断点、栅格或特定的特征(如屏幕方向、窗口宽高等)自动变化**以适应外部容器变化的布局能力。当前响应式布局能力有3种:[断点](responsive-layout.md#断点)[媒体查询](responsive-layout.md#媒体查询)[栅格布局](responsive-layout.md#栅格布局)。响应式布局可以实现界面随外部容器大小有级不连续变化,通常不同特征下的界面显示会有较大的差异。 | | 响应式布局 | 当外部容器大小发生变化时,元素可以**根据断点、栅格或特定的特征(如屏幕方向、窗口宽高等)自动变化**以适应外部容器变化的布局能力。当前响应式布局能力有3种:[断点](responsive-layout.md#断点)[媒体查询](responsive-layout.md#媒体查询)[栅格布局](responsive-layout.md#栅格布局)。响应式布局可以实现界面随外部容器大小有级不连续变化,通常不同特征下的界面显示会有较大的差异。 |
> **说明:**
> 自适应布局多用于解决页面各区域内的布局差异,响应式布局多用于解决页面各区域间的布局差异。
自适应布局和响应式布局常常需要借助容器类组件实现,或与容器类组件搭配使用。 自适应布局和响应式布局常常需要借助容器类组件实现,或与容器类组件搭配使用。
...@@ -25,4 +27,3 @@ ...@@ -25,4 +27,3 @@
接下来将依次介绍自适应布局和响应式布局,同时结合实际,通过典型布局场景以及典型页面场景详细介绍两种布局能力的用法。 接下来将依次介绍自适应布局和响应式布局,同时结合实际,通过典型布局场景以及典型页面场景详细介绍两种布局能力的用法。
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
| ------------------------------------------------------------ | -------------- | ------------------------------------------------------------ | | ------------------------------------------------------------ | -------------- | ------------------------------------------------------------ |
| [页面开发一多能力](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/AdaptiveCapabilities) | 声明式开发范式 | 本章配套的示例代码,包括自适应布局、响应式布局、典型布局场景以及资源文件使用等。 | | [页面开发一多能力](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/AdaptiveCapabilities) | 声明式开发范式 | 本章配套的示例代码,包括自适应布局、响应式布局、典型布局场景以及资源文件使用等。 |
| [页面开发一多能力](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/JsAdaptiveCapabilities) | 类Web开发范式 | 本章配套的示例代码,包括自适应布局、响应式布局及资源文件使用等。 | | [页面开发一多能力](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/JsAdaptiveCapabilities) | 类Web开发范式 | 本章配套的示例代码,包括自适应布局、响应式布局及资源文件使用等。 |
| [天气](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/Weather) | 声明式开发范式 | 一多示例应用,以天气应用为例,演示如何使用一多能力实现包含多个页面的应用。 |
| [应用市场首页](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/AppMarket) | 声明式开发范式 | 本章配套的示例代码,以应用市场首页为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 | | [应用市场首页](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/AppMarket) | 声明式开发范式 | 本章配套的示例代码,以应用市场首页为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 |
| [音乐专辑页](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/MusicAlbum) | 声明式开发范式 | 本章配套的示例代码,以音乐专辑页为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 | | [音乐专辑页](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/MusicAlbum) | 声明式开发范式 | 本章配套的示例代码,以音乐专辑页为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 |
| [蔬菜百科首页](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/Vegetable) | 声明式开发范式 | 一多示例页面,以蔬菜百科首页为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 | | [设置应用页面](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/Settings) | 声明式开发范式 | 本章配套的示例代码,以设置应用页面为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 |
| [天气](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/Weather) | 声明式开发范式 | 一多示例应用,以天气应用为例,演示如何使用一多能力实现包含多个页面的应用。 |
...@@ -29,9 +29,12 @@ ...@@ -29,9 +29,12 @@
| lg | [840,&nbsp;+∞) | | lg | [840,&nbsp;+∞) |
> **说明:** > **说明:**
>
> - 以设备屏幕宽度作为参照物,也可以实现类似的效果。考虑到应用可能以非全屏窗口的形式显示,以应用窗口宽度为参照物更为通用。 > - 以设备屏幕宽度作为参照物,也可以实现类似的效果。考虑到应用可能以非全屏窗口的形式显示,以应用窗口宽度为参照物更为通用。
> >
> - 开发者可以根据实际使用场景决定适配哪些断点。如xs断点对应的一般是智能穿戴类设备,如果确定某页面不会在智能穿戴设备上显示,则可以不适配xs断点。 > - 开发者可以根据实际使用场景决定适配哪些断点。如xs断点对应的一般是智能穿戴类设备,如果确定某页面不会在智能穿戴设备上显示,则可以不适配xs断点。
>
> - 可以根据实际需要在lg断点后面新增xl、xxl等断点,但注意新增断点会同时增加UX设计师及应用开发者的工作量,除非必要否则不建议盲目新增断点。
OpenHarmony提供了多种方法,判断应用当前处于何种断点,进而可以调整应用的布局。常见的监听断点变化的方法如下所示: OpenHarmony提供了多种方法,判断应用当前处于何种断点,进而可以调整应用的布局。常见的监听断点变化的方法如下所示:
...@@ -45,69 +48,72 @@ OpenHarmony提供了多种方法,判断应用当前处于何种断点,进而 ...@@ -45,69 +48,72 @@ OpenHarmony提供了多种方法,判断应用当前处于何种断点,进而
通过窗口对象监听断点变化的核心是获取窗口对象及注册窗口尺寸变化的回调函数。 通过窗口对象监听断点变化的核心是获取窗口对象及注册窗口尺寸变化的回调函数。
1. 在Ability的[onWindowStageCreate](../../application-models/uiability-lifecycle.md)生命周期回调中,获取并记录[窗口](../../reference/apis/js-apis-window.md)对象 1. 在Ability的[onWindowStageCreate](../../application-models/uiability-lifecycle.md)生命周期回调中,通过[窗口](../../reference/apis/js-apis-window.md)对象获取启动时的应用窗口宽度并注册回调函数监听窗口尺寸变化。将窗口尺寸的长度单位[由px换算为vp](../../key-features/multi-device-app-dev/visual-basics.md#视觉基础)后,即可基于前文中介绍的规则得到当前断点值,此时可以使用[状态变量](../../quick-start/arkts-state-mgmt-application-level.md)记录当前的断点值方便后续使用
```ts ```ts
// EntryAbility.ts // MainAbility.ts
import Window from '@ohos.window'; import window from '@ohos.window'
import UIAbility from '@ohos.app.ability.UIAbility'; import display from '@ohos.display'
export default class EntryAbility extends UIAbility {
// ...
onWindowStageCreate(windowStage) {
window.getTopWindow(this.context).then((windowObj) => {
AppStorage.SetOrCreate('windowObj', windowObj)
})
}
// ...
}
```
2. 在页面中,通过窗口对象获取启动时的应用窗口宽度,同时注册回调函数监听窗口尺寸变化。 export default class MainAbility extends Ability {
private windowObj: window.Window
```ts private curBp: string
@Entry ...
@Component // 根据当前窗口尺寸更新断点
struct Index {
@State private currentBreakpoint: string = 'sm'
private updateBreakpoint(windowWidth) { private updateBreakpoint(windowWidth) {
if (windowWidth < 320) { // 将长度的单位由px换算为vp
this.currentBreakpoint = 'xs' let windowWidthVp = windowWidth / (display.getDefaultDisplaySync().densityDPI / 160)
return let newBp: string = ''
} if (windowWidthVp < 320) {
if (windowWidth < 520) { newBp = 'xs'
this.currentBreakpoint = 'sm' } else if (windowWidthVp < 520) {
return newBp = 'sm'
} else if (windowWidthVp < 840) {
newBp = 'md'
} else {
newBp = 'lg'
} }
if (windowWidth < 840) { if (this.curBp !== newBp) {
this.currentBreakpoint = 'md' this.curBp = newBp
return // 使用状态变量记录当前断点值
AppStorage.SetOrCreate('currentBreakpoint', this.curBp)
} }
this.currentBreakpoint = 'lg'
} }
aboutToAppear() { onWindowStageCreate(windowStage: window.WindowStage) {
let windowObj: window.Window = AppStorage.Get('windowObj') windowStage.getMainWindow().then((windowObj) => {
// 获取应用启动时的窗口尺寸 this.windowObj = windowObj
windowObj.getProperties().then((windowProperties) => { // 获取应用启动时的窗口尺寸
this.updateBreakpoint(px2vp(windowProperties.windowRect.width)) this.updateBreakpoint(windowObj.getWindowProperties().windowRect.width)
}) // 注册回调函数,监听窗口尺寸变化
windowObj.on('windowSizeChange', (windowSize)=>{
// 注册回调函数,监听窗口尺寸变化 this.updateBreakpoint(windowSize.width)
windowObj.on('windowSizeChange', (data) => { })
this.updateBreakpoint(px2vp(data.width))
}); });
...
} }
aboutToDisappear() { // 窗口销毁时,取消窗口尺寸变化监听
let windowObj: window.Window = AppStorage.Get('windowObj') onWindowStageDestroy() {
windowObj.off('windowSizeChange') if (this.windowObj) {
this.windowObj.off('windowSizeChange')
}
} }
...
}
```
2. 在页面中,获取及使用当前的断点。
```ts
@Entry
@Component
struct Index {
@StorageProp('currentBreakpoint') curBp: string = 'sm'
build() { build() {
Flex({justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center}) { Flex({justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center}) {
Text(this.currentBreakpoint).fontSize(50).fontWeight(FontWeight.Medium) Text(this.curBp).fontSize(50).fontWeight(FontWeight.Medium)
} }
.width('100%') .width('100%')
.height('100%') .height('100%')
...@@ -116,7 +122,7 @@ OpenHarmony提供了多种方法,判断应用当前处于何种断点,进而 ...@@ -116,7 +122,7 @@ OpenHarmony提供了多种方法,判断应用当前处于何种断点,进而
``` ```
3. 运行及验证效果。 3. 运行及验证效果。
| | | | | | | |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| ![zh-cn_image_0000001336485520](figures/zh-cn_image_0000001336485520.jpg) | ![zh-cn_image_0000001386645965](figures/zh-cn_image_0000001386645965.jpg) | ![zh-cn_image_0000001386325621](figures/zh-cn_image_0000001386325621.jpg) | | ![zh-cn_image_0000001336485520](figures/zh-cn_image_0000001336485520.jpg) | ![zh-cn_image_0000001386645965](figures/zh-cn_image_0000001386645965.jpg) | ![zh-cn_image_0000001386325621](figures/zh-cn_image_0000001386325621.jpg) |
......
# 设置应用页面
本小节以“设置”应用页面为例,介绍如何使用自适应布局能力和响应式布局能力适配不同尺寸窗口。本示例已经在[OpenHarmony应用示例](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/Settings)中开源,读者可以根据需要自行下载源码并运行及查看效果。
## 页面设计
为充分利用屏幕尺寸优势,应用常常有在小屏设备上单栏显示,大屏设备上左右分两栏显示的设计,设置应用页面设计如下。
![](figures/settings_ux.png)
观察“设置”应用页面设计,不同断点下“设置主页”、“WLAN页面”和“更多WLAN设置页面”几乎完全一致,只是在sm断点下采用单栏显示,在md和lg断点下采用双栏显示。
在前面的典型页面场景中,已经介绍了如何分析及实现不同断点下设计相似的单个页面,本小节将展开介绍如何实现不同断点下存在单栏和双栏设计的场景。
为了方便读者理解,本小节将围绕以下三个问题进行介绍。
1. [如何实现单/双栏的显示效果](#如何实现单/双栏的显示效果)
2. [如何实现点击跳转或刷新](#如何实现点击跳转或刷新)
3. [如何实现多级跳转](#如何实现多级跳转)
## 如何实现单/双栏的显示效果
开发者可以使用Row、Column、[RowSplit](../../reference/arkui-ts/ts-container-rowsplit.md)等基础的组件,实现分栏显示的效果,但是需要较多的开发工作量。方舟开发框架在API 9重构了[Navigation组件](../../reference/arkui-ts/ts-basic-components-navigation.md),开发者可以通过配置Navigation组件的属性,控制其按照单栏或双栏的效果进行显示。
Navigation组件由Navbar和Content两部分区域组成,Navigation组件支持Stack、Split以及Auto三种模式。Stack及Split模式下Navigation组件的表现如下图所示。
* Stack模式
![](figures/settings_navigation_stack.png)
* Split模式
![](figures/settings_navigation_split.png)
* Auto模式
Auto模式是指Navigation组件可以根据应用窗口尺寸,自动选择合适的模式:窗口宽度小于520vp时,采用Stack模式显示;窗口宽度大于等于520vp时,采用Split模式显示。当窗口尺寸发生改变时,Navigation组件也会自动在Stack模式和Split模式之间切换。
> **说明:**
>
> * Navigation组件提供的title、navBarWidth、navBarPosition等属性来调整其显示效果。Navigation组件样式的配置与其它组件类似,这里不做赘述。
> * 首次加载Navigation组件所在的页面时,如果Navigation组件处于Split模式,Navigation组件会自动激活其第一个NavRouter孩子节点(后文会展开介绍NavRouter)来刷新Content区域的显示。
设置主页的核心代码如下所示。Navigation组件默认处于Auto模式,其样式会根据应用窗口尺寸在单栏和双栏之间自动切换。
```typescript
@Entry
@Component
struct Index {
build() {
Navigation() {
SettingList()
}
.title($r('app.string.settings'))
.navBarWidth('40%')
.width('100%')
.height('100%')
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
}
}
```
## 如何实现点击跳转或刷新
Navigation组件通常搭配[NavRouter组件](../../reference/arkui-ts/ts-basic-components-navrouter.md)以及[NavDestination组件](../../reference/arkui-ts/ts-basic-components-navdestination.md)一起使用:
* NavRouter组件用于控制Navigation组件Content区域的显示和刷新逻辑。
* NavDestination组件用于实际刷新Navigation组件Content区域的显示。
### 刷新控制
NavRouter组件用于控制Navigation组件中Content区域的刷新逻辑,其必须包含两个孩子节点。
| | 节点类型 | 节点功能 |
| -------------- | ------------------ | ----------------------------------- |
| 第一个孩子节点 | 容器类组件 | 直接控制NavRouter的显示效果 |
| 第二个孩子节点 | NavDestination组件 | 刷新Navigation组件Content区域的显示 |
NavRouter组件默认提供了点击响应处理,不需要开发者自定义点击事件逻辑。另外,NavRouter组件还提供了onStateChange回调事件,用于通知开发者NavRouter的状态:用户点击NavRouter,激活NavRouter并加载对应的NavDestination子组件时,回调onStateChange(true);NavRouter对应的NavDestination子组件不再显示时,回调onStateChange(false)。
![img](figures/settings_navrouter.png)
结合设置应用的具体场景来看,上图1号小红框是NavRouter的第一个孩子节点,2号红框是NavRouter的第二个孩子节点,相应的核心代码实现如下。
```typescript
@Component
export struct WlanSettingItem {
@LocalStorageLink('selectedLabel') selectedLabel: string = ''
build() {
Column() {
NavRouter() {
MainItem({
title: $r('app.string.wifiTab'),
tag: 'UX',
icon: $r('app.media.wlan'),
label: 'WLAN'
})
NavDestination() {
WlanSetting()
}
.title($r('app.string.wifiTab'))
.backgroundColor($r('sys.color.ohos_id_color_sub_background'))
}
}
}
}
```
### 显示刷新
NavDestination组件用于实际刷新Navigation组件Content区域的显示。激活后的NavRouter对应的NavDestination组件,会占满整个Content区域并刷新其显示。
开发者可以通过NavDestination组件提供的如下属性,调整其最终显示效果:
- backgroundColor:设置NavDestination组件的背景色。
- title:自定义NavDestination组件的标题。
- hideTitleBar:隐藏NavDestination组件的标题栏。
特别的,Navigation组件会根据当前的状态决定是否在NavDestination组件标题栏起始部分自动添加返回键图标。当Navigation组件添加了返回键图标时,还可以自动响应及处理系统三键导航中的返回键事件。
![](figures/settings_navdestination_title.png)
## 如何实现多级跳转
可以在NavDesination组件中,继续使用NavRouter组件,以实现多级跳转。多级跳转场景下,Navigation组件同样会根据当前的状态决定是否自动添加返回键图标及响应系统三键导航中的返回键事件。
| 一级页面 | 二级页面 |
| --------------------------------- | ----------------------------------- |
| ![](figures/settings_primary.png) | ![](figures/settings_secondary.png) |
结合具体场景,红框3是一个NavRouter组件,点击后可以控制Navigation组件中的Content区域刷新为红框4对应的NavDestination组件吗,其核心代码实现如下所示。
```typescript
@Component
export struct WlanMoreSettingItem {
@LocalStorageLink('selectedLabel') selectedLabel: string = ''
build() {
NavRouter() {
SubItemArrow({ title: $r('app.string.moreWlanSettings') })
NavDestination() {
WlanMoreSetting()
}
.title($r('app.string.moreWlanSettings'))
.backgroundColor($r('sys.color.ohos_id_color_sub_background'))
}
}
}
```
## 总结
![](figures/settings_navigation_structure.png)
本示例的基础导航结构上图所示:
* 激活`SettingList`中的`WLANSettingItem`,可以加载及显示`WlanSetting`
* 激活`WlanSetting`中的`WlanMoreSettingItem`,可以加载及显示`WlanMoreSetting`
Navigation组件支持自动切换单栏和双栏的显示效果,同时可以根据当前状态自动添加返回键及响应系统的返回键事件。借助Navigation组件,开发者不用关心单栏和双栏场景的差异而更关注于应用本身,极大的减少开发工作量及提高开发效率。
...@@ -4,18 +4,20 @@ ...@@ -4,18 +4,20 @@
虽然不同应用的页面千变万化,但对其进行拆分和分析,页面中的很多布局场景是相似的。本小节将介绍如何借助自适应布局、响应式布局以及常见的容器类组件,实现应用中的典型布局场景。 虽然不同应用的页面千变万化,但对其进行拆分和分析,页面中的很多布局场景是相似的。本小节将介绍如何借助自适应布局、响应式布局以及常见的容器类组件,实现应用中的典型布局场景。
| 布局场景 | 实现方案 | | 布局场景 | 实现方案 |
| -------- | -------- | | -------- | -------- |
| [页签栏](#页签栏) | Tab组件&nbsp;+&nbsp;响应式布局 | | [页签栏](#页签栏) | Tab组件&nbsp;+&nbsp;响应式布局 |
| [运营横幅(Banner)](#运营横幅banner) | Swiper组件&nbsp;+&nbsp;响应式布局 | | [运营横幅(Banner)](#运营横幅banner) | Swiper组件&nbsp;+&nbsp;响应式布局 |
| [网格](#网格) | Grid组件&nbsp;/&nbsp;List组件&nbsp;+&nbsp;响应式布局 | | [网格](#网格) | Grid组件&nbsp;/&nbsp;List组件&nbsp;+&nbsp;响应式布局 |
| [侧边栏](#侧边栏) | SiderBar组件&nbsp;+&nbsp;响应式布局 | | [侧边栏](#侧边栏) | SiderBar组件&nbsp;+&nbsp;响应式布局 |
| [大图浏览](#大图浏览) | Image组件 | | [单/双栏](#单/双栏) | Navigation组件&nbsp;+&nbsp;响应式布局 |
| [操作入口](#操作入口) | Scroll组件+Row组件横向均分 | | [自定义弹窗](#自定义弹窗) | CustomDialogController组件&nbsp;+&nbsp;响应式布局 |
| [顶部](#顶部) | 栅格组件 | | [大图浏览](#大图浏览) | Image组件 |
| [缩进布局](#缩进布局) | 栅格组件 | | [操作入口](#操作入口) | Scroll组件+Row组件横向均分 |
| [挪移布局](#挪移布局) | 栅格组件 | | [顶部](#顶部) | 栅格组件 |
| [重复布局](#重复布局) | 栅格组件 | | [缩进布局](#缩进布局) | 栅格组件 |
| [挪移布局](#挪移布局) | 栅格组件 |
| [重复布局](#重复布局) | 栅格组件 |
> **说明:** > **说明:**
...@@ -418,6 +420,239 @@ struct SideBarSample { ...@@ -418,6 +420,239 @@ struct SideBarSample {
} }
``` ```
## 单/双栏
**布局效果**
| sm | md | lg |
| ------------------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ |
| 单栏显示,在首页中点击选项可以显示详情。<br>点击详情上方的返回键图标或使用系统返回键可以返回到主页。 | 双栏显示,点击左侧不同的选项可以刷新右侧的显示。 | 双栏显示,点击左侧不同的选项可以刷新右侧的显示。 |
| ![](figures/navigation_sm.png) | ![](figures/navigation_md.png) | ![](figures/navigation_lg.png) |
**实现方案**
单/双栏场景可以使用[Navigation组件](../../reference/arkui-ts/ts-basic-components-navigation.md)实现,Navigation组件可以根据窗口宽度自动切换单/双栏显示,减少开发工作量。
**参考代码**
```
@Component
struct Details {
private imageSrc: Resource
build() {
Column() {
Image(this.imageSrc)
.objectFit(ImageFit.Contain)
.height(300)
.width(300)
}
.justifyContent(FlexAlign.Center)
.width('100%')
.height('100%')
}
}
@Component
struct Item {
private imageSrc: Resource
private label: string
build() {
NavRouter() {
Text(this.label)
.fontSize(24)
.fontWeight(FontWeight.Bold)
.borderRadius(5)
.backgroundColor('#FFFFFF')
.textAlign(TextAlign.Center)
.width(180)
.height(36)
NavDestination() {
Details({imageSrc: this.imageSrc})
}.title(this.label)
}
}
}
@Entry
@Component
struct NavigationSample {
build() {
Navigation() {
Column({space: 30}) {
Item({label: 'moon', imageSrc: $r('app.media.my_image_moon')})
Item({label: 'sun', imageSrc: $r('app.media.my_image')})
}
.justifyContent(FlexAlign.Center)
.height('100%')
.width('100%')
}
.mode(NavigationMode.Auto)
.backgroundColor('#F1F3F5')
.height('100%')
.width('100%')
.navBarWidth('40%')
.hideToolBar(true)
.title('Sample')
}
}
```
## 自定义弹窗
**布局效果**
| sm | md | lg |
| -------------------------------------------- | --------------------------------------- | --------------------------------------- |
| 弹窗居中显示,<br>与窗口左右两侧各间距24vp。 | 弹窗居中显示,其宽度约为窗口宽度的1/2。 | 弹窗居中显示,其宽度约为窗口宽度的1/3。 |
| ![](figures/custom_dialog_sm.png) | ![](figures/custom_dialog_md.png) | ![](figures/custom_dialog_lg.png) |
**实现方案**
自定义弹窗通常通过[CustomDialogController](../../reference/arkui-ts/ts-methods-custom-dialog-box.md)实现,有两种方式实现本场景的目标效果:
* 通过gridCount属性配置自定义弹窗的宽度。
系统默认对不同断点下的窗口进行了栅格化:sm断点下为4栅格,md断点下为8栅格,lg断点下为12栅格。通过gridCount属性可以配置弹窗占据栅格中的多少列,将该值配置为4即可实现目标效果。
* 将customStyle设置为true,即弹窗的样式完全由开发者自定义。
开发者自定义弹窗样式时,开发者可以根据需要配置弹窗的宽高和背景色(非弹窗区域保持默认的半透明色)。自定义弹窗样式配合[栅格组件](../../reference/arkui-ts/ts-container-gridrow.md)同样可以实现目标效果。
**参考代码**
```
@Entry
@Component
struct CustomDialogSample {
// 通过gridCount配置弹窗的宽度
dialogControllerA: CustomDialogController = new CustomDialogController({
builder: CustomDialogA ({
cancel: this.onCancel,
confirm: this.onConfirm
}),
cancel: this.onCancel,
autoCancel: true,
gridCount: 4,
customStyle: false
})
// 自定义弹窗样式
dialogControllerB: CustomDialogController = new CustomDialogController({
builder: CustomDialogB ({
cancel: this.onCancel,
confirm: this.onConfirm
}),
cancel: this.onCancel,
autoCancel: true,
customStyle: true
})
onCancel() {
console.info('callback when dialog is canceled')
}
onConfirm() {
console.info('callback when dialog is confirmed')
}
build() {
Column() {
Button('CustomDialogA').margin(12)
.onClick(() => {
this.dialogControllerA.open()
})
Button('CustomDialogB').margin(12)
.onClick(() => {
this.dialogControllerB.open()
})
}.width('100%').height('100%').justifyContent(FlexAlign.Center)
}
}
@CustomDialog
struct CustomDialogA {
controller: CustomDialogController
cancel: () => void
confirm: () => void
build() {
Column() {
Text('是否删除此联系人?')
.fontSize(16)
.fontColor('#E6000000')
.margin({bottom: 8, top: 24, left: 24, right: 24})
Row() {
Text('取消')
.fontColor('#007DFF')
.fontSize(16)
.layoutWeight(1)
.textAlign(TextAlign.Center)
.onClick(()=>{
this.controller.close()
this.cancel()
})
Line().width(1).height(24).backgroundColor('#33000000').margin({left: 4, right: 4})
Text('删除')
.fontColor('#FA2A2D')
.fontSize(16)
.layoutWeight(1)
.textAlign(TextAlign.Center)
.onClick(()=>{
this.controller.close()
this.confirm()
})
}.height(40)
.margin({left: 24, right: 24, bottom: 16})
}.borderRadius(24)
}
}
@CustomDialog
struct CustomDialogB {
controller: CustomDialogController
cancel: () => void
confirm: () => void
build() {
GridRow({columns: {sm: 4, md: 8, lg: 12}}) {
GridCol({span: 4, offset: {sm: 0, md: 2, lg: 4}}) {
Column() {
Text('是否删除此联系人?')
.fontSize(16)
.fontColor('#E6000000')
.margin({bottom: 8, top: 24, left: 24, right: 24})
Row() {
Text('取消')
.fontColor('#007DFF')
.fontSize(16)
.layoutWeight(1)
.textAlign(TextAlign.Center)
.onClick(()=>{
this.controller.close()
this.cancel()
})
Line().width(1).height(24).backgroundColor('#33000000').margin({left: 4, right: 4})
Text('删除')
.fontColor('#FA2A2D')
.fontSize(16)
.layoutWeight(1)
.textAlign(TextAlign.Center)
.onClick(()=>{
this.controller.close()
this.confirm()
})
}.height(40)
.margin({left: 24, right: 24, bottom: 16})
}.borderRadius(24).backgroundColor('#FFFFFF')
}
}.margin({left: 24, right: 24})
}
}
```
## 大图浏览 ## 大图浏览
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
- [Native API在应用工程中的使用指导](napi-guidelines.md) - [Native API在应用工程中的使用指导](napi-guidelines.md)
- [Drawing开发指导](drawing-guidelines.md) - [Drawing开发指导](drawing-guidelines.md)
- [Rawfile开发指导](rawfile-guidelines.md) - [Rawfile开发指导](rawfile-guidelines.md)
- [Window开发指导](native-window-guidelines.md) - [NativeWindow开发指导](native-window-guidelines.md)
- [使用MindSpore Lite引擎进行模型推理](mindspore-lite-guidelines.md) - [使用MindSpore Lite引擎进行模型推理](mindspore-lite-guidelines.md)
- [Neural Network Runtime对接AI推理框架开发指导](neural-network-runtime-guidelines.md) - [Neural Network Runtime对接AI推理框架开发指导](neural-network-runtime-guidelines.md)
\ No newline at end of file
...@@ -35,15 +35,68 @@ NativeWindow是`OpenHarmony`**本地平台化窗口**,表示图形队列的生 ...@@ -35,15 +35,68 @@ NativeWindow是`OpenHarmony`**本地平台化窗口**,表示图形队列的生
以下步骤描述了在**OpenHarmony**中如何使用`NativeWindow`提供的`NAPI`接口,申请图形`Buffer`,并将生产图形内容写入图形`Buffer`后,最终提交`Buffer`到图形队列。 以下步骤描述了在**OpenHarmony**中如何使用`NativeWindow`提供的`NAPI`接口,申请图形`Buffer`,并将生产图形内容写入图形`Buffer`后,最终提交`Buffer`到图形队列。
1. **获取NativeWindow实例**。例如,使用`Surface`创建`NativeWindow`实例。 1. **获取NativeWindow实例**。可在[`OH_NativeXComponent_Callback`](../reference/native-apis/_o_h___native_x_component___callback.md)提供的接口中获取。
```c++ 1. 在xxx.ets 中定义 XComponent。
sptr<OHOS::Surface> cSurface = Surface::CreateSurfaceAsConsumer(); ```ts
sptr<IBufferConsumerListener> listener = new BufferConsumerListenerTest(); XComponent({ id: 'xcomponentId', type: 'surface', libraryname: 'nativerender'})
cSurface->RegisterConsumerListener(listener); .onLoad((context) => {
sptr<OHOS::IBufferProducer> producer = cSurface->GetProducer(); this.context = context;
sptr<OHOS::Surface> pSurface = Surface::CreateSurfaceAsProducer(producer); })
OHNativeWindow* nativeWindow = OH_NativeWindow_CreateNativeWindow(&pSurface); .onDestroy(() => {
``` })
```
2. 在 native c++ 层获取 NativeXComponent。
```c++
napi_value exportInstance = nullptr;
napi_get_named_property(env, exports, OH_NATIVE_XCOMPONENT_OBJ, &exportInstance);
OH_NativeXComponent *nativeXComponent = nullptr;
napi_unwrap(env, exportInstance, reinterpret_cast<void**>(&nativeXComponent));
char idStr[OH_XCOMPONENT_ID_LEN_MAX + 1] = { };
uint64_t idSize = OH_XCOMPONENT_ID_LEN_MAX + 1;
OH_NativeXComponent_GetXComponentId(nativeXComponent, idStr, &idSize);
```
3. 定义 OH_NativeXComponent_Callback
```c++
// 定义回调函数
void OnSurfaceCreatedCB(OH_NativeXComponent* component, void* window)
{
// 可获取 NativeWindow 实例
OHNativeWindow* nativeWindow = window;
// ...
}
void OnSurfaceChangedCB(OH_NativeXComponent* component, void* window)
{
// 可获取 NativeWindow 实例
OHNativeWindow* nativeWindow = window;
// ...
}
void OnSurfaceDestroyedCB(OH_NativeXComponent* component, void* window)
{
// 可获取 NativeWindow 实例
OHNativeWindow* nativeWindow = window;
// ...
}
void DispatchTouchEventCB(OH_NativeXComponent* component, void* window)
{
// 可获取 NativeWindow 实例
OHNativeWindow* nativeWindow = window;
// ...
}
```
```c++
// 初始化 OH_NativeXComponent_Callback
OH_NativeXComponent_Callback callback_;
callback_->OnSurfaceCreated = OnSurfaceCreatedCB;
callback_->OnSurfaceChanged = OnSurfaceChangedCB;
callback_->OnSurfaceDestroyed = OnSurfaceDestroyedCB;
callback_->DispatchTouchEvent = DispatchTouchEventCB;
```
4. 将 OH_NativeXComponent_Callback 注册给 NativeXComponent。
```c++
OH_NativeXComponent_RegisterCallback(nativeXComponent, &callback_);
```
2. **设置NativeWindowBuffer的属性**。使用`OH_NativeWindow_NativeWindowHandleOpt`设置`NativeWindowBuffer`的属性。 2. **设置NativeWindowBuffer的属性**。使用`OH_NativeWindow_NativeWindowHandleOpt`设置`NativeWindowBuffer`的属性。
```c++ ```c++
...@@ -91,7 +144,6 @@ NativeWindow是`OpenHarmony`**本地平台化窗口**,表示图形队列的生 ...@@ -91,7 +144,6 @@ NativeWindow是`OpenHarmony`**本地平台化窗口**,表示图形队列的生
``` ```
5. **提交NativeWindowBuffer到图形队列** 5. **提交NativeWindowBuffer到图形队列**
```c++ ```c++
// 设置刷新区域,如果Region中的Rect为nullptr,或者rectNumber为0,则认为NativeWindowBuffer全部有内容更改。 // 设置刷新区域,如果Region中的Rect为nullptr,或者rectNumber为0,则认为NativeWindowBuffer全部有内容更改。
Region region{nullptr, 0}; Region region{nullptr, 0};
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
app对象包含应用全局配置信息,内部结构如下: app对象包含应用全局配置信息,内部结构如下:
### **表1** **app对象内部结构说明** **表1** **app对象内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -14,7 +14,9 @@ app对象包含应用全局配置信息,内部结构如下: ...@@ -14,7 +14,9 @@ app对象包含应用全局配置信息,内部结构如下:
| smartWindowSize | 标识应用在模拟器中运行时使用的屏幕尺寸。 | 字符串 | 可缺省,缺省值为空。 | | smartWindowSize | 标识应用在模拟器中运行时使用的屏幕尺寸。 | 字符串 | 可缺省,缺省值为空。 |
| smartWindowDeviceType | 标识应用在模拟器中运行时可以模拟的设备。 | 字符串数组 | 可缺省,缺省值为空。 | | smartWindowDeviceType | 标识应用在模拟器中运行时可以模拟的设备。 | 字符串数组 | 可缺省,缺省值为空。 |
#### **表2** **version对象内部结构说明** ## version对象内部结构
**表2** **version对象内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -22,7 +24,9 @@ app对象包含应用全局配置信息,内部结构如下: ...@@ -22,7 +24,9 @@ app对象包含应用全局配置信息,内部结构如下:
| code | 标识应用的版本号,仅用于OpenHarmony管理该应用,不对应用的终端用户呈现。取值规则如下:API5及更早版本:二进制32位以内的非负整数,需要从version.name的值转换得到。转换规则为:code值=A&nbsp;\*&nbsp;1,000,000&nbsp;+&nbsp;B&nbsp;\*&nbsp;1,000&nbsp;+&nbsp;C例如,version.name字段取值为2.2.1,则code值为2002001。API6版本起:code的取值不与version.name字段的取值关联,开发者可自定义code取值,取值范围为2^31以内的非负整数,但是每次应用版本的更新,均需要更新code字段的值,新版本code取值必须大于旧版本code的值。 | 数值 | 不可缺省。 | | code | 标识应用的版本号,仅用于OpenHarmony管理该应用,不对应用的终端用户呈现。取值规则如下:API5及更早版本:二进制32位以内的非负整数,需要从version.name的值转换得到。转换规则为:code值=A&nbsp;\*&nbsp;1,000,000&nbsp;+&nbsp;B&nbsp;\*&nbsp;1,000&nbsp;+&nbsp;C例如,version.name字段取值为2.2.1,则code值为2002001。API6版本起:code的取值不与version.name字段的取值关联,开发者可自定义code取值,取值范围为2^31以内的非负整数,但是每次应用版本的更新,均需要更新code字段的值,新版本code取值必须大于旧版本code的值。 | 数值 | 不可缺省。 |
| minCompatibleVersionCode | 标识应用可兼容的最低版本号,用于跨设备场景下,判断其他设备上该应用的版本是否兼容。格式与version.code字段的格式要求相同。 | 数值 | 可缺省,缺省值为code标签值。 | | minCompatibleVersionCode | 标识应用可兼容的最低版本号,用于跨设备场景下,判断其他设备上该应用的版本是否兼容。格式与version.code字段的格式要求相同。 | 数值 | 可缺省,缺省值为code标签值。 |
#### **表3** **apiVersion内部结构** ## apiVersion内部结构
**表3** **apiVersion内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -30,7 +34,7 @@ app对象包含应用全局配置信息,内部结构如下: ...@@ -30,7 +34,7 @@ app对象包含应用全局配置信息,内部结构如下:
| target | 用于标识应用运行时使用的API版本,取值范围为0~2147483647。 | 数值 | 配置在build.profile中,打包时由IDE填充到config.json中。 | | target | 用于标识应用运行时使用的API版本,取值范围为0~2147483647。 | 数值 | 配置在build.profile中,打包时由IDE填充到config.json中。 |
| releaseType | 用于标识应用运行时SDK的状态。<br/>canary:面向特定开发者早期预览版本,不承诺质量,不承诺API稳定。<br/>beta:公开发布的Beta版本,早期Beta版本不承诺API稳定,经历若干次发布后,通过Release&nbsp;Notes对开发者声明该Beta版本为API稳定里程碑,后续版本的API冻结。<br/>release:正式发布版本,承诺质量,API不可变更。当版本处于此状态时版本号中不呈现Stage字段。 | 字符串 | 配置在build.profile中,打包时由IDE填充到config.json中。 | | releaseType | 用于标识应用运行时SDK的状态。<br/>canary:面向特定开发者早期预览版本,不承诺质量,不承诺API稳定。<br/>beta:公开发布的Beta版本,早期Beta版本不承诺API稳定,经历若干次发布后,通过Release&nbsp;Notes对开发者声明该Beta版本为API稳定里程碑,后续版本的API冻结。<br/>release:正式发布版本,承诺质量,API不可变更。当版本处于此状态时版本号中不呈现Stage字段。 | 字符串 | 配置在build.profile中,打包时由IDE填充到config.json中。 |
### app对象示例 app对象示例
```json ```json
"app": { "app": {
......
...@@ -267,7 +267,7 @@ struct MyComponent { ...@@ -267,7 +267,7 @@ struct MyComponent {
> >
> - 生成的子组件必须是允许包含在LazyForEach父容器组件中的子组件。 > - 生成的子组件必须是允许包含在LazyForEach父容器组件中的子组件。
> >
> - 允许LazyForEach包含在if/else条件渲染语句中,但不允许LazyForEach中出现if/else条件渲染语句 > - 允许LazyForEach包含在if/else条件渲染语句中。
> >
> - 为了高性能渲染,通过DataChangeListener对象的onDataChange方法来更新UI时,仅当itemGenerator中创建的子组件内使用了状态变量时,才会触发组件刷新。 > - 为了高性能渲染,通过DataChangeListener对象的onDataChange方法来更新UI时,仅当itemGenerator中创建的子组件内使用了状态变量时,才会触发组件刷新。
> >
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
deviceConfig包含设备上的应用配置信息,可以包含default,tv,car,wearable等属性。default标签内的配置适用于所有通用设备,其他设备类型如果有特殊的需求,则需要在该设备类型的标签下进行配置。 deviceConfig包含设备上的应用配置信息,可以包含default,tv,car,wearable等属性。default标签内的配置适用于所有通用设备,其他设备类型如果有特殊的需求,则需要在该设备类型的标签下进行配置。
### **表1** **deviceConfig对象内部结构说明** ## deviceConfig对象内部结构
**表1** **deviceConfig对象内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -16,7 +18,9 @@ deviceConfig包含设备上的应用配置信息,可以包含default,tv,ca ...@@ -16,7 +18,9 @@ deviceConfig包含设备上的应用配置信息,可以包含default,tv,ca
上表中各类设备对象的内部结构说明请见表2。 上表中各类设备对象的内部结构说明请见表2。
#### **表2** **deviceConfig设备对象内部结构说明** ## deviceConfig设备对象内部结构
**表2** **deviceConfig设备对象内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -26,27 +30,33 @@ deviceConfig包含设备上的应用配置信息,可以包含default,tv,ca ...@@ -26,27 +30,33 @@ deviceConfig包含设备上的应用配置信息,可以包含default,tv,ca
| compressNativeLibs | 标识libs库是否以压缩存储的方式打包到HAP。如果配置为"false",则libs库以不压缩的方式存储,HAP在安装时无需解压libs,运行时会直接从HAP内加载libs库。 | 布尔值 | 可缺省,缺省值为false。 | | compressNativeLibs | 标识libs库是否以压缩存储的方式打包到HAP。如果配置为"false",则libs库以不压缩的方式存储,HAP在安装时无需解压libs,运行时会直接从HAP内加载libs库。 | 布尔值 | 可缺省,缺省值为false。 |
| network | 标识网络安全性配置。该标签允许应用通过配置文件的安全声明来自定义其网络安全,无需修改应用代码。 | 对象 | 可缺省,缺省值为空。 | | network | 标识网络安全性配置。该标签允许应用通过配置文件的安全声明来自定义其网络安全,无需修改应用代码。 | 对象 | 可缺省,缺省值为空。 |
#### **表3** **network对象的内部结构说明** ## network对象的内部结构
**表3** **network对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| cleartextTraffic | 标识是否允许应用使用明文网络流量(例如,明文HTTP)。<br/>true:允许应用使用明文流量的请求。false:拒绝应用使用明文流量的请求。 | 布尔值 | 可缺省,缺省值为false。 | | cleartextTraffic | 标识是否允许应用使用明文网络流量(例如,明文HTTP)。<br/>true:允许应用使用明文流量的请求。false:拒绝应用使用明文流量的请求。 | 布尔值 | 可缺省,缺省值为false。 |
| securityConfig | 标识应用的网络安全配置信息。 | 对象 | 可缺省,缺省为空。 | | securityConfig | 标识应用的网络安全配置信息。 | 对象 | 可缺省,缺省为空。 |
#### **表4** **securityConfig对象的内部结构说明** ## securityConfig对象的内部结构
**表4** **securityConfig对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| domainSettings | 标识自定义的网域范围的安全配置,支持多层嵌套,即一个domainSettings对象中允许嵌套更小网域范围的domainSettings对象。 | 对象类型 | 可缺省,缺省为空。 | | domainSettings | 标识自定义的网域范围的安全配置,支持多层嵌套,即一个domainSettings对象中允许嵌套更小网域范围的domainSettings对象。 | 对象类型 | 可缺省,缺省为空。 |
#### **表5** **domainSettings对象内部结构说明** ## domainSettings对象内部结构
**表5** **domainSettings对象内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| cleartextPermitted | 标识自定义的网域范围内是否允许明文流量传输。当cleartextTraffic和security同时存在时,自定义网域是否允许明文流量传输以cleartextPermitted的取值为准。true:允许明文流量传输。false:拒绝明文流量传输。 | 布尔类型 | 可缺省,缺省值为空。 | | cleartextPermitted | 标识自定义的网域范围内是否允许明文流量传输。当cleartextTraffic和security同时存在时,自定义网域是否允许明文流量传输以cleartextPermitted的取值为准。true:允许明文流量传输。false:拒绝明文流量传输。 | 布尔类型 | 可缺省,缺省值为空。 |
| domains | 标识域名配置信息,包含两个参数:subdomains和name。subdomains(布尔类型):表示是否包含子域名。如果为"true",此网域规则将与相应网域及所有子网域(包括子网域的子网域)匹配。否则,该规则仅适用于精确匹配项。name(字符串):表示域名名称。 | 对象数组 | 可缺省,缺省值为空。 | | domains | 标识域名配置信息,包含两个参数:subdomains和name。subdomains(布尔类型):表示是否包含子域名。如果为"true",此网域规则将与相应网域及所有子网域(包括子网域的子网域)匹配。否则,该规则仅适用于精确匹配项。name(字符串):表示域名名称。 | 对象数组 | 可缺省,缺省值为空。 |
### deviceConfig示例 deviceConfig示例
```json ```json
"deviceConfig": { "deviceConfig": {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module对象包含HAP的配置信息。 module对象包含HAP的配置信息。
### **表1** **module对象内部结构说明** **表1** **module对象内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -89,7 +89,9 @@ module示例: ...@@ -89,7 +89,9 @@ module示例:
} }
``` ```
#### **表2** **distro对象内部结构说明** ## distro对象内部结构
**表2** **distro对象内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -110,7 +112,9 @@ distro示例: ...@@ -110,7 +112,9 @@ distro示例:
} }
``` ```
#### **表3** **metadata对象内部结构说明** ## metadata对象内部结构
**表3** **metadata对象内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -118,7 +122,9 @@ distro示例: ...@@ -118,7 +122,9 @@ distro示例:
| results | 标识Ability返回值的元信息。每个返回值的元信息由以下三个标签组成:description、name、type。 | 对象数组 | 可缺省,缺省值为空。 | | results | 标识Ability返回值的元信息。每个返回值的元信息由以下三个标签组成:description、name、type。 | 对象数组 | 可缺省,缺省值为空。 |
| customizeData | 该标签标识父级组件的自定义元信息,Parameters和results在application不可配。 | 对象数组 | 可缺省,缺省值为空。 | | customizeData | 该标签标识父级组件的自定义元信息,Parameters和results在application不可配。 | 对象数组 | 可缺省,缺省值为空。 |
#### **表4** **parameters对象内部结构说明** ## parameters对象内部结构
**表4** **parameters对象内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -126,7 +132,9 @@ distro示例: ...@@ -126,7 +132,9 @@ distro示例:
| name | 标识调用参数的名称。该标签最大长度为255个字节。 | 字符串 | 不可缺省。 | | name | 标识调用参数的名称。该标签最大长度为255个字节。 | 字符串 | 不可缺省。 |
| type | 标识调用参数的类型,如Integer。 | 字符串 | 不可缺省。 | | type | 标识调用参数的类型,如Integer。 | 字符串 | 不可缺省。 |
#### **表5** **results对象内部结构说明** ## results对象内部结构
**表5** **results对象内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -134,7 +142,9 @@ distro示例: ...@@ -134,7 +142,9 @@ distro示例:
| name | 标识返回值的名字。该标签最大长度为255个字节。 | 字符串 | 可缺省,缺省值为空。 | | name | 标识返回值的名字。该标签最大长度为255个字节。 | 字符串 | 可缺省,缺省值为空。 |
| type | 标识返回值的类型,如Integer。 | 字符串 | 不可缺省 | | type | 标识返回值的类型,如Integer。 | 字符串 | 不可缺省 |
#### **表6** **customizeData对象的内部结构说明** ## customizeData对象的内部结构
**表6** **customizeData对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -166,7 +176,9 @@ metadata对象示例: ...@@ -166,7 +176,9 @@ metadata对象示例:
} }
``` ```
#### **表7** **deviceType标签配置说明** ## deviceType标签
**表7** **deviceType标签配置说明**
| 设备类型 | 枚举值 | 说明 | | 设备类型 | 枚举值 | 说明 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
...@@ -176,7 +188,9 @@ metadata对象示例: ...@@ -176,7 +188,9 @@ metadata对象示例:
| 车机 | car | - | | 车机 | car | - |
| 默认设备 | default | 能够使用全部系统能力的OpenHarmony设备。 | | 默认设备 | default | 能够使用全部系统能力的OpenHarmony设备。 |
#### **表8** **abilities对象的内部结构说明** ## abilities对象的内部结构
**表8** **abilities对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -210,7 +224,9 @@ metadata对象示例: ...@@ -210,7 +224,9 @@ metadata对象示例:
| startWindowBackground | 标识该Ability启动页面背景颜色资源文件的索引。该标签仅适用于page类型的Ability。取值示例:$color:red。 | 字符串 | 可缺省,缺省值为空。 | | startWindowBackground | 标识该Ability启动页面背景颜色资源文件的索引。该标签仅适用于page类型的Ability。取值示例:$color:red。 | 字符串 | 可缺省,缺省值为空。 |
| removeMissionAfterTerminate | 该标签标识Ability销毁后是否从任务列表中移除任务。该标签仅适用于page类型的Ability。true表示销毁后移除任务,&nbsp;false表示销毁后不移除任务。 | 布尔值 | 可缺省,缺省值为false。 | | removeMissionAfterTerminate | 该标签标识Ability销毁后是否从任务列表中移除任务。该标签仅适用于page类型的Ability。true表示销毁后移除任务,&nbsp;false表示销毁后不移除任务。 | 布尔值 | 可缺省,缺省值为false。 |
#### **表9** **uriPermission对象的内部结构说明** ## uriPermission对象的内部结构
**表9** **uriPermission对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -286,8 +302,9 @@ abilities示例: ...@@ -286,8 +302,9 @@ abilities示例:
} }
] ]
``` ```
## skills对象的内部结构
#### **表10** **skills对象的内部结构说明** **表10** **skills对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -295,7 +312,9 @@ abilities示例: ...@@ -295,7 +312,9 @@ abilities示例:
| entities | 标识能够接收的want的Ability的类别(如视频、桌面应用等),可以包含一个或多个entity。 | 字符串数组 | 可缺省,缺省值为空。 | | entities | 标识能够接收的want的Ability的类别(如视频、桌面应用等),可以包含一个或多个entity。 | 字符串数组 | 可缺省,缺省值为空。 |
| uris | 该标签标识向want过滤器添加数据规范集合。该规范可以是只有数据类型(mimeType属性),可以是只有URI,也可以是既有数据类型又有URI。<br/>URI由其各个部分的单独属性指定:&lt;scheme&gt;://&lt;host&gt;:&lt;port&gt;[&lt;path&gt;\|&lt;pathStartWith&gt;\|&lt;pathRegex&gt;]。该标签可缺省,缺省值为空。<br/>其中,scheme字段配置为uri时必配;当只设置数据类型(mimeType)时,则scheme字段为非必配项。 | 对象数组 | 可缺省,缺省值为空。 | | uris | 该标签标识向want过滤器添加数据规范集合。该规范可以是只有数据类型(mimeType属性),可以是只有URI,也可以是既有数据类型又有URI。<br/>URI由其各个部分的单独属性指定:&lt;scheme&gt;://&lt;host&gt;:&lt;port&gt;[&lt;path&gt;\|&lt;pathStartWith&gt;\|&lt;pathRegex&gt;]。该标签可缺省,缺省值为空。<br/>其中,scheme字段配置为uri时必配;当只设置数据类型(mimeType)时,则scheme字段为非必配项。 | 对象数组 | 可缺省,缺省值为空。 |
#### **表11** **uris对象的内部结构说明** ## uris对象的内部结构
**表11** **uris对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -332,7 +351,9 @@ skills示例: ...@@ -332,7 +351,9 @@ skills示例:
] ]
``` ```
#### **表12** **reqPermissions权限申请字段说明** ## reqPermissions权限申请
**表12** **reqPermissions权限申请字段说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -340,14 +361,18 @@ skills示例: ...@@ -340,14 +361,18 @@ skills示例:
| reason | 描述申请权限的原因。需要做多语种适配。 | 字符串 | 分情况:当申请的权限为user_grant时,必须填写此字段,否则不允许在应用市场上架;其他权限可缺省,缺省为空 | | reason | 描述申请权限的原因。需要做多语种适配。 | 字符串 | 分情况:当申请的权限为user_grant时,必须填写此字段,否则不允许在应用市场上架;其他权限可缺省,缺省为空 |
| usedScene | 描述权限使用的场景和时机。场景类型如下两种:<br/>-&nbsp;ability:ability的名称,可配置多个。<br/>-&nbsp;when:调用时机,可填的值有inuse(使用时)、always(始终)。 | 对象 | 可缺省,缺省值为空。<br/>when可缺省,缺省值为"inuse" | | usedScene | 描述权限使用的场景和时机。场景类型如下两种:<br/>-&nbsp;ability:ability的名称,可配置多个。<br/>-&nbsp;when:调用时机,可填的值有inuse(使用时)、always(始终)。 | 对象 | 可缺省,缺省值为空。<br/>when可缺省,缺省值为"inuse" |
#### **表13** **usedScene对象内部结构说明** ## usedScene对象内部结构
**表13** **usedScene对象内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| ability | 标识哪些Ability需要此权限,里面配置Ability的名称。 | 字符串数组 | 可以缺省,缺省表示所有Ability都需要此权限。 | | ability | 标识哪些Ability需要此权限,里面配置Ability的名称。 | 字符串数组 | 可以缺省,缺省表示所有Ability都需要此权限。 |
| when | 标识此权限的使用时间:<br/>inuse:&nbsp;使用时需要此权限。<br/>always:&nbsp;所有时间都需要此权限。 | 枚举值 | 可缺省,缺省值为空。 | | when | 标识此权限的使用时间:<br/>inuse:&nbsp;使用时需要此权限。<br/>always:&nbsp;所有时间都需要此权限。 | 枚举值 | 可缺省,缺省值为空。 |
#### **表14** **js对象的内部结构说明** ## js对象的内部结构
**表14** **js对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -357,14 +382,18 @@ skills示例: ...@@ -357,14 +382,18 @@ skills示例:
| type | 标识JS应用的类型。取值范围如下:<br/>normal:标识该JS&nbsp;Component为应用实例。<br/>form:标识该JS&nbsp;Component为卡片实例。 | 字符串 | 可缺省,缺省值为"normal"。 | | type | 标识JS应用的类型。取值范围如下:<br/>normal:标识该JS&nbsp;Component为应用实例。<br/>form:标识该JS&nbsp;Component为卡片实例。 | 字符串 | 可缺省,缺省值为"normal"。 |
|mode | 定义JS组件的开发模式。 | 对象 | 可缺省,缺省值为空。 | |mode | 定义JS组件的开发模式。 | 对象 | 可缺省,缺省值为空。 |
#### **表15** **window对象的内部结构说明** ## window对象的内部结构
**表15** **window对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| designWidth | 标识页面设计基准宽度。以此为基准,根据实际设备宽度来缩放元素大小。 | 数值 | 可缺省,缺省值为720px。 | | designWidth | 标识页面设计基准宽度。以此为基准,根据实际设备宽度来缩放元素大小。 | 数值 | 可缺省,缺省值为720px。 |
| autoDesignWidth | 标识页面设计基准宽度是否自动计算。当配置为true时,designWidth将会被忽略,设计基准宽度由设备宽度与屏幕密度计算得出。 | 布尔值 | 可缺省,缺省值为false。 | | autoDesignWidth | 标识页面设计基准宽度是否自动计算。当配置为true时,designWidth将会被忽略,设计基准宽度由设备宽度与屏幕密度计算得出。 | 布尔值 | 可缺省,缺省值为false。 |
#### **表16** **mode对象的内部结构说明** ## mode对象的内部结构
**表16** **mode对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -391,7 +420,9 @@ js示例: ...@@ -391,7 +420,9 @@ js示例:
] ]
``` ```
#### **表17** **shortcuts对象的内部结构说明** ## shortcuts对象的内部结构
**表17** **shortcuts对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -400,7 +431,9 @@ js示例: ...@@ -400,7 +431,9 @@ js示例:
| icon | 标识快捷方式的图标信息。取值为表示icon的资源索引。 | 字符串 | 可缺省,缺省为空。 | | icon | 标识快捷方式的图标信息。取值为表示icon的资源索引。 | 字符串 | 可缺省,缺省为空。 |
| intents | 标识快捷方式内定义的目标intent信息集合,每个intent可配置两个子标签,targetClass,&nbsp;targetBundle。 | 对象数组 | 可缺省,缺省为空。 | | intents | 标识快捷方式内定义的目标intent信息集合,每个intent可配置两个子标签,targetClass,&nbsp;targetBundle。 | 对象数组 | 可缺省,缺省为空。 |
#### **表18** **intents对象的内部结构说明** ## intents对象的内部结构
**表18** **intents对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -426,7 +459,9 @@ shortcuts示例: ...@@ -426,7 +459,9 @@ shortcuts示例:
] ]
``` ```
#### **表19** **forms对象的内部结构说明** ## forms对象的内部结构
**表19** **forms对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -445,7 +480,9 @@ shortcuts示例: ...@@ -445,7 +480,9 @@ shortcuts示例:
| metaData | 标识卡片的自定义信息,包含customizeData数组标签。 | 对象 | 可缺省,缺省值为空。 | | metaData | 标识卡片的自定义信息,包含customizeData数组标签。 | 对象 | 可缺省,缺省值为空。 |
| customizeData | 标识自定义的卡片信息。 | 对象数组 | 可缺省,缺省值为空。 | | customizeData | 标识自定义的卡片信息。 | 对象数组 | 可缺省,缺省值为空。 |
#### **表20** **customizeData对象内部结构说明** ## customizeData对象内部结构
**表20** **customizeData对象内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -507,7 +544,9 @@ forms示例: ...@@ -507,7 +544,9 @@ forms示例:
] ]
``` ```
#### **表21** **distroFilter对象的内部结构说明** ## distroFilter对象的内部结构
**表21** **distroFilter对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -517,35 +556,45 @@ forms示例: ...@@ -517,35 +556,45 @@ forms示例:
|screenDensity | 标识屏幕的像素密度(dpi:Dots&nbsp;Per&nbsp;Inch)。 | 对象数组 | 可缺省,缺省值为空。 | |screenDensity | 标识屏幕的像素密度(dpi:Dots&nbsp;Per&nbsp;Inch)。 | 对象数组 | 可缺省,缺省值为空。 |
| countryCode | 标识分发应用时的国家码。具体值参考ISO-3166-1的标准,支持多个国家和地区的枚举定义。 | 对象数组 | 可缺省,缺省值为空。 | | countryCode | 标识分发应用时的国家码。具体值参考ISO-3166-1的标准,支持多个国家和地区的枚举定义。 | 对象数组 | 可缺省,缺省值为空。 |
#### **表22** **apiVersion对象的内部结构说明** ## apiVersion对象的内部结构
**表22** **apiVersion对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| policy | 标识该子属性取值规则。配置为“exclude”或“include”。<br/>-&nbsp;exclude:表示需要排除的value属性。<br/>-&nbsp;include:表示需要包含的value属性。 | 字符串 | 不可缺省。 | | policy | 标识该子属性取值规则。配置为“exclude”或“include”。<br/>-&nbsp;exclude:表示需要排除的value属性。<br/>-&nbsp;include:表示需要包含的value属性。 | 字符串 | 不可缺省。 |
| value | 支持的取值为API&nbsp;Version存在的整数值,例如4、5、6。场景示例:某应用,针对相同设备型号,同时在网的为使用API&nbsp;5和API&nbsp;6开发的两个软件版本,则允许上架2个entry类型的安装包,分别支持到对应设备侧软件版本的分发。 | 数组 | 不可缺省。 | | value | 支持的取值为API&nbsp;Version存在的整数值,例如4、5、6。场景示例:某应用,针对相同设备型号,同时在网的为使用API&nbsp;5和API&nbsp;6开发的两个软件版本,则允许上架2个entry类型的安装包,分别支持到对应设备侧软件版本的分发。 | 数组 | 不可缺省。 |
#### **表23** **screenShape对象的内部结构说明** ## screenShape对象的内部结构
**表23** **screenShape对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| policy | 标识该子属性取值规则。配置为“exclude”或“include”。<br/>-&nbsp;exclude:表示需要排除的value属性。<br/>-&nbsp;include:表示需要包含的value属性。 | 字符串 | 不可缺省。 | | policy | 标识该子属性取值规则。配置为“exclude”或“include”。<br/>-&nbsp;exclude:表示需要排除的value属性。<br/>-&nbsp;include:表示需要包含的value属性。 | 字符串 | 不可缺省。 |
| value | 支持的取值为API&nbsp;Version存在的整数值,例如4、5、6。场景示例:某应用,针对相同设备型号,同时在网的为使用API&nbsp;5和API&nbsp;6开发的两个软件版本,则允许上架2个entry类型的安装包,分别支持到对应设备侧软件版本的分发。 | 数组 | 不可缺省。 | | value | 支持的取值为API&nbsp;Version存在的整数值,例如4、5、6。场景示例:某应用,针对相同设备型号,同时在网的为使用API&nbsp;5和API&nbsp;6开发的两个软件版本,则允许上架2个entry类型的安装包,分别支持到对应设备侧软件版本的分发。 | 数组 | 不可缺省。 |
#### **表24** **screenWindow对象的内部结构说明** ## screenWindow对象的内部结构
**表24** **screenWindow对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| policy | 标识该子属性取值规则。配置为“exclude”或“include”。<br/>-&nbsp;exclude:表示需要排除的value属性。<br/>-&nbsp;include:表示需要包含的value属性。 | 字符串 | 不可缺省。 | | policy | 标识该子属性取值规则。配置为“exclude”或“include”。<br/>-&nbsp;exclude:表示需要排除的value属性。<br/>-&nbsp;include:表示需要包含的value属性。 | 字符串 | 不可缺省。 |
| value | 支持的取值为API&nbsp;Version存在的整数值,例如4、5、6。场景示例:某应用,针对相同设备型号,同时在网的为使用API&nbsp;5和API&nbsp;6开发的两个软件版本,则允许上架2个entry类型的安装包,分别支持到对应设备侧软件版本的分发。 | 数组 | 不可缺省。 | | value | 支持的取值为API&nbsp;Version存在的整数值,例如4、5、6。场景示例:某应用,针对相同设备型号,同时在网的为使用API&nbsp;5和API&nbsp;6开发的两个软件版本,则允许上架2个entry类型的安装包,分别支持到对应设备侧软件版本的分发。 | 数组 | 不可缺省。 |
#### **表25** **screenDensity对象的内部结构说明** ## screenDensity对象的内部结构
**表25** **screenDensity对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| policy | 标识该子属性取值规则。配置为“exclude”或“include”。<br/>-&nbsp;exclude:表示需要排除的value属性。<br/>-&nbsp;include:表示需要包含的value属性。 | 字符串 | 不可缺省。 | | policy | 标识该子属性取值规则。配置为“exclude”或“include”。<br/>-&nbsp;exclude:表示需要排除的value属性。<br/>-&nbsp;include:表示需要包含的value属性。 | 字符串 | 不可缺省。 |
| value | 取值范围如下:<br/>sdpi:表示小规模的屏幕密度(Small-scale&nbsp;Dots&nbsp;Per&nbsp;Inch),适用于dpi取值为(0,120]的设备。<br/>mdpi:表示中规模的屏幕密度(Medium-scale&nbsp;Dots&nbsp;Per&nbsp;Inch),适用于dpi取值为(120,160]的设备。<br/>ldpi:表示大规模的屏幕密度(Large-scale&nbsp;Dots&nbsp;Per&nbsp;Inch),适用于dpi取值为(160,240]的设备。<br/>xldpi:表示特大规模的屏幕密度(Extra&nbsp;Large-scale&nbsp;Dots&nbsp;Per&nbsp;Inch),适用于dpi取值为(240,320]的设备。<br/>xxldpi:表示超大规模的屏幕密度(Extra&nbsp;Extra&nbsp;Large-scale&nbsp;Dots&nbsp;Per&nbsp;Inch),适用于dpi取值为(320,480]的设备。<br/>xxxldpi:表示超特大规模的屏幕密度(Extra&nbsp;Extra&nbsp;Extra&nbsp;Large-scale&nbsp;Dots&nbsp;Per&nbsp;Inch),适用于dpi取值为(480,640]的设备。 | 数组 | 不可缺省。 | | value | 取值范围如下:<br/>sdpi:表示小规模的屏幕密度(Small-scale&nbsp;Dots&nbsp;Per&nbsp;Inch),适用于dpi取值为(0,120]的设备。<br/>mdpi:表示中规模的屏幕密度(Medium-scale&nbsp;Dots&nbsp;Per&nbsp;Inch),适用于dpi取值为(120,160]的设备。<br/>ldpi:表示大规模的屏幕密度(Large-scale&nbsp;Dots&nbsp;Per&nbsp;Inch),适用于dpi取值为(160,240]的设备。<br/>xldpi:表示特大规模的屏幕密度(Extra&nbsp;Large-scale&nbsp;Dots&nbsp;Per&nbsp;Inch),适用于dpi取值为(240,320]的设备。<br/>xxldpi:表示超大规模的屏幕密度(Extra&nbsp;Extra&nbsp;Large-scale&nbsp;Dots&nbsp;Per&nbsp;Inch),适用于dpi取值为(320,480]的设备。<br/>xxxldpi:表示超特大规模的屏幕密度(Extra&nbsp;Extra&nbsp;Extra&nbsp;Large-scale&nbsp;Dots&nbsp;Per&nbsp;Inch),适用于dpi取值为(480,640]的设备。 | 数组 | 不可缺省。 |
#### **表26** **countryCode对象的内部结构说明** ## countryCode对象的内部结构
**表26** **countryCode对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -580,7 +629,9 @@ distroFilter示例: ...@@ -580,7 +629,9 @@ distroFilter示例:
} }
``` ```
#### **表27** **commonEvents对象的内部结构说明** ## commonEvents对象的内部结构
**表27** **commonEvents对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -610,7 +661,9 @@ commonEvents示例: ...@@ -610,7 +661,9 @@ commonEvents示例:
] ]
``` ```
#### **表28** **testRunner对象的内部结构说明** ## testRunner对象的内部结构
**表28** **testRunner对象的内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
...@@ -627,7 +680,8 @@ commonEvents示例: ...@@ -627,7 +680,8 @@ commonEvents示例:
definePermission仅支持系统应用配置,三方应用配置不生效。 definePermission仅支持系统应用配置,三方应用配置不生效。
#### **表29** **definePermissions对象内部结构说明** ## definePermissions对象内部结构
**表29** **definePermissions对象内部结构说明**
| 属性名称 | 含义 | 数据类型 | 是否可缺省 | | 属性名称 | 含义 | 数据类型 | 是否可缺省 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
......
...@@ -203,7 +203,7 @@ cryptoCert.createX509Cert(encodingBlob, function (error, x509Cert) { ...@@ -203,7 +203,7 @@ cryptoCert.createX509Cert(encodingBlob, function (error, x509Cert) {
console.log("createX509Cert failed, errCode: " + error.code + ", errMsg: " + error.message); console.log("createX509Cert failed, errCode: " + error.code + ", errMsg: " + error.message);
} else { } else {
console.log("createX509Cert success"); console.log("createX509Cert success");
// 业务需通过AsyKeyGenerator生成PubKey或通过上级X509Cert证书对象的getPublicKey获取PubKey // 业务需通过上级X509Cert证书对象的getPublicKey获取PubKey
let pubKey = null; let pubKey = null;
x509Cert.verify(pubKey, function (error, data) { x509Cert.verify(pubKey, function (error, data) {
if (error != null) { if (error != null) {
...@@ -355,8 +355,7 @@ getPublicKey() : cryptoFramework.PubKey ...@@ -355,8 +355,7 @@ getPublicKey() : cryptoFramework.PubKey
| 类型 | 说明 | | 类型 | 说明 |
| ------ | ---------------- | | ------ | ---------------- |
| cryptoFramework.PubKey | X509证书公钥对象 | | cryptoFramework.PubKey | X509证书公钥对象:仅用于X509Cert的verify接口 |
**示例:** **示例:**
...@@ -398,8 +397,7 @@ checkValidityWithDate(date: string) : void ...@@ -398,8 +397,7 @@ checkValidityWithDate(date: string) : void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------- | ---- | ---------- | | -------- | -------------- | ---- | ---------- |
| date | string | 是 | 日期 | | date | string | 是 | 日期(格式:YYMMDDHHMMSSZ 或 YYYYMMDDHHMMSSZ,时间必须以Z结尾:表示标准时间) |
**示例:** **示例:**
...@@ -584,9 +582,9 @@ getNotBeforeTime() : string ...@@ -584,9 +582,9 @@ getNotBeforeTime() : string
**返回值** **返回值**
| 类型 | 说明 | | 类型 | 说明 |
| ------ | -------------------------- | | ------ | ------------------------------------------------------------ |
| string | 表示X509证书有效期起始时间 | | string | 表示X509证书有效期起始时间(格式:YYMMDDHHMMSSZ 或 YYYYMMDDHHMMSSZ,时间以Z结尾:表示标准时间) |
**示例:** **示例:**
...@@ -620,9 +618,9 @@ getNotAfterTime() : string ...@@ -620,9 +618,9 @@ getNotAfterTime() : string
**返回值** **返回值**
| 类型 | 说明 | | 类型 | 说明 |
| ------ | -------------------------- | | ------ | ------------------------------------------------------------ |
| string | 表示X509证书有效期截止时间 | | string | 表示X509证书有效期截止时间(格式:YYMMDDHHMMSSZ 或 YYYYMMDDHHMMSSZ,时间以Z结尾:表示标准时间) |
**示例:** **示例:**
......
...@@ -58,7 +58,7 @@ stepsCurve(count: number, end: boolean):ICurve ...@@ -58,7 +58,7 @@ stepsCurve(count: number, end: boolean):ICurve
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ----| ------------------------------------------------------------ | | ------ | ------- | ----| ------------------------------------------------------------ |
| count | number | 是 | 阶梯的数量,需要为正整数。 | | count | number | 是 | 阶梯的数量,需要为正整数。 |
| end | boolean | 是 | 在每个间隔的起点或是终点发生阶跃变化。<br>-true:在终点发生阶跃变化。<br>-false:在起点发生阶跃变化。 | | end | boolean | 是 | 在每个间隔的起点或是终点发生阶跃变化。<br>-true:在终点发生阶跃变化。<br>-false在起点发生阶跃变化。 |
**返回值:** **返回值:**
......
...@@ -47,25 +47,21 @@ pushUrl(options: RouterOptions): Promise&lt;void&gt; ...@@ -47,25 +47,21 @@ pushUrl(options: RouterOptions): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
try { router.pushUrl({
router.pushUrl({ url: 'pages/routerpage2',
url: 'pages/routerpage2', params: {
params: { data1: 'message',
data1: 'message', data2: {
data2: { data3: [123, 456, 789]
data3: [123, 456, 789]
}
} }
}
})
.then(() => {
// success
})
.catch(err => {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
}) })
.then(() => {
// success
})
.catch(err => {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
})
} catch (error) {
console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`);
};
``` ```
## router.pushUrl<sup>9+</sup> ## router.pushUrl<sup>9+</sup>
...@@ -96,25 +92,21 @@ pushUrl(options: RouterOptions, callback: AsyncCallback&lt;void&gt;): void ...@@ -96,25 +92,21 @@ pushUrl(options: RouterOptions, callback: AsyncCallback&lt;void&gt;): void
**示例:** **示例:**
```js ```js
try { router.pushUrl({
router.pushUrl({ url: 'pages/routerpage2',
url: 'pages/routerpage2', params: {
params: { data1: 'message',
data1: 'message', data2: {
data2: { data3: [123, 456, 789]
data3: [123, 456, 789]
}
}
}, (err) => {
if (err) {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
return;
} }
console.info('pushUrl success'); }
}); })
} catch (error) { .then(() => {
console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`); // success
}; })
.catch(err => {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
})
``` ```
## router.pushUrl<sup>9+</sup> ## router.pushUrl<sup>9+</sup>
...@@ -135,7 +127,7 @@ pushUrl(options: RouterOptions, mode: RouterMode): Promise&lt;void&gt; ...@@ -135,7 +127,7 @@ pushUrl(options: RouterOptions, mode: RouterMode): Promise&lt;void&gt;
| 类型 | 说明 | | 类型 | 说明 |
| ------------------- | --------- | | ------------------- | --------- |
| Promise&lt;void&gt; | 异常返回结果 | | Promise&lt;void&gt; | 异常返回结果 |
**错误码:** **错误码:**
...@@ -150,25 +142,21 @@ pushUrl(options: RouterOptions, mode: RouterMode): Promise&lt;void&gt; ...@@ -150,25 +142,21 @@ pushUrl(options: RouterOptions, mode: RouterMode): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
try { router.pushUrl({
router.pushUrl({ url: 'pages/routerpage2',
url: 'pages/routerpage2', params: {
params: { data1: 'message',
data1: 'message', data2: {
data2: { data3: [123, 456, 789]
data3: [123, 456, 789]
}
} }
}, router.RouterMode.Standard) }
.then(() => { }, router.RouterMode.Standard)
// success .then(() => {
}) // success
.catch(err => { })
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); .catch(err => {
}) console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
} catch (error) { })
console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`);
};
``` ```
## router.pushUrl<sup>9+</sup> ## router.pushUrl<sup>9+</sup>
...@@ -185,7 +173,7 @@ pushUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback&lt;voi ...@@ -185,7 +173,7 @@ pushUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback&lt;voi
| ------- | ------------------------------- | ---- | ---------- | | ------- | ------------------------------- | ---- | ---------- |
| options | [RouterOptions](#routeroptions) | 是 | 跳转页面描述信息。 | | options | [RouterOptions](#routeroptions) | 是 | 跳转页面描述信息。 |
| mode | [RouterMode](#routermode9) | 是 | 跳转页面使用的模式。 | | mode | [RouterMode](#routermode9) | 是 | 跳转页面使用的模式。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 异常响应回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 异常响应回调。 |
**错误码:** **错误码:**
...@@ -200,25 +188,21 @@ pushUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback&lt;voi ...@@ -200,25 +188,21 @@ pushUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback&lt;voi
**示例:** **示例:**
```js ```js
try { router.pushUrl({
router.pushUrl({ url: 'pages/routerpage2',
url: 'pages/routerpage2', params: {
params: { data1: 'message',
data1: 'message', data2: {
data2: { data3: [123, 456, 789]
data3: [123, 456, 789]
}
}
}, router.RouterMode.Standard, (err) => {
if (err) {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
return;
} }
console.info('pushUrl success'); }
}); }, router.RouterMode.Standard, (err) => {
} catch (error) { if (err) {
console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`); console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
}; return;
}
console.info('pushUrl success');
})
``` ```
## router.replaceUrl<sup>9+</sup> ## router.replaceUrl<sup>9+</sup>
...@@ -253,22 +237,18 @@ replaceUrl(options: RouterOptions): Promise&lt;void&gt; ...@@ -253,22 +237,18 @@ replaceUrl(options: RouterOptions): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
try { router.replaceUrl({
router.replaceUrl({ url: 'pages/detail',
url: 'pages/detail', params: {
params: { data1: 'message'
data1: 'message' }
} })
.then(() => {
// success
})
.catch(err => {
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`);
}) })
.then(() => {
// success
})
.catch(err => {
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`);
})
} catch (error) {
console.error(`replaceUrl args error code is ${error.code}, message is ${error.message}`);
};
``` ```
## router.replaceUrl<sup>9+</sup> ## router.replaceUrl<sup>9+</sup>
...@@ -284,7 +264,7 @@ replaceUrl(options: RouterOptions, callback: AsyncCallback&lt;void&gt;): void ...@@ -284,7 +264,7 @@ replaceUrl(options: RouterOptions, callback: AsyncCallback&lt;void&gt;): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------------------- | ---- | ------------------ | | ------- | ------------------------------- | ---- | ------------------ |
| options | [RouterOptions](#routeroptions) | 是 | 替换页面描述信息。 | | options | [RouterOptions](#routeroptions) | 是 | 替换页面描述信息。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 异常响应回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 异常响应回调。 |
**错误码:** **错误码:**
...@@ -298,22 +278,18 @@ replaceUrl(options: RouterOptions, callback: AsyncCallback&lt;void&gt;): void ...@@ -298,22 +278,18 @@ replaceUrl(options: RouterOptions, callback: AsyncCallback&lt;void&gt;): void
**示例:** **示例:**
```js ```js
try { router.replaceUrl({
router.replaceUrl({ url: 'pages/detail',
url: 'pages/detail', params: {
params: { data1: 'message'
data1: 'message' }
} }, (err) => {
}, (err) => { if (err) {
if (err) { console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`);
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); return;
return; }
} console.info('replaceUrl success');
console.info('replaceUrl success'); })
});
} catch (error) {
console.error(`replaceUrl args error code is ${error.code}, message is ${error.message}`);
};
``` ```
## router.replaceUrl<sup>9+</sup> ## router.replaceUrl<sup>9+</sup>
...@@ -350,22 +326,18 @@ replaceUrl(options: RouterOptions, mode: RouterMode): Promise&lt;void&gt; ...@@ -350,22 +326,18 @@ replaceUrl(options: RouterOptions, mode: RouterMode): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
try { router.replaceUrl({
router.replaceUrl({ url: 'pages/detail',
url: 'pages/detail', params: {
params: { data1: 'message'
data1: 'message' }
} }, router.RouterMode.Standard)
}, router.RouterMode.Standard) .then(() => {
.then(() => { // success
// success })
}) .catch(err => {
.catch(err => { console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`);
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); })
})
} catch (error) {
console.error(`replaceUrl args error code is ${error.code}, message is ${error.message}`);
};
``` ```
## router.replaceUrl<sup>9+</sup> ## router.replaceUrl<sup>9+</sup>
...@@ -382,7 +354,7 @@ replaceUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback&lt; ...@@ -382,7 +354,7 @@ replaceUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback&lt;
| ------- | ------------------------------- | ---- | ---------- | | ------- | ------------------------------- | ---- | ---------- |
| options | [RouterOptions](#routeroptions) | 是 | 替换页面描述信息。 | | options | [RouterOptions](#routeroptions) | 是 | 替换页面描述信息。 |
| mode | [RouterMode](#routermode9) | 是 | 跳转页面使用的模式。 | | mode | [RouterMode](#routermode9) | 是 | 跳转页面使用的模式。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 异常响应回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 异常响应回调。 |
**错误码:** **错误码:**
...@@ -396,22 +368,19 @@ replaceUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback&lt; ...@@ -396,22 +368,19 @@ replaceUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback&lt;
**示例:** **示例:**
```js ```js
try { router.replaceUrl({
router.replaceUrl({ url: 'pages/detail',
url: 'pages/detail', params: {
params: { data1: 'message'
data1: 'message' }
} }, router.RouterMode.Standard, (err) => {
}, router.RouterMode.Standard, (err) => { if (err) {
if (err) { console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`);
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); return;
return; }
} console.info('replaceUrl success');
console.info('replaceUrl success'); });
});
} catch (error) {
console.error(`replaceUrl args error code is ${error.code}, message is ${error.message}`);
};
``` ```
## router.back ## router.back
...@@ -571,9 +540,9 @@ getParams(): Object ...@@ -571,9 +540,9 @@ getParams(): Object
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------ | ----------------- | | ------ | ---------------------------------- |
| Object | 发起跳转的页面往当前页传入的参数。 | | object | 发起跳转的页面往当前页传入的参数。 |
**示例:** **示例:**
...@@ -636,7 +605,7 @@ export default { ...@@ -636,7 +605,7 @@ export default {
### 基于TS扩展的声明式开发范式 ### 基于TS扩展的声明式开发范式
```ts ```ts
// 通过router.push跳转至目标页携带params参数 // 通过router.pushUrl跳转至目标页携带params参数
import router from '@ohos.router' import router from '@ohos.router'
@Entry @Entry
......
...@@ -395,6 +395,6 @@ export default { ...@@ -395,6 +395,6 @@ export default {
## ParamsInterface ## ParamsInterface
| 名称 | 参数类型 | 说明 | | 名称 | 参数类型 | 说明 |
| ------------- | ------ | ------- | | ------------- | -------- | -------------- |
| [key: string] | Object | 路由参数列表。 | | [key: string] | object | 路由参数列表。 |
...@@ -70,12 +70,12 @@ import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern ...@@ -70,12 +70,12 @@ import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern
**系统能力**:SystemCapability.Test.UiTest **系统能力**:SystemCapability.Test.UiTest
| 名称 | 类型 | 可读 | 可写 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ------- | ------ | ---- | ---- | ------------------------- | | ------ | ------ | ---- | ---- | ------------------------- |
| leftX | number | 是 | 否 | 控件边框的左上角的X坐标。 | | left | number | 是 | 否 | 控件边框的左上角的X坐标。 |
| topY | number | 是 | 否 | 控件边框的左上角的Y坐标。 | | top | number | 是 | 否 | 控件边框的左上角的Y坐标。 |
| rightX | number | 是 | 否 | 控件边框的右下角的X坐标。 | | right | number | 是 | 否 | 控件边框的右下角的X坐标。 |
| bottomY | number | 是 | 否 | 控件边框的右下角的Y坐标。 | | bottom | number | 是 | 否 | 控件边框的右下角的Y坐标。 |
## WindowMode<sup>9+</sup> ## WindowMode<sup>9+</sup>
......
# ListItem # ListItem
用来展示列表具体item,宽度默认充满List组件,必须配合List来使用。 用来展示列表具体item,必须配合List来使用。
> **说明:** > **说明:**
> >
......
...@@ -131,7 +131,7 @@ scrollToIndex(value: number): void ...@@ -131,7 +131,7 @@ scrollToIndex(value: number): void
> **说明:** > **说明:**
> >
> 仅支持list组件。 > 仅支持Grid、list、WaterFlow组件。
**参数:** **参数:**
......
...@@ -60,4 +60,20 @@ struct TransitionExample { ...@@ -60,4 +60,20 @@ struct TransitionExample {
} }
``` ```
![animateTo](figures/animateTo.gif) 示意图:
\ No newline at end of file
图片完全显示时:
![animationComponent1](figures/animationComponent1.png)
图片消失时配置顺时针旋转180°的过渡效果:
![animationComponent3](figures/animationComponent3.png)
图片完全消失时:
![animationComponent2](figures/animationComponent2.png)
图片显示时配置横向放大一倍的过渡效果:
![animationComponent4](figures/animationComponent4.png)
\ No newline at end of file
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
] ]
``` ```
实际开发中,开发者可以自定义更多的数据资源,当食物资源很多时,建议使用数据懒加载LazyForEach 实际开发中,开发者可以自定义更多的数据资源,当食物资源很多时,建议使用[数据懒加载LazyForEach](../quick-start/arkts-rendering-control.md#数据懒加载)
5. 创建initializeOnStartUp方法来初始化FoodData的数组。在FoodDataModels.ets中使用了定义在FoodData.ets的FoodData和Category,所以要将FoodData.ets的FoodData类export,在FoodDataModels.ets内import FoodData和Category。 5. 创建initializeOnStartUp方法来初始化FoodData的数组。在FoodDataModels.ets中使用了定义在FoodData.ets的FoodData和Category,所以要将FoodData.ets的FoodData类export,在FoodDataModels.ets内import FoodData和Category。
```ts ```ts
......
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
栅格系统以设备的水平宽度(屏幕密度像素值,单位vp)作为断点依据,定义设备的宽度类型,形成了一套断点规则。开发者可根据需求在不同的断点区间实现不同的页面布局效果。 栅格系统以设备的水平宽度(屏幕密度像素值,单位vp)作为断点依据,定义设备的宽度类型,形成了一套断点规则。开发者可根据需求在不同的断点区间实现不同的页面布局效果。
栅格系统默认断点将设备宽度分为xs、sm、md、lg四类,尺寸范围如下: 栅格系统默认断点将设备宽度分为xs、sm、md、lg四类,尺寸范围如下:
| 断点名称 | 取值范围(vp)| | 断点名称 | 取值范围(vp)|
| --------| ------ | | --------| ------ |
| xs | [0, 320) | | xs | [0, 320) |
| sm | [320, 520) | | sm | [320, 520) |
| md | [520, 840) | | md | [520, 840) |
| lg | [840, +∞) | | lg | [840, +∞) |
在GridRow新栅格组件中,允许开发者使用breakpoints自定义修改断点的取值范围,最多支持6个断点,除了默认的四个断点外, 在GridRow新栅格组件中,允许开发者使用breakpoints自定义修改断点的取值范围,最多支持6个断点,除了默认的四个断点外,
还可以启用xl,xxl两个断点,支持六种不同尺寸(xs, sm, md, lg, xl, xxl)设备的布局设置。 还可以启用xl,xxl两个断点,支持六种不同尺寸(xs, sm, md, lg, xl, xxl)设备的布局设置。
...@@ -88,10 +88,10 @@ GridRow({ ...@@ -88,10 +88,10 @@ GridRow({
}.backgroundColor(color) }.backgroundColor(color)
}) })
} }
``` ```
![](figures/breakpoints.gif) ![](figures/breakpoints.gif)
### 栅格布局的总列数 ### 栅格布局的总列数
...@@ -333,8 +333,8 @@ GridCol组件作为GridRow组件的子组件,通过给GridCol传参或者设 ...@@ -333,8 +333,8 @@ GridCol组件作为GridRow组件的子组件,通过给GridCol传参或者设
### order ### order
栅格子组件的序号,决定子组件排列次序。当子组件不设置order或者设置相同的order, 子组件按照代码顺序展示。当子组件设置不同的order时,order较大的组件在前,较小的在后。 栅格子组件的序号,决定子组件排列次序。当子组件不设置order或者设置相同的order, 子组件按照代码顺序展示。当子组件设置不同的order时,order较小的组件在前,较大的在后。
当子组件部分设置order,部分不设置order时,未设置order的子组件依次排序靠前,设置了order的子组件按照数值从大到小排列。 当子组件部分设置order,部分不设置order时,未设置order的子组件依次排序靠前,设置了order的子组件按照数值从小到大排列。
- 当类型为number时,子组件在任何尺寸下排序次序一致。 - 当类型为number时,子组件在任何尺寸下排序次序一致。
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
``` ```
/base/global /base/global
├── i18n_standard # 国际化框架代码仓 ├── i18n # 国际化框架代码仓
│ ├── frameworks # 国际化框架核心代码 │ ├── frameworks # 国际化框架核心代码
│ ├── interfaces # 国际化框架接口 │ ├── interfaces # 国际化框架接口
│ │ ├── js # 国际化框架JavaScript接口 │ │ ├── js # 国际化框架JavaScript接口
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
[global\_i18n\_lite](https://gitee.com/openharmony/global_i18n_lite) [global\_i18n\_lite](https://gitee.com/openharmony/global_i18n_lite)
[global\_i18n\_standard](https://gitee.com/openharmony/global_i18n_standard) [global\_i18n](https://gitee.com/openharmony/global_i18n)
[global\_resmgr\_lite](https://gitee.com/openharmony/global_resmgr_lite) [global\_resmgr\_lite](https://gitee.com/openharmony/global_resmgr_lite)
......
...@@ -76,8 +76,8 @@ function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number) ...@@ -76,8 +76,8 @@ function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number)
``` ```
从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts: 从@ohos.data.rdb.d.ts 迁移至@ohos.data.relationalStore.d.ts:
``` ```
function getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback<RdbStore>): void; function getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback<RdbStore>): void;
function getRdbStore(context: Context, config: StoreConfig, version: number): Promise<RdbStore>; function getRdbStore(context: Context, config: StoreConfig): Promise<RdbStore>;
``` ```
**适配指导** **适配指导**
......
# 测试子系统ChangeLog
## cl.testfwk_arkxtest.1 Rect控件边框信息类接口名称变更
表示控件边框信息的枚举类型Rect定义自4.0.2.1版本起进行了变更。
## 变更影响
此变更影响@ohos.uitest提供的Rect接口。用户此前在测试用例开发中使用了@ohos.uitest-api9 中Rect接口的,需要进行适配才可以在新版本SDK环境正常编译通过。
## 关键的接口/组件变更
### Rect<sup>9+</sup>
变更前:
| 名称 | 值 | 说明 |
| ------- | ---- | ------------------------- |
| leftX | 1 | 控件边框的左上角的X坐标。 |
| topY | 2 | 控件边框的左上角的Y坐标。 |
| rightX | 3 | 控件边框的右下角的X坐标。 |
| bottomY | 4 | 控件边框的右下角的Y坐标。 |
变更后:
| 名称 | 值 | 说明 |
| ------ | ---- | ------------------------- |
| left | 1 | 控件边框的左上角的X坐标。 |
| top | 2 | 控件边框的左上角的Y坐标。 |
| right | 3 | 控件边框的右下角的X坐标。 |
| bottom | 4 | 控件边框的右下角的Y坐标。 |
## 适配指导
### 适配接口名称变更
可按照如下规则做类名替换:
- `leftX-->left`
- `topY-->top`
- `rightX-->right`
- `bottomY-->bottom`
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册