未验证 提交 b1df875c 编写于 作者: O openharmony_ci 提交者: Gitee

!2703 翻译已完成 2326#I4ZOVF

Merge pull request !2703 from shawn_he/b2326
# Update
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
The Update module applies to updates throughout the entire system, including built-in resources and preset applications, but not third-party applications.
......@@ -30,15 +30,15 @@ Obtains the **Updater** object for local update.
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | -------- |
| Name | Type | Mandatory | Description |
| ----------- | --------------------------- | ---- | ---- |
| upgradeFile | string | Yes | Update file.|
| updateType | [UpdateTypes](#updatetypes) | Yes | Update type.|
**Return Value**
**Return value**
| Type | Description |
| ------------------- | -------- |
| ------------------- | ---- |
| [Updater](#updater) | **Updater** object.|
**Example**
......@@ -61,16 +61,16 @@ Obtains the **Updater** object for the device to be updated.
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | ---------- |
| Name | Type | Mandatory | Description |
| ----------- | --------------------------- | ---- | ----- |
| upgradeFile | string | Yes | Update file. |
| device | string | Yes | Device to be updated.|
| updateType | [UpdateTypes](#updatetypes) | Yes | Update type. |
**Return Value**
**Return value**
| Type | Description |
| ------------------- | -------- |
| ------------------- | ---- |
| [Updater](#updater) | **Updater** object.|
**Example**
......@@ -93,16 +93,16 @@ Obtains the **Updater** object from another device for the device to be updated.
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | ---------- |
| Name | Type | Mandatory | Description |
| ----------- | --------------------------- | ---- | ----- |
| upgradeFile | string | Yes | Update file. |
| device | string | Yes | Device to be updated.|
| updateType | [UpdateTypes](#updatetypes) | Yes | Update type. |
**Return Value**
**Return value**
| Type | Description |
| ------------------- | -------- |
| ------------------- | ---- |
| [Updater](#updater) | **Updater** object.|
**Example**
......@@ -121,15 +121,15 @@ try {
getNewVersionInfo(callback: AsyncCallback\<NewVersionInfo>): void
Obtains the new version information. This API uses an asynchronous callback to return the result.
Obtains the new version information. This function uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Update.UpdateService
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | ------------------ |
| callback | AsyncCallback<[NewVersionInfo](#newversioninfo)> | No | Callback used to return the result.|
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | --------- |
| callback | AsyncCallback<[NewVersionInfo](#newversioninfo)> | No | Callback used to return the new version information.|
**Example**
......@@ -146,15 +146,15 @@ update.getNewVersionInfo(info => {
getNewVersionInfo(): Promise\<NewVersionInfo>
Obtains the new version information. This API uses a promise to return the result.
Obtains the new version information. This function uses a promise to return the result.
**System capability**: SystemCapability.Update.UpdateService
**Return Value**
**Return value**
| Type | Description |
| ------------------------------------------- | ------------------------- |
| Promise\<[NewVersionInfo](#newversioninfo)> | Promise used to return the result.|
| ---------------------------------------- | ---------------- |
| Promise\<[NewVersionInfo](#newversioninfo)> | Promise used to return the new version information.|
**Example**
......@@ -172,15 +172,15 @@ updater.getNewVersionInfo().then(value => {
checkNewVersion(callback: AsyncCallback\<NewVersionInfo>): void
Checks whether the current version is the latest. This API uses an asynchronous callback to return the result.
Checks whether the current version is the latest. This function uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Update.UpdateService
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------- | ---- | ------------------ |
| callback | AsyncCallback\<[NewVersionInfo](#newversioninfo)> | No | Callback used to return the result.|
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | --------- |
| callback | AsyncCallback\<[NewVersionInfo](#newversioninfo)> | No | Callback used to return the new version information.|
**Example**
......@@ -197,15 +197,15 @@ update.checkNewVersion(info => {
checkNewVersion(): Promise\<NewVersionInfo>
Checks whether the current version is the latest. This API uses a promise to return the result.
Checks whether the current version is the latest. This function uses a promise to return the result.
**System capability**: SystemCapability.Update.UpdateService
**Return Value**
**Return value**
| Type | Description |
| ------------------------------------------- | ------------------------- |
| Promise\<[NewVersionInfo](#newversioninfo)> | Promise used to return the result.|
| ---------------------------------------- | ---------------- |
| Promise\<[NewVersionInfo](#newversioninfo)> | Promise used to return the new version information.|
**Example**
......@@ -229,8 +229,8 @@ Verifies whether the update package is valid.
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------------ |
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | --------- |
| upgradeFile | string | Yes | Path of the update package to be verified.|
| certsFile | string | Yes | Certificate path. |
......@@ -247,15 +247,15 @@ update.verifyUpdatePackage("XXX", "XXX");
rebootAndCleanUserData(): Promise\<number>
Reboots the device and clears the user partition data. This API uses a promise to return the result.
Reboots the device and clears the user partition data. This function uses a promise to return the result.
**System capability**: SystemCapability.Update.UpdateService
**Return Value**
**Return value**
| Type | Description |
| ---------------- | ------------------------------- |
| Promise\<number> | Promise used to return the result.|
| ---------------- | ------------------- |
| Promise\<number> | Promise used to return the execution result.|
**Example**
......@@ -271,15 +271,15 @@ update.rebootAndCleanUserData().then(result => {
rebootAndCleanUserData(callback: AsyncCallback\<number>): void
Reboots the device and clears the user partition data. This API uses an asynchronous callback to return the result.
Reboots the device and clears the user partition data. This function uses a promise to return the result.
**System capability**: SystemCapability.Update.UpdateService
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| -------- | -------- | ---- | ---------------------- |
| callback | AsyncCallback\<number>| Yes | Callback used to return the result.|
| callback | AsyncCallback\<number>| Yes | Callback used to return the execution result.|
**Example**
......@@ -293,15 +293,15 @@ update.rebootAndCleanUserData(result => {
applyNewVersion(): Promise\<number>
Installs the update package. This API uses a promise to return the result.
Installs the update package. This function uses a promise to return the result.
**System capability**: SystemCapability.Update.UpdateService
**Return Value**
**Return value**
| Type | Description |
| ---------------- | ------------------------------- |
| Promise\<number> | Promise used to return the result.|
| ---------------- | ------------------- |
| Promise\<number> | Promise used to return the execution result.|
**Example**
......@@ -317,15 +317,15 @@ update.applyNewVersion().then(result => {
applyNewVersion(callback: AsyncCallback\<number>): void
Installs the update package. This API uses an asynchronous callback to return the result.
Installs the update package. This function uses a promise to return the result.
**System capability**: SystemCapability.Update.UpdateService
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory | Description |
| -------- | -------- | ---- | ---------------------- |
| callback | AsyncCallback\<number>| Yes | Callback used to return the result.|
| callback | AsyncCallback\<number>| Yes | Callback used to return the execution result.|
**Example**
......@@ -356,7 +356,7 @@ updater.download();
### upgrade
updater.upgrade():void
upgrade():void
Starts an update.
......@@ -377,16 +377,16 @@ updater.upgrade();
setUpdatePolicy(policy: UpdatePolicy, callback: AsyncCallback\<number>): void
Sets the update policy. This API uses an asynchronous callback to return the result.
Sets the update policy. This function uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Update.UpdateService
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------- | ---- | ------------ |
| Name | Type | Mandatory | Description |
| -------- | ----------------------------- | ---- | ------ |
| policy | [UpdatePolicy](#updatepolicy) | Yes | Update policy to set.|
| callback | AsyncCallback\<number> | Yes | Callback used to return the result.|
| callback | Callback used to return the execution result. | Yes | Callback used to return the execution result.|
**Example**
......@@ -408,21 +408,21 @@ update.setUpdatePolicy(policy, result => {
setUpdatePolicy(policy: UpdatePolicy): Promise\<number>
Sets the update policy. This API uses a promise to return the result.
Sets the update policy. This function uses a promise to return the result.
**System capability**: SystemCapability.Update.UpdateService
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ----------------------------- | ---- | ------------ |
| Name | Type | Mandatory | Description |
| ------ | ----------------------------- | ---- | ------ |
| policy | [UpdatePolicy](#updatepolicy) | Yes | Update policy to set.|
**Return Value**
**Return value**
| Type | Description |
| ---------------- | ----------------------- |
| Promise\<number> | Promise used to return the result.|
| ---------------- | --------------- |
| Promise\<number> | Promise used to return the execution result.|
**Example**
......@@ -445,15 +445,15 @@ update.setUpdatePolicy(policy).then(result =>
getUpdatePolicy(callback: AsyncCallback\<UpdatePolicy>): void
Obtains the update policy. This API uses an asynchronous callback to return the result.
Obtains the update policy. This function uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Update.UpdateService
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------- | ---- | -------------------- |
| callback | AsyncCallback\<[UpdatePolicy](#updatepolicy)> | No | Callback used to return the result.|
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------- |
| callback | AsyncCallback\<[UpdatePolicy](#updatepolicy)> | No | Callback used to return the update policy.|
**Example**
......@@ -470,15 +470,15 @@ update.getUpdatePolicy(policy => {
getUpdatePolicy(): Promise\<UpdatePolicy>
Obtains the update policy. This API uses a promise to return the result.
Obtains the update policy. This function uses a promise to return the result.
**System capability**: SystemCapability.Update.UpdateService
**Return Value**
**Return value**
| Type | Description |
| --------------------------------------- | --------------------------- |
| Promise\<[UpdatePolicy](#updatepolicy)> | Promise used to return the result.|
| --------------------------------------- | ----------------- |
| Promise\<[UpdatePolicy](#updatepolicy)> | Promise used to return the update policy.|
**Example**
......@@ -498,10 +498,10 @@ Enumerates update types.
**System capability**: SystemCapability.Update.UpdateService
| Name| Description |
| ------ | -------- |
| OTA | OTA update. |
| patch | Patch update.|
| Name | Description |
| ----- | ----- |
| OTA | OTA update.|
| patch | Patch update. |
## PackageTypes
......@@ -509,15 +509,15 @@ Enumerates update package types.
**System capability**: SystemCapability.Update.UpdateService
| Name | Default Value| Description |
| -------------------- | ------ | -------------- |
| Name | Default Value | Description |
| -------------------- | ---- | ------- |
| PACKAGE_TYPE_NORMAL | 1 | Common update package. |
| PACKAGE_TYPE_BASE | 2 | Basic update package. |
| PACKAGE_TYPE_CUST | 3 | Custom update package. |
| PACKAGE_TYPE_PRELOAD | 4 | Preinstalled update package. |
| PACKAGE_TYPE_COTA | 5 | Parameter configuration update package.|
| PACKAGE_TYPE_VERSION | 6 | Version update package. |
| PACKAGE_TYPE_PATCH | 7 | Patch packages |
| PACKAGE_TYPE_PATCH | 7 | Patch package. |
## InstallMode
......@@ -525,8 +525,8 @@ Enumerates update modes.
**System capability**: SystemCapability.Update.UpdateService
| Name | Default Value| Description |
| ------------------- | ------ | -------- |
| Name | Default Value | Description |
| ------------------- | ---- | ---- |
| INSTALL_MODE_NORMAL | 0 | Normal update.|
| INSTALL_MODE_NIGHT | 1 | Update at night.|
| INSTALL_MODE_AUTO | 2 | Automatic update.|
......@@ -537,8 +537,8 @@ Enumerates new version check results.
**System capability**: SystemCapability.Update.UpdateService
| Name | Default Value| Description |
| ------------------- | ------ | ---------------- |
| Name | Default Value | Description |
| ------------------- | ---- | -------- |
| VERSION_STATUS_ERR | -1 | System error while checking for the new version. |
| VERSION_STATUS_NEW | 0 | New version detected. |
| VERSION_STATUS_NONE | 1 | No new version detected.|
......@@ -550,10 +550,10 @@ Defines the update policy.
**System capability**: SystemCapability.Update.UpdateService
| Name | Type | Mandatory| Description |
| ------------------- | --------------------------- | ---- | -------------- |
| Name | Type | Mandatory | Description |
| ------------------- | --------------------------- | ---- | ------- |
| autoDownload | bool | Yes | Automatic update switch. |
| installMode | [InstallMode](#installmode) | Yes | Installation mode. |
| installMode | [InstallMode](#installmode) | Yes | Update mode. |
| autoUpgradeInterval | Array\<number> | Yes | Period of time for automatic update.|
## NewVersionInfo
......@@ -562,8 +562,8 @@ Defines the new version information.
**System capability**: SystemCapability.Update.UpdateService
| Name | Type | Mandatory| Description |
| --------------- | ------------------------------------------- | ---- | -------- |
| Name | Type | Mandatory | Description |
| --------------- | ---------------------------------------- | ---- | ---- |
| status | [NewVersionStatus](#newversionstatus) | Yes | Update status.|
| errMsg | string | Yes | Error message.|
| checkResults | Array<[CheckResult](#checkresult)> | Yes | Version check result.|
......@@ -575,8 +575,8 @@ Defines the version check result.
**System capability**: SystemCapability.Update.UpdateService
| Name | Type | Mandatory| Description |
| ------------- | ----------------------------- | ---- | ------------ |
| Name | Type | Mandatory | Description |
| ------------- | ----------------------------- | ---- | ------ |
| versionName | string | Yes | Version name. |
| versionCode | number | Yes | Version code. |
| size | number | Yes | Version size. |
......@@ -590,7 +590,7 @@ Defines the version description information.
**System capability**: SystemCapability.Update.UpdateService
| Name | Type| Mandatory| Description |
| ------------- | -------- | ---- | ----------------- |
| Name | Type | Mandatory | Description |
| ------------- | ------ | ---- | ------------- |
| descriptionId | string | Yes | Version ID information.|
| content | string | Yes | Version changelog information.|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册