提交 4709a6c9 编写于 作者: Mr-YX's avatar Mr-YX 提交者: Gitee

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

Signed-off-by: Mr-YX's avatarmr-yx <496043997@qq.com>
# Bundle Module (JavaScript SDK APIs) # Bundle
> **NOTE**<br> The **Bundle** module provides APIs for querying bundle information, application information, abilities, Extension abilities, and application states.
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. 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 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> API version 9 is a canary version for trial use. The APIs of this version may be unstable. > API version 9 is a canary version for trial use. The APIs of this version may be unstable.
## Modules to Import ## Modules to Import
...@@ -16,11 +19,13 @@ SystemCapability.BundleManager.BundleFramework ...@@ -16,11 +19,13 @@ SystemCapability.BundleManager.BundleFramework
## Required Permissions ## Required Permissions
| Required Permissions | Permission Level | Description | | Required Permissions | Permission Level | Description |
| ---------------------------------------- | ------------ | --------- | | ------------------------------------------ | ------------ | ------------------ |
| ohos.permission.GET_BUNDLE_INFO | normal | Permission to query information about the current application.| | ohos.permission.GET_BUNDLE_INFO | normal | Permission to query information about a specified application. |
| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED| system_basic | Permission to query information about all applications.| | ohos.permission.GET_BUNDLE_INFO_PRIVILEGED| system_basic | Permission to query information about all applications.|
| ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall applications. | | ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall applications. |
For details, see “Permission Levels” in [Access Control Overview](../../security/accesstoken-overview.md).
## bundle.getApplicationInfo ## bundle.getApplicationInfo
getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number): Promise\<ApplicationInfo> getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number): Promise\<ApplicationInfo>
...@@ -69,7 +74,7 @@ bundle.getApplicationInfo(bundleName, bundleFlags, userId) ...@@ -69,7 +74,7 @@ bundle.getApplicationInfo(bundleName, bundleFlags, userId)
getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback\<ApplicationInfo>): void getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback\<ApplicationInfo>): void
Obtains the application information based on a given bundle name. This API uses an asynchronous callback to return the result. Obtains the application information of the specified user based on a given bundle name. This API uses an asynchronous callback to return the result.
**Required permissions** **Required permissions**
...@@ -143,9 +148,9 @@ bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => { ...@@ -143,9 +148,9 @@ bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => {
## bundle.getAllBundleInfo ## bundle.getAllBundleInfo
getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise\<Array\<BundleInfo>> getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise<Array\<BundleInfo>>
Obtains the information of all available bundles of a specified user in the system. This API uses a promise to return the result. Obtains the information of all available bundles of the specified user in the system. This API uses a promise to return the result.
**Required permissions** **Required permissions**
...@@ -166,7 +171,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -166,7 +171,7 @@ SystemCapability.BundleManager.BundleFramework
| Type | Description | | Type | Description |
| --------------------------- | -------------------------- | | --------------------------- | -------------------------- |
| Promise\<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Promise used to return the information of all available bundles.| | Promise<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Promise used to return the information of all available bundles.|
**Example** **Example**
...@@ -185,7 +190,7 @@ bundle.getAllBundleInfo(bundleFlag, userId) ...@@ -185,7 +190,7 @@ bundle.getAllBundleInfo(bundleFlag, userId)
## bundle.getAllBundleInfo ## bundle.getAllBundleInfo
getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback\<Array\<BundleInfo>>): void getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback<Array\<BundleInfo>>): void
Obtains the information of all available bundles in the system. This API uses an asynchronous callback to return the result. Obtains the information of all available bundles in the system. This API uses an asynchronous callback to return the result.
...@@ -220,9 +225,9 @@ bundle.getAllBundleInfo(bundleFlag, (err, data) => { ...@@ -220,9 +225,9 @@ bundle.getAllBundleInfo(bundleFlag, (err, data) => {
## bundle.getAllBundleInfo ## bundle.getAllBundleInfo
getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback\<Array\<BundleInfo>>): void getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback<Array\<BundleInfo>>): void
Obtains the information of all available bundles in the system. This API uses an asynchronous callback to return the result. Obtains the information of all available bundles of the specified user in the system. This API uses an asynchronous callback to return the result.
**Required permissions** **Required permissions**
...@@ -238,7 +243,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -238,7 +243,7 @@ SystemCapability.BundleManager.BundleFramework
| ---------- | --------------------------------- | ---- | --------------------------------------- | | ---------- | --------------------------------- | ---- | --------------------------------------- |
| bundleFlag | BundleFlag | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.| | bundleFlag | BundleFlag | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. | | userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
| callback | AsyncCallback\<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Yes | Callback used to return the information of all available bundles. | | callback | AsyncCallback<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Yes | Callback used to return the information of all available bundles. |
**Example** **Example**
...@@ -343,7 +348,7 @@ bundle.getBundleInfo(bundleName, bundleFlags, (err, data) => { ...@@ -343,7 +348,7 @@ bundle.getBundleInfo(bundleName, bundleFlags, (err, data) => {
getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback\<BundleInfo>): void getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback\<BundleInfo>): void
Obtains the bundle information based on a given bundle name. This API uses an asynchronous callback to return the result. Obtains the bundle information based on a given bundle name and bundle options. This API uses an asynchronous callback to return the result.
**Required permissions** **Required permissions**
...@@ -877,10 +882,6 @@ isAbilityEnabled(info: AbilityInfo): Promise\<boolean> ...@@ -877,10 +882,6 @@ isAbilityEnabled(info: AbilityInfo): Promise\<boolean>
Checks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses a promise to return the result. Checks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses a promise to return the result.
**Required permissions**
None
**System capability** **System capability**
SystemCapability.BundleManager.BundleFramework SystemCapability.BundleManager.BundleFramework
...@@ -917,10 +918,6 @@ isAbilityEnabled(info : AbilityInfo, callback : AsyncCallback\<boolean>): void ...@@ -917,10 +918,6 @@ isAbilityEnabled(info : AbilityInfo, callback : AsyncCallback\<boolean>): void
Checks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses an asynchronous callback to return the result. Checks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses an asynchronous callback to return the result.
**Required permissions**
None
**System capability** **System capability**
SystemCapability.BundleManager.BundleFramework SystemCapability.BundleManager.BundleFramework
...@@ -954,10 +951,6 @@ isApplicationEnabled(bundleName: string): Promise\<boolean> ...@@ -954,10 +951,6 @@ isApplicationEnabled(bundleName: string): Promise\<boolean>
Checks whether an application is enabled based on a given bundle name. This API uses a promise to return the result. Checks whether an application is enabled based on a given bundle name. This API uses a promise to return the result.
**Required permissions**
None
**System capability** **System capability**
SystemCapability.BundleManager.BundleFramework SystemCapability.BundleManager.BundleFramework
...@@ -992,10 +985,6 @@ isApplicationEnabled(bundleName: string, callback : AsyncCallback\<boolean>): vo ...@@ -992,10 +985,6 @@ isApplicationEnabled(bundleName: string, callback : AsyncCallback\<boolean>): vo
Checks whether an application is enabled based on a given bundle name. This API uses an asynchronous callback to return the result. Checks whether an application is enabled based on a given bundle name. This API uses an asynchronous callback to return the result.
**Required permissions**
None
**System capability** **System capability**
SystemCapability.BundleManager.BundleFramework SystemCapability.BundleManager.BundleFramework
...@@ -1069,9 +1058,13 @@ bundle.queryAbilityByWant(want, bundleFlags, userId) ...@@ -1069,9 +1058,13 @@ bundle.queryAbilityByWant(want, bundleFlags, userId)
## bundle.queryAbilityByWant ## bundle.queryAbilityByWant
queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<AbilityInfo>>): void queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback<Array\<AbilityInfo>>): void
Obtains the ability information based on a given want. This API uses an asynchronous callback to return the result. Obtains the ability information of the specified user based on a given want. This API uses an asynchronous callback to return the result.
**Required permissions**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability** **System capability**
...@@ -1110,6 +1103,10 @@ queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback<Arra ...@@ -1110,6 +1103,10 @@ queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback<Arra
Obtains the ability information based on a given want. This API uses an asynchronous callback to return the result. Obtains the ability information based on a given want. This API uses an asynchronous callback to return the result.
**Required permissions**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability** **System capability**
SystemCapability.BundleManager.BundleFramework SystemCapability.BundleManager.BundleFramework
...@@ -1285,7 +1282,7 @@ Obtains the [PixelMap](js-apis-image.md) of the icon corresponding to a given bu ...@@ -1285,7 +1282,7 @@ Obtains the [PixelMap](js-apis-image.md) of the icon corresponding to a given bu
**Required permissions** **Required permissions**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability** **System capability**
...@@ -1324,7 +1321,7 @@ Obtains the [PixelMap](js-apis-image.md) of the icon corresponding to a given bu ...@@ -1324,7 +1321,7 @@ Obtains the [PixelMap](js-apis-image.md) of the icon corresponding to a given bu
**Required permissions** **Required permissions**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability** **System capability**
...@@ -1439,7 +1436,7 @@ Obtains the Extension ability information based on a given want. This API uses a ...@@ -1439,7 +1436,7 @@ Obtains the Extension ability information based on a given want. This API uses a
**Required permissions** **Required permissions**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability** **System capability**
...@@ -1484,11 +1481,11 @@ bundle.queryExtensionAbilityInfos(want, extensionType, extensionFlags, userId) ...@@ -1484,11 +1481,11 @@ bundle.queryExtensionAbilityInfos(want, extensionType, extensionFlags, userId)
queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, userId: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, userId: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void
Obtains the Extension ability information based on a given want. This API uses an asynchronous callback to return the result. Obtains the Extension ability information of the specified user based on a given want. This API uses an asynchronous callback to return the result.
**Required permissions** **Required permissions**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability** **System capability**
...@@ -1564,6 +1561,138 @@ const receiver = function onReceive(err, data) { ...@@ -1564,6 +1561,138 @@ const receiver = function onReceive(err, data) {
bundle.queryExtensionAbilityInfos(want, extensionType, extensionFlags, receiver) bundle.queryExtensionAbilityInfos(want, extensionType, extensionFlags, receiver)
``` ```
## bundle.getProfileByAbility<sup>9+</sup>
getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback\<Array\<string>>): void;
Obtains the JSON string array of the current application's configuration file in the [metadata](js-apis-bundle-Metadata.md) based on a given module name, ability name, and metadata name. This API uses an asynchronous callback to return the result. This API cannot be used to obtain the JSON string array of another application.
**System capability**: SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory | Description |
| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
| moduleName | string | Yes | Module to which the configuration file to be obtained belongs. |
| abilityName | string | Yes | Ability to which the configuration file to be obtained belongs. |
| metadataName | string | Yes | Metadata to which the configuration file to be obtained belongs. |
| callback | AsyncCallback\<Array\<string>> | Yes | Callback used to return the JSON string array of the configuration file. |
**Example**
```js
let moduleName = 'entry';
let abilityName = 'MainAbility';
let metadataName = 'ohos.ability.shortcuts';
const caller = function callback(err, data) {
console.error('Operation errcode is: ' + err);
console.error('Operation result is: ' + data);
}
bundle.getProfileByAbility(moduleName, abilityName, metadataName, caller)
```
## bundle.getProfileByAbility<sup>9+</sup>
getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise\<Array\<string>>;
Obtains the JSON string array of the current application's configuration file in the [metadata](js-apis-bundle-Metadata.md) based on a given module name, ability name, and metadata name. This API uses a promise to return the result. This API cannot be used to obtain the JSON string array of another application.
**System capability**: SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory | Description |
| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
| moduleName | string | Yes | Module to which the configuration file to be obtained belongs. |
| abilityName | string | Yes | Ability to which the configuration file to be obtained belongs. |
| metadataName | string | No | Metadata to which the configuration file to be obtained belongs. |
**Return value**
| Type | Description |
| ------------------------------------- | ------------------------------ |
| Promise\<Array\<string>> | Promise used to return the JSON string array of the configuration file.|
**Example**
```js
let moduleName = 'entry';
let abilityName = 'MainAbility';
let metadataName = 'ohos.ability.shortcuts';
bundle.getProfileByAbility(moduleName, abilityName, metadataName).then(data=>{
console.error('Operation result is: ' + data);
}).catch(err=>{
console.error('Operation errcode is: ' + err);
})
```
## bundle.getProfileByExtensionAbility<sup>9+</sup>
getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback\<Array\<string>>): void;
Obtains the JSON string array of the current application's configuration file in the [metadata](js-apis-bundle-Metadata.md) based on a given module name, Extension ability name, and metadata name. This API uses an asynchronous callback to return the result. This API cannot be used to obtain the JSON string array of another application.
**System capability**: SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory | Description |
| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
| moduleName | string | Yes | Module to which the configuration file to be obtained belongs. |
| extensionAbilityName | string | Yes | Extension ability to which the configuration file to be obtained belongs. |
| metadataName | string | Yes | Metadata to which the configuration file to be obtained belongs. |
| callback | AsyncCallback\<Array\<string>> | Yes | Callback used to return the JSON string array of the configuration file. |
**Example**
```js
let moduleName = 'entry';
let extensionAbilityName = 'Form';
let metadataName = 'ohos.extension.form';
const caller = function callback(err, data) {
console.error('Operation errcode is: ' + err);
console.error('Operation result is: ' + data);
}
bundle.getProfileByExtensionAbility(moduleName, extensionAbilityName, metadataName, caller)
```
## bundle.getProfileByExtensionAbility<sup>9+</sup>
getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise\<Array\<string>>;
Obtains the JSON string array of the current application's configuration file in the [metadata](js-apis-bundle-Metadata.md) based on a given module name, Extension ability name, and metadata name. This API uses a promise to return the result. This API cannot be used to obtain the JSON string array of another application.
**System capability**: SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory | Description |
| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
| moduleName | string | Yes | Module to which the configuration file to be obtained belongs. |
| extensionAbilityName | string | Yes | Extension ability to which the configuration file to be obtained belongs. |
| metadataName | string | No | Metadata to which the configuration file to be obtained belongs. |
**Return value**
| Type | Description |
| ------------------------------------- | ------------------------------ |
| Promise\<Array\<string>> | Promise used to return the JSON string array of the configuration file.|
**Example**
```js
let moduleName = 'entry';
let extensionAbilityName = 'Form';
let metadataName = 'ohos.extension.form';
bundle.getProfileByExtensionAbility(moduleName, extensionAbilityName, metadataName).then(data=>{
console.error('Operation result is: ' + data);
}).catch(err=>{
console.error('Operation errcode is: ' + err);
})
```
## InstallErrorCode ## InstallErrorCode
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
...@@ -1646,11 +1775,19 @@ Enumerates display orientations. ...@@ -1646,11 +1775,19 @@ Enumerates display orientations.
| Name | Type | Description | | Name | Type | Description |
| ------------- | ---- | ------------- | | ------------- | ---- | ------------- |
| UNSPECIFIED | None | The system automatically determines the display orientation. | | UNSPECIFIED | None | Unspecified display orientation. |
| LANDSCAPE | None | Landscape orientation. | | LANDSCAPE | None | Landscape orientation. |
| PORTRAIT | None | Portrait orientation. | | PORTRAIT | None | Portrait orientation. |
| FOLLOW_RECENT | None | The page ability orientation is the same as that of the nearest ability in the stack.| | FOLLOW_RECENT | None | Orientation same as that of the nearest ability in the stack.|
| LANDSCAPE_INVERTED |None | Reverse landscape orientation. |
| PORTRAIT_INVERTED |None | Reverse portrait orientation. |
| AUTO_ROTATION |None | Orientation determined by the sensor. |
| AUTO_ROTATION_LANDSCAPE |None | Orientation determined by the sensor in the horizontal direction, including landscape and reverse landscape. |
| AUTO_ROTATION_PORTRAIT |None | Orientation determined by the sensor in the vertical direction, including portrait and reverse portrait. |
| AUTO_ROTATION_RESTRICTED |None | Orientation determined by the sensor when the sensor switch is enabled. |
| AUTO_ROTATION_LANDSCAPE_RESTRICTED |None | Orientation determined by the sensor in the horizontal direction, including landscape and reverse landscape, when the sensor switch is enabled. |
| AUTO_ROTATION_PORTRAIT_RESTRICTED |None | Orientation determined by the sensor in the vertical direction, including portrait and reverse portrait, when the sensor switch is enabled. |
| LOCKED |None | Auto rotate locked. |
## LaunchMode ## LaunchMode
Enumerates launch modes. Enumerates launch modes.
...@@ -1681,7 +1818,7 @@ Enumerates Extension ability types. ...@@ -1681,7 +1818,7 @@ Enumerates Extension ability types.
| Name | Type | Description | | Name | Type | Description |
| ------------------------------ | ---- | ------------------------- | | ------------------------------ | ---- | ------------------------- |
| FORM<sup>9+</sup> | 0 | Form included. | | FORM<sup>9+</sup> | 0 | Form (widget) included. |
| WORK_SCHEDULER<sup>9+</sup> | 1 | Work scheduler included.| | WORK_SCHEDULER<sup>9+</sup> | 1 | Work scheduler included.|
| INPUT_METHOD<sup>9+</sup> | 2 | Input method included. | | INPUT_METHOD<sup>9+</sup> | 2 | Input method included. |
| SERVICE<sup>9+</sup> | 3 | Service included. | | SERVICE<sup>9+</sup> | 3 | Service included. |
...@@ -1690,7 +1827,8 @@ Enumerates Extension ability types. ...@@ -1690,7 +1827,8 @@ Enumerates Extension ability types.
| FILE_SHARE<sup>9+</sup> | 6 | File sharing included.| | FILE_SHARE<sup>9+</sup> | 6 | File sharing included.|
| STATIC_SUBSCRIBER<sup>9+</sup> | 7 | Subscribers included. | | STATIC_SUBSCRIBER<sup>9+</sup> | 7 | Subscribers included. |
| WALLPAPER<sup>9+</sup> | 8 | Wallpaper included. | | WALLPAPER<sup>9+</sup> | 8 | Wallpaper included. |
| BACKUP<sup>9+</sup> | 9 | Data backup and restore included. | | BACKUP<sup>9+</sup> | 9 | Data backup and restore included.|
| ENTERPRISE_ADMIN<sup>9+</sup> | 11 | Enterprise administrators included. |
| UNSPECIFIED<sup>9+</sup> | 20 | Unspecified type. | | UNSPECIFIED<sup>9+</sup> | 20 | Unspecified type. |
## ExtensionFlag<sup>9+</sup> ## ExtensionFlag<sup>9+</sup>
...@@ -1729,3 +1867,15 @@ Enumerates permission grant states. ...@@ -1729,3 +1867,15 @@ Enumerates permission grant states.
| ------------------ | ---- | ---- | | ------------------ | ---- | ---- |
| PERMISSION_DENIED | -1 | Permission denied.| | PERMISSION_DENIED | -1 | Permission denied.|
| PERMISSION_GRANTED | 0 | Permission granted. | | PERMISSION_GRANTED | 0 | Permission granted. |
## SupportWindowMode
Enumerates window modes.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Description |
| ------------------ | ---- | ---- |
| FULLSCREEN | None | Full screen.|
| SPLIT | None | Split-screen. |
| FLOATING | None | Floating. |
...@@ -836,7 +836,7 @@ Obtains information of the current ability. This API uses an asynchronous callba ...@@ -836,7 +836,7 @@ Obtains information of the current ability. This API uses an asynchronous callba
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------- | | -------- | ---------------------- | ---- | ------------------------- |
| callback | AsyncCallback\<[AbilityInfo](#abilityInfo)> | Yes | Callback used to return the ability information.| | callback | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes | Callback used to return the ability information.|
**Example** **Example**
...@@ -864,7 +864,7 @@ Obtains information of the current ability. This API uses a promise to return th ...@@ -864,7 +864,7 @@ Obtains information of the current ability. This API uses a promise to return th
| Type | Description | | Type | Description |
| --------------- | ------------------------- | | --------------- | ------------------------- |
| Promise\<[AbilityInfo](#abilityInfo)> | Promise used to return the ability information.| | Promise\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Promise used to return the ability information.|
**Example** **Example**
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
> **NOTE**<br/> > **NOTE**
>
> The initial APIs of this module are supported since API version 7. 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 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -11,7 +12,7 @@ Provides the ability information. ...@@ -11,7 +12,7 @@ Provides the ability information.
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------------------- | -------------------------------------------------------- | ---- | ---- | ----------------------------------------- | | --------------------- | -------------------------------------------------------- | ---- | ---- | ----------------------------------------- |
...@@ -43,3 +44,10 @@ Provides the ability information. ...@@ -43,3 +44,10 @@ Provides the ability information.
| metaData<sup>8+</sup> | Array\<[CustomizeData](js-apis-bundle-CustomizeData.md)> | Yes | No | Custom metadata of the ability. | | metaData<sup>8+</sup> | Array\<[CustomizeData](js-apis-bundle-CustomizeData.md)> | Yes | No | Custom metadata of the ability. |
| metaData<sup>9+</sup> | Array\<[Metadata](js-apis-bundle-Metadata.md)> | Yes | No | Metadata of the ability. | | metaData<sup>9+</sup> | Array\<[Metadata](js-apis-bundle-Metadata.md)> | Yes | No | Metadata of the ability. |
| enabled<sup>8+</sup> | boolean | Yes | No | Whether the ability is enabled. | | enabled<sup>8+</sup> | boolean | Yes | No | Whether the ability is enabled. |
| supportWindowMode<sup>9+</sup> | Array\<[SupportWindowMode](js-apis-Bundle.md)> | Yes | No | Window modes supported by the ability. |
| maxWindowRatio<sup>9+</sup> | number | Yes | No | Maximum window ratio supported by the ability. |
| minWindowRatio<sup>9+</sup> | number | Yes | No | Minimum window ratio supported by ability. |
| maxWindowWidth<sup>9+</sup> | number | Yes | No | Maximum window width supported by the ability. |
| minWindowWidth<sup>9+</sup> | number | Yes | No | Minimum window width supported by the ability. |
| maxWindowHeight<sup>9+</sup> | number | Yes | No | Maximum window height supported by the ability. |
| minWindowHeight<sup>9+</sup> | number | Yes | No | Minimum window height supported by the ability. |
# Zip Module (JavaScript SDK APIs) # Zip
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Constraints
None
## Modules to Import ## Modules to Import
```javascript ```javascript
...@@ -7,8 +14,7 @@ import zlib from '@ohos.zlib'; ...@@ -7,8 +14,7 @@ import zlib from '@ohos.zlib';
``` ```
## zlib.zipFile ## zlib.zipFile
zipFile(inFile:string, outFile:string, options: Options): Promise&lt;void&gt;
zipFile(inFile:string, outFile:string, options: Options): Promise\<void>
Zips a file. This API uses a promise to return the result. Zips a file. This API uses a promise to return the result.
...@@ -17,10 +23,10 @@ Zips a file. This API uses a promise to return the result. ...@@ -17,10 +23,10 @@ Zips a file. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------- | ---- | ------------------------------------------- | | ------- | ------------------- | ---- | ------------------------------------------------------------ |
| inFile | string | Yes | Path of the folder or file to zip. | | inFile | string | Yes | Path of the folder or file to zip. For details about the path, see [FA Model](js-apis-Context.md) and [Stage Model](js-apis-application-context.md).|
| outFile | string | Yes | Path of the zipped file. The file name extension is .zip.| | outFile | string | Yes | Path of the zipped file. The file name extension is .zip. |
| options | [Options](#options)| No | Optional parameters for the zip operation. | | options | [Options](#options) | No | Optional parameters for the zip operation. |
**Return value** **Return value**
...@@ -72,7 +78,7 @@ zlib.zipFile(inFile , outFile, options).then((data) => { ...@@ -72,7 +78,7 @@ zlib.zipFile(inFile , outFile, options).then((data) => {
## zlib.unzipFile ## zlib.unzipFile
unzipFile(inFile:string, outFile:string, options: Options): Promise\<void> unzipFile(inFile:string, outFile:string, options: Options): Promise&lt;void&gt;
Unzips a file. This API uses a promise to return the result. Unzips a file. This API uses a promise to return the result.
...@@ -81,10 +87,10 @@ Unzips a file. This API uses a promise to return the result. ...@@ -81,10 +87,10 @@ Unzips a file. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------- | ---- | ----------------------------------- | | ------- | ------------------- | ---- | ------------------------------------------------------------ |
| inFile | string | Yes | Path of the .zip file to unzip.| | inFile | string | Yes | Path of the folder or file to zip. For details about the path, see [FA Model](js-apis-Context.md) and [Stage Model](js-apis-application-context.md).|
| outFile | string | Yes | Path of the unzipped file. | | outFile | string | Yes | Path of the unzipped file. |
| options | [Options](#options)| No | Optional parameters for the unzip operation. | | options | [Options](#options) | No | Optional parameters for the unzip operation. |
**Return value** **Return value**
...@@ -115,42 +121,52 @@ zlib.unzipFile(inFile, outFile, options).then((data) => { ...@@ -115,42 +121,52 @@ zlib.unzipFile(inFile, outFile, options).then((data) => {
## Options ## Options
| Name | Description | **System capability**: SystemCapability.BundleManager.Zlib
| --------------------------- | ------------------------------------------------------------ |
| level?: CompressLeve | See [zip.CompressLevel](#zipcompresslevel).| | Name | Type | Mandatory| Description |
| memLevel?: MemLevel | See [zip.MemLevel](#zipmemlevel). | | -------- | ---------------- | ---- | --------------------------------------------------------- |
| strategy?: CompressStrategy | See [zip.CompressStrategy](#zipcompressstrategy).| | level | CompressLeve | No | See [zip.CompressLevel](#zipcompresslevel). |
| memLevel | MemLevel | No | See [zip.MemLevel](#zipmemlevel). |
| strategy | CompressStrategy | No | See [zip.CompressStrategy](#zipcompressstrategy).|
## zip.MemLevel ## zip.MemLevel
| Name | Description | **System capability**: SystemCapability.BundleManager.Zlib
| ----------------- | -------------------------------- |
| MEM_LEVEL_MIN | Minimum memory used by the **zip** API during compression.| | Name | Value | Description |
| MEM_LEVEL_MAX | Maximum memory used by the **zip** API during compression.| | ----------------- | ---- | -------------------------------- |
| MEM_LEVEL_DEFAULT | Default memory used by the **zip** API during compression.| | MEM_LEVEL_MIN | 1 | Minimum memory used by the **zip** API during compression.|
| MEM_LEVEL_MIN | 9 | Maximum memory used by the **zip** API during compression.|
| MEM_LEVEL_DEFAULT | 8 | Default memory used by the **zip** API during compression.|
## zip.CompressLevel
## Zip.CompressLevel **System capability**: SystemCapability.BundleManager.Zlib
| Name | Description | | Name | Value | Description |
| --------------------------------------- | ----------------- | | ---------------------------------- | ---- | ----------------- |
| COMPRESS_LEVEL_NO_COMPRESSION: 0 | Compress level 0 that indicates uncompressed.| | COMPRESS_LEVEL_NO_COMPRESSION | 0 | Compress level 0 that indicates uncompressed.|
| COMPRESS_LEVEL_BEST_SPEED: 1 | Compression level 1 that gives the best speed. | | COMPRESS_LEVEL_BEST_SPEED | 1 | Compression level 1 that gives the best speed. |
| COMPRESS_LEVEL_BEST_COMPRESSION: 9 | Compression level 9 that gives the best compression. | | COMPRESS_LEVEL_BEST_COMPRESSION | 9 | Compression level 9 that gives the best compression. |
| COMPRESS_LEVEL_DEFAULT_COMPRESSION: -1| Default compression level. | | COMPRESS_LEVEL_DEFAULT_COMPRESSION | -1 | Default compression level. |
## Zip.CompressStrategy ## zip.CompressStrategy
| Name | Description | **System capability**: SystemCapability.BundleManager.Zlib
| -------------------------------------- | ------------------------ |
| COMPRESS_STRATEGY_DEFAULT_STRATEGY: 0 | Default compression strategy. | | Name | Value | Description |
| COMPRESS_STRATEGY_FILTERED: 1 | Filtered compression strategy.| | ---------------------------------- | ---- | ------------------------ |
| COMPRESS_STRATEGY_HUFFMAN_ONLY: 2 | Huffman coding compression strategy. | | COMPRESS_STRATEGY_DEFAULT_STRATEGY | 0 | Default compression strategy. |
| COMPRESS_STRATEGY_RLE: 3 | RLE compression strategy. | | COMPRESS_STRATEGY_FILTERED | 1 | Filtered compression strategy.|
| COMPRESS_STRATEGY_FIXED: 4 | Fixed compression strategy. | | COMPRESS_STRATEGY_HUFFMAN_ONLY | 2 | Huffman coding compression strategy. |
| COMPRESS_STRATEGY_RLE | 3 | RLE compression strategy. |
| COMPRESS_STRATEGY_FIXED | 4 | Fixed compression strategy. |
## zip.ErrorCode ## zip.ErrorCode
| Name | Description | **System capability**: SystemCapability.BundleManager.Zlib
| -------------------- | ------------ |
| ERROR_CODE_OK: 0 | The API is successfully called.| | Name | Value | Description |
| ERROR_CODE_ERRNO: -1| Failed to call the API.| | ---------------- | ---- | ------------ |
| ERROR_CODE_OK | 0 | The API is successfully called.|
| ERROR_CODE_ERRNO | -1 | Failed to call the API.|
...@@ -54,7 +54,7 @@ ImageAnimator() ...@@ -54,7 +54,7 @@ ImageAnimator()
## Events ## Events
| Name | Description | | Name | Description |
| -------- | -------- | -------- | | -------- | -------- |
| onStart() =&gt; void | Triggered when the animation starts to play. | | onStart() =&gt; void | Triggered when the animation starts to play. |
| onPause() =&gt; void | Triggered when the animation playback is paused. | | onPause() =&gt; void | Triggered when the animation playback is paused. |
| onRepeat() =&gt; void | Triggered when the animation playback is repeated. | | onRepeat() =&gt; void | Triggered when the animation playback is repeated. |
......
...@@ -20,7 +20,7 @@ This component contains the child component [<ListItem>](ts-container-listitem.m ...@@ -20,7 +20,7 @@ This component contains the child component [<ListItem>](ts-container-listitem.m
## APIs ## APIs
List(value:{space?: number, initialIndex?: number}) List(value:{space?: number | string, initialIndex?: number, scroller?: Scroller})
- Parameters - Parameters
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Default Value | Description |
......
...@@ -15,7 +15,7 @@ This component supports only one child component. ...@@ -15,7 +15,7 @@ This component supports only one child component.
## APIs ## APIs
Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number\}\) Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number | string\}\)
- Parameters - Parameters
......
# Date Picker Dialog Box # Date Picker Dialog Box
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
You can display a date picker in a dialog box to allow users to select a date from the given range. You can display a date picker in a dialog box to allow users to select a date from the given range.
...@@ -13,18 +13,18 @@ None ...@@ -13,18 +13,18 @@ None
show(options?: DatePickerDialogOptions) show(options?: DatePickerDialogOptions)
Defines and displays a date picker dialog box. Displays a date picker dialog box.
- options parameters - options parameters
| Name| Type| Mandatory| Default Value| Description| | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| start | Date | No| Date('1970-1-1') | Start date of the picker.| | start | Date | No | Date('1970-1-1') | Start date of the picker. |
| end | Date | No| Date('2100-12-31') | End date of the picker.| | end | Date | No | Date('2100-12-31') | End date of the picker. |
| selected | Date | No| Current system date| Date of the selected item.| | selected | Date | No | Current system date | Date of the selected item. |
| lunar | boolean | No| false | Whether to display the lunar calendar.| | lunar | boolean | No | false | Whether to display the lunar calendar. |
| onAccept | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult)) => void | No| - | Triggered when the OK button in the dialog box is clicked.| | onAccept | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult)) => void | No | - | Callback invoked when the OK button in the dialog box is clicked. |
| onCancel | () => void | No| - | Triggered when the Cancel button in the dialog box is clicked.| | onCancel | () => void | No | - | Triggered when the Cancel button in the dialog box is clicked. |
| onChange | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult)) => void | No| - | Triggered when the selected item in the picker changes.| | onChange | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult)) => void | No | - | Callback invoked when the selected item in the picker changes. |
## Example ## Example
......
# Menu # Menu
> **NOTE**<br>The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. > **NOTE**<br>
> The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
## ContextMenu.close ## ContextMenu.close
|Method|Description| | API | Description |
|----|---| | ---- | --- |
|close(): void|Closes the menu bound to this component through [bindContextMenu](./ts-universal-attributes-menu.md#Atrributes) on a page.| |close(): void| Closes the menu bound to this component through [bindContextMenu](./ts-universal-attributes-menu.md#Atrributes) on a page. |
- Example - Example
``` ```
......
# Text Picker Dialog Box # Text Picker Dialog Box
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
You can display a text picker in a dialog box to allow users to select text from the given range. You can display a text picker in a dialog box to allow users to select text from the given range.
...@@ -16,20 +16,20 @@ show(options: TextPickerDialogOptions) ...@@ -16,20 +16,20 @@ show(options: TextPickerDialogOptions)
Shows a text picker in the given settings. Shows a text picker in the given settings.
- TextPickerDialogOptions - TextPickerDialogOptions
| Name| Type| Mandatory| Default Value| Description| | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| range | string[] | Yes| - | Data selection range of the picker.| | range | string[] | Yes | - | Data selection range of the picker. |
| selected | number | No| First element| Index value of the selected item in the range.| | selected | number | No | First element | Index value of the selected item in the range. |
| defaultPickerItemHeight | number | No| - | Height of the default selected item in the picker.| | defaultPickerItemHeight | number | No | - | Height of the default selected item in the picker. |
| onAccept | (value: TextPickerResult) => void | No| - | Triggered when the OK button in the dialog box is clicked.| | onAccept | (value: TextPickerResult) => void | No | - | Callback invoked when the OK button in the dialog box is clicked. |
| onCancel | () => void | No| - | Triggered when the Cancel button in the dialog box is clicked.| | onCancel | () => void | No | - | Triggered when the Cancel button in the dialog box is clicked. |
| onChange | (value: TextPickerResult) => void | No| - | Triggered when the selected item in the picker changes.| | onChange | (value: TextPickerResult) => void | No | - | Callback invoked when the selected item in the picker changes. |
- TextPickerResult - TextPickerResult
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| value | string | Text of the selected item.| | value | string | Text of the selected item. |
| index | number | Index value of the selected item in the range.| | index | number | Index value of the selected item in the range. |
## Example ## Example
......
# Time Picker Dialog Box # Time Picker Dialog Box
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
You can display a time picker in a dialog box to allow users to select a time from the given range, which is from 00:00 to 23:59 by default. You can display a time picker in a dialog box to allow users to select a time from the given range, which is from 00:00 to 23:59 by default.
...@@ -13,16 +13,16 @@ None ...@@ -13,16 +13,16 @@ None
show(options?: TimePickerDialogOptions) show(options?: TimePickerDialogOptions)
Defines and displays a time picker dialog box. Shows a time picker dialog box.
- options parameters - options parameters
| Name| Type| Mandatory| Default Value| Description| | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| selected | Date | No| Current system time| Time of the selected item.| | selected | Date | No | Current system time | Time of the selected item. |
| useMilitaryTime | boolean | No| false | Whether to display time in 24-hour format.| | useMilitaryTime | boolean | No | false | Whether to display time in 24-hour format. |
| onAccept | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult)) => void | No| - | Triggered when the OK button in the dialog box is clicked.| | onAccept | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult)) => void | No | - | Callback invoked when the OK button in the dialog box is clicked. |
| onCancel | () => void | No| - | Triggered when the Cancel button in the dialog box is clicked.| | onCancel | () => void | No | - | Triggered when the Cancel button in the dialog box is clicked. |
| onChange | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult)) => void | No| - | Triggered when the selected item in the picker changes.| | onChange | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult)) => void | No | - | Callback invoked when the selected item in the picker changes. |
## Example ## Example
......
# Page Transition # Page Transition
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
Customize the page transition animations by configuring the page entrance and exit components in the global **pageTransition** method. Customize the page transition animations by configuring the page entrance and exit components in the global **pageTransition** method.
## APIs
| Name | Parameter | Description | | Name | Parameter | Description |
| -------- | -------- | -------- | | -------- | -------- | -------- |
...@@ -56,8 +57,8 @@ The PageTransitionEnter and PageTransitionExit components support the following ...@@ -56,8 +57,8 @@ The PageTransitionEnter and PageTransitionExit components support the following
| Event | Description | | Event | Description |
| -------- | -------- | | -------- | -------- |
| onEnter(type: RouteType, progress: number) =&gt; void | The callback input parameter is the normalized progress of the current entrance animation. The value range is 0–1. | | onEnter(type: RouteType, progress: number) =&gt; void | Callback invoked when page entrance occurs. The input parameter is the normalized progress of the current entrance animation. The value range is 0–1. |
| onExit(type: RouteType, progress: number) =&gt; void | The callback input parameter is the normalized progress of the current exit animation. The value range is 0–1. | | onExit(type: RouteType, progress: number) =&gt; void | Callback invoked when page exit occurs. The input parameter is the normalized progress of the current exit animation. The value range is 0–1. |
## Example ## Example
......
...@@ -23,11 +23,9 @@ Based on the unified user authentication framework, the system can be extended t ...@@ -23,11 +23,9 @@ Based on the unified user authentication framework, the system can be extended t
```undefined ```undefined
//base/user_iam //base/user_iam
├── auth_executor_mgr # Authentication executor management part, which supports unified authentication resource management and scheduling ├── user_auth_framework # User authentication framework, including user authentication, credential management and executor management
├── face_auth # Facial authentication module, which connects to the authentication executor management part and supports facial information recording, deletion, and verification ├── face_auth # Facial authentication module, which connects to the authentication executor management part and supports facial information recording, deletion, and verification
├── pin_auth # Password authentication module, which connects to the authentication executor management part and supports password recording, deletion, and verification ├── pin_auth # Password authentication module, which connects to the authentication executor management part and supports password recording, deletion, and verification
├── user_auth # Unified user authentication part
└── user_idm # User credential management part
``` ```
...@@ -45,12 +43,12 @@ Based on the unified user authentication framework, the system can be extended t ...@@ -45,12 +43,12 @@ Based on the unified user authentication framework, the system can be extended t
## Repositories Involved ## Repositories Involved
[useriam_auth_executor_mgr](https://gitee.com/openharmony/useriam_auth_executor_mgr) [useriam_user_auth_framework](https://gitee.com/openharmony/useriam_user_auth_framework)
[useriam_user_idm](https://gitee.com/openharmony/useriam_user_idm) [useriam_pin_auth](https://gitee.com/openharmony/useriam_pin_auth)
[useriam_user_auth](https://gitee.com/openharmony/useriam_user_auth) [useriam_face_auth](https://gitee.com/openharmony/useriam_face_auth)
[useriam_pin_auth](https://gitee.com/openharmony/useriam_pin_auth) [drivers_interface](https://gitee.com/openharmony/drivers_interface)
[useriam_faceauth](https://gitee.com/openharmony/useriam_faceauth) [drivers_peripheral](https://gitee.com/openharmony/drivers_peripheral)
\ No newline at end of file
...@@ -4,6 +4,28 @@ ...@@ -4,6 +4,28 @@
Data提供方可以自定义数据的增、删、改、查,以及文件打开等功能,并对外提供这些接口。 Data提供方可以自定义数据的增、删、改、查,以及文件打开等功能,并对外提供这些接口。
## URI介绍
Data的提供方和使用方都通过URI(Uniform Resource Identifier)来标识一个具体的数据,例如数据库中的某个表或磁盘上的某个文件。HarmonyOS的URI仍基于URI通用标准,格式如下:
![fa-dataability-uri](figures/fa-dataability-uri.png)
- scheme:协议方案名,固定为“dataability”,代表Data Ability所使用的协议类型。
- authority:设备ID。如果为跨设备场景,则为目标设备的ID;如果为本地设备场景,则不需要填写。
- path:资源的路径信息,代表特定资源的位置信息。
- query:查询参数。
- fragment:可以用于指示要访问的子资源。
URI示例:
- 跨设备场景:dataability://*device_id*/*com.domainname.dataability.persondata*/*person*/*10*
- 本地设备:dataability:///*com.domainname.dataability.persondata*/*person*/*10*
```
说明
本地设备的“device_id”字段为空,因此在“dataability:”后面有三个“/”。
```
## 接口说明 ## 接口说明
**表1** Data中相关生命周期API功能介绍 **表1** Data中相关生命周期API功能介绍
......
...@@ -8,13 +8,13 @@ Stage模型是区别于FA模型的一种应用开发模型,对此模型的介 ...@@ -8,13 +8,13 @@ Stage模型是区别于FA模型的一种应用开发模型,对此模型的介
- 应用迁移,详见[应用迁移开发指导](stage-ability-continuation.md) - 应用迁移,详见[应用迁移开发指导](stage-ability-continuation.md)
### 启动模式 ### 启动模式
ability支持单实例、多实例和指定实例3种启动模式,在module.json中通过launchType配置。启动模式对应Ability被启动时的行为,对启动模式的详细说明如下: Ability支持单实例、多实例和指定实例3种启动模式,在module.json中通过launchType配置。启动模式对应Ability被启动时的行为,对启动模式的详细说明如下:
| 启动模式 | 描述 |说明 | | 启动模式 | 描述 |说明 |
| ----------- | ------- |---------------- | | ----------- | ------- |---------------- |
| standard | 多实例 | 每次startAbility都会启动一个新的实例 | | standard | 多实例 | 每次startAbility都会启动一个新的实例 |
| singleton | 单实例 | 系统中只存在唯一一个实例,startAbility时,如果已存在,则复用系统中的唯一一个实例 | | singleton | 单实例 | 系统中只存在唯一一个实例,startAbility时,如果已存在,则复用系统中的唯一一个实例 |
| specified | 指定实例 | 运行时由ability内部业务决定是否创建多实例 | | specified | 指定实例 | 运行时由Ability内部业务决定是否创建多实例 |
缺省情况下是singleton模式,module.json示例如下: 缺省情况下是singleton模式,module.json示例如下:
```json ```json
...@@ -107,7 +107,7 @@ Ability功能如下(Ability类,具体的API详见[接口文档](../reference ...@@ -107,7 +107,7 @@ Ability功能如下(Ability类,具体的API详见[接口文档](../reference
} }
``` ```
### 获取AbilityStage及Ability的配置信息 ### 获取AbilityStage及Ability的配置信息
AbilityStage类及Ability类均拥有context属性,应用可以通过`this.context`获取Ability实例的上下文,进而获取详细的配置信息。如下示例展示了AbilityStage通过context属性获取包代码路径、hap包名、ability名以及系统语言的方法。具体示例代码如下: AbilityStage类及Ability类均拥有context属性,应用可以通过`this.context`获取Ability实例的上下文,进而获取详细的配置信息。如下示例展示了AbilityStage通过context属性获取包代码路径、hap包名、Ability名以及系统语言的方法。具体示例代码如下:
```ts ```ts
import AbilityStage from "@ohos.application.AbilityStage" import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage { export default class MyAbilityStage extends AbilityStage {
...@@ -126,7 +126,7 @@ export default class MyAbilityStage extends AbilityStage { ...@@ -126,7 +126,7 @@ export default class MyAbilityStage extends AbilityStage {
} }
``` ```
如下示例展示了Ability通过context属性获取包代码路径、hap包名、ability名以及系统语言的方法。具体示例代码如下: 如下示例展示了Ability通过context属性获取包代码路径、hap包名、Ability名以及系统语言的方法。具体示例代码如下:
```ts ```ts
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
......
...@@ -34,39 +34,51 @@ ...@@ -34,39 +34,51 @@
1. 获取设备上传感器的数据,需要在“config.json”里面进行配置请求权限。具体如下: 1. 获取设备上传感器的数据,需要在“config.json”里面进行配置请求权限。具体如下:
``` ```
”reqPermissions“:[ "reqPermissions": [
{ {
"name":"ohos.permission.ACCELEROMETER", "name": "ohos.permission.ACCELEROMETER",
"reason"":"", "reason": "",
"usedScene":{ "usedScene": {
"ability": ["sensor.index.MainAbility",".MainAbility"], "ability": [
"when":"inuse" "sensor.index.MainAbility",
".MainAbility"
],
"when": "inuse"
} }
}, },
{ {
"name":"ohos.permission.GYROSCOPE", "name": "ohos.permission.GYROSCOPE",
"reason"":"", "reason": "",
"usedScene":{ "usedScene": {
"ability": ["sensor.index.MainAbility",".MainAbility"], "ability": [
"when":"inuse" "sensor.index.MainAbility",
".MainAbility"
],
"when": "inuse"
} }
}, },
{ {
"name":"ohos.permission.ACTIVITY_MOTION", "name": "ohos.permission.ACTIVITY_MOTION",
"reason"":"ACTIVITY_MOTION_TEST", "reason": "ACTIVITY_MOTION_TEST",
"usedScene":{ "usedScene": {
"ability": ["sensor.index.MainAbility",".MainAbility"], "ability": [
"when":"inuse" "sensor.index.MainAbility",
".MainAbility"
],
"when": "inuse"
} }
}, },
{ {
"name":"ohos.permission.READ_HEALTH_DATA", "name": "ohos.permission.READ_HEALTH_DATA",
"reason"":"HEALTH_DATA_TEST", "reason": "HEALTH_DATA_TEST",
"usedScene":{ "usedScene": {
"ability": ["sensor.index.MainAbility",".MainAbility"], "ability": [
"when":"inuse" "sensor.index.MainAbility",
".MainAbility"
],
"when": "inuse"
}
} }
},
] ]
``` ```
......
# 传感器开发概述 # 传感器开发概述
OpenHarmony系统传感器是应用访问底层硬件传感器的一种设备抽象概念。开发者根据传感器提供的Sensor API,可以查询设备上的传感器,订阅传感器数据,并根据传感器数据定制相应的算法开发各类应用,比如指南针、运动健康、游戏等。 OpenHarmony系统传感器是应用访问底层硬件传感器的一种设备抽象概念。开发者根据传感器提供的[Sensor接口](../reference/apis/js-apis-sensor.md),可以查询设备上的传感器,订阅传感器数据,并根据传感器数据定制相应的算法开发各类应用,比如指南针、运动健康、游戏等。
传感器是指用于侦测环境中所发生事件或变化,并将此消息发送至其他电子设备(如中央处理器)的设备,通常由敏感组件和转换组件组成。传感器是实现物联网智能化的重要基石,为实现全场景智慧化战略,支撑“1+8+N”产品需求,需要构筑统一的传感器管理框架,达到为各产品/业务提供低时延、低功耗的感知数据的目的。下面为传感器列表: 传感器是指用于侦测环境中所发生事件或变化,并将此消息发送至其他电子设备(如中央处理器)的设备,通常由敏感组件和转换组件组成。传感器是实现物联网智能化的重要基石,为实现全场景智慧化战略,支撑“1+8+N”产品需求,需要构筑统一的传感器管理框架,达到为各产品/业务提供低时延、低功耗的感知数据的目的。下面为传感器列表:
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
当设备需要设置不同的振动效果时,可以调用Vibrator模块,例如:设备的按键可以设置不同强度和不同时长的振动,闹钟和来电可以设置不同强度和时长的单次或周期振动。 当设备需要设置不同的振动效果时,可以调用Vibrator模块,例如:设备的按键可以设置不同强度和不同时长的振动,闹钟和来电可以设置不同强度和时长的单次或周期振动。
详细的接口介绍请参考[Vibrator接口](../reference/apis/js-apis-vibrator.md)
## 接口说明 ## 接口说明
...@@ -61,12 +63,12 @@ ...@@ -61,12 +63,12 @@
``` ```
import vibrator from "@ohos.vibrator" import vibrator from "@ohos.vibrator"
vibrator.vibrate(1000).then((error)=>{ vibrator.vibrate(1000).then((error) => {
if(error){//调用失败,打印error.code和error.message if (error) { //调用失败,打印error.code和error.message
Console.log("Promise return failed.error.code"+error.code+"error.message"+error.message); Console.log("Promise return failed.error.code " + error.code + "error.message " + error.message);
}else{//调用成功,设备开始振动 } else { //调用成功,设备开始振动
Console.log("Promise returned to indicate a successful vibration.") Console.log("Promise returned to indicate a successful vibration.")
}; }
}) })
``` ```
...@@ -74,12 +76,12 @@ ...@@ -74,12 +76,12 @@
``` ```
import vibrator from "@ohos.vibrator" import vibrator from "@ohos.vibrator"
vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then((error)=>{ vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then((error) => {
if(error){//调用失败,打印error.code和error.message if (error) { //调用失败,打印error.code和error.message
Console.log("Promise return failed.error.code"+error.code+"error.message"+error.message); Console.log("Promise return failed.error.code " + error.code + "error.message " + error.message);
}else{//调用成功,设备停止振动 } else { //调用成功,设备停止振动
Console.log("Promise returned to indicate successful."); Console.log("Promise returned to indicate successful.");
}; }
}) })
``` ```
......
...@@ -292,8 +292,8 @@ ...@@ -292,8 +292,8 @@
另一种方法是使用开发者提供的Locale和格式化参数来创建相对时间格式化对象。其中,格式化参数是可选的,完整的参数列表参见[ RelativeTimeFormatInputOptions](../reference/apis/js-apis-intl.md)。 另一种方法是使用开发者提供的Locale和格式化参数来创建相对时间格式化对象。其中,格式化参数是可选的,完整的参数列表参见[ RelativeTimeFormatInputOptions](../reference/apis/js-apis-intl.md)。
```js ```
var relativeTimeFormat = new intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"}; var relativeTimeFormat = new intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"});
``` ```
2. 相对时间格式化。 2. 相对时间格式化。
......
...@@ -20,7 +20,7 @@ resources ...@@ -20,7 +20,7 @@ resources
| | |---string.json | | |---string.json
| |---media | |---media
| | |---icon.png | | |---icon.png
|---rawfile // 默认存在的目录 |---rawfile
``` ```
**表1** resources目录分类 **表1** resources目录分类
......
# full-SDK替换指南
**public-SDK**是提供给应用开发的工具包,跟随DevEco Studio下载,不包含系统应用所需要的高权限API
**full-SDK**是提供给OEM厂商开发应用的工具包,不能随DevEco Studio下载,包含了系统应用所需要的高权限API
三方开发者通过DevEco Studio自动下载的**API8版本**SDK均为**public版本**。public-SDK**不支持**开发者使用**所有的系统API**,包括animator组件、xcomponent组件、@ohos.application.abilityManager.d.ts、@ohos.application.formInfo.d.ts、@ohos.bluetooth.d.ts等,如工程必须依赖于系统API,请按照以下步骤替换**full-SDK**
## 下载full-SDK(这里以3.1.1 Release版本为例)
full-SDK需要手动下载。请参考[OpenHarmony 3.1.1 Release版本说明书](https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/OpenHarmony-v3.1.1-release.md)中的获取方式,获取所需的操作系统的full-SDK。
![image-20220613161049897](figures/zh-cn_image_0000001655128646.png)
## 查看本地SDK路径(此处以ets工程为例,1.0工程请以相同方式替换js-SDK)
打开DevEco Studio——>Tools——>OpenHarmony SDK Manager,查看本地SDK安装路径。
![](figures/zh-cn_image_0000001655128939.png)
![image-20220613160524053](figures/zh-cn_image_0000001655128998.png)
## 替换SDK
1. 确认下载的SDK版本是否为full-SDK
a.检查下载文件名是否包含full-SDK字样
![image-20220613220702504](figures/zh-cn_image_0000001655129232.png)
b.检查api中是否包含系统API(@ohos.application.abilityManager.d.ts、@ohos.application.formInfo.d.ts、@ohos.bluetooth.d.ts等)
注:系统api判定标准以发布api指导文档为主。
2. 替换SDK,以public-SDK-3.1.6.6版本为例。
以windows为例:
a.解压已下载的full-SDK文件:`ets-windows-3.1.6.5-Release.zip`
![image-20220613165018184](figures/zh-cn_image_0000001655129264.png)
b.替换SDK文件
**备份本地SDK**(复制并重命名ets目录下版本信息目录名,或者将ets目录拷贝至其他本地路径)
打开获取到的本地已安装SDK文件路径并进行备份。
![image-20220613161352157](figures/zh-cn_image_0000001655129041.png)
注:备份版本信息目录名称只要与其下`oh-uni-package.json`配置文件的version字段不一致即可,如下图所示,备份3.1.6.6版本sdk
![image-20220613165018184](figures/zh-cn_image_0000001655129398.png)
`oh-uni-package.json`文件配置信息如下:
```
{
"apiVersion": "8",
"displayName": "Ets",
"meta": {
"metaVersion": "3.0.0"
},
"path": "ets",
"releaseType": "Release",
"version": "3.1.6.6"
}
```
**删除原SDK(3.1.6.6)目录中的所有文件**(否则可能会导致文件无法全部覆盖)
**拷贝full-SDK至本地SDK路径**
将下载的full-SDK文件包中`ets`目录下的所有文件替换至本地SDK路径下`ets\3.1.6.6`目录中
修改`oh-uni-package.json`配置文件的version字段为当前SDK版本号
`3.1.6.6\build-tools\ets-loader`目录中打开cmd/powerShell窗口,输入命令`npm install`下载**node_modules**依赖包
![image-20220613171111405](figures/zh-cn_image_0000001655129333.png)
c.验证系统API接口
![image-20220613213038104](figures/zh-cn_image_0000001655129372.png)
\ No newline at end of file
...@@ -124,7 +124,7 @@ app实例: ...@@ -124,7 +124,7 @@ app实例:
"target": 5, "target": 5,
"releaseType": "Beta1" "releaseType": "Beta1"
} }
} }
``` ```
### deviceConfig对象的内部结构 ### deviceConfig对象的内部结构
...@@ -398,8 +398,7 @@ abilities示例: ...@@ -398,8 +398,7 @@ abilities示例:
"label": "$media:example", "label": "$media:example",
"launchType": "standard", "launchType": "standard",
"orientation": "unspecified", "orientation": "unspecified",
"permissions": [ "permissions": [],
],
"visible": true, "visible": true,
"skills": [ "skills": [
{ {
......
...@@ -620,18 +620,14 @@ form示例 : ...@@ -620,18 +620,14 @@ form示例 :
```json ```json
{ {
"extensionAbilities": [ "extensionAbilities": [{
{
"name": "MyForm", "name": "MyForm",
"type": "form", "type": "form",
"metadata": [ "metadata": [{
{
"name": "ohos.extability.form", "name": "ohos.extability.form",
"resource": "$profile:form_config", "resource": "$profile:form_config"
} }]
], }]
}
]
} }
``` ```
...@@ -656,19 +652,15 @@ metadata中指定shortcut信息,其中 : ...@@ -656,19 +652,15 @@ metadata中指定shortcut信息,其中 :
```json ```json
{ {
"shortcuts": [ "shortcuts": [{
{
"shortcutId": "id_test1", "shortcutId": "id_test1",
"label": "$string:shortcut", "label": "$string:shortcut",
"icon": "$media:aa_icon", "icon": "$media:aa_icon",
"wants": [ "wants": [{
{ "bundleName": "com.ohos.hello",
"bundleName": "com.ohos.hello"
"abilityName": "MainAbility" "abilityName": "MainAbility"
} }]
] }]
}
]
} }
``` ```
...@@ -678,23 +670,19 @@ metadata中指定shortcut信息,其中 : ...@@ -678,23 +670,19 @@ metadata中指定shortcut信息,其中 :
{ {
"module": { "module": {
"name": "MyAbilityStage", "name": "MyAbilityStage",
"abilities" : [ "abilities": [{
{ "name": "MyAbility",
"name" : "MyAbility",
"srcEntrance": "./abilities/MyAbility.ts", "srcEntrance": "./abilities/MyAbility.ts",
"skills": [{ "skills": [{
"actions": ["action.system.home"], "actions": ["action.system.home"],
"entities": ["entity.system.home"], "entities": ["entity.system.home"],
"uris": [] "uris": []
}], }],
"metadata": [ "metadata": [{
{
"name": "ohos.ability.shortcuts", "name": "ohos.ability.shortcuts",
"resource": "$profile:shortcuts_config", "resource": "$profile:shortcuts_config"
} }]
], }]
}
]
} }
} }
``` ```
...@@ -721,8 +709,7 @@ metadata中指定commonEvent信息,其中 : ...@@ -721,8 +709,7 @@ metadata中指定commonEvent信息,其中 :
```json ```json
{ {
"commonEvents": [ "commonEvents": [{
{
"name": "abilityName", "name": "abilityName",
"permission": "string", "permission": "string",
"types": [ "types": [
...@@ -733,8 +720,7 @@ metadata中指定commonEvent信息,其中 : ...@@ -733,8 +720,7 @@ metadata中指定commonEvent信息,其中 :
"string", "string",
"string" "string"
] ]
} }]
]
} }
``` ```
...@@ -746,12 +732,10 @@ metadata中指定commonEvent信息,其中 : ...@@ -746,12 +732,10 @@ metadata中指定commonEvent信息,其中 :
"name": "mySubscriber", "name": "mySubscriber",
"srcEntrance": "./extension/my_subscriber.js", "srcEntrance": "./extension/my_subscriber.js",
"type": "staticSubscriber", "type": "staticSubscriber",
"metadata": [ "metadata": [{
{
"name": "ohos.extability.staticSubscriber", "name": "ohos.extability.staticSubscriber",
"resource": "$profile:common_event_config", "resource": "$profile:common_event_config",
} }],
],
} }
] ]
``` ```
...@@ -816,15 +800,15 @@ distroFilter示例 : ...@@ -816,15 +800,15 @@ distroFilter示例 :
{ {
"apiVersion": { "apiVersion": {
"policy": "include", "policy": "include",
"value": [4,5] "value": [4, 5]
}, },
"screenShape": { "screenShape": {
"policy": "include", "policy": "include",
"value": ["circle","rect"] "value": ["circle", "rect"]
}, },
"screenWindow": { "screenWindow": {
"policy": "include", "policy": "include",
"value": ["454*454","466*466"] "value": ["454*454", "466*466"]
} }
} }
] ]
...@@ -838,15 +822,12 @@ distroFilter示例 : ...@@ -838,15 +822,12 @@ distroFilter示例 :
"name": "mySubscriber", "name": "mySubscriber",
"srcEntrance": "./extension/my_subscriber.js", "srcEntrance": "./extension/my_subscriber.js",
"type": "staticSubscriber", "type": "staticSubscriber",
"metadata": [ "metadata": [{
{
"name": "ohos.extability.staticSubscriber", "name": "ohos.extability.staticSubscriber",
"resource": "$profile:distroFilter_config", "resource": "$profile:distroFilter_config",
} }],
],
} }
] ]
``` ```
#### testRunner对象内部结构 #### testRunner对象内部结构
......
...@@ -81,6 +81,7 @@ ...@@ -81,6 +81,7 @@
- 图形图像 - 图形图像
- [@ohos.display (屏幕属性)](js-apis-display.md) - [@ohos.display (屏幕属性)](js-apis-display.md)
- [@ohos.effectKit (图像效果)](js-apis-effectKit.md)
- [@ohos.screenshot (屏幕截图)](js-apis-screenshot.md) - [@ohos.screenshot (屏幕截图)](js-apis-screenshot.md)
- [@ohos.window (窗口)](js-apis-window.md) - [@ohos.window (窗口)](js-apis-window.md)
- [webgl (WebGL)](js-apis-webgl.md) - [webgl (WebGL)](js-apis-webgl.md)
......
...@@ -832,7 +832,7 @@ getAbilityInfo(callback: AsyncCallback\<AbilityInfo>): void ...@@ -832,7 +832,7 @@ getAbilityInfo(callback: AsyncCallback\<AbilityInfo>): void
| 名称 | 类型 | 必填 | 描述 | | 名称 | 类型 | 必填 | 描述 |
| -------- | ---------------------- | ---- | ------------------------- | | -------- | ---------------------- | ---- | ------------------------- |
| callback | AsyncCallback\<[AbilityInfo](#abilityInfo)> | 是 | 回调函数,可以在回调函数中处理接口返回值,返回当前归属Ability详细信息。| | callback | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | 是 | 回调函数,可以在回调函数中处理接口返回值,返回当前归属Ability详细信息。|
**示例:** **示例:**
...@@ -860,7 +860,7 @@ getAbilityInfo(): Promise\<AbilityInfo> ...@@ -860,7 +860,7 @@ getAbilityInfo(): Promise\<AbilityInfo>
| 类型 | 说明 | | 类型 | 说明 |
| --------------- | ------------------------- | | --------------- | ------------------------- |
| Promise\<[AbilityInfo](#abilityInfo)> | 返回当前归属Ability详细信息。 | | Promise\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | 返回当前归属Ability详细信息。 |
**示例:** **示例:**
......
...@@ -20,11 +20,26 @@ import Want from '@ohos.application.Want'; ...@@ -20,11 +20,26 @@ import Want from '@ohos.application.Want';
| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | | ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
| deviceId | 只读 | string | 否 | 表示运行指定Ability的设备ID。 | | deviceId | 只读 | string | 否 | 表示运行指定Ability的设备ID。 |
| bundleName | 只读 | string | 否 | 表示包描述。如果在Want中同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。 | | bundleName | 只读 | string | 否 | 表示包描述。如果在Want中同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。 |
| abilityName | 只读 | string | 否 | 表示待启动的Ability名称。如果在Want中该字段同时指定了package和AbilityName,则Want可以直接匹配到指定的Ability。 | | abilityName | 只读 | string | 否 | 表示待启动的Ability名称。如果在Want中该字段同时指定了package和AbilityName,则Want可以直接匹配到指定的Ability。AbilityName需要在一个应用的范围内保证唯一。 |
| uri | 只读 | string | 否 | 表示Uri描述。如果在Want中指定了Uri,则Want将匹配指定的Uri信息,包括scheme, schemeSpecificPart, authority和path信息。 | | uri | 只读 | string | 否 | 表示Uri描述。如果在Want中指定了Uri,则Want将匹配指定的Uri信息,包括scheme, schemeSpecificPart, authority和path信息。 |
| type | 只读 | string | 否 | 表示MIME type类型描述,比如:"text/plain" 、 "image/*"等。 | | type | 只读 | string | 否 | 表示MIME type类型描述,比如:"text/plain" 、 "image/*"等。 |
| flags | 只读 | number | 否 | 表示处理Want的方式。默认传数字,具体参考:[flags说明](js-apis-featureAbility.md#flags说明)。 | | flags | 只读 | number | 否 | 表示处理Want的方式。默认传数字,具体参考:[flags说明](js-apis-featureAbility.md#flags说明)。 |
| action | 只读 | string | 否 | 表示action选项描述。 | | action | 只读 | string | 否 | 表示action选项描述。 |
| parameters | 只读 | {[key: string]: any} | 否 | 表示WantParams描述,由开发者自行决定传入的键值对。默认会携带以下key值:<br>ohos.aafwk.callerPid 表示拉起方的pid。<br>ohos.aafwk.param.callerToken 表示拉起方的token。<br>ohos.aafwk.param.callerUid 表示发起方的uid。[Bundle](js-apis-Bundle.js)模块中userId参数,可用于获取应用信息、包信息等,具体参考:[Bundle](js-apis-Bundle.js)。 | | parameters | 只读 | {[key: string]: any} | 否 | 表示WantParams描述,由开发者自行决定传入的键值对。默认会携带以下key值:<br>ohos.aafwk.callerPid 表示拉起方的pid。<br>ohos.aafwk.param.callerToken 表示拉起方的token。<br>ohos.aafwk.param.callerUid 表示发起方的uid。[Bundle](js-apis-Bundle.js)模块中userId参数,可用于获取应用信息、包信息等,具体参考:[Bundle](js-apis-Bundle.js)。 |
| entities | 只读 | Array\<string> | 否 | 表示entities相关描述。 | | entities | 只读 | Array\<string> | 否 | 表示entities相关描述。 |
| moduleName<sup>9+</sup> | 只读 | string | 否 | 表示待启动的Ability所属的模块(module)。同一应用的不同hap的组件可能重名,仅通过BundleName和AbilityName无法区分时,可以通过设置moduleName加以区分,以匹配到指定的Ability。 | | | moduleName<sup>9+</sup> | 只读 | string | 否 | 表示待启动的Ability所属的模块(module)。 |
**示例:**
``` js
var want = {
"deviceId": "", // deviceId为空表示本设备
"bundleName": "com.extreme.test",
"abilityName": "MainAbility",
"moduleName": "entry" // moduleName非必选
};
this.context.startAbility(want, (error) => {
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
console.log("error.code = " + error.code)
})
```
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
该模块提供以下图像效果相关的常用功能: 该模块提供以下图像效果相关的常用功能:
- [Filter](#filter):效果链。 - [Filter](#filter):效果链。
- [Color](#color):颜色类,用于保存取色的结果。
- [ColorPicker](#colorpicker):智能取色器。 - [ColorPicker](#colorpicker):智能取色器。
> **说明:** > **说明:**
...@@ -52,7 +53,7 @@ image.createPixelMap(color, opts) ...@@ -52,7 +53,7 @@ image.createPixelMap(color, opts)
createColorPicker(source: image.PixelMap): Promise\<ColorPicker> createColorPicker(source: image.PixelMap): Promise\<ColorPicker>
通过属性创建PixelMap,使用Promise异步回调。 通过传入的PixelMap创建ColorPicker实例,使用Promise异步回调。
**系统能力:** SystemCapability.Multimedia.Image.Core **系统能力:** SystemCapability.Multimedia.Image.Core
...@@ -60,13 +61,13 @@ createColorPicker(source: image.PixelMap): Promise\<ColorPicker> ...@@ -60,13 +61,13 @@ createColorPicker(source: image.PixelMap): Promise\<ColorPicker>
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| -------- | ----------- | ---- | -------------------------- | | -------- | ----------- | ---- | -------------------------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例 | | source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------- | -------------- | | ---------------------- | -------------- |
| Promisse\<[ColorPicker](#colorpicker)> | Promise对象。返回当前创建的子窗口对象。 | | Promisse\<[ColorPicker](#colorpicker)> | Promise对象。返回创建的ColorPicker实例。 |
**示例:** **示例:**
...@@ -87,7 +88,7 @@ image.createPixelMap(color, opts, (pixelmap) => { ...@@ -87,7 +88,7 @@ image.createPixelMap(color, opts, (pixelmap) => {
createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>): void createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>): void
通过属性创建PixelMap,使用callback异步回调。 通过传入的PixelMap创建ColorPicker实例,使用callback异步回调。
**系统能力:** SystemCapability.Multimedia.Image.Core **系统能力:** SystemCapability.Multimedia.Image.Core
...@@ -95,8 +96,8 @@ createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>) ...@@ -95,8 +96,8 @@ createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>)
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| -------- | ------------------ | ---- | -------------------------- | | -------- | ------------------ | ---- | -------------------------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | BGRA_8888格式的颜色数组。 | | source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 |image模块创建的PixelMap实例。 |
| callback | AsyncCallback\<[ColorPicker](#colorpicker)> | 是 | 回调函数,返回ColorPicker。 | | callback | AsyncCallback\<[ColorPicker](#colorpicker)> | 是 | 回调函数。返回创建的ColorPicker实例。 |
**示例:** **示例:**
...@@ -107,9 +108,9 @@ let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } ...@@ -107,9 +108,9 @@ let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts, (pixelmap) => { image.createPixelMap(color, opts, (pixelmap) => {
effectKit.createColorPicker(pixelMap, (error, colorPicker) ) { effectKit.createColorPicker(pixelMap, (error, colorPicker) ) {
if(error) { if(error) {
console.log('create color picker failed.'); console.log('Failed to create color picker.');
} else { } else {
console.log('create color picker succeeded.'); console.log('Succeeded in creating color picker.');
} }
}) })
}) })
...@@ -144,16 +145,16 @@ getMainColor(): Promise\<Color> ...@@ -144,16 +145,16 @@ getMainColor(): Promise\<Color>
| 类型 | 说明 | | 类型 | 说明 |
| :------------- | :---------------------------------------------- | | :------------- | :---------------------------------------------- |
| Promise\<[Color](#color)> | Promise实例,用于获取结果,失败时返回错误信息。 | | Promise\<[Color](#color)> | Promise对象。返回图像主色对应的颜色值,失败时返回错误信息。 |
**示例:** **示例:**
```js ```js
colorPicker.getMainColor().then(color => { colorPicker.getMainColor().then(color => {
console.log('get main color succeeded.') console.log('Succeeded in getting main color.')
console.info("color[ARGB]=" + color.alpha "," + color.red + "," + color.green + "," + color.blue); console.info("color[ARGB]=" + color.alpha "," + color.red + "," + color.green + "," + color.blue);
}).catch(error => { }).catch(error => {
console.log('get main color failed.'); console.log('Failed to get main color.');
}) })
``` ```
...@@ -169,7 +170,7 @@ getMainColorSync(): Color ...@@ -169,7 +170,7 @@ getMainColorSync(): Color
| 类型 | 说明 | | 类型 | 说明 |
| :------- | :----------------------------------- | | :------- | :----------------------------------- |
| [Color](#color) | Color实例,用于获取结果,失败时返回null。 | | [Color](#color) | Color实例,即图像主色对应的颜色值,失败时返回null。 |
**示例:** **示例:**
...@@ -266,7 +267,7 @@ grayscale(): Filter ...@@ -266,7 +267,7 @@ grayscale(): Filter
| 类型 | 说明 | | 类型 | 说明 |
| :------------- | :---------------------------------------------- | | :------------- | :---------------------------------------------- |
| Filter | 返回效果链表头。 | | [Filter](#filter) | 返回效果链表头。 |
**示例:** **示例:**
......
...@@ -1333,7 +1333,7 @@ videoPlayer.setSpeed(speed).then() => { ...@@ -1333,7 +1333,7 @@ videoPlayer.setSpeed(speed).then() => {
selectBitrate(bitrate:number, callback: AsyncCallback\<number>): void selectBitrate(bitrate:number, callback: AsyncCallback\<number>): void
通过回调方式设置码率。 通过回调方式设置码率,通过[availableBitrateCollected](#on('availableBitrateCollected')<sup>9+</sup>)获取当前码流支持的Bitrate
**系统能力:** SystemCapability.Multimedia.Media.VideoPlayer **系统能力:** SystemCapability.Multimedia.Media.VideoPlayer
...@@ -1392,7 +1392,7 @@ videoPlayer.selectBitrate(bitrate).then() => { ...@@ -1392,7 +1392,7 @@ videoPlayer.selectBitrate(bitrate).then() => {
on(type: 'playbackCompleted', callback: Callback\<void>): void on(type: 'playbackCompleted', callback: Callback\<void>): void
开始监听视频播放完成事件,通过[availableBitrateCollected](#on('availableBitrateCollected')<sup>9+</sup>)获取当前码流支持的Bitrate 开始监听视频播放完成事件。
**系统能力:** SystemCapability.Multimedia.Media.VideoPlayer **系统能力:** SystemCapability.Multimedia.Media.VideoPlayer
...@@ -1521,7 +1521,7 @@ on(type: 'availableBitrateCollected', callback: (bitrates: Array<number>) => voi ...@@ -1521,7 +1521,7 @@ on(type: 'availableBitrateCollected', callback: (bitrates: Array<number>) => voi
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ------------------------------------------------------------ | | -------- | -------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 视频播放码率上报事件回调类型,支持的事件:'availableBitrateCollected',只在开始播放时候上报一次 | | type | string | 是 | 视频播放码率上报事件回调类型,支持的事件:'availableBitrateCollected',只在开始播放时候上报一次 |
| callback | function | 是 | 视频播放码率事件回调方法,使用Array数组存放支持的码率。 | | callback | function | 是 | 视频播放码率事件回调方法,使用数组存放支持的码率。 |
**示例:** **示例:**
...@@ -1875,7 +1875,7 @@ audioRecorder.prepare(); // pre ...@@ -1875,7 +1875,7 @@ audioRecorder.prepare(); // pre
## AudioOutputFormat<sup>(deprecated)</sup> ## AudioOutputFormat<sup>(deprecated)</sup>
> **说明:** > **说明:**
> 从 API Version 8 开始废弃,建议使用[ContainerFormatType ](#containerformattype8)替代。 > 从 API Version 8 开始废弃,建议使用[ContainerFormatType](#containerformattype8)替代。
表示音频封装格式的枚举。 表示音频封装格式的枚举。
......
# 上传下载 # 上传下载
request部件主要给应用提供上传下载文件、后台传输代理的基础能力。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
...@@ -18,14 +19,16 @@ import request from '@ohos.request'; ...@@ -18,14 +19,16 @@ import request from '@ohos.request';
默认支持https,如果要支持http,需要在config.json里增加network标签,属性标识 "cleartextTraffic": true。即: 默认支持https,如果要支持http,需要在config.json里增加network标签,属性标识 "cleartextTraffic": true。即:
``` ```
var config = {
"deviceConfig": { "deviceConfig": {
"default": { "default": {
"network": { "network": {
"cleartextTraffic": true "cleartextTraffic": true
} }
... //...
} }
} }
}
``` ```
...@@ -470,7 +473,6 @@ on(type: 'progress', callback:(receivedSize: number, totalSize: number) =&gt; vo ...@@ -470,7 +473,6 @@ on(type: 'progress', callback:(receivedSize: number, totalSize: number) =&gt; vo
console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize); console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize);
} }
); );
});
``` ```
...@@ -505,7 +507,6 @@ off(type: 'progress', callback?: (receivedSize: number, totalSize: number) =&gt; ...@@ -505,7 +507,6 @@ off(type: 'progress', callback?: (receivedSize: number, totalSize: number) =&gt;
console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize); console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize);
} }
); );
});
``` ```
...@@ -533,7 +534,6 @@ on(type: 'complete'|'pause'|'remove', callback:() =&gt; void): void ...@@ -533,7 +534,6 @@ on(type: 'complete'|'pause'|'remove', callback:() =&gt; void): void
console.info('Download task completed.'); console.info('Download task completed.');
} }
); );
});
``` ```
...@@ -561,7 +561,6 @@ off(type: 'complete'|'pause'|'remove', callback?:() =&gt; void): void ...@@ -561,7 +561,6 @@ off(type: 'complete'|'pause'|'remove', callback?:() =&gt; void): void
console.info('Download task completed.'); console.info('Download task completed.');
} }
); );
});
``` ```
...@@ -595,7 +594,6 @@ on(type: 'fail', callback: (err: number) =&gt; void): void ...@@ -595,7 +594,6 @@ on(type: 'fail', callback: (err: number) =&gt; void): void
console.info('Download task failed. Cause:' + err); console.info('Download task failed. Cause:' + err);
} }
); );
});
``` ```
...@@ -629,7 +627,6 @@ off(type: 'fail', callback?: (err: number) =&gt; void): void ...@@ -629,7 +627,6 @@ off(type: 'fail', callback?: (err: number) =&gt; void): void
console.info('Download task failed. Cause:' + err); console.info('Download task failed. Cause:' + err);
} }
); );
});
``` ```
......
...@@ -27,6 +27,7 @@ push(options: RouterOptions): void ...@@ -27,6 +27,7 @@ push(options: RouterOptions): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| options | [RouterOptions](#routeroptions) | 是 | 跳转页面描述信息。 | | options | [RouterOptions](#routeroptions) | 是 | 跳转页面描述信息。 |
| mode<sup>9+</sup> | [RouterMode](#routermode9) | 否 | 跳转页面使用的模式。 |
**示例:** **示例:**
...@@ -75,6 +76,7 @@ replace(options: RouterOptions): void ...@@ -75,6 +76,7 @@ replace(options: RouterOptions): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| options | [RouterOptions](#routeroptions) | 是 | 替换页面描述信息。 | | options | [RouterOptions](#routeroptions) | 是 | 替换页面描述信息。 |
| mode<sup>9+</sup> | [RouterMode](#routermode9) | 否 | 跳转页面使用的模式。 |
**示例:** **示例:**
...@@ -87,7 +89,7 @@ replace(options: RouterOptions): void ...@@ -87,7 +89,7 @@ replace(options: RouterOptions): void
params: { params: {
data1: 'message', data1: 'message',
}, },
}); }, router.RouterMode.Standard);
} }
} }
``` ```
...@@ -436,3 +438,13 @@ getParams(): Object ...@@ -436,3 +438,13 @@ getParams(): Object
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 页面路由栈支持的最大Page数量为32。 > 页面路由栈支持的最大Page数量为32。
## RouterMode<sup>9+</sup>
路由跳转模式。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Lite。
| 名称 | 描述 |
| -------- | -------- |
| Standard | 标准模式。 |
| Single | 单实例模式。<br/>如果目标页面的url在页面栈中已经存在同url页面,离栈顶最近的页面会被移动到栈顶,移动后的页面为新建页。<br/>如目标页面的url在页面栈中不存在同url页面,按标准模式跳转。 |
...@@ -202,6 +202,8 @@ onReconnect(want: Want): void; ...@@ -202,6 +202,8 @@ onReconnect(want: Want): void;
onConfigurationUpdated(config: Configuration): void; onConfigurationUpdated(config: Configuration): void;
当Extension更新配置信息时调用。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core **系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**系统API**: 此接口为系统接口,三方应用不支持调用。 **系统API**: 此接口为系统接口,三方应用不支持调用。
......
...@@ -1001,6 +1001,54 @@ async function demo() { ...@@ -1001,6 +1001,54 @@ async function demo() {
} }
``` ```
### pinchOut<sup>9+</sup>
pinchOut(scale: number): Promise\<void>
将控件按指定的比例进行捏合放大。
**系统能力**:SystemCapability.Test.UiTest
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------- | ---- | ---------- |
| scale | number | 是 | 指定比例 |
**示例:**
```js
async function demo() {
let driver = UiDriver.create()
let image = await driver.findComponent(BY.type('image'))
await image.pinchOut(1.5)
}
```
### pinchIn<sup>9+</sup>
pinchIn(scale: number): Promise\<void>
将控件按指定的比例进行捏合缩小。
**系统能力**:SystemCapability.Test.UiTest
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------- | ---- | ---------- |
| scale | number | 是 | 指定比例 |
**示例:**
```js
async function demo() {
let driver = UiDriver.create()
let image = await driver.findComponent(BY.type('image'))
await image.pinchIn(0.5)
}
```
## UiDriver ## UiDriver
UiDriver类为uitest测试框架的总入口,提供控件匹配/查找,按键注入,坐标点击/滑动,截图等API。 UiDriver类为uitest测试框架的总入口,提供控件匹配/查找,按键注入,坐标点击/滑动,截图等API。
...@@ -1231,6 +1279,32 @@ async function demo() { ...@@ -1231,6 +1279,32 @@ async function demo() {
} }
``` ```
### triggerCombineKeys<sup>9+</sup>
triggerCombineKeys(key0: number, key1: number, key2: number): Promise\<void>
UiDriver对象通过给定的key值,找到对应组合键并点击。例如,Key值为(2072, 2019)时,UiDriver对象找到组合键并点击ctrl+c。
**系统能力**:SystemCapability.Test.UiTest
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ------------------- |
| key0 | number | 是 | 指定的第一个key值。 |
| key1 | number | 是 | 指定的第二个key值。 |
| key2 | number | 否 | 指定的第三个key值。 |
**示例:**
```js
async function demo() {
let driver = UiDriver.create()
await driver.triggerCombineKeys(2072, 2047, 2035)
}
```
### click ### click
click(x: number, y: number): Promise\<void> click(x: number, y: number): Promise\<void>
......
# 升级 # 升级
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > **说明:**
> 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 >
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
升级范围:升级整个系统,包括内置的资源、预置应用;第三方的应用不在升级的范围。 升级范围:升级整个系统,包括内置的资源、预置应用;第三方的应用不在升级的范围。
...@@ -16,15 +17,11 @@ ...@@ -16,15 +17,11 @@
import update from '@ohos.update' import update from '@ohos.update'
``` ```
## 权限列表 ## update.getOnlineUpdater
getOnlineUpdater(upgradeInfo: UpgradeInfo): Updater
## update.getUpdater 获取在线升级对象。
getUpdater(upgradeFile: string, updateType?: UpdateTypes): Updater
获取本地升级Updater。
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
...@@ -32,8 +29,7 @@ getUpdater(upgradeFile: string, updateType?: UpdateTypes): Updater ...@@ -32,8 +29,7 @@ getUpdater(upgradeFile: string, updateType?: UpdateTypes): Updater
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ----------- | --------------------------- | ---- | ---- | | ----------- | --------------------------- | ---- | ---- |
| upgradeFile | string | 是 | 升级文件 | | upgradeInfo | [UpgradeInfo](#upgradeinfo) | 是 | 升级信息对象 |
| updateType | [UpdateTypes](#updatetypes) | 是 | 升级类型 |
**返回值:** **返回值:**
...@@ -45,100 +41,144 @@ getUpdater(upgradeFile: string, updateType?: UpdateTypes): Updater ...@@ -45,100 +41,144 @@ getUpdater(upgradeFile: string, updateType?: UpdateTypes): Updater
``` ```
try { try {
let updater = update.getUpdater('/data/updater/updater.zip', 'OTA'); var upgradeInfo = {
upgradeApp: "com.ohos.ota.updateclient",
businessType: {
vendor: update.BusinessVendor.PUBLIC,
subType: update.BusinessSubType.FIRMWARE
}
}
let updater = update.getOnlineUpdater(upgradeInfo);
} catch(error) { } catch(error) {
console.error(" Fail to get updater error: " + error); console.error(`Fail to get updater error: ${error}`);
} }
``` ```
## update.getUpdaterForOther ## update.getRestorer
getUpdaterForOther(upgradeFile: string, device: string, updateType?: UpdateTypes): Updater getRestorer(): Restorer
获取升级对象给待升级设备 获取恢复出厂对象
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | --------------------------- | ---- | ----- |
| upgradeFile | string | 是 | 升级文件 |
| device | string | 是 | 待升级设备 |
| updateType | [UpdateTypes](#updatetypes) | 是 | 升级类型 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------- | ---- | | ------------------- | ---- |
| [Updater](#updater) | 升级对象 | | [Restorer](#restorer) | 恢复出厂对象 |
**示例:** **示例:**
``` ```
try { try {
let updater = update.getUpdaterForOther('/data/updater/updater.zip', '1234567890', 'OTA'); let restorer = update.getRestorer();
} catch(error) { } catch(error) {
console.error(" Fail to get updater error: " + error); console.error(`Fail to get restorer: ${error}`);
} }
``` ```
## update.getUpdaterFromOther ## update.getLocalUpdater
getUpdaterFromOther(upgradeFile: string, device: string, updateType?: UpdateTypes): Updater getLocalUpdater(): LocalUpdater
获取其它设备为本设备升级的Updater 获取本地升级对象
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | --------------------------- | ---- | ----- |
| upgradeFile | string | 是 | 升级文件 |
| device | string | 是 | 待升级设备 |
| updateType | [UpdateTypes](#updatetypes) | 是 | 升级类型 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------- | ---- | | ------------------- | ---- |
| [Updater](#updater) | 升级对象 | | [LocalUpdater](#localupdater) | 本地升级对象 |
**示例:** **示例:**
``` ```
try { try {
let updater = update.getUpdaterFromOther('/data/updater/updater.zip', '1234567890', 'OTA'); let localUpdater = update.getLocalUpdater();
} catch(error) { } catch(error) {
console.error(" Fail to get updater error: " + error); console.error(`Fail to get localUpdater error: ${error}`);
} }
``` ```
## Updater ## Updater
### checkNewVersion
checkNewVersion(callback: AsyncCallback\<CheckResult>): void
检查新版本信息。使用callback异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| callback | AsyncCallback\<[CheckResult](#checkresult)> | 是 | 回调函数,返回搜包结果对象。 |
**示例:**
```
updater.checkNewVersion((err, result) => {
console.log(`checkNewVersion isExistNewVersion ${result?.isExistNewVersion}`);
});
```
### checkNewVersion
checkNewVersion(): Promise\<CheckResult>
检查新版本信息。使用Promise异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**返回值:**
| 类型 | 说明 |
| ---------------------------------------- | ---------------- |
| Promise\<[CheckResult](#checkresult)> | Promise对象,返回搜包结果对象。 |
**示例:**
```
updater.checkNewVersion().then(result => {
console.log(`checkNewVersion isExistNewVersion: ${result.isExistNewVersion}`);
// 版本摘要信息
console.log(`checkNewVersion versionDigestInfo: ${result.newVersionInfo.versionDigestInfo.versionDigest}`);
}).catch(err => {
console.log(`checkNewVersion promise error ${JSON.stringify(err)}`);
});
```
### getNewVersionInfo ### getNewVersionInfo
getNewVersionInfo(callback: AsyncCallback\<NewVersionInfo>): void getNewVersionInfo(callback: AsyncCallback\<NewVersionInfo>): void
获取新版本信息,使用callback方式作为异步方法 获取新版本信息。使用callback异步回调
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- | | -------- | ---------------------------------------- | ---- | --------- |
| callback | AsyncCallback<[NewVersionInfo](#newversioninfo)> | 否 | 回调返回新版本信息 | | callback | AsyncCallback\<[NewVersionInfo](#newversioninfo)> | 是 | 回调函数,返回新版本信息对象。 |
**示例:** **示例:**
``` ```
updater.getNewVersionInfo((err, info) => { updater.getNewVersionInfo((err, info) => {
console.log("getNewVersionInfo success " + info.status); console.log(`info displayVersion = ${info?.versionComponents[0].displayVersion}`);
console.log(`info versionName = ` + info.checkResults[0].versionName); console.log(`info innerVersion = ${info?.versionComponents[0].innerVersion}`);
console.log(`info versionCode = ` + info.checkResults[0].versionCode);
console.log(`info verifyInfo = ` + info.checkResults[0].verifyInfo);
}); });
``` ```
...@@ -146,451 +186,1377 @@ updater.getNewVersionInfo((err, info) => { ...@@ -146,451 +186,1377 @@ updater.getNewVersionInfo((err, info) => {
getNewVersionInfo(): Promise\<NewVersionInfo> getNewVersionInfo(): Promise\<NewVersionInfo>
获取新版本信息,使用promise方式作为异步方法 获取新版本信息。使用Promise异步回调
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------------------------- | ---------------- | | ---------------------------------------- | ---------------- |
| Promise\<[NewVersionInfo](#newversioninfo)> | Promise,用于异步获取结果 | | Promise\<[NewVersionInfo](#newversioninfo)> | Promise对象,返回新版本信息对象。 |
**示例:** **示例:**
``` ```
updater.getNewVersionInfo().then(value => { updater.getNewVersionInfo().then(info => {
console.log(`info versionName = ` + value.checkResults[0].versionName); console.log(`info displayVersion = ${info.versionComponents[0].displayVersion}`);
console.log(`info versionCode = ` + value.checkResults[0].versionCode); console.log(`info innerVersion = ${info.versionComponents[0].innerVersion}`);
console.log(`info verifyInfo = ` + value.checkResults[0].verifyInfo);
}).catch(err => { }).catch(err => {
console.log("getNewVersionInfo promise error: " + err.code); console.log(`getNewVersionInfo promise error ${JSON.stringify(err)}`);
}); });
``` ```
### checkNewVersion ### getCurrentVersionInfo
checkNewVersion(callback: AsyncCallback\<NewVersionInfo>): void getCurrentVersionInfo(callback: AsyncCallback\<CurrentVersionInfo>): void
检查新版本,使用callback方式作为异步方法 获取当前版本信息。使用callback异步回调
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- | | -------- | ---------------------------------------- | ---- | --------- |
| callback | AsyncCallback\<[NewVersionInfo](#newversioninfo)> | 否 | 回调返回新版本信息 | | callback | AsyncCallback\<[CurrentVersionInfo](#currentversioninfo)> | 是 | 回调函数,返回当前版本信息对象。 |
**示例:** **示例:**
``` ```
updater.checkNewVersion((err, info) => { updater.getCurrentVersionInfo((err, info) => {
console.log("checkNewVersion success " + info.status); console.log(`info osVersion = ${info?.osVersion}`);
console.log(`info versionName = ` + info.checkResults[0].versionName); console.log(`info deviceName = ${info?.deviceName}`);
console.log(`info versionCode = ` + info.checkResults[0].versionCode); console.log(`info displayVersion = ${info?.versionComponents[0].displayVersion}`);
console.log(`info verifyInfo = ` + info.checkResults[0].verifyInfo);
}); });
``` ```
### checkNewVersion ### getCurrentVersionInfo
checkNewVersion(): Promise\<NewVersionInfo> getCurrentVersionInfo(): Promise\<CurrentVersionInfo>
检查新版本,使用promise方式作为异步方法 获取当前版本信息。使用Promise异步回调
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**返回值:** **需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------------------------- | ---------------- | | ---------------------------------------- | ---------------- |
| Promise\<[NewVersionInfo](#newversioninfo)> | Promise函数返回新版本信息 | | Promise\<[CurrentVersionInfo](#currentversioninfo)> | Promise对象,返回当前版本对象。 |
**示例:** **示例**
``` ```
updater.checkNewVersion().then(value => { updater.getCurrentVersionInfo().then(info => {
console.log(`info versionName = ` + value.checkResults[0].versionName); console.log(`info osVersion = ${info.osVersion}`);
console.log(`info versionCode = ` + value.checkResults[0].versionCode); console.log(`info deviceName = ${info.deviceName}`);
console.log(`info verifyInfo = ` + value.checkResults[0].verifyInfo); console.log(`info displayVersion = ${info.versionComponents[0].displayVersion}`);
}).catch(err => { }).catch(err => {
console.log("checkNewVersion promise error: " + err.code); console.log(`getCurrentVersionInfo promise error ${JSON.stringify(err)}`);
}); });
``` ```
### verifyUpdatePackage ### getTaskInfo
verifyUpdatePackage(upgradeFile: string, certsFile: string): void getTaskInfo(callback: AsyncCallback\<TaskInfo>): void
升级前检查升级包是否有效 获取升级任务信息。使用callback异步回调
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ----------- | ------ | ---- | --------- | | -------- | ---------------------------------------- | ---- | --------- |
| upgradeFile | string | 是 | 待校验的升级包路径 | | callback | AsyncCallback\<[TaskInfo](#taskinfo)> | 是 | 回调函数,返回升级任务信息对象。 |
| certsFile | string | 是 | 证书路径 |
**示例:** **示例:**
``` ```
updater.on("verifyProgress", callback => { updater.getTaskInfo((err, info) => {
console.info('on verifyProgress ' + callback.percent); console.log(`getTaskInfo isexistTask= ${info?.existTask}`);
}); });
update.verifyUpdatePackage("XXX", "XXX");
``` ```
### rebootAndCleanUserData<sup>8+</sup> ### getTaskInfo
rebootAndCleanUserData(): Promise\<number> getTaskInfo(): Promise\<TaskInfo>
重启设备并清除用户分区数据 获取升级任务信息。使用Promise异步回调
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ---------------- | ------------------- | | ---------------------------------------- | ---------------- |
| Promise\<number> | Promise示例,用于异步获取结果。 | | Promise\<[TaskInfo](#taskinfo)> | Promise对象,返回任务信息对象。 |
**示例:** **示例:**
``` ```
updater.rebootAndCleanUserData().then(result => { updater.getTaskInfo().then(info => {
console.log("rebootAndCleanUserData " + result); console.log(`getTaskInfo isexistTask= ${info.existTask}`);
}).catch(err => { }).catch(err => {
console.info("rebootAndCleanUserData promise error: " + err.code); console.log(`getTaskInfo promise error ${JSON.stringify(err)}`);
}); });
``` ```
### rebootAndCleanUserData<sup>8+</sup> ### download
rebootAndCleanUserData(callback: AsyncCallback\<number>): void download(versionDigestInfo: VersionDigestInfo, downloadOptions: DownloadOptions, callback: AsyncCallback\<void>): void
重启设备并清除用户分区数据 下载新版本。使用callback异步回调
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ---------------------- | | -------- | ---------------------------------------- | ---- | --------- |
| callback | Function | 是 | AsyncCallback\<number> | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | 是 | 版本摘要信息 |
| downloadOptions | [DownloadOptions](#downloadoptions) | 是 | 下载选项 |
| callback | AsyncCallback\<void> | 是 | 回调函数。当下载成功时,err为undefined,否则为错误对象。 |
**示例:** **示例:**
``` ```
updater.rebootAndCleanUserData((err, result) => { // 版本摘要信息
console.log("rebootAndCleanUserData ", result) var versionDigestInfo = {
versionDigest: "versionDigest" // 检测结果中的版本摘要信息
}
// 下载选项
var downloadOptions = {
allowNetwork: update.NetType.CELLULAR_AND_WIFI, // 允许所有网络下载
order: update.Order.DOWNLOAD // 下载
}
updater.download(versionDigestInfo, downloadOptions, (err) => {
console.log(`download error ${JSON.stringify(err)}`);
}); });
``` ```
### applyNewVersion ### download
applyNewVersion(): Promise\<number> download(versionDigestInfo: VersionDigestInfo, downloadOptions: DownloadOptions): Promise\<void>
重启设备后安装升级包 下载新版本。使用Promise异步回调
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | 是 | 版本摘要信息 |
| downloadOptions | [DownloadOptions](#downloadoptions) | 是 | 下载选项 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ---------------- | ------------------- | | ---------------------------------------- | ---------------- |
| Promise\<number> | Promise示例,用于异步获取结果。 | | Promise\<void> | Promise对象。无返回结果的Promise对象。 |
**示例:** **示例:**
``` ```
updater.applyNewVersion().then(result => { // 版本摘要信息
console.log("appVewVersion ", result) var versionDigestInfo = {
versionDigest: "versionDigest" // 检测结果中的版本摘要信息
}
// 下载选项
var downloadOptions = {
allowNetwork: update.NetType.CELLULAR_AND_WIFI, // 允许所有网络下载
order: update.Order.DOWNLOAD // 下载
}
updater.download(versionDigestInfo, downloadOptions).then(() => {
console.log(`download start`);
}).catch(err => { }).catch(err => {
console.info("applyNewVersion promise error: " + err.code); console.log(`download error ${JSON.stringify(err)}`);
}); });
``` ```
### applyNewVersion ### resumeDownload
applyNewVersion(callback: AsyncCallback\<number>): void resumeDownload(versionDigestInfo: VersionDigestInfo, resumeDownloadOptions: ResumeDownloadOptions, callback: AsyncCallback\<void>): void
重启设备后安装升级包 恢复下载新版本。使用callback异步回调
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ---------------------- | | -------- | ---------------------------------------- | ---- | --------- |
| callback | Function | 是 | AsyncCallback\<number> | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | 是 | 版本摘要信息 |
| resumeDownloadOptions | [ResumeDownloadOptions](#resumedownloadoptions) | 是 | 恢复下载选项 |
| callback | AsyncCallback\<void> | 是 | 回调函数。当恢复下载成功时,err为undefined,否则为错误对象。 |
**示例:** **示例:**
``` ```
updater.applyNewVersion((err, result) => { // 版本摘要信息
console.log("applyNewVersion ", result) var versionDigestInfo = {
versionDigest: "versionDigest" // 检测结果中的版本摘要信息
}
// 恢复下载选项
var resumeDownloadOptions = {
allowNetwork: update.NetType.CELLULAR_AND_WIFI, // 允许所有网络下载
}
updater.resumeDownload(versionDigestInfo, resumeDownloadOptions, (err) => {
console.log(`resumeDownload error ${JSON.stringify(err)}`);
}); });
``` ```
### download ### resumeDownload
resumeDownload(versionDigestInfo: VersionDigestInfo, resumeDownloadOptions: ResumeDownloadOptions): Promise\<void>
恢复下载新版本。使用Promise异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | 是 | 版本摘要信息 |
| resumeDownloadOptions | [ResumeDownloadOptions](#resumedownloadoptions) | 是 | 恢复下载选项 |
**返回值:**
| 类型 | 说明 |
| ---------------------------------------- | ---------------- |
| Promise\<void> | Promise对象。无返回结果的Promise对象。 |
**示例:**
```
// 版本摘要信息
var versionDigestInfo = {
versionDigest: "versionDigest" // 检测结果中的版本摘要信息
}
// 恢复下载选项
var resumeDownloadOptions = {
allowNetwork: update.NetType.CELLULAR_AND_WIFI, // 允许所有网络下载
}
updater.resumeDownload(versionDigestInfo, resumeDownloadOptions).then(value => {
console.log(`resumeDownload start`);
}).catch(err => {
console.log(`resumeDownload error ${JSON.stringify(err)}`);
});
```
### pauseDownload
pauseDownload(versionDigestInfo: VersionDigestInfo, pauseDownloadOptions: PauseDownloadOptions, callback: AsyncCallback\<void>): void
暂停下载新版本。使用callback异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | 是 | 版本摘要信息 |
| pauseDownloadOptions | [PauseDownloadOptions](#pausedownloadoptions) | 是 | 暂停下载选项 |
| callback | AsyncCallback\<void> | 是 | 回调函数。当暂停下载成功时,err为undefined,否则为错误对象。 |
**示例:**
```
// 版本摘要信息
var versionDigestInfo = {
versionDigest: "versionDigest" // 检测结果中的版本摘要信息
}
// 暂停下载选项
var pauseDownloadOptions = {
isAllowAutoResume: true // 允许自动恢复下载
}
updater.pauseDownload(versionDigestInfo, pauseDownloadOptions, (err) => {
console.log(`pauseDownload error ${JSON.stringify(err)}`);
});
```
### pauseDownload
pauseDownload(versionDigestInfo: VersionDigestInfo, pauseDownloadOptions: PauseDownloadOptions): Promise\<void>
恢复下载新版本。使用Promise异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | 是 | 版本摘要信息 |
| pauseDownloadOptions | [PauseDownloadOptions](#pausedownloadoptions) | 是 | 暂停下载选项 |
**返回值:**
download(): void | 类型 | 说明 |
| ---------------------------------------- | ---------------- |
| Promise\<void> | Promise对象。无返回结果的Promise对象。 |
**示例:**
```
// 版本摘要信息
var versionDigestInfo = {
versionDigest: "versionDigest" // 检测结果中的版本摘要信息
}
// 暂停下载选项
var pauseDownloadOptions = {
isAllowAutoResume: true // 允许自动恢复下载
}
updater.pauseDownload(versionDigestInfo, pauseDownloadOptions).then(value => {
console.log(`pauseDownload`);
}).catch(err => {
console.log(`pauseDownload error ${JSON.stringify(err)}`);
});
```
下载新版本,并监听下载进程。 ### upgrade
upgrade(versionDigestInfo: VersionDigestInfo, upgradeOptions: UpgradeOptions, callback: AsyncCallback\<void>): void
升级新版本。使用callback异步回调。
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | 是 | 版本摘要信息 |
| upgradeOptions | [UpgradeOptions](#upgradeoptions) | 是 | 更新选项 |
| callback | AsyncCallback\<void> | 是 | 回调函数。当升级执行成功时,err为undefined,否则为错误对象。 |
**示例:** **示例:**
``` ```
updater.on("downloadProgress", progress => { // 版本摘要信息
console.log("downloadProgress on" + progress); var versionDigestInfo = {
console.log(`downloadProgress status: ` + progress.status); versionDigest: "versionDigest" // 检测结果中的版本摘要信息
console.log(`downloadProgress percent: ` + progress.percent); }
// 安装选项
var upgradeOptions = {
order: update.Order.INSTALL // 安装指令
}
updater.upgrade(versionDigestInfo, upgradeOptions, (err) => {
console.log(`upgrade error ${JSON.stringify(err)}`);
}); });
updater.download();
``` ```
### upgrade ### upgrade
upgrade():void upgrade(versionDigestInfo: VersionDigestInfo, upgradeOptions: UpgradeOptions): Promise\<void>
启动升级 升级新版本。使用Promise异步回调
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | 是 | 版本摘要信息 |
| upgradeOptions | [UpgradeOptions](#upgradeoptions) | 是 | 更新选项 |
**返回值:**
| 类型 | 说明 |
| ---------------------------------------- | ---------------- |
| Promise\<void> | Promise对象。无返回结果的Promise对象。 |
**示例:** **示例:**
``` ```
updater.on("upgradeProgress", progress => { // 版本摘要信息
console.log("upgradeProgress on" + progress); var versionDigestInfo = {
console.log(`upgradeProgress status: ` + progress.status); versionDigest: "versionDigest" // 检测结果中的版本摘要信息
console.log(`upgradeProgress percent: ` + progress.percent); }
// 安装选项
var upgradeOptions = {
order: update.Order.INSTALL // 安装指令
}
updater.upgrade(versionDigestInfo, upgradeOptions).then(() => {
console.log(`upgrade start`);
}).catch(err => {
console.log(`upgrade error ${JSON.stringify(err)}`);
}); });
updater.upgrade();
``` ```
### setUpdatePolicy ### clearError
setUpdatePolicy(policy: UpdatePolicy, callback: AsyncCallback\<number>): void clearError(versionDigestInfo: VersionDigestInfo, clearOptions: ClearOptions, callback: AsyncCallback\<void>): void
设置升级策略,使用callback方式作为异步方法 清除异常状态。使用callback异步回调
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------- | ---- | ------ | | -------- | ---------------------------------------- | ---- | --------- |
| policy | [UpdatePolicy](#updatepolicy) | 是 | 设置升级策略 | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | 是 | 版本摘要信息 |
| callback | AsyncCallback\<number> | 是 | 回调返回结果 | | clearOptions | [ClearOptions](#clearoptions) | 是 | 清除选项 |
| callback | AsyncCallback\<void> | 是 | 回调函数。当清除异常成功时,err为undefined,否则为错误对象。 |
**示例:** **示例:**
``` ```
// 设置策略 // 版本摘要信息
let policy = { var versionDigestInfo = {
autoDownload: false, versionDigest: "versionDigest" // 检测结果中的版本摘要信息
autoDownloadNet: true, }
mode: 2,
autoUpgradeInterval: [ 2, 3 ], // 清除选项
autoUpgradeCondition: 2 var clearOptions = {
} status: update.UpgradeStatus.UPGRADE_FAIL,
updater.setUpdatePolicy(policy, (err, result) => { }
console.log("setUpdatePolicy ", result) updater.clearError(versionDigestInfo, clearOptions, (err) => {
console.log(`clearError error ${JSON.stringify(err)}`);
}); });
``` ```
### setUpdatePolicy ### clearError
setUpdatePolicy(policy: UpdatePolicy): Promise\<number> clearError(versionDigestInfo: VersionDigestInfo, clearOptions: ClearOptions): Promise\<void>
设置升级策略,使用promise方式作为异步方法 清除异常状态。使用Promise异步回调
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | ------ | | -------- | ---------------------------------------- | ---- | --------- |
| policy | [UpdatePolicy](#updatepolicy) | 是 | 设置升级策略 | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | 是 | 版本摘要信息 |
| clearOptions | [ClearOptions](#clearoptions) | 是 | 更新选项 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ---------------- | --------------- | | ---------------------------------------- | ---------------- |
| Promise\<number> | Promise函数返回设置结果 | | Promise\<void> | Promise对象。无返回结果的Promise对象。 |
**示例:** **示例:**
``` ```
let policy = { // 版本摘要信息
autoDownload: false, var versionDigestInfo = {
autoDownloadNet: true, versionDigest: "versionDigest" // 检测结果中的版本摘要信息
mode: 2, }
autoUpgradeInterval: [ 2, 3 ],
autoUpgradeCondition: 2 // 清除选项
} var clearOptions = {
updater.setUpdatePolicy(policy).then(result => status: update.UpgradeStatus.UPGRADE_FAIL,
console.log("setUpdatePolicy ", result) }
).catch(err => { updater.clearError(versionDigestInfo, clearOptions).then(() => {
console.log("setUpdatePolicy promise error: " + err.code); console.log(`clearError success`);
}).catch(err => {
console.log(`clearError error ${JSON.stringify(err)}`);
}); });
``` ```
### getUpdatePolicy ### getUpgradePolicy
getUpdatePolicy(callback: AsyncCallback\<UpdatePolicy>): void getUpgradePolicy(callback: AsyncCallback\<UpgradePolicy>): void
获取升级策略信息,使用callback方式作为异步方法 获取升级策略信息。使用callback异步回调
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ---------- | | -------- | ---------------------------------------- | ---- | ---------- |
| callback | AsyncCallback\<[UpdatePolicy](#updatepolicy)> | 否 | 回调返回升级策略信息 | | callback | AsyncCallback\<[UpgradePolicy](#upgradepolicy)> | 是 | 回调函数,返回升级策略信息对象 |
**示例:** **示例:**
``` ```
updater.getUpdatePolicy((err, policy) => { updater.getUpgradePolicy((err, policy) => {
console.log("getUpdatePolicy success"); console.log(`policy downloadStrategy = ${policy?.downloadStrategy}`);
console.log(`policy autoDownload = ` + policy.autoDownload); console.log(`policy autoUpgradeStrategy = ${policy?.autoUpgradeStrategy}`);
console.log(`policy autoDownloadNet = ` + policy.autoDownloadNet);
console.log(`policy mode = ` + policy.mode);
}); });
``` ```
### getUpdatePolicy ### getUpgradePolicy
getUpdatePolicy(): Promise\<UpdatePolicy> getUpgradePolicy(): Promise\<UpgradePolicy>
获取升级策略,通过promise方式作为异步方法。 获取升级策略,通过promise方式作为异步方法。
**系统能力**:SystemCapability.Update.UpdateService **系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| --------------------------------------- | ----------------- | | --------------------------------------- | ----------------- |
| Promise\<[UpdatePolicy](#updatepolicy)> | Promise函数返回升级策略信息 | | Promise\<[UpgradePolicy](#upgradepolicy)> | Promise对象,返回升级策略信息对象。 |
**示例:** **示例:**
``` ```
updater.getUpdatePolicy().then(value => { updater.getUpgradePolicy().then(policy => {
console.log(`info autoDownload = ` + value.autoDownload); console.log(`policy downloadStrategy = ${policy.downloadStrategy}`);
console.log(`info autoDownloadNet = ` + value.autoDownloadNet); console.log(`policy autoUpgradeStrategy = ${policy.autoUpgradeStrategy}`);
console.log(`info mode = ` + value.mode);
}).catch(err => { }).catch(err => {
console.log("getUpdatePolicy promise error: " + err.code); console.log(`getUpgradePolicy promise error ${JSON.stringify(err)}`);
}); });
``` ```
## UpdateTypes ### setUpgradePolicy
升级类型。 setUpgradePolicy(policy: UpgradePolicy, callback: AsyncCallback\<number>): void
**系统能力**:以下各项对应的系统能力均为:SystemCapability.Update.UpdateService 设置升级策略。使用callback异步回调。
| 参数名 | 说明 | **系统能力**:SystemCapability.Update.UpdateService
| ----- | ----- |
| OTA | OTA升级 |
| patch | 补丁升级 |
## PackageTypes **需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
升级包类型。 **参数:**
**系统能力**:以下各项对应的系统能力均为:SystemCapability.Update.UpdateService | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ---------- |
| policy | [UpgradePolicy](#upgradepolicy) | 是 | 升级策略 |
| callback | AsyncCallback\<number> | 是 | 回调函数,返回设置结果对象 |
| 参数名 | 默认值 | 说明 | **示例:**
| -------------------- | ---- | ------- |
| PACKAGE_TYPE_NORMAL | 1 | 通用升级包 |
| PACKAGE_TYPE_BASE | 2 | 基础升级包 |
| PACKAGE_TYPE_CUST | 3 | 定制升级包 |
| PACKAGE_TYPE_PRELOAD | 4 | 预装升级包 |
| PACKAGE_TYPE_COTA | 5 | 参数配置升级包 |
| PACKAGE_TYPE_VERSION | 6 | 版本升级包 |
| PACKAGE_TYPE_PATCH | 7 | 补丁包 |
## InstallMode ```
let policy = {
downloadStrategy: false,
autoUpgradeStrategy: false,
autoUpgradeInterval: [ 120, 240 ], // 自动升级时间段,用分钟表示
}
updater.setUpgradePolicy(policy, (err, value) => {
console.log(`setUpgradePolicy result: ${value?}`);
});
```
安装模式。 ### setUpgradePolicy
**系统能力**:以下各项对应的系统能力均为:SystemCapability.Update.UpdateService setUpgradePolicy(policy: UpgradePolicy): Promise\<number>
| 参数名 | 默认值 | 说明 | 设置升级策略。使用Promise异步回调。
| ------------------- | ---- | ---- |
| INSTALL_MODE_NORMAL | 0 | 正常升级 |
| INSTALL_MODE_NIGHT | 1 | 夜间升级 |
| INSTALL_MODE_AUTO | 2 | 自动升级 |
## NewVersionStatus **系统能力**:SystemCapability.Update.UpdateService
新版本检测状态。 **需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**系统能力**:以下各项对应的系统能力均为:SystemCapability.Update.UpdateService **参数:**
| 参数名 | 默认值 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------------------- | ---- | -------- | | ------ | ----------------------------- | ---- | ------ |
| VERSION_STATUS_ERR | -1 | 检测版本时出错 | | policy | [UpgradePolicy](#upgradepolicy) | 是 | 升级策略 |
| VERSION_STATUS_NEW | 0 | 检测到新版本 |
| VERSION_STATUS_NONE | 1 | 没有检测到新版本 |
| VERSION_STATUS_BUSY | 2 | 检测版本时忙 |
## UpdatePolicy **返回值:**
升级策略。 | 类型 | 说明 |
| ---------------- | --------------- |
| Promise\<number> | Promise对象,返回设置结果对象。 |
**系统能力**:以下各项对应的系统能力均为:SystemCapability.Update.UpdateService **示例:**
| 名称 | 参数类型 | 必填 | 说明 | ```
| ------------------- | --------------------------- | ---- | ------- | let policy = {
| autoDownload | bool | 是 | 自动升级开关 | downloadStrategy: false,
| installMode | [InstallMode](#installmode) | 是 | 安装模式 | autoUpgradeStrategy: false,
| autoUpgradeInterval | Array\<number> | 是 | 自动升级时间段 | autoUpgradeInterval: [ 120, 240 ], // 自动升级时间段,用分钟表示
}
updater.setUpgradePolicy(policy).then(result =>
console.log(`setUpgradePolicy &{result}`);
).catch(err => {
console.log(`setUpgradePolicy promise error ${JSON.stringify(err)}`);
});
```
## NewVersionInfo ### terminateUpgrade
新版本信息。 terminateUpgrade(callback: AsyncCallback\<void>): void
**系统能力**:以下各项对应的系统能力均为:SystemCapability.Update.UpdateService 终止升级。使用callback异步回调。
| 名称 | 参数类型 | 必填 | 说明 | **系统能力**:SystemCapability.Update.UpdateService
| --------------- | ---------------------------------------- | ---- | ---- |
| status | [NewVersionStatus](#newversionstatus) | 是 | 升级状态 |
| errMsg | string | 是 | 错误信息 |
| checkResults | Array<[CheckResult](#checkresult)> | 是 | 检测结果 |
| descriptionInfo | Array\<[DescriptionInfo](#descriptioninfo)> | 是 | 描述信息 |
## CheckResult **需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
检测结果。 **参数:**
**系统能力**:以下各项对应的系统能力均为:SystemCapability.Update.UpdateService | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| callback | AsyncCallback\<void> | 是 | 回调函数。当清除升级缓存成功时,err为undefined,否则为错误对象。 |
| 名称 | 参数类型 | 必填 | 说明 | **示例:**
| ------------- | ----------------------------- | ---- | ------ |
| versionName | string | 是 | 版本名称 |
| versionCode | number | 是 | 版本编码 |
| size | number | 是 | 版本大小 |
| verifyInfo | string | 是 | 版本校验信息 |
| packageType | [PackageTypes](#packagetypes) | 是 | 版本类型 |
| descriptionId | string | 是 | 版本描述信息 |
## DescriptionInfo ```
updater.terminateUpgrade((err) => {
console.log(`terminateUpgrade error ${JSON.stringify(err)}`);
});
```
版本描述信息。 ### terminateUpgrade
**系统能力**:以下各项对应的系统能力均为:SystemCapability.Update.UpdateService terminateUpgrade(): Promise\<void>
| 名称 | 参数类型 | 必填 | 说明 | 终止升级。使用Promise异步回调。
| ------------- | ------ | ---- | ------------- |
| descriptionId | string | 是 | 版本versionId信息 | **系统能力**:SystemCapability.Update.UpdateService
| content | string | 是 | 版本changelog信息 |
\ No newline at end of file **返回值:**
| 类型 | 说明 |
| ---------------------------------------- | ---------------- |
| Promise\<void> | Promise对象。无返回结果的Promise对象。 |
**示例:**
```
updater.terminateUpgrade().then(() => {
console.log(`terminateUpgrade success`);
}).catch(err => {
console.log(`terminateUpgrade error ${JSON.stringify(err)}`);
});
```
### on
on(eventClassifyInfo: EventClassifyInfo, taskCallback: UpgradeTaskCallback): void
注册事件监听。使用callback异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | 是 | 事件信息 |
| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | 是 | 事件回调 |
**示例:**
```
var eventClassifyInfo = {
eventClassify: update.EventClassify.TASK, // 订阅升级更新事件
extraInfo: ""
}
function onTaskUpdate(eventInfo): void {
console.log(`on eventInfo id `, eventInfo.eventId);
}
updater.on(eventClassifyInfo, onTaskUpdate);
```
### off
off(eventClassifyInfo: EventClassifyInfo, taskCallback?: UpgradeTaskCallback): void
取消注册事件监听。使用callback异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | 是 | 事件信息 |
| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | 否 | 事件回调 |
**示例:**
```
var eventClassifyInfo = {
eventClassify: update.EventClassify.TASK, // 订阅升级更新事件
extraInfo: ""
}
function onTaskUpdate(eventInfo): void {
console.log(`on eventInfo id `, eventInfo.eventId);
}
updater.off(eventClassifyInfo, onTaskUpdate);
```
## Restorer
### factoryReset
factoryReset(callback: AsyncCallback\<void>): void
恢复出厂设置。使用callback异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.FACTORY_RESET,该权限为系统权限
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| callback | AsyncCallback\<void> | 是 | 回调函数。当恢复出厂执行成功时,err为undefined,否则为错误对象。 |
**示例:**
```
restorer.factoryReset((err) => {
console.log(`factoryReset error ${JSON.stringify(err)}`);
});
```
### factoryReset
factoryReset(): Promise\<void>
恢复出厂设置。使用Promise异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.FACTORY_RESET,该权限为系统权限
**返回值:**
| 类型 | 说明 |
| ---------------------------------------- | ---------------- |
| Promise\<void> | Promise对象。无返回结果的Promise对象。 |
**示例:**
```
restorer.factoryReset().then(() => {
console.log(`factoryReset success`);
}).catch(err => {
console.log(`factoryReset error ${JSON.stringify(err)}`);
});
```
## LocalUpdater
### verifyUpgradePackage
verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string, callback: AsyncCallback\<number>): void
校验升级包。使用callback异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| upgradeFile | [UpgradeFile](#upgradefile) | 是 | 升级文件 |
| certsFile | string | 是 | 证书文件路径 |
| callback | AsyncCallback\<number> | 是 | 回调函数,返回升级包校验结果对象 |
**示例:**
```
var upgradeFile = {
fileType: update.ComponentType.OTA, // OTA包
filePath: "path" // 本地升级包路径
}
localUpdater.verifyUpgradePackage(upgradeFile, "cerstFilePath", (err, result) => {
console.log(`factoryReset error ${JSON.stringify(err)}`);
});
```
### verifyUpgradePackage
verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string): Promise\<number>
校验升级包。使用Promise异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| upgradeFile | [UpgradeFile](#upgradefile) | 是 | 升级文件 |
| certsFile | string | 是 | 证书文件路径 |
**返回值:**
| 类型 | 说明 |
| ---------------------------------------- | ---------------- |
| Promise\<number> | Promise对象,返回升级包校验结果对象。 |
**示例:**
```
var upgradeFile = {
fileType: update.ComponentType.OTA, // OTA包
filePath: "path" // 本地升级包路径
}
localUpdater.verifyUpgradePackage(upgradeFile, "cerstFilePath").then(result => {
console.log(`verifyUpgradePackage result: ${result}`);
}).catch(err => {
console.log(`verifyUpgradePackage error ${JSON.stringify(err)}`);
});
```
### applyNewVersion
applyNewVersion(upgradeFiles: Array<[UpgradeFile](#upgradefile)>, callback: AsyncCallback\<void>): void
安装升级包。使用callback异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| upgradeFile | Array<[UpgradeFile](#upgradefile)> | 是 | 升级文件 |
| callback | AsyncCallback\<void> | 是 | 回调函数。当安装升级包执行成功时,err为undefined,否则为错误对象。 |
**示例:**
```
var upgradeFiles = [{
fileType: update.ComponentType.OTA, // OTA包
filePath: "path" // 本地升级包路径
}]
localUpdater.applyNewVersion(upgradeFiles, (err) => {
console.log(`applyNewVersion error ${JSON.stringify(err)}`);
});
```
### applyNewVersion
applyNewVersion(upgradeFiles: Array<[UpgradeFile](#upgradefile)>): Promise\<void>
安装升级包。使用Promise异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**需要权限**:ohos.permission.UPDATE_SYSTEM,该权限为系统权限
**返回值:**
| 类型 | 说明 |
| ---------------------------------------- | ---------------- |
| Promise\<void> | Promise对象。无返回结果的Promise对象。 |
**示例:**
```
var upgradeFiles = [{
fileType: update.update.ComponentType.OTA, // OTA包
filePath: "path" // 本地升级包路径
}]
localUpdater.applyNewVersion(upgradeFiles).then(() => {
console.log(`applyNewVersion success`);
}).catch(err => {
console.log(`applyNewVersion error ${JSON.stringify(err)}`);
});
```
### on
on(eventClassifyInfo: EventClassifyInfo, taskCallback: UpgradeTaskCallback): void
注册事件监听。使用callback异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | 是 | 事件信息 |
| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | 是 | 事件回调 |
**示例:**
```
var eventClassifyInfo = {
eventClassify: update.EventClassify.TASK, // 订阅升级更新事件
extraInfo: ""
}
function onTaskUpdate(eventInfo) {
console.log(`on eventInfo id `, eventInfo.eventId);
}
localUpdater.on(eventClassifyInfo, onTaskUpdate);
```
### off
off(eventClassifyInfo: EventClassifyInfo, taskCallback?: UpgradeTaskCallback): void
取消注册事件监听。使用callback异步回调。
**系统能力**:SystemCapability.Update.UpdateService
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | --------- |
| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | 是 | 事件信息 |
| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | 是 | 事件回调 |
**示例:**
```
var eventClassifyInfo = {
eventClassify: update.EventClassify.TASK, // 订阅升级更新事件
extraInfo: ""
}
function onTaskUpdate(eventInfo) {
console.log(`on eventInfo id `, eventInfo.eventId);
}
localUpdater.off(eventClassifyInfo, onTaskUpdate);
```
## UpgradeInfo
升级信息。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| upgradeApp | string | 是 | 调用方包名 |
| businessType | [BusinessType](#businesstype) | 是 | 升级业务类型 |
## BusinessType
升级业务类型。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| vendor | [BusinessVendor](#businessvendor) | 是 | 供应商 |
| subType | [BusinessSubType](#businesssubtype) | 是 | 类型 |
## CheckResult
搜包结果。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| isExistNewVersion | bool | 是 | 是否有新版本 |
| newVersionInfo | [NewVersionInfo](#newversioninfo) | 否 | 新版本数据 |
## NewVersionInfo
新版本数据。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | 是 | 版本摘要 |
| versionComponents | Array\<[VersionComponent](#versioncomponent)> | 是 | 版本组件 |
## VersionDigestInfo
版本摘要。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| versionDigest | string | 是 | 版本摘要 |
## VersionComponent
版本组件。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| componentType | [ComponentType](#componentyype) | 是 | 组件类型 |
| upgradeAction | [UpgradeAction](#upgradeaction) | 是 | 升级方式 |
| displayVersion | string | 是 | 显示版本号 |
| innerVersion | string | 是 | 版本号 |
| size | number | 是 | 升级包大小 |
| effectiveMode | [EffectiveMode](#effectivemode) | 是 | 生效模式 |
| descriptionInfo | [DescriptionInfo](#descriptioninfo) | 是 | 版本描述文件信息 |
## DescriptionInfo
版本描述文件信息。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| descriptionType | [DescriptionType](#descriptiontype) | 是 | 描述文件类型 |
| content | string | 是 | 描述文件内容 |
## CurrentVersionInfo
当前版本信息。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| osVersion | string | 是 | 系统版本号 |
| deviceName | string | 是 | 设备名 |
| versionComponents | Array\<[VersionComponent](#vesioncomponent)> | 否 | 版本组件 |
## DownloadOptions
下载选项。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| allowNetwork | [NetType](#nettype) | 是 | 网络类型 |
| order | [Order](#order) | 是 | 升级指令 |
## ResumeDownloadOptions
恢复下载选项。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| allowNetwork | [NetType](#nettype) | 是 | 网络类型 |
## PauseDownloadOptions
暂停下载选项。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| isAllowAutoResume | bool | 是 | 是否允许自动恢复 |
## UpgradeOptions
升级选项。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| order | [Order](#order) | 是 | 升级指令 |
## ClearOptions
清除异常选项。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| status | [UpgradeStatus](#upgradestatus) | 是 | 异常状态 |
## UpgradePolicy
升级策略。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| downloadStrategy | bool | 是 | 自动下载策略 |
| autoUpgradeStrategy | bool | 是 | 自动升级策略 |
| autoUpgradePeriods | Array\<[UpgradePeriod](#upgradeperiod)> | 是 | 自动升级时间段 |
## UpgradePeriod
升级时间段。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| start | number | 是 | 开始时间 |
| end | number | 是 | 结束时间 |
## TaskInfo
任务信息。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| existTask | bool | 是 | 是否存在任务 |
| taskBody | [TaskBody](#taskinfo) | 是 | 任务数据 |
## EventInfo
事件信息。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| eventId | [EventId](#eventid) | 是 | 事件ID |
| taskBody | [TaskBody](#taskinfo) | 是 | 任务数据 |
## TaskBody
任务数据。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | 是 | 版本摘要 |
| status | [UpgradeStatus](#upgradestatus) | 是 | 升级状态 |
| subStatus | number | 否 | 子状态 |
| progress | number | 是 | 进度 |
| installMode | number | 是 | 安装模式 |
| errorMessages | Array\<[ErrorMessage](#errormessage)> | 否 | 错误信息 |
| versionComponets | Array\<[VersionComponet](#versioncomponet)> | 是 | 版本组件 |
## ErrorMessage
错误信息。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| errorCode | number | 是 | 错误码 |
| errorMessage | string | 是 | 错误描述 |
## EventClassifyInfo
事件信息。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| eventClassify | [EventClassify](#eventclassify) | 是 | 事件类型 |
| extraInfo | string | 是 | 额外信息 |
## UpgradeFile
升级文件。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| ------------------- | --------------------------- | ---- | ------- |
| fileType | [ComponentType](#componenttype) | 是 | 文件类型 |
| filePath | string | 是 | 文件路径 |
## UpgradeTaskCallback
### onTaskUpdate
onTaskUpdate(eventInfo: [EventInfo](#eventinfo)): void
事件回调。
**系统能力**:SystemCapability.Update.UpdateService
| 名称 | 参数类型 | 必填 | 说明 |
| --------------- | ---------------------------------------- | ---- | ---- |
| eventInfo | [EventInfo](#eventinfo) | 是 | 事件信息 |
## BusinessVendor
设备厂家。
**系统能力**:SystemCapability.Update.UpdateService
| 参数名 | 默认值 | 说明 |
| ------------------- | ---- | -------- |
| PUBLIC | "public" | 开源 |
## BusinessSubType
升级类型。
**系统能力**:SystemCapability.Update.UpdateService
| 参数名 | 默认值 | 说明 |
| ------------------- | ---- | -------- |
| FIRWARE | 1 | 固件 |
## ComponentType
升级包类型。
**系统能力**:SystemCapability.Update.UpdateService
| 参数名 | 默认值 | 说明 |
| ------------------- | ---- | -------- |
| OTA | 1 | 固件 |
## UpgradeAction
升级方式。
**系统能力**:SystemCapability.Update.UpdateService
| 参数名 | 默认值 | 说明 |
| ------------------- | ---- | -------- |
| UPGRADE | "upgrade" | 差分包 |
| RECOVERY | "recovery" | 修复包 |
## EffectiveMode
生效模式。
**系统能力**:SystemCapability.Update.UpdateService
| 参数名 | 默认值 | 说明 |
| ------------------- | ---- | -------- |
| COLD | 1 | 冷升级 |
| LIVE | 2 | 热升级 |
| LIVE_AND_COLD | 3 | 融合升级 |
## DescriptionType
描述文件类型。
**系统能力**:SystemCapability.Update.UpdateService
| 参数名 | 默认值 | 说明 |
| ------------------- | ---- | -------- |
| CONTENT | 0 | 内容 |
| URI | 1 | 链接 |
## NetType
网络类型。
**系统能力**:SystemCapability.Update.UpdateService
| 参数名 | 默认值 | 说明 |
| ------------------- | ---- | -------- |
| CELLULAR | 1 | 数据网络 |
| METERED_WIFI | 2 | 热点WIFI |
| NOT_METERED_WIFI | 4 | 非热点WIFI |
| WIFI | 6 | WIFI |
| CELLULAR_AND_WIFI | 7 | 数据网络和WIFI |
## Order
升级指令。
**系统能力**:SystemCapability.Update.UpdateService
| 参数名 | 默认值 | 说明 |
| ------------------- | ---- | -------- |
| DOWNLOAD | 1 | 下载 |
| INSTALL | 2 | 安装 |
| APPLY | 4 | 生效 |
| DOWNLOAD_AND_INSTALL | 3 | 下载并安装 |
| INSTALL_AND_APPLY | 6 | 安装并生效 |
## UpgradeStatus
升级状态。
**系统能力**:SystemCapability.Update.UpdateService
| 参数名 | 默认值 | 说明 |
| ------------------- | ---- | -------- |
| WAITING_DOWNLOAD | 20 | 待下载 |
| DOWNLOADING | 21 | 下载中 |
| DOWNLOAD_PAUSE | 22 | 下载暂停 |
| DOWNLOAD_FAIL | 23 | 下载失败 |
| WAITING_INSTALL | 30 | 待安装 |
| UPDATING | 31 | 更新中 |
| WATING_APPLY | 40 | 待生效 |
| APPLYING | 21 | 生效中 |
| UPGRADE_SUCCESS | 50 | 升级成功 |
| UPGRADE_FAIL | 51 | 升级失败 |
## EventClassify
事件类型。
**系统能力**:SystemCapability.Update.UpdateService
| 参数名 | 默认值 | 说明 |
| ------------------- | ---- | -------- |
| TASK | 0x01000000 | 任务事件 |
## EventId
事件ID。
**系统能力**:SystemCapability.Update.UpdateService
| 参数名 | 默认值 | 说明 |
| ------------------- | ---- | -------- |
| EVENT_TASK_BASE | 0x01000000 | 任务事件 |
| EVENT_TASK_RECEIVE | 0x01000001 | 收到任务 |
| EVENT_TASK_CANCEL | 0x01000010 | 取消任务 |
| EVENT_DOWNLOAD_WAIT | 0x01000011 | 待下载 |
| EVENT_DOWNLOAD_START | 0x01000100 | 开始下载 |
| EVENT_DOWNLOAD_UPDATE | 0x01000101 | 下载进度更新 |
| EVENT_DOWNLOAD_PAUSE | 0x01000110 | 下载暂停 |
| EVENT_DOWNLOAD_RESUME | 0x01000111 | 恢复下载 |
| EVENT_DOWNLOAD_SUCCESS | 0x01001000 | 下载成功 |
| EVENT_DOWNLOAD_FAIL | 0x01001001 | 下载失败 |
| EVENT_UPGRADE_WAIT | 0x01001010 | 待升级 |
| EVENT_UPGRADE_START | 0x01001011 | 开始升级 |
| EVENT_UPGRADE_UPDATE | 0x01001100 | 升级中 |
| EVENT_APPLY_WAIT | 0x01001101 | 待生效 |
| EVENT_APPLY_START | 0x01001110 | 开始生效 |
| EVENT_UPGRADE_SUCCESS | 0x01001111 | 更新成功 |
| EVENT_UPGRADE_FAIL | 0x01010000 | 更新失败 |
# USB管理 # USB管理
本模块主要提供管理USB设备的相关功能,包括查询USB设备列表、批量数据传输、控制命令传输、权限控制等。
> **说明:** > **说明:**
>
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块 ## 导入模块
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
| 名称 | 类型定义 | 描述 | | 名称 | 类型定义 | 描述 |
| ----- | --------------------- | ---------------------------------------- | | ----- | --------------------- | ---------------------------------------- |
| color | string&nbsp;\|颜色枚举字符串 | 用于描述颜色信息,JS脚本中不支持颜色枚举格式。<br/>字符串格式如下:<br/>-&nbsp;'rgb(255,&nbsp;255,&nbsp;255)'<br/>-&nbsp;'rgba(255,&nbsp;255,&nbsp;255,&nbsp;1.0)'<br/>-&nbsp;HEX格式:'\#rrggbb','\#aarrggbb'<br/>-&nbsp;枚举格式:'black','white'。 | | color | string&nbsp;\|&nbsp;颜色枚举字符串 | 用于描述颜色信息,JS脚本中不支持颜色枚举格式。<br/>字符串格式如下:<br/>-&nbsp;'rgb(255,&nbsp;255,&nbsp;255)'<br/>-&nbsp;'rgba(255,&nbsp;255,&nbsp;255,&nbsp;1.0)'<br/>-&nbsp;HEX格式:'\#rrggbb','\#aarrggbb'<br/>-&nbsp;枚举格式:'black','white'。 |
**表1** 当前支持的颜色枚举 **表1** 当前支持的颜色枚举
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
| 名称 | 类型 | 默认值 | 必填 | 描述 | | 名称 | 类型 | 默认值 | 必填 | 描述 |
| -------------------------------- | -------------- | ---------- | ---- | ---------------------------------------- | | -------------------------------- | -------------- | ---------- | ---- | ---------------------------------------- |
| color | &lt;color&gt | \#ffffff | 否 | 候选项字体颜色。 | | color | &lt;color&gt; | \#ffffff | 否 | 候选项字体颜色。 |
| font-size | &lt;length&gt; | 16px | 否 | 候选项字体尺寸,类型length,单位px。 | | font-size | &lt;length&gt; | 16px | 否 | 候选项字体尺寸,类型length,单位px。 |
| selected-color | &lt;color&gt; | #ff0a69f7 | 否 | 选中项字体颜色。 | | selected-color | &lt;color&gt; | #ff0a69f7 | 否 | 选中项字体颜色。 |
| selected-font-size | &lt;length&gt; | 20px | 否 | 选中项字体尺寸,类型length,单位px。 | | selected-font-size | &lt;length&gt; | 20px | 否 | 选中项字体尺寸,类型length,单位px。 |
......
...@@ -30,7 +30,7 @@ Checkbox( name?: string, group?: string ) ...@@ -30,7 +30,7 @@ Checkbox( name?: string, group?: string )
| 名称 | 参数类型 | 默认值 | 描述 | | 名称 | 参数类型 | 默认值 | 描述 |
| ------------- | ------- | ------ | -------- | | ------------- | ------- | ------ | -------- |
| select | bool | false | 设置多选框是否选中。 | | select | boolean | false | 设置多选框是否选中。 |
| selectedColor | Color | - | 设置多选框选中状态颜色。 | | selectedColor | Color | - | 设置多选框选中状态颜色。 |
## 事件 ## 事件
......
...@@ -29,7 +29,7 @@ CheckboxGroup( group?: string ) ...@@ -29,7 +29,7 @@ CheckboxGroup( group?: string )
| 名称 | 参数类型 | 默认值 | 描述 | | 名称 | 参数类型 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| selectAll | bool | false | 设置是否全选。 | | selectAll | boolean | false | 设置是否全选。 |
| selectedColor | Color | - | 设置被选中或部分选中状态的颜色。 | | selectedColor | Color | - | 设置被选中或部分选中状态的颜色。 |
## 事件 ## 事件
......
...@@ -166,8 +166,6 @@ struct ImageExample1 { ...@@ -166,8 +166,6 @@ struct ImageExample1 {
@Entry @Entry
@Component @Component
struct ImageExample2 { struct ImageExample2 {
@State width: number = 100
@State height: number = 100
build() { build() {
Column({ space: 10 }) { Column({ space: 10 }) {
......
...@@ -29,7 +29,7 @@ Navigation() ...@@ -29,7 +29,7 @@ Navigation()
| 名称 | 参数类型 | 默认值 | 描述 | | 名称 | 参数类型 | 默认值 | 描述 |
| -------------- | ---------------------------------------- | ------------------------ | ---------------------------------------- | | -------------- | ---------------------------------------- | ------------------------ | ---------------------------------------- |
| title | string&nbsp;\|&nbsp;[CustomBuilder](../../ui/ts-types.md) | - | 页面标题。 | | title | string&nbsp;\|&nbsp;[CustomBuilder](../../ui/ts-types.md) | - | 页面标题。 |
| subtitle | string | - | 页面副标题。 | | subTitle | string | - | 页面副标题。 |
| menus | Array<NavigationMenuItem&gt;&nbsp;\|&nbsp;[CustomBuilder](../../ui/ts-types.md) | - | 页面右上角菜单。 | | menus | Array<NavigationMenuItem&gt;&nbsp;\|&nbsp;[CustomBuilder](../../ui/ts-types.md) | - | 页面右上角菜单。 |
| titleMode | NavigationTitleMode | NavigationTitleMode.Free | 页面标题栏显示模式。 | | titleMode | NavigationTitleMode | NavigationTitleMode.Free | 页面标题栏显示模式。 |
| toolBar | {<br/>items:[<br/>Object<br/>]&nbsp;}<br/>\|&nbsp;[CustomBuilder](../../ui/ts-types.md) | - | 设置工具栏内容。<br/>items:&nbsp;工具栏所有项。 | | toolBar | {<br/>items:[<br/>Object<br/>]&nbsp;}<br/>\|&nbsp;[CustomBuilder](../../ui/ts-types.md) | - | 设置工具栏内容。<br/>items:&nbsp;工具栏所有项。 |
......
# PatternLock # PatternLock
> **说明:** 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
图案密码锁组件,以宫格图案的方式输入密码,用于密码验证。手指触碰图案密码锁时开始进入输入状态,手指离开屏幕时结束输入状态并向应用返回输入的密码。 图案密码锁组件,以宫格图案的方式输入密码,用于密码验证。手指触碰图案密码锁时开始进入输入状态,手指离开屏幕时结束输入状态并向应用返回输入的密码。
> **说明:**
>
> 该组件从API Version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
## 权限列表 ## 权限列表
......
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
> **说明:** > **说明:**
> - 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
> >
> - 本组件均为系统接口,三方应用不支持调用。 > - 该组件从API Version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
>
> - 本组件为系统接口。
提供外部应用组件嵌入式显示功能,即外部应用提供的UI可在本应用内显示。 提供外部应用组件嵌入式显示功能,即外部应用提供的UI可在本应用内显示。
......
...@@ -52,11 +52,11 @@ Search(options?: { value?: string; placeholder?: string; icon?: string; controll ...@@ -52,11 +52,11 @@ Search(options?: { value?: string; placeholder?: string; icon?: string; controll
Search组件的控制器,通过它操作Search组件。 Search组件的控制器,通过它操作Search组件。
#### 导入对象 ### 导入对象
``` ```
controller: SearchController = new SearchController() controller: SearchController = new SearchController()
``` ```
#### caretPosition ### caretPosition
caretPosition(value: number): void caretPosition(value: number): void
......
...@@ -32,7 +32,7 @@ Grid() ...@@ -32,7 +32,7 @@ Grid()
| columnsGap | Length | 0 | 用于设置列与列的间距。 | | columnsGap | Length | 0 | 用于设置列与列的间距。 |
| rowsGap | Length | 0 | 用于设置行与行的间距。 | | rowsGap | Length | 0 | 用于设置行与行的间距。 |
| editMode<font color=ff0000><sup>8+</sup></font> | boolean | flase | 是否进入编辑模式,进入编辑模式可以拖拽Gird组件内部[GridItem](ts-container-griditem.md)。 | | editMode<font color=ff0000><sup>8+</sup></font> | boolean | flase | 是否进入编辑模式,进入编辑模式可以拖拽Gird组件内部[GridItem](ts-container-griditem.md)。 |
| layoutDirection<font color=ff0000><sup>8+</sup></font> | [LayoutDirection](ts-appendix-enums.md) | LayoutDirection.Row |设置布局的主轴方向,目前支持的主轴布局方向如下:<br/>-&nbsp;LayoutDirection.Row:沿水平方向布局,即先填满一列,再去填下一列。 <br/>-&nbsp;LayoutDirection.Column:沿垂直方向布局,即先填满一行,再去填下一行。| | layoutDirection<font color=ff0000><sup>8+</sup></font> | number | 0 |设置布局的主轴方向,目前支持的主轴布局方向如下:<br/>-&nbsp;0:主轴布局方向沿水平方向布局,即先填满一列,再去填下一列。 <br/>-&nbsp;1:主轴布局方向沿垂直方向布局,即先填满一行,再去填下一行。|
| maxCount<font color=ff0000><sup>8+</sup></font> | number | 1 | 当layoutDirection是Row时,表示可显示的最大行数<br/>当layoutDirection是Column时,表示可显示的最大列数。 | | maxCount<font color=ff0000><sup>8+</sup></font> | number | 1 | 当layoutDirection是Row时,表示可显示的最大行数<br/>当layoutDirection是Column时,表示可显示的最大列数。 |
| minCount<font color=ff0000><sup>8+</sup></font> | number | 1 | 当layoutDirection是Row时,表示可显示的最小行数<br/>当layoutDirection是Column时,表示可显示的最小列数。 | | minCount<font color=ff0000><sup>8+</sup></font> | number | 1 | 当layoutDirection是Row时,表示可显示的最小行数<br/>当layoutDirection是Column时,表示可显示的最小列数。 |
| cellLength<font color=ff0000><sup>8+</sup></font> | number | 0 | 当layoutDirection是Row时,表示一行的高度<br/>当layoutDirection是Column时,表示一列的宽度。 | | cellLength<font color=ff0000><sup>8+</sup></font> | number | 0 | 当layoutDirection是Row时,表示一行的高度<br/>当layoutDirection是Column时,表示一列的宽度。 |
......
...@@ -19,13 +19,14 @@ ...@@ -19,13 +19,14 @@
## 接口 ## 接口
List(value:{space?: number, initialIndex?: number}) List(value:{space?: number | string, initialIndex?: number, scroller?: Scroller})
- 参数 - 参数
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| space | number | 否 | 0 | 列表项间距。 | | space | number&nbsp;\|&nbsp;string | 否 | 0 | 列表项间距。 |
| initialIndex | number | 否 | 0 | 设置当前List初次加载时视口起始位置显示的item,即显示第一个item,如设置的序号超过了最后一个item的序号,则设置不生效。 | | initialIndex | number | 否 | 0 | 设置当前List初次加载时视口起始位置显示的item,即显示第一个item,如设置的序号超过了最后一个item的序号,则设置不生效。 |
| scroller | [Scroller](ts-container-scroll.md#scroller) | 是 | - | 可滚动组件的控制器。用于与可滚动组件进行绑定。 |
## 属性 ## 属性
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
## 接口 ## 接口
Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number\}\) Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number | string\}\)
- 参数 - 参数
...@@ -23,7 +23,7 @@ Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number\}\) ...@@ -23,7 +23,7 @@ Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number\}\)
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| refreshing | boolean | 是 | - | 当前组件是否正在刷新。 | | refreshing | boolean | 是 | - | 当前组件是否正在刷新。 |
| offset | Length | 否 | 16 | 刷新组件静止时距离父组件顶部的距离。| | offset | Length | 否 | 16 | 刷新组件静止时距离父组件顶部的距离。|
| friction | number | 否 | 62 | 下拉摩擦系数,取值范围为0到100。<br/>-&nbsp;0表示下拉刷新容器不跟随手势下拉而下拉。<br/>-&nbsp;100表示下拉刷新容器紧紧跟随手势下拉而下拉。<br/>-&nbsp;数值越大,下拉刷新容器跟随手势下拉的反应越灵敏。 | | friction | number&nbsp;\|&nbsp;string | 否 | 62 | 下拉摩擦系数,取值范围为0到100。<br/>-&nbsp;0表示下拉刷新容器不跟随手势下拉而下拉。<br/>-&nbsp;100表示下拉刷新容器紧紧跟随手势下拉而下拉。<br/>-&nbsp;数值越大,下拉刷新容器跟随手势下拉的反应越灵敏。 |
......
...@@ -45,7 +45,7 @@ Tabs(value: {barPosition?: BarPosition, index?: number, controller?: [TabsContro ...@@ -45,7 +45,7 @@ Tabs(value: {barPosition?: BarPosition, index?: number, controller?: [TabsContro
| scrollable | boolean | 是否可以通过左右滑动进行页面切换,默认为true。 | 是否可以通过左右滑动进行页面切换,默认为true。 | | scrollable | boolean | 是否可以通过左右滑动进行页面切换,默认为true。 | 是否可以通过左右滑动进行页面切换,默认为true。 |
| barMode | BarMode | TabBar布局模式。 | TabBar布局模式。 | | barMode | BarMode | TabBar布局模式。 | TabBar布局模式。 |
| barWidth | number | TabBar的宽度值,不设置时使用系统主题中的默认值。 | TabBar的宽度值,不设置时使用系统主题中的默认值。 | | barWidth | number | TabBar的宽度值,不设置时使用系统主题中的默认值。 | TabBar的宽度值,不设置时使用系统主题中的默认值。 |
| barHeight | number | TabBar的高度值,不设置时使用系统主题中的默认值。 | TabBar的高度值,不设置时使用系统主题中的默认值**。** | | barHeight | number | TabBar的高度值,不设置时使用系统主题中的默认值。 | TabBar的高度值,不设置时使用系统主题中的默认值 |
| animationDuration | number | 200 | TabContent滑动动画时长。 | | animationDuration | number | 200 | TabContent滑动动画时长。 |
- BarMode枚举说明 - BarMode枚举说明
......
...@@ -166,7 +166,6 @@ struct VideoCreateComponent { ...@@ -166,7 +166,6 @@ struct VideoCreateComponent {
@State autoPlays: boolean = false; @State autoPlays: boolean = false;
@State controlsss: boolean = true; @State controlsss: boolean = true;
controller: VideoController = new VideoController(); controller: VideoController = new VideoController();
@State startStaus: boolean = true;
build() { build() {
Column() { Column() {
Video({ Video({
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
- paramObject2参数 - paramObject2参数
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| title | string&nbsp;\|&&nbsp;[Resource](../../ui/ts-types.md#resource类型) | 否 | - | 弹窗标题。 | | title | string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型) | 否 | - | 弹窗标题。 |
| message | string&nbsp;\|&&nbsp;[Resource](../../ui/ts-types.md#resource类型) | 是 | - | 弹窗内容。 | | message | string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型) | 是 | - | 弹窗内容。 |
| autoCancel | boolean | 否 | true | 点击遮障层时,是否关闭弹窗。 | | autoCancel | boolean | 否 | true | 点击遮障层时,是否关闭弹窗。 |
| primaryButton | {<br/>value:&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>fontColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>backgroundColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>action:&nbsp;()&nbsp;=&gt;&nbsp;void;<br/>} | 否 | - | 按钮的文本内容、文本色、按钮背景色和点击回调。 | | primaryButton | {<br/>value:&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>fontColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>backgroundColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>action:&nbsp;()&nbsp;=&gt;&nbsp;void;<br/>} | 否 | - | 按钮的文本内容、文本色、按钮背景色和点击回调。 |
| secondaryButton | {<br/>value:&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>fontColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>backgroundColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>action:&nbsp;()&nbsp;=&gt;&nbsp;void;<br/>} | 否 | - | 按钮的文本内容、文本色、按钮背景色和点击回调。 | | secondaryButton | {<br/>value:&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>fontColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>backgroundColor?:&nbsp;Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型),<br/>action:&nbsp;()&nbsp;=&gt;&nbsp;void;<br/>} | 否 | - | 按钮的文本内容、文本色、按钮背景色和点击回调。 |
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
@Entry @Entry
@Component @Component
struct MotionPathExample { struct MotionPathExample {
@State offsetX: number = 0
@State offsetY: number = 0
@State toggle: boolean = true @State toggle: boolean = true
build() { build() {
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
@Entry @Entry
@Component @Component
struct SharedTransitionExample { struct SharedTransitionExample {
@State scale: number = 1
@State opacity: number = 1
@State active: boolean = false @State active: boolean = false
build() { build() {
......
# 边框设置 # 边框设置
> **说明:** > **说明:**
> 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。<br> >
> 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
>
> 从API Version 9开始,父节点的border显示在子节点内容之上。 > 从API Version 9开始,父节点的border显示在子节点内容之上。
...@@ -18,12 +20,20 @@ ...@@ -18,12 +20,20 @@
| 名称 | 参数类型 | 默认值 | 描述 | | 名称 | 参数类型 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| border | {<br/>width?:&nbsp;Length,<br/>color?:&nbsp;Color,<br/>radius?:&nbsp;Length,<br/>style?:&nbsp;BorderStyle<br/>} | - | 统一边框样式设置接口。 | | border | BorderOptions | - | 统一边框样式设置接口。 |
| borderStyle | BorderStyle | &nbsp;BorderStyle.Solid | 设置元素的边框样式。 | | borderStyle | BorderStyle | &nbsp;BorderStyle.Solid | 设置元素的边框样式。 |
| borderWidth | Length | 0 | 设置元素的边框宽度。 | | borderWidth | Length | 0 | 设置元素的边框宽度。 |
| borderColor | Color | - | 设置元素的边框颜色。 | | borderColor | Color | - | 设置元素的边框颜色。 |
| borderRadius | Length | 0 | 设置元素的边框圆角半径。 | | borderRadius | Length | 0 | 设置元素的边框圆角半径。 |
- BorderOptions属性说明
| 参数名称 | 参数类型 | 默认值 | 必填 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- |
| width | [Length](../../ui/ts-types.md#长度类型) | 0 | 否 | 边框宽度。 |
| color | [ResourceColor](../../ui/ts-types.md) | 'Black' | 否 | 边框颜色。 |
| radius | [Length](../../ui/ts-types.md#长度类型) | 0 | 否 | 边框角度。 |
| style | BorderStyle | BorderStyle.Solid | 否 | 边框样式。 |
- BorderStyle枚举说明 - BorderStyle枚举说明
| 名称 | 描述 | | 名称 | 描述 |
......
...@@ -171,17 +171,17 @@ struct IdExample { ...@@ -171,17 +171,17 @@ struct IdExample {
console.info(getInspectorTree()) console.info(getInspectorTree())
this.text = "Button 'click to start' is clicked" this.text = "Button 'click to start' is clicked"
setTimeout(() => { setTimeout(() => {
sendEventByKey("longclick", 11, "") sendEventByKey("longClick", 11, "")
}, 2000) }, 2000)
}).id('click') }).id('click')
Button() { Button() {
Text('longclick').fontSize(25).fontWeight(FontWeight.Bold) Text('longClick').fontSize(25).fontWeight(FontWeight.Bold)
}.margin({ top: 20 }).backgroundColor('#0D9FFB') }.margin({ top: 20 }).backgroundColor('#0D9FFB')
.gesture( .gesture(
LongPressGesture().onActionEnd(() => { LongPressGesture().onActionEnd(() => {
console.info('long clicked') console.info('long clicked')
this.text = "Button 'longclick' is longclicked" this.text = "Button 'longClick' is longclicked"
setTimeout(() => { setTimeout(() => {
let rect = Utils.getComponentRect('onTouch') let rect = Utils.getComponentRect('onTouch')
let touchPoint: TouchObject = { let touchPoint: TouchObject = {
...@@ -196,7 +196,7 @@ struct IdExample { ...@@ -196,7 +196,7 @@ struct IdExample {
touchPoint.type = TouchType.Up touchPoint.type = TouchType.Up
sendTouchEvent(touchPoint) sendTouchEvent(touchPoint)
}, 2000) }, 2000)
})).id('longclick') })).id('longClick')
Button() { Button() {
Text('onTouch').fontSize(25).fontWeight(FontWeight.Bold) Text('onTouch').fontSize(25).fontWeight(FontWeight.Bold)
......
...@@ -38,7 +38,6 @@ struct DragExample { ...@@ -38,7 +38,6 @@ struct DragExample {
@State text: string = '' @State text: string = ''
@State bool: boolean = false @State bool: boolean = false
@State bool1: boolean = false @State bool1: boolean = false
@State size: string = ''
@State appleVisible: Visibility = Visibility.Visible @State appleVisible: Visibility = Visibility.Visible
@State orangeVisible: Visibility = Visibility.Visible @State orangeVisible: Visibility = Visibility.Visible
@State bananaVisible: Visibility = Visibility.Visible @State bananaVisible: Visibility = Visibility.Visible
......
...@@ -23,7 +23,7 @@ struct CountDownTimerComponent { ...@@ -23,7 +23,7 @@ struct CountDownTimerComponent {
@State countDownFrom: number = 10 @State countDownFrom: number = 10
private timerId: number = -1 private timerId: number = -1
private aboutToAppear(): void { aboutToAppear(): void {
this.timerId = setInterval(() => { this.timerId = setInterval(() => {
if (this.countDownFrom <= 1) { if (this.countDownFrom <= 1) {
clearTimeout(this.timerId) clearTimeout(this.timerId)
...@@ -32,7 +32,7 @@ struct CountDownTimerComponent { ...@@ -32,7 +32,7 @@ struct CountDownTimerComponent {
}, 1000) // decr counter by 1 every second }, 1000) // decr counter by 1 every second
} }
private aboutToDisappear(): void { aboutToDisappear(): void {
if (this.timerId > 0) { if (this.timerId > 0) {
clearTimeout(this.timerId) clearTimeout(this.timerId)
this.timerId = -1 this.timerId = -1
......
# 概述
## 基本概念
*【 **写作要求**】*
*必选,描述本开发任务相关的基本概念,帮助开发者更好的理解开发任务。* *写作要求见下,完成写作后,请逐项自检*
| 内容要求 | 是否满足 |
| -------- | -------- |
| 业界通用的概念不用赘述。 | |
| 注意使用业界通用术语来表达,不用开发者无法理解的内部语言。 | |
【写作样例】
XX系统音频模块支持音频业务的开发,提供音频相关的功能,主要包括音频播放、音频采集、音量管理和短音播放等。
在进行应用的开发前,开发者应了解以下基本概念:
- 采样
采样就是把模拟信号数字化的过程,所有的模拟信号都需要通过采样转换为可以用0101来表示的数字信号。
- 采样率
采样率为每秒从连续信号中提取并组成离散信号的采样次数,单位用赫兹(Hz)来表示。通常人耳能听到频率范围大约在20Hz~20kHz之间的声音。常用的音频采样频率有:8kHz、11.025kHz、22.05kHz、16kHz、37.8kHz、44.1kHz、48kHz、96kHz、192kHz等。
- 声道
声道是指声音在录制或播放时在不同空间位置采集或回放的相互独立的音频信号,所以声道数也就是声音录制时的音源数量或回放时相应的扬声器数量。
- 音频帧
音频数据是流式的,本身没有明确的一帧帧的概念,在实际的应用中,为了音频算法处理/传输的方便,一般约定俗成取2.5ms~60ms为单位的数据量为一帧音频。这个时间被称之为“采样时间”,其长度没有特别的标准,它是根据编解码器和具体应用的需求来决定的。
## 运作机制
*【 **写作要求**】*
*可选。如果机制比较简单,通过前面基本概念就可以说清楚,此章节可以不用提供,删除标题即可*
*描述实现原理介绍机制,如关键步骤相关接口调用时机和触发时机,帮助开发者了解该功能的基本运作原理,以便更好的理解开发任务和定位问题*
*写作要求见下,完成写作后,请逐项自检*
| 内容要求 | 是否满足 |
| -------- | -------- |
| 仅描述开发任务相关的原理。 | |
| 尽量图文配合,一般使用时序图、流程图等形式。文字描述与图形描述匹配。 | |
【写作样例-1】
- 信号量初始化,为配置的N个信号量申请内存(N值可以由用户自行配置,受内存限制),并把所有的信号量初始化成未使用,并加入到未使用链表中供系统使用。
- 信号量创建,从未使用的信号量链表中获取一个信号量资源,并设定初值。
- 信号量申请,若其计数器值大于0,则直接减1返回成功。否则任务阻塞,等待其它任务释放该信号量,等待的超时时间可设定。当任务被一个信号量阻塞时,将该任务挂到信号量等待任务队列的队尾。
- 信号量释放,若没有任务等待该信号量,则直接将计数器加1返回。否则唤醒该信号量等待任务队列上的第一个任务。
- 信号量删除,将正在使用的信号量置为未使用信号量,并挂回到未使用链表。
- 信号量允许多个任务在同一时刻访问同一资源,但会限制同一时刻访问此资源的最大任务数目。访问同一资源的任务数达到该资源的最大数量时,会阻塞其他试图获取该资源的任务,直到有任务释放该信号量。
【写作样例-2】
**互斥锁运作原理**
多任务环境下会存在多个任务访问同一公共资源的场景,而有些公共资源是非共享的,需要任务进行独占式处理。互斥锁怎样来避免这种冲突呢?
用互斥锁处理非共享资源的同步访问时,如果有任务访问该资源,则互斥锁为加锁状态。此时其他任务如果想访问这个公共资源则会被阻塞,直到互斥锁被持有该锁的任务释放后,其他任务才能重新访问该公共资源,此时互斥锁再次上锁,如此确保同一时刻只有一个任务正在访问这个公共资源,保证了公共资源操作的完整性。
## 约束与限制
【写作要求】
*必选**描述本开发任务过程中* *的约束条件,以及此操作约束带来相应的负面影响,包括但不限于如下几方面*
- **功能限制**
- 功能使用范围(明确不支持的场景)。
- 规格限制。
* **操作限制**
* 已知问题的操作。
* 潜在风险的操作(如引起性能降低)。
* 引起性能降低的操作。
写作要求见下,完成写作后,请逐项自检。
| 内容要求 | 是否满足 |
| -------- | -------- |
| 明确功能限制或操作限制。 | |
| 约束对指导任务开发有影响或体验有感知,否则不用体现。 | |
| 容易出错的操作在步骤里描述,不在此体现。 | |
**写作样例**
**互斥锁的约束与限制**
- 两个任务不能对同一把互斥锁加锁。如果某任务对已被持有的互斥锁加锁,则该任务会被挂起,直到持有该锁的任务对互斥锁解锁,才能执行对这把互斥锁的加锁操作。
- 互斥锁不能在中断服务程序中使用。
- XXX作为实时操作系统需要保证任务调度的实时性,尽量避免任务的长时间阻塞,因此在获得互斥锁之后,应该尽快释放互斥锁。
- 持有互斥锁的过程中,不得再调用LOS_TaskPriSet等接口更改持有互斥锁任务的优先级。
# 开发指 # 开发指南写作模板
***【写作要求】***
> **注意:**
> _1、本模板提供推荐的开发指南文档框架、典型知识点写作要求及写作指导。实际写作中,应视具体__方案/特性/功能/模块__情况,先完成开发者任务场景分析与开发指南大纲设计,然后参照本模板写作具体内容。_
>
> _2、文档写作时,两级标题之间的位置不允许添加内容。_
>
> _3、所有斜体为写作指导,正式文档中注意全部删除。_
*必选**描述各个场景下,开发者如何完成开发任务**可根据多场景任务增加章节。写作要求见下,完成写作后,请逐项自检*
## xxx概述
| 内容要求 | 是否满足 | _必选。根据具体__方案/特性/功能/模块__的场景划分情况,此处的“xxx概述”与具体任务场景下的“任务场景n概述”按需提供一处或共存,具体的:_
| -------- | -------- |
| 如果有多个场景,请写起多个“开发指导”章节,如音频播放开发指导、音量管理开发指导、短音播放开发指导。 | |
| 标题尽量使用“动词+名词”的句式表述任务操作。 | |
_1、此处的“xxx概述”":用于承载开发者需要了解的、本特性各任务场景通用的概述内容。如无,则删除。_
## 场景介绍 _2、“任务场景n概述”:用于承载任务场景n直接相关的概述内容,知识点构成及写作要点与“xxx概述”相同,包括任务场景n简介、任务场景n直接相关的基本概念、任务场景n直接相关的实现原理、任务场景n直接相关的约束与限制、任务场景n直接相关的相关实例。如无,则删除。_
***【写作要求】*** **_【开发指南总体写作要求】_**
*必选**描述在什么情景下解决什么问题,最终达到什么样的效果*。应用SCQA描述方法: **_1、目标对象:_**_面向内、外部开发者(含产品经理、开发人员)。面向UX设计师的指导文档通常由专门的UX设计规范承载,不在开发指南范畴。本文如需提及,以超链接方式指向对应UX规范即可。_
- S:situation(情景),由大家都熟悉的的情景,事实引入。 _**2、内容定位:**介绍__方案/特性/功能/模块__是什么(What)、能做什么(Why),以及如何进行相关应用程序/设备的设计、开发、发布上架(How)。支撑开发者学习必要知识,最终在实际开发活动中完成既定任务目标。_
- C:complication(冲突),但是实际情况往往和我们的要求有冲突。 _**3、用户视角:**变身开发者,始终以开发者视角,提供开发者关注的、可感知和使用的内容。_
- Q:question(疑问),怎么办? _**4、面向任务:**聚焦开发者实际任务,完整、正确、易用,具备权威指导性。_
- A:answer(回答),我们的解决方案是 … _5、不要受限:模板只是基础框架,不要僵化。_
*写作要求见下,完成写作后,请逐项自检*
| 内容要求 | 是否满足 | ### xxx简介
| -------- | -------- |
| 背景原因、什么时候在哪、做了什么操作、最终解决什么问题或操作效果都明确。 | |
**写作样例** _必选。_
音频播放的主要工作是将音频数据转码为可听见的音频模拟信号并通过输出设备进行播放,同时对播放任务进行管理。 _**【开发者关注点】**_
_这个方案/特性/功能/模块是什么(定义-what)?我为什么要用它?它能解决哪些问题或带来哪些收益?(目的/客户价值-why)_
## 接口说明 _**【写作要点】**_
*【**写作要求**】* - _提供易理解的场景化描述。__可参考如下SCQA方式介绍方案/特性/功能/模块客户面的功能场景、特点。_
- _S:situation(情景),由大家都熟悉的的情景、事实引入。_
- _C:complication(冲突),但是实际情况往往和我们的要求有冲突。_
- _Q:question(疑问),怎么办?_
- _A:answer(回答),我们的解决方案是 …_
*必选**描述本开发指导相关的接口有哪些,旨在要开发者在开发前有大体了解,提升开发效率**写作要求见下,完成写作后,请逐项自检* - _抽象的概念要具象化,可以适当引入2C视角(如UX中的场景效果)的内容,帮助理解。_
| 内容要求 | 是否满足 | **_【写作要求】_**
| -------- | -------- |
| 不在本开发任务的接口无需提供。 | |
| 如果接口太多,超过10个,可以提供主要的接口 | |
**写作样例** - _清晰易懂,避免模糊、晦涩、有歧义的表述。_
音频播放开放能力如下:AudioRenderer类,具体的API详见接口文档。 - _仅使用必要的术语、缩略语或专有名词,并给出解释(提供到术语表链接也可以)。_
**表1** 音频播放API接口功能介绍 - _文中使用的术语、缩略语或专有名词应全文保持一致。_
| 接口名 | 描述 |
| -------- | -------- |
| AudioRenderer(AudioRendererInfo audioRendererInfo, PlayMode pm) throws IllegalArgumentException | 构造函数,设置播放相关音频参数和播放模式,使用默认播放设备 |
| AudioRenderer(AudioRendererInfo audioRendererInfo, PlayMode pm, AudioDeviceDescriptor outputDevice) throws IllegalArgumentException | 构造函数,设置播放相关音频参数、播放模式和播放设备 |
| boolean play() | 播放音频流 |
| boolean write(byte[] data, int offset, int size) | 将音频数据以byte流写入音频接收器以进行播放 |
## 开发步骤
*【**写作要求**】*
*必选。描述* *开发的整体过程,便于开发者快速完成开发**具体写作要求见下,完成写作后,请逐项自检下*
| 内容要求 | 是否满足 |
| -------- | -------- |
| **如何写好步骤** | |
| 步骤完整:提供必需的步骤,顺利指导完成操作,无缺失。 | |
| 脉络清楚:文档逻辑清晰、合理。文档前面的概述、准备、操作围绕一条线描述,不能章节断裂或前后矛盾的现象。 | |
| 任务句式:标题或句子尽量使用“动词+名词”的句式表述动作。 | |
| 预防提前:操作过程中的限制、易错的、有潜在风险的,要提前描述,使用DOCS平台的“插入&gt;&nbsp;说明&nbsp;&gt;&nbsp;须知”描述。 | |
| 步骤清晰-1:无论步骤简单或复杂,都需要写步骤目的,即为什么做。 | |
| 步骤清晰-2:明确在什么环境下,使用什么工具,做什么操作,怎么做该操作。 | |
| 步骤具体:如果操作可选,要明确可选条件。 | |
| 在开发步骤执行完成后,及时明确操作正确的标准。 | |
| **如何写好代码段** | |
| 代码涉及开发者拷贝的命令,必须用可编辑的报文呈现,避免截图,使用代码片段包裹。 | |
| 代码中关键段用蓝色(RGB:0.0.255)突出显示,关键步骤要有注释说明。 | |
| 代码显示符合代码缩进要求。 | |
| 步骤涉及接口调用,清晰给出接口及其使用说明或示例代码,代码来源于具体实例。 | |
**写作样例**
1. 构造音频流参数的数据结构AudioStreamInfo,推荐使用AudioStreamInfo.Builder类来构造,模板如下,模板中设置的均为AudioStreamInfo.Builder类的默认值,根据音频流的具体规格来设置具体参数。
```
AudioStreamInfo audioStreamInfo = new AudioStreamInfo.Builder()
.sampleRate( AudioStreamInfo.SAMPLE_RATE_UNSPECIFIED)
.audioStreamFlag(AudioStreamInfo.AudioStreamFlag.AUDIO_STREAM_FLAG_NONE)
.encodingFormat(AudioStreamInfo.EncodingFormat.ENCODING_INVALID)
.channelMask(AudioStreamInfo.ChannelMask.CHANNEL_INVALID)
.streamUsage(AudioStreamInfo.StreamUsage.STREAM_USAGE_UNKNOWN)
.build();
```
以真实的播放pcm流为例: ### xxx基本概念
_可选。此处放置以下各任务场景通用的基本概念。_
_**【开发者关注点】**_
_要使用该方案/特性/功能/模块,有哪些独有概念是我需要了解的?_
**_【写作要点】_**
- _仅提供开发者任务中必须的概念。_
- _运作机制、约束限制、开发过程等多个章节相关的概念在此介绍,仅某个章节用到的概念在对应章节中介绍。_
- _业界通用的概念不用在此赘述。__注意使用业界通用术语来表达,不用华为研发内部语言。_
- _概念之间如有逻辑关系,推荐使用图形描述。_
**_【写作要求】_**
- _清晰易懂,避免模糊、晦涩、有歧义的表述。_
- _仅使用必要的术语、缩略语或专有名词,并给出解释(提供到术语表链接也可以)。_
- _文中使用的术语、缩略语或专有名词应全文保持一致。_
**【写作样例】**
在进行关系型数据库开发前,开发者应了解以下基本概念:
- **关系型数据库**
基于关系模型来管理数据的数据库,以行和列的形式存储数据。
- **谓词**
数据库中用来代表数据实体的性质、特征或者数据实体之间关系的词项,主要用来定义数据库的操作条件。
- **结果集**
指用户查询之后的结果集合,可以对数据进行访问。结果集提供了灵活的数据访问方式,可以更方便的拿到用户想要的数据。
### 实现原理
_可选。此处放置以下各任务场景通用的实现原理。_
_**【开发者关注点】**_
_该方案/特性/功能/模块是如何工作的?关键步骤相关接口调用和触发时机?我要了解其原理,以更好的使用、调试它。_
**_【写作要点】_**
- _如果原理简单,通过前面基本概念就可以说清楚,此章节可以不提供,删除即可。_
- _仅描述开发者任务(使用或接入)过程中可见的机制原理,不要提供开发者不可见的内部实现。_
- _尽量图文结合,一般使用时序图、流程图等形式。文字描述与图形描述匹配。_
- _注意不要泄密。_
**_【写作要求】_**
- _清晰易懂,避免模糊、晦涩、有歧义的表述。_
- _仅使用必要的术语、缩略语或专有名词,并给出解释(提供到术语表链接也可以)。_
- _文中使用的术语、缩略语或专有名词应全文保持一致。_
**【写作样例】**
分布式数据对象生长在分布式内存数据库之上,在分布式内存数据库上进行了JS对象型的封装,能像操作本地变量一样操作分布式数据对象,数据的跨设备同步由系统自动完成。
**图1** 分布式数据对象运行机制
![how-distributedobject-works](figures/how-distributedobject-works.png)
### 约束与限制
_可选。此处放置以下各任务场景通用的约束与限制。_
_**【开发者关注点】**_
_我要__使用该方案/特性/功能/模块,有什么约束条件吗?__该方案/特性/功能/模块__实现的程度如何,能满足我的需求吗?_
**_【写作要点】_**
- _描述对开发活动有影响、可感知的约束限制,及其带来的影响,包括但不限于如下几方面:_
- **_功能限制_**
- _功能使用范围(明确不支持的场景)。_
- _规格限制。_
- **_操作限制_**
- _已知问题的操作。_
- _潜在风险的操作(如引起性能降低)。_
- _容易出错的操作在步骤里描述,不在此体现。_
**【写作样例】**
- 不同设备间只有相同bundleName的应用才能直接同步。
- 不建议创建过多分布式数据对象,每个分布式数据对象将占用100-150KB内存。
- 每个分布式数据对象大小不超过500KB。
### 相关实例
_可选。此处放置以下各任务场景通用的相关实例。_
**_【开发者关注点】_**
_有哪些Sample code、Codelabs、Demo工程可供学习、参考。_
**_【写作要点】_**
_已发布的Sample code、Codelabs、Demo工程包,请在此处提供链接(一般为Gitee链接)。__注意:不允许将工程包等作为附件插入到文档中。_
**【写作样例】**
针对Ability开发,有以下相关实例可供参考:
- [Page内和Page间导航跳转](https://gitee.com/openharmony/codelabs/tree/master/Ability/PageAbility)
## 环境准备
_可选。_
_根据具体的开发场景分析分解情况,本节内容可按需放入“开发指导”下,作为“前提条件”或“开发准备”与具体场景的“开发步骤”就近放置。_
_明确如何准备开发环境(如软硬件配置要求、工具要求、设备要求等)__。_
_如果不涉及上述特殊要求,此章节删除。_
### 环境要求
**_【写作要求】_**
_明确开发环境所需要的软硬件配置,旨在要用户提前准备环境。如果软硬件内容比较多,可以再增加子标题。_
**【写作样例】**
Hi3861开发板对环境配置的特有要求如下表所示。
**表1** Hi3861开发板对环境配置的特有要求
| 平台类型 | 开发工具 | 用途 | 获取途径 |
| -------- | -------- | -------- | -------- |
| Linux服务器 | SCons3.0.4+ | 编译构建工具 | 通过互联网获取 |
| Linux服务器 | build-essential | 编译依赖的基础软件包 | 通过互联网获取 |
### 搭建环境
**_【写作要求】_**
_描述搭建开发环境的具体步骤,如果内容比较多,可以再区分章节,如:搭建编译基础环境、搭建编译工具环境等。_
**【写作样例】**
1. 打开Linux编译服务器终端。
2. 运行如下命令,安装工具安装包。
``` ```
AudioStreamInfo audioStreamInfo = new AudioStreamInfo.Builder().sampleRate(44100)//44.1kHz xxxxx
.audioStreamFlag(AudioStreamInfo.AudioStreamFlag.AUDIO_STREAM_FLAG_MAY_DUCK)//混音
.encodingFormat(AudioStreamInfo.EncodingFormat.ENCODING_PCM_16BIT)//16-bit PCM
.channelMask(AudioStreamInfo.ChannelMask.CHANNEL_OUT_STEREO)//双声道
.streamUsage(AudioStreamInfo.StreamUsage.STREAM_USAGE_MEDIA)//媒体类音频
.build();
``` ```
2. 使用步骤1创建的音频流构建音频播放的参数结构AudioRendererInfo,推荐使用AudioRendererInfo.Builder类来构造,模板如下,模板中设置的均为AudioRendererInfo.Builder类的默认值,根据音频播放的具体规格来设置具体参数。 3. 运行如下命令,查看是否安装成功。
``` ```
AudioRendererInfo audioRendererInfo = new AudioRendererInfo.Builder() xxxxx
.audioStreamInfo(audioStreamInfo)
.audioStreamOutputFlag(AudioRendererInfo.AudioStreamOutputFlag.AUDIO_STREAM_OUTPUT_FLAG_NONE)
.bufferSizeInBytes(0)
.distributedDeviceId("")
.isOffload(false)
.sessionID(AudioRendererInfo.SESSION_ID_UNSPECIFIED)
.build();
``` ```
以真实的播放pcm流为例:
### 检验环境是否搭建成功
**_【写作要求】_**
_可选。环境搭建完成后,需要明确给出环境搭建是否成功的检验标准,也可以与搭建步骤合一。如上述写作样例。_
## 任务场景n(使用具体任务/场景名称替代,只有1个场景时使用特性名称xxx)开发指导
_必选。_
_**【开发者关注点】**_
_我要使用/接入这个方案/特性/功能/模块,需要怎么做(how)?_
_**【写作要点】**_
_贴近开发者实际开发场景:_
- _开发者需要通过哪些任务来达成开发目标,这就是任务场景。_
- _任务场景可以有1个或多个,__可按需添加多个“开发指导”章节。__同时要遵循分层分级逻辑,即大场景(任务场景n)-&gt;小场景(子任务场景n-x)-&gt;任务逻辑(对应“开发流程”)-&gt;操作步骤(一个个step)。_
### 任务场景n概述
_根据具体特性的场景划分情况,“任务场景n概述”与开篇的“xxx概述”按需提供一处或共存,具体的:_
_1、开篇的“xxx概述”":用于承载开发者需要了解的、本特性各任务场景通用的概述内容。如无,则删除。_
_2、“任务场景n概述”:用于承载任务场景n直接相关的概述内容,知识点构成及写作要点与开篇的“xxx概述”相同,包括任务场景n简介、任务场景n直接相关的基本概念、任务场景n直接相关的实现原理、任务场景n直接相关的约束与限制、任务场景n直接相关的相关实例。如无,则删除。_
### 开发流程
**_【写作要点】_**
- _可选。当开发步骤较多(达到5步及以上核心操作)或步骤间存在复杂的逻辑关系时,请提供开发流程,让开发者对他要执行的操作有一个全景认知。_
- _一般使用流程图、表。_
### 接口说明
**_【写作要求】_**
- _可选。描述以下开发步骤中有哪些关键接口,并提供接口简介。旨在要开发者在开发前有大体了解,提升开发效率。_
- _如果相关接口超过10个,只提供主要接口即可_。
- _接口及其涉及的功能必须在文档发布时的对应版本已支持。_
**【写作样例】**
部分接口仅系统应用才可以调用,且需要具备权限:SystemCapability.Notification.Notification ,接口返回值有两种返回形式:callback和promise,下表中为callback形式接口,promise和callback只是返回值方式不一样,功能相同。具体API说明详见[接口文档](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-notification.md)
**表1** 通知使能开关接口功能介绍
| 接口名 | 描述 |
| ------------------------------------------------------------ | ---------------- |
| isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean>): void | 查询通知使能开关 |
| enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void | 设置使能开关 |
### 开发步骤
**_【写作要求】_**
_必选。_
- _完整性、正确性要求_
- _描述开发的完整过程,使开发者能够完整(如HAP中代码、资源、第三方库及应用配置文件都涉及哪些相关步骤)、正确的完成开发,不可遗漏关键配置操作。_
- _文档中的片段示例代码直接拷贝进DevEco Studio中,放入上下文可以正常编译。_
- _文档中的完整示例代码直接拷贝进DevEco Studio中能够运行,并和文档中描述的执行结果一致。_
- _清晰性要求_
- _每个步骤有清晰的执行主体(who),明确操作目的(why)、操作内容(what/how)、场景(when/where)。使用祈使句描述步骤。_
- _步骤中如果涉及接口调用,需要清晰给出使用的接口及其使用说明、示例代码。_
- _关键步骤和示例代码中有开发建议或注意事项的位置,需要提供相关描述(示例代码中采用注释)。_
变身开发者,假想自己在操作,可能会提出什么问题?这些问题就是开发者的障碍。需要在文档中提供支撑信息,来帮助开发者处理及应对这些障碍。例如:
- 分支选取原则:步骤分支选取原则、参数选取原则或建议。
- 必要的随操作步骤就近放置的补充说明:可能存在的特殊操作、操作权限要求、效率提升技巧、几句话即可说清的背景知识等。
- 需要事先告知用户并提醒注意的信息:对其他功能可能造成影响的操作;对系统性能、可靠性可能造成影响的操作;可能导致数据丢失或各类安全问题的操作。这些信息需要在“操作步骤”开始前,以区别于正文的样式加以提示强调。
- 防错/纠错信息:针对开发全流程中可能遇到的典型问题,提供预防、定位或恢复指导,以提高开发效率。防错/纠错信息可酌情在“开发步骤”或下文的“常见问题”中承载。
- _规范性要求_
- _保证示例代码的逻辑/语法正确性、书写规范性。涉及用户手机号码、身份证、帐号名等敏感信息均需要打码处理,如186\*\*\*\*\*\*\*\*;涉及IP地址、域名等,需要使用私网IP或相应格式代替,如xx.xx.xx.xx、www.example.com,禁止使用真实IP地址、域名。_
- _代码显示符合代码缩进要求。缩进不要用tab键,改为4个空格,否则上网格式错乱。_
**【写作样例-节选】**
1. 导入相关模块。
```javascript
import formBindingData from '@ohos.application.formBindingData'
import formInfo from '@ohos.application.formInfo'
import formProvider from '@ohos.application.formProvider'
``` ```
AudioRendererInfo audioRendererInfo = new AudioRendererInfo.Builder()
.audioStreamInfo(audioStreamInfo) 2. 实现LifecycleForm生命周期接口。
.audioStreamOutputFlag(AudioRendererInfo.AudioStreamOutputFlag.AUDIO_STREAM_OUTPUT_FLAG_DIRECT_PCM)//pcm格式的输出流
.bufferSizeInBytes(100) ```javascript
.distributedDeviceId("E54***5E8")//使用分布式设备E54***5E8播放 export default {
.isOffload(false)//false表示分段传输buffer并播放,true表示整个音频流一次性传输到HAL层播放 onCreate(want) {
.build(); console.log('FormAbility onCreate');
// 由开发人员自行实现,将创建的卡片信息持久化,以便在下次获取/更新该卡片实例时进行使用
let obj = {
"title": "titleOnCreate",
"detail": "detailOnCreate"
};
let formData = formBindingData.createFormBindingData(obj);
return formData;
},
onCastToNormal(formId) {
// 使用方将临时卡片转换为常态卡片触发,提供方需要做相应的处理
console.log('FormAbility onCastToNormal');
},
}
``` ```
3. 根据要播放音频流指定PlayMode,不同的PlayMode在写数据时存在差异,详情见步骤7,其余播放流程是无区别的。并通过构造函数获取AudioRenderer类的实例化对象。
4. 播放任务结束后,调用AudioRenderer实例化对象的release()释放资源。 ### 调测验证
**_【写作要求】_**
- _可选。开发完成后,如有独立的调测验证操作,需提供指导,以确认操作是否成功。操作步骤要求同“开发步骤”。_
- _此处仅提供最后的业务调测,每个小任务的操作结果,推荐在开发步骤执行完成后及时验证。_
## 常见问题
_可选。_
**_【开发者关注点】_**
_该方案/特性/功能/模块开发全流程中可能遇到哪些典型问题?如何定位、解决?_
**_【写作要点】_**
_描述开发过程遇到的各类问题以及解决方案,以提高开发效率。_
- _如果无常见问题,删除此章节。_
- _如果有常见问题,建议单独章节,后续具备扩展性。_
- _如果有常见问题,问题少于1屏且未来扩充可能性不大,可放在“开发指导”。_
### 1.XX问题(简单问题)
## 调测验证(可选) XXX
*【**写作要求**】*
*可选*。 *描述开发完成后,进行调测验证,确保最终操作成功*。*操作步骤要求同“开发指导”,其他具体写作要求见下,完成写作后,请逐项自检下*。 ### 2.XX问题(复杂问题)
| 内容要求 | 是否满足 | **现象描述**
| -------- | -------- |
| 仅进行最后的业务调测,每个小任务的操作结果,在开发步骤执行完成后,及时验证操作结果。 | |
| 明确开发成功标准。 | |
## 开发实例 XXX
*【**写作要求**】*
*提供完整的sample示例,同时简要描述示例原理和实现,并链接到源码仓*。 **可能原因**
针对xxx开发,有以下示例工程可供参考: XXX
- xxx(此处请提供源码超链接) **解决办法**
本示例xxxx。 XXX
...@@ -105,7 +105,7 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动 ...@@ -105,7 +105,7 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
permission = 0644; permission = 0644;
moduleName = "HDF_PLATFORM_SPI"; // 【必要】用于指定驱动名称,该字段的值必须和驱动入口结构的moduleName值一致 moduleName = "HDF_PLATFORM_SPI"; // 【必要】用于指定驱动名称,该字段的值必须和驱动入口结构的moduleName值一致
serviceName = "HDF_PLATFORM_SPI_1"; // 【必要且唯一】驱动对外发布服务的名称 serviceName = "HDF_PLATFORM_SPI_1"; // 【必要且唯一】驱动对外发布服务的名称
deviceMatchAttr = "hisilicon_hi35xx_spi_1";// 需要与设备hcs文件中的match_attr匹配 deviceMatchAttr = "hisilicon_hi35xx_spi_1"; // 需要与设备hcs文件中的match_attr匹配
} }
... ...
} }
...@@ -294,10 +294,10 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动 ...@@ -294,10 +294,10 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
int32_t ret; int32_t ret;
struct SpiCntlr *cntlr = NULL; struct SpiCntlr *cntlr = NULL;
... ...
cntlr = SpiCntlrFromDevice(device);// 这里有HdfDeviceObject到SpiCntlr的强制转化,通过service成员,赋值见Bind函数 cntlr = SpiCntlrFromDevice(device); // 这里有HdfDeviceObject到SpiCntlr的强制转化,通过service成员,赋值见Bind函数
// return (device == NULL) ? NULL : (struct SpiCntlr *)device->service; // return (device == NULL) ? NULL : (struct SpiCntlr *)device->service;
... ...
ret = Pl022Init(cntlr, device);// 【必要】实例化厂商自定义操作对象,示例见下 ret = Pl022Init(cntlr, device); // 【必要】实例化厂商自定义操作对象,示例见下
... ...
ret = Pl022Probe(cntlr->priv); ret = Pl022Probe(cntlr->priv);
... ...
...@@ -318,7 +318,7 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动 ...@@ -318,7 +318,7 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
// 计算最大,最小速度对应的频率 // 计算最大,最小速度对应的频率
pl022->maxSpeedHz = (pl022->clkRate) / ((SCR_MIN + 1) * CPSDVSR_MIN); pl022->maxSpeedHz = (pl022->clkRate) / ((SCR_MIN + 1) * CPSDVSR_MIN);
pl022->minSpeedHz = (pl022->clkRate) / ((SCR_MAX + 1) * CPSDVSR_MAX); pl022->minSpeedHz = (pl022->clkRate) / ((SCR_MAX + 1) * CPSDVSR_MAX);
DListHeadInit(&pl022->deviceList);// 初始化DList链表 DListHeadInit(&pl022->deviceList); // 初始化DList链表
pl022->cntlr = cntlr; // 使Pl022与SpiCntlr可以相互转化的前提 pl022->cntlr = cntlr; // 使Pl022与SpiCntlr可以相互转化的前提
cntlr->priv = pl022; // 使Pl022与SpiCntlr可以相互转化的前提 cntlr->priv = pl022; // 使Pl022与SpiCntlr可以相互转化的前提
cntlr->busNum = pl022->busNum; // 给SpiCntlr的busNum赋值 cntlr->busNum = pl022->busNum; // 给SpiCntlr的busNum赋值
...@@ -352,11 +352,11 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动 ...@@ -352,11 +352,11 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
{ {
struct SpiCntlr *cntlr = NULL; struct SpiCntlr *cntlr = NULL;
... ...
cntlr = SpiCntlrFromDevice(device);// 这里有HdfDeviceObject到SpiCntlr的强制转化,通过service成员,赋值见Bind函数 cntlr = SpiCntlrFromDevice(device); // 这里有HdfDeviceObject到SpiCntlr的强制转化,通过service成员,赋值见Bind函数
// return (device==NULL) ?NULL:(struct SpiCntlr *)device->service; // return (device==NULL) ?NULL:(struct SpiCntlr *)device->service;
... ...
if (cntlr->priv != NULL) { if (cntlr->priv != NULL) {
Pl022Remove((struct Pl022 *)cntlr->priv);// 这里有SpiCntlr到Pl022的强制转化 Pl022Remove((struct Pl022 *)cntlr->priv); // 这里有SpiCntlr到Pl022的强制转化
} }
SpiCntlrDestroy(cntlr); // 释放Pl022对象 SpiCntlrDestroy(cntlr); // 释放Pl022对象
} }
......
...@@ -174,8 +174,8 @@ LOSCFG_SOC_ASR5822S=y ...@@ -174,8 +174,8 @@ LOSCFG_SOC_ASR5822S=y
module_name = get_path_info(rebase_path("."), "name") module_name = get_path_info(rebase_path("."), "name")
module_group(module_name) { module_group(module_name) {
modules = [ modules = [
"dev_wifi_a", --- 单板模块 "dev_wifi_a", # 单板模块
"hcs", --- hcs文件的对应模块 "hcs", # hcs文件的对应模块
] ]
} }
} }
...@@ -203,17 +203,17 @@ LOSCFG_SOC_ASR5822S=y ...@@ -203,17 +203,17 @@ LOSCFG_SOC_ASR5822S=y
import("//kernel/liteos_m/liteos.gni") import("//kernel/liteos_m/liteos.gni")
config("public") { config("public") {
include_dirs = [ "." ] --- 公共头文件 include_dirs = [ "." ] # 公共头文件
} }
kernel_module("asr_startup") { --- 编译的模块 kernel_module("asr_startup") { # 编译的模块
sources = [ --- 编译的源文件 sources = [ # 编译的源文件
"startup.c", "startup.c",
"board.c", "board.c",
"startup_cm4.S", "startup_cm4.S",
] ]
include_dirs = [ --- 模块内使用到的头文件 include_dirs = [ # 模块内使用到的头文件
"...", "...",
] ]
} }
...@@ -223,10 +223,10 @@ LOSCFG_SOC_ASR5822S=y ...@@ -223,10 +223,10 @@ LOSCFG_SOC_ASR5822S=y
``` ```
config("public") { config("public") {
include_dirs = [] --- 公共头文件 include_dirs = [] # 公共头文件
ldflags = [] --- 链接参数,包括ld文件 ldflags = [] # 链接参数,包括ld文件
libs = [] --- 链接库 libs = [] # 链接库
defines = [] --- 定义 defines = [] # 定义
``` ```
![](../public_sys-resources/icon-note.gif) **说明:** ![](../public_sys-resources/icon-note.gif) **说明:**
...@@ -306,8 +306,8 @@ if (ret != LOS_OK) { ...@@ -306,8 +306,8 @@ if (ret != LOS_OK) {
在初始化之后,每个shell命令需要进行注册,例如:`vendor/asrmicro/wifi_demo/tests/wifi/wifi_app.c` 在初始化之后,每个shell命令需要进行注册,例如:`vendor/asrmicro/wifi_demo/tests/wifi/wifi_app.c`
``` ```
osCmdReg(CMD_TYPE_STD, "wifi_open", 0, (CMD_CBK_FUNC)ap_conn_func); --- 连接AP的指令,这里可以带参 osCmdReg(CMD_TYPE_STD, "wifi_open", 0, (CMD_CBK_FUNC)ap_conn_func); // 连接AP的指令,这里可以带参
osCmdReg(CMD_TYPE_EX, "wifi_close", 0, (CMD_CBK_FUNC)ap_close_func); --- 断开指令 osCmdReg(CMD_TYPE_EX, "wifi_close", 0, (CMD_CBK_FUNC)ap_close_func); // 断开指令
``` ```
### 内核启动适配 ### 内核启动适配
...@@ -316,21 +316,21 @@ osCmdReg(CMD_TYPE_EX, "wifi_close", 0, (CMD_CBK_FUNC)ap_close_func); --- 断 ...@@ -316,21 +316,21 @@ osCmdReg(CMD_TYPE_EX, "wifi_close", 0, (CMD_CBK_FUNC)ap_close_func); --- 断
注册中断,可参考`//device/soc/asrmicro/asr582x/liteos_m/sdk/startup/board.c`: 注册中断,可参考`//device/soc/asrmicro/asr582x/liteos_m/sdk/startup/board.c`:
``` ```
ArchHwiCreate(UART1_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY,0,UART1_IRQHandler,0); --- UART中断 ArchHwiCreate(UART1_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY,0,UART1_IRQHandler,0); // UART中断
ArchHwiCreate(GPIO_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY,0,GPIO_IRQHandler,0); --- GPIO中断 ArchHwiCreate(GPIO_IRQn,configLIBRARY_NORMAL_INTERRUPT_PRIORITY,0,GPIO_IRQHandler,0); // GPIO中断
``` ```
内核初始化示例如下: 内核初始化示例如下:
``` ```
osStatus_t ret = osKernelInitialize(); --- 内核初始化 osStatus_t ret = osKernelInitialize(); // 内核初始化
if(ret == osOK) if(ret == osOK)
{ {
threadId = osThreadNew((osThreadFunc_t)sys_init,NULL,&g_main_task); --- 创建init线程 threadId = osThreadNew((osThreadFunc_t)sys_init,NULL,&g_main_task); // 创建init线程
if(threadId!=NULL) if(threadId!=NULL)
{ {
osKernelStart(); --- 线程调度 osKernelStart(); // 线程调度
} }
} }
``` ```
...@@ -339,9 +339,9 @@ if(ret == osOK) ...@@ -339,9 +339,9 @@ if(ret == osOK)
``` ```
... ...
DeviceManagerStart(); --- HDF初始化 DeviceManagerStart(); // HDF初始化
OHOS_SystemInit(); --- OpenHarmony系统组件初始化 OHOS_SystemInit(); // OpenHarmony系统组件初始化
.... ....
``` ```
...@@ -598,7 +598,7 @@ dsoftbus组件的选项配置如下: ...@@ -598,7 +598,7 @@ dsoftbus组件的选项配置如下:
``` ```
declare_args() { declare_args() {
asr_dsoftbus_test = true --- 打开dsoftbus demo编译 asr_dsoftbus_test = true # 打开dsoftbus demo编译
} }
``` ```
...@@ -610,7 +610,7 @@ declare_args() { ...@@ -610,7 +610,7 @@ declare_args() {
"enable": "true", "enable": "true",
"test_modules": [ "test_modules": [
"wifi_test", "wifi_test",
"dsoftbus_test" --- 打开dsoftbus_test模块 "dsoftbus_test" # 打开dsoftbus_test模块
] ]
} }
] ]
...@@ -626,7 +626,7 @@ dsoftbus组件的运行需至少预留80KB RAM。如资源不够,可对其它 ...@@ -626,7 +626,7 @@ dsoftbus组件的运行需至少预留80KB RAM。如资源不够,可对其它
`//kernel_liteos_m/blob/master/components/net/lwip-2.1/porting/include/lwip/lwipopts.h` `//kernel_liteos_m/blob/master/components/net/lwip-2.1/porting/include/lwip/lwipopts.h`
``` ```
#define TCPIP_THREAD_STACKSIZE 0x2000 --- 缩小TCPIP任务栈大小 #define TCPIP_THREAD_STACKSIZE 0x2000 // 缩小TCPIP任务栈大小
``` ```
在communication_dsoftbus仓中,加入了-fPIC编译选项,这样会让编译器产生与位置无关代码,并使用相对地址,但是在LiteOS-M核中使用的是静态库,不推荐使用。 在communication_dsoftbus仓中,加入了-fPIC编译选项,这样会让编译器产生与位置无关代码,并使用相对地址,但是在LiteOS-M核中使用的是静态库,不推荐使用。
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
设置Makefile的交叉编译工具链,修改并编译该库,生成OpenHarmony平台的可执行文件,步骤如下: 设置Makefile的交叉编译工具链,修改并编译该库,生成OpenHarmony平台的可执行文件,步骤如下:
1. 设置工具链 1. 设置工具链
将下列clang工具链配置替换掉yxml库根目录的MakeFile(即表1中的文件)中的原有配置。 将下列clang工具链配置替换掉yxml库根目录的Makefile(即表1中的文件)中的原有配置。
clang工具链配置: clang工具链配置:
......
...@@ -19,66 +19,6 @@ HiSysEvent提供OpenHarmony打点接口,通过在关键路径打点记录系 ...@@ -19,66 +19,6 @@ HiSysEvent提供OpenHarmony打点接口,通过在关键路径打点记录系
### 接口说明 ### 接口说明
JAVA打点接口如下:
HiSysEvent类,具体的API详见接口文档 。
**表1** HiSysEvent接口介绍
| 接口名 | 描述 |
| -------- | -------- |
| public&nbsp;static&nbsp;int&nbsp;write(String&nbsp;domain,&nbsp;String&nbsp;eventName,&nbsp;EventType&nbsp;type,&nbsp;Object...&nbsp;keyValues) | 接口功能:记录系统事件。<br/>输入参数:<br/>-&nbsp;domain:事件的相关领域,需要使用预置领域请参考Domain,可自定义领域。自定义领域长度在16个字符以内,有效的字符是0-9、A-Z,以字母开头。<br/>-&nbsp;eventName:事件名,长度在32个字符以内,有效的字符是0-9、a-z、A-Z、_,以字母开头,不能以_结尾。<br/>-&nbsp;type:事件类型,参考EventType。<br/>-&nbsp;keyValues:事件参数键值对,支持基本的数据类型、std::string,以及std::vector&lt;基本类型&gt;、std:vector&lt;std::string&gt;。参数名长度在48个字符以内,有效的字符是0-9、a-z、A-Z、_,以字母开头,不能以_结尾。参数名的个数在32个以内。<br/>返回值:成功返回0,错误返回小于0的值。 |
| public&nbsp;static&nbsp;int&nbsp;write(String&nbsp;domain,&nbsp;String&nbsp;eventName,&nbsp;EventType&nbsp;type,&nbsp;Map&lt;String,&nbsp;Object&gt;&nbsp;keyValues) | 接口功能:记录系统事件。<br/>输入参数:<br/>-&nbsp;domain:事件的相关领域,需要使用预置领域请参考Domain,可自定义领域。自定义领域长度在16个字符以内,有效的字符是0-9、A-Z,以字母开头。<br/>-&nbsp;eventName:事件名,长度在32个字符以内,有效的字符是0-9、a-z、A-Z、_,以字母开头,不能以_结尾。<br/>-&nbsp;type:事件类型,参考EventType。<br/>-&nbsp;keyValues:事件参数键值对,支持基本的数据类型、std::string,以及std::vector&lt;基本类型&gt;、std:vector&lt;std::string&gt;。参数名长度在48个字符以内,有效的字符是0-9、a-z、A-Z、_,以字母开头,不能以_结尾。参数名的个数在32个以内。<br/>返回值:成功返回0,错误返回小于0的值。 |
**表2** HiSysEvent.Domain接口介绍
| 成员 | 描述 |
| -------- | -------- |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;AAFWK&nbsp;=&nbsp;"AAFWK" | 元能力子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;APPEXECFWK&nbsp;=&nbsp;"APPEXECFWK" | 用户程序框架子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;ACCOUNT&nbsp;=&nbsp;"ACCOUNT" | 账号子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;AI&nbsp;=&nbsp;"AI" | AI子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;BARRIER_FREE&nbsp;=&nbsp;"BARRIERFREE" | 无障碍软件服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;BIOMETRICS&nbsp;=&nbsp;"BIOMETRICS" | 生物特征识别服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;CCRUNTIME&nbsp;=&nbsp;"CCRUNTIME" | C/C++运行环境子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;COMMUNICATION&nbsp;=&nbsp;"COMMUNICATION" | 公共通信子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;DEVELOPTOOLS&nbsp;=&nbsp;"DEVELOPTOOLS" | 研发工具链子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;DISTRIBUTED_DATAMGR&nbsp;=&nbsp;"DISTDATAMGR" | 分布式数据管理子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;DISTRIBUTED_SCHEDULE&nbsp;=&nbsp;"DISTSCHEDULE" | 分布式任务调度子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;GLOBAL&nbsp;=&nbsp;"GLOBAL" | 全球化子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;GRAPHIC&nbsp;=&nbsp;"GRAPHIC" | 图形子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;HIVIEWDFX&nbsp;=&nbsp;"HIVIEWDFX" | DFX子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;IAWARE&nbsp;=&nbsp;"IAWARE" | 本地资源调度管控子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;INTELLI_ACCESSORIES&nbsp;=&nbsp;"INTELLIACC" | 智能配件业务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;INTELLI_TV&nbsp;=&nbsp;"INTELLITV" | 智能电视业务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;IVI_HARDWARE&nbsp;=&nbsp;"IVIHARDWARE" | 车机专有硬件服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;LOCATION&nbsp;=&nbsp;"LOCATION" | 位置服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;MSDP&nbsp;=&nbsp;"MSDP" | 综合传感处理平台子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;MULTI_MEDIA&nbsp;=&nbsp;"MULTIMEDIA" | 媒体子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;MULTI_MODAL_INPUT&nbsp;=&nbsp;"MULTIMODALINPUT" | 多模输入子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;NOTIFICATION&nbsp;=&nbsp;"NOTIFICATION" | 事件通知子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;POWERMGR&nbsp;=&nbsp;"POWERMGR" | 电源服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;ROUTER&nbsp;=&nbsp;"ROUTER" | 路由器业务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;SECURITY&nbsp;=&nbsp;"SECURITY" | 安全子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;SENSORS&nbsp;=&nbsp;"SENSORS" | 泛Sensor服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;SOURCE_CODE_TRANSFORMER&nbsp;=&nbsp;"SRCTRANSFORMER" | 应用移植子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;STARTUP&nbsp;=&nbsp;"STARTUP" | 启动恢复子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;TELEPHONY&nbsp;=&nbsp;"TELEPHONY" | 电话服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;UPDATE&nbsp;=&nbsp;"UPDATE" | 升级服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;USB&nbsp;=&nbsp;"USB" | USB服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;WEARABLE_HARDWARE&nbsp;=&nbsp;"WEARABLEHW" | 穿戴专有硬件服务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;WEARABLE&nbsp;=&nbsp;"WEARABLE" | 穿戴业务子系统 |
| public&nbsp;static&nbsp;final&nbsp;String&nbsp;OTHERS&nbsp;=&nbsp;"OTHERS" | 其它 |
**表3** HiSysEvent.EventType接口介绍
| 接口名 | 描述 |
| -------- | -------- |
| FAULT | 故障类型事件 |
| STATISTIC | 统计类型事件 |
| SECURITY | 安全类型事件 |
| BEHAVIOR | 系统行为事件 |
C++打点接口如下: C++打点接口如下:
HiSysEvent类,具体的API详见接口文档 。 HiSysEvent类,具体的API详见接口文档 。
...@@ -87,7 +27,7 @@ HiSysEvent类,具体的API详见接口文档 。 ...@@ -87,7 +27,7 @@ HiSysEvent类,具体的API详见接口文档 。
| 接口名 | 描述 | | 接口名 | 描述 |
| -------- | -------- | | -------- | -------- |
| template&lt;typename...&nbsp;Types&gt;&nbsp;static&nbsp;int&nbsp;Write(const&nbsp;std::string&nbsp;&amp;domain,&nbsp;const&nbsp;std::string&nbsp;&amp;eventName,&nbsp;EventType&nbsp;type,&nbsp;Types...&nbsp;keyValues) | 接口功能:记录系统事件。<br/>输入参数:<br/>-&nbsp;domain:事件的相关领域,需要使用预置领域请参考Domain,可自定义领域。自定义领域长度在16个字符以内,有效的字符是0-9、A-Z,以字母开头。<br/>-&nbsp;eventName:事件名,长度在32个字符以内,有效的字符是0-9、A-Z、下划线,以字母开头,不能以下划线结尾。<br/>-&nbsp;type:事件类型,参考EventType。<br/>-&nbsp;keyValues:事件参数键值对,支持基本的数据类型、std::string,以及std::vector&lt;基本类型&gt;、std:vector&lt;std::string&gt;。参数名长度在48个字符以内,有效的字符是0-9、A-Z、下划线,以字母开头,不能以下划线结尾。参数名的个数在32个以内。<br/>返回值:<br/>-&nbsp;0:系统事件记录成功。<br/>-&nbsp;负值:系统事件记录失败。 | | template&lt;typename...&nbsp;Types&gt;&nbsp;static&nbsp;int&nbsp;Write(const&nbsp;std::string&nbsp;&amp;domain,<br/>&nbsp;const&nbsp;std::string&nbsp;&amp;eventName,<br/>&nbsp;EventType&nbsp;type,&nbsp;Types...&nbsp;keyValues) | 接口功能:记录系统事件。<br/>输入参数:<br/>-&nbsp;domain:事件的相关领域,需要使用预置领域请参考Domain,可自定义领域。自定义领域长度在16个字符以内,有效的字符是0-9、A-Z,以字母开头。<br/>-&nbsp;eventName:事件名,长度在32个字符以内,有效的字符是0-9、A-Z、下划线,以字母开头,不能以下划线结尾。<br/>-&nbsp;type:事件类型,参考EventType。<br/>-&nbsp;keyValues:事件参数键值对,支持基本的数据类型、std::string,以及std::vector&lt;基本类型&gt;、std:vector&lt;std::string&gt;。参数名长度在48个字符以内,有效的字符是0-9、A-Z、下划线,以字母开头,不能以下划线结尾。参数名的个数在32个以内。<br/>返回值:<br/>-&nbsp;0:系统事件记录成功。<br/>-&nbsp;负值:系统事件记录失败。 |
**表5** HiSysEvent::Domain接口介绍 **表5** HiSysEvent::Domain接口介绍
...@@ -142,29 +82,6 @@ HiSysEvent类,具体的API详见接口文档 。 ...@@ -142,29 +82,6 @@ HiSysEvent类,具体的API详见接口文档 。
### 开发实例 ### 开发实例
Java接口实例
1. 源代码开发
引入类名:
```
import ohos.hiviewdfx.HiSysEvent;
```
假设业务关注应用启动时间start_app,在相关代码中使用(调用接口打点):
```
HiSysEvent.write(HiSysEvent.Domain.AAFWK, "start_app", HiSysEvent.EventType.FAULT, "app_name", "com.demo");
```
2. 编译设置,在BUILD.gn里增加子系统SDK依赖:
```
external_deps = [ "hisysevent:hisysevent_java" ]
```
C++接口实例 C++接口实例
1. 源代码开发 1. 源代码开发
......
...@@ -179,15 +179,13 @@ subscribeInfos.emplace_back(info2); ...@@ -179,15 +179,13 @@ subscribeInfos.emplace_back(info2);
std::list<ProfileEvent> failedEvents; std::list<ProfileEvent> failedEvents;
// 执行订阅接口 // 执行订阅接口
DistributedDeviceProfileClient::GetInstance().SubscribeProfileEvents(subscribeInfos, DistributedDeviceProfileClient::GetInstance().SubscribeProfileEvents(subscribeInfos, callback, failedEvents);
callback, failedEvents);
sleep(SUBSCRIBE_SLEEP_TIME); sleep(SUBSCRIBE_SLEEP_TIME);
std::list<ProfileEvent> profileEvents; std::list<ProfileEvent> profileEvents;
profileEvents.emplace_back(ProfileEvent::EVENT_PROFILE_CHANGED); profileEvents.emplace_back(ProfileEvent::EVENT_PROFILE_CHANGED);
failedEvents.clear(); failedEvents.clear();
// 解除订阅 // 解除订阅
DistributedDeviceProfileClient::GetInstance().UnsubscribeProfileEvents(profileEvents, DistributedDeviceProfileClient::GetInstance().UnsubscribeProfileEvents(profileEvents, callback, failedEvents);
callback, failedEvents);
``` ```
## 相关仓<a name="section176111311166"></a> ## 相关仓<a name="section176111311166"></a>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
- **用户身份凭据管理:** 向上提供系统内统一的用户身份凭据信息管理接口,向下通过认证执行器管理模块,调用系统内的认证资源,完成用户身份凭据的生命周期管理和安全存储。 - **用户身份凭据管理:** 向上提供系统内统一的用户身份凭据信息管理接口,向下通过认证执行器管理模块,调用系统内的认证资源,完成用户身份凭据的生命周期管理和安全存储。
- **认证执行器管理:** 提供认证资源管理和认证会话管理功能,支持系统内身份认证相关**执行器**<sup></sup>统一管理和协同调度,支持不同类型的身份认证执行器灵活对接。 - **认证执行器管理:** 提供认证资源管理和认证会话管理功能,支持系统内身份认证相关**执行器**<sup></sup>统一管理和协同调度,支持不同类型的身份认证执行器灵活对接。
基于统一用户认证框架,系统可以扩展支持多种认证能力。OpenHarmony框架当前已经支持的**认证执行器**包含口令认证和人脸认证,开发者如果想实现新的认证执行器,只需要在新的部件内实现认证相关功能,并且按照执行器管理模块定义的接口与统一用户认证框架对接即可。 基于统一用户认证框架,系统可以扩展支持多种认证能力。OpenHarmony框架当前已经支持的**认证执行器**包含口令认证和人脸认证,开发者如果想实现新的认证执行器,只需要在新的部件内实现认证相关功能,并且按照执行器管理模块定义的接口与统一用户认证框架对接即可。
*注:在用户IAM子系统内,将一个用户身份认证操作的最小执行单元称为**执行器**,如一个口令认证模块,处理口令采集、口令处理和比对、口令安全存储的全过程,因此可以抽象为一个口令认证的全功能执行器。* *注:在用户IAM子系统内,将一个用户身份认证操作的最小执行单元称为**执行器**,如一个口令认证模块,处理口令采集、口令处理和比对、口令安全存储的全过程,因此可以抽象为一个口令认证的全功能执行器。*
...@@ -31,34 +31,32 @@ ...@@ -31,34 +31,32 @@
```undefined ```undefined
//base/user_iam //base/user_iam
├── auth_executor_mgr # 认证执行器管理部件,支持系统内统一的认证资源管理和调度 ├── user_auth_framework # 用户认证框架,包括用户认证、凭据管理和执行器管理
├── face_auth # 人脸认证部件,与认证执行器管理对接,支持人脸录入、删除和人脸认证功能 ├── face_auth # 人脸认证部件,与认证执行器管理对接,支持人脸录入、删除和人脸认证功能
├── pin_auth # 口令认证部件,与认证执行器管理对接,支持口令录入、删除和口令认证功能 ├── pin_auth # 口令认证部件,与认证执行器管理对接,支持口令录入、删除和口令认证功能
├── user_auth # 统一用户认证部件,提供统一用户身份认证功能
└── user_idm # 用户身份凭据管理部件,提供系统内统一的用户身份凭据信息管理功能
``` ```
## 约束 ## 约束
1. 用户身份凭据信息管理类操作,是系统内的关键操作,相关接口只支持系统基础应用调用。 1. 用户身份凭据信息管理类操作,是系统内的关键操作,相关接口只支持系统基础应用调用。
2. 用户身份认证执行器内真正完成用户身份认证凭据信息的处理,因此只支持系统服务实现执行器的功能,与认证执行器管理模块对接。 2. 执行器内部真正完成用户凭据信息的处理,因此只支持系统服务实现执行器的功能,与认证执行器管理模块对接。
## 说明 ## 说明
### 使用说明 ### 使用说明
1. 统一用户认证框架必须配合一个认证执行器才可以使用。 1. 统一用户认证框架必须配合一个认证执行器才可以使用。
2. 系统内默认存在的第一个认证执行器应该是口令认证 2. 系统内默认存在的第一个认证执行器应该是口令执行器
## 相关仓 ## 相关仓
[useriam_auth_executor_mgr](https://gitee.com/openharmony/useriam_auth_executor_mgr) [useriam_user_auth_framework](https://gitee.com/openharmony/useriam_user_auth_framework)
[useriam_user_idm](https://gitee.com/openharmony/useriam_user_idm) [useriam_pin_auth](https://gitee.com/openharmony/useriam_pin_auth)
[useriam_user_auth](https://gitee.com/openharmony/useriam_user_auth) [useriam_face_auth](https://gitee.com/openharmony/useriam_face_auth)
[useriam_pin_auth](https://gitee.com/openharmony/useriam_pin_auth) [drivers_interface](https://gitee.com/openharmony/drivers_interface)
[useriam_faceauth](https://gitee.com/openharmony/useriam_faceauth) [drivers_peripheral](https://gitee.com/openharmony/drivers_peripheral)
\ No newline at end of file
...@@ -35,9 +35,10 @@ ...@@ -35,9 +35,10 @@
| 软件 | 版本 | 备注 | | 软件 | 版本 | 备注 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| OpenHarmony | 3.1.1&nbsp;Release | NA | | OpenHarmony | 3.1.1&nbsp;Release | NA |
| SDK | Ohos_sdk_full&nbsp;3.1.6.5 (API&nbsp;Version&nbsp;8&nbsp;Release) | NA | | Public SDK | Ohos_sdk_public&nbsp;3.1.6.6 (API&nbsp;Version&nbsp;8&nbsp;Release) | 面向应用开发者提供,不包含需要使用系统权限的系统接口。<br/>DevEco Studio 3.0 Beta4版本起,通过DevEco Studio获取的SDK默认为Public SDK。<br/>该版本Public SDK于7月6日单独更新发布。 |
| HUAWEI&nbsp;DevEco&nbsp;Studio(可选) | 3.0&nbsp;Beta3&nbsp;for&nbsp;OpenHarmony | OpenHarmony应用开发推荐使用 | | Full SDK | Ohos_sdk_full&nbsp;3.1.6.5 (API&nbsp;Version&nbsp;8&nbsp;Release) | 面向OEM厂商提供,包含了需要使用系统权限的系统接口。<br/>使用Full SDK时需要手动从镜像站点获取,并在DevEco Studio中替换,具体操作可参考[替换指南](../application-dev/quick-start/full-sdk-switch-guide.md)。 |
| HUAWEI&nbsp;DevEco&nbsp;Device&nbsp;Tool(可选) | 3.0&nbsp;Release | OpenHarmony智能设备集成开发环境推荐使用 | | HUAWEI&nbsp;DevEco&nbsp;Studio(可选) | 3.0&nbsp;Beta3&nbsp;for&nbsp;OpenHarmony | OpenHarmony应用开发推荐使用。 |
| HUAWEI&nbsp;DevEco&nbsp;Device&nbsp;Tool(可选) | 3.0&nbsp;Release | OpenHarmony智能设备集成开发环境推荐使用。 |
## 源码获取 ## 源码获取
...@@ -101,8 +102,10 @@ repo forall -c 'git lfs pull' ...@@ -101,8 +102,10 @@ repo forall -c 'git lfs pull'
| Hi3861轻量系统解决方案(二进制) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_pegasus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_pegasus.tar.gz.sha256) | | Hi3861轻量系统解决方案(二进制) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_pegasus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_pegasus.tar.gz.sha256) |
| Hi3516轻量系统解决方案-LiteOS(二进制) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus.tar.gz.sha256) | | Hi3516轻量系统解决方案-LiteOS(二进制) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus.tar.gz.sha256) |
| Hi3516轻量系统解决方案-Linux(二进制) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus_linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus_linux.tar.gz.sha256) | | Hi3516轻量系统解决方案-Linux(二进制) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus_linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus_linux.tar.gz.sha256) |
| 标准系统SDK包(Mac) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-full.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-full.tar.gz.sha256) | | 标准系统Full SDK包(Mac) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-full.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-full.tar.gz.sha256) |
| 标准系统SDK包(Windows\Linux) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-full.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-full.tar.gz.sha256) | | 标准系统Full SDK包(Windows\Linux) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-full.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-full.tar.gz.sha256) |
| 标准系统Public SDK包(Mac) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-public.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-public.tar.gz.sha256) |
| 标准系统Public SDK包(Windows\Linux) | 3.1.1 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-public.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-public.tar.gz.sha256) |
## 更新说明 ## 更新说明
...@@ -114,8 +117,9 @@ repo forall -c 'git lfs pull' ...@@ -114,8 +117,9 @@ repo forall -c 'git lfs pull'
**表3** 版本新增特性表 **表3** 版本新增特性表
| 子系统名称 | 标准系统 | 轻量、小型系统 | | 子系统名称 | 标准系统 | 轻量、小型系统 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| SDK | SDK区分Full SDK和Public SDK进行发布。<br/>*说明:API Version 8的Public SDK首次于7月6日单独更新发布。* | NA |
| 系统服务管理 | 新增添加群组校验机制。<br/>主要涉及如下需求:<br/>I52G5Q&nbsp;添加群组校验机制 | NA | | 系统服务管理 | 新增添加群组校验机制。<br/>主要涉及如下需求:<br/>I52G5Q&nbsp;添加群组校验机制 | NA |
| 电源管理 | 实现兼容亮度调节和电池信息查询API接口能力。<br/>主要涉及如下需求:<br/>I526UP&nbsp;支持\@system.brightness亮度调节接口<br/>I526UP&nbsp;支持\@system.battery电池信息查询接口 | NA | | 电源管理 | 实现兼容亮度调节和电池信息查询API接口能力。<br/>主要涉及如下需求:<br/>I526UP&nbsp;支持\@system.brightness亮度调节接口<br/>I526UP&nbsp;支持\@system.battery电池信息查询接口 | NA |
| 包管理 | 实现查询指定应用是否安装接口能力。<br/>主要涉及如下需求:<br/>I56EWD&nbsp;支持对测试框架的配置<br/>I55RZJ&nbsp;查询指定应用是否安装 | NA | | 包管理 | 实现查询指定应用是否安装接口能力。<br/>主要涉及如下需求:<br/>I56EWD&nbsp;支持对测试框架的配置<br/>I55RZJ&nbsp;查询指定应用是否安装 | NA |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册