• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.update (Update)
2
3The **update** module implements update of the entire system, including built-in resources and preset applications, but not third-party applications.
4
5There are two types of updates: SD card update and over the air (OTA) update.
6
7- The SD card update depends on the update packages and SD cards.
8
9- The OTA update depends on the server deployed by the device manufacturer for managing update packages. The OTA server IP address is passed by the caller. The request interface is fixed and developed by the device manufacturer.
10
11> **NOTE**
12>
13> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
14>
15> The APIs provided by this module are system APIs.
16
17## Modules to Import
18
19```js
20import update from '@ohos.update';
21```
22
23## update.getOnlineUpdater
24
25getOnlineUpdater(upgradeInfo: UpgradeInfo): Updater
26
27Obtains an **OnlineUpdater** object.
28
29**System capability**: SystemCapability.Update.UpdateService
30
31**Parameters**
32
33| Name        | Type                         | Mandatory  | Description    |
34| ----------- | --------------------------- | ---- | ------ |
35| upgradeInfo | [UpgradeInfo](#upgradeinfo) | Yes   | **OnlineUpdater** object information.|
36
37**Return value**
38
39| Type                 | Description  |
40| ------------------- | ---- |
41| [Updater](#updater) | **OnlineUpdater** object.|
42
43**Example**
44
45```ts
46try {
47      const upgradeInfo: update.UpgradeInfo = {
48        upgradeApp: "com.ohos.ota.updateclient",
49        businessType: {
50          vendor: update.BusinessVendor.PUBLIC,
51          subType: update.BusinessSubType.FIRMWARE
52        }
53      };
54      let updater = update.getOnlineUpdater(upgradeInfo);
55    } catch(error) {
56      console.error(`Fail to get updater error: ${error}`);
57    }
58```
59
60## update.getRestorer
61
62getRestorer(): Restorer
63
64Obtains a **Restorer** object for restoring factory settings.
65
66**System capability**: SystemCapability.Update.UpdateService
67
68
69**Return value**
70
71| Type                   | Description    |
72| --------------------- | ------ |
73| [Restorer](#restorer) | **Restorer** object for restoring factory settings.|
74
75
76**Example**
77
78```ts
79try {
80  let restorer = update.getRestorer();
81} catch(error) {
82  console.error(`Fail to get restorer: ${error}`);
83}
84```
85
86## update.getLocalUpdater
87
88getLocalUpdater(): LocalUpdater
89
90Obtains a **LocalUpdater** object.
91
92**System capability**: SystemCapability.Update.UpdateService
93
94**Return value**
95
96| Type                           | Description    |
97| ----------------------------- | ------ |
98| [LocalUpdater](#localupdater) | **LocalUpdater** object.|
99
100
101**Example**
102
103```ts
104try {
105  let localUpdater = update.getLocalUpdater();
106} catch(error) {
107  console.error(`Fail to get localUpdater error: ${error}`);
108};
109```
110
111## Updater
112
113### checkNewVersion
114
115checkNewVersion(callback: AsyncCallback\<CheckResult>): void
116
117Checks whether a new version is available. This API uses an asynchronous callback to return the result.
118
119**System capability**: SystemCapability.Update.UpdateService
120
121**Required permission**: ohos.permission.UPDATE_SYSTEM
122
123**Parameters**
124
125| Name     | Type                                      | Mandatory  | Description            |
126| -------- | ---------------------------------------- | ---- | -------------- |
127| callback | AsyncCallback\<[CheckResult](#checkresult)> | Yes   | Callback used to return the result.|
128
129**Error codes**
130
131For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
132
133| ID      | Error Message                                                 |
134| -------  | ---------------------------------------------------- |
135| 11500104 | IPC error.               |
136
137**Example**
138
139```ts
140import { BusinessError } from '@ohos.base';
141
142updater.checkNewVersion((err: BusinessError, result: update.CheckResult) => {
143      console.log(`checkNewVersion isExistNewVersion  ${result?.isExistNewVersion}`);
144    });
145```
146
147### checkNewVersion
148
149checkNewVersion(): Promise\<CheckResult>
150
151Checks whether a new version is available. This API uses a promise to return the result.
152
153**System capability**: SystemCapability.Update.UpdateService
154
155**Required permission**: ohos.permission.UPDATE_SYSTEM
156
157**Return value**
158
159| Type                                   | Description                 |
160| ------------------------------------- | ------------------- |
161| Promise\<[CheckResult](#checkresult)> | Promise used to return the result.|
162
163**Error codes**
164
165For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
166
167| ID      | Error Message                                                 |
168| -------  | ---------------------------------------------------- |
169| 11500104 | IPC error.               |
170
171**Example**
172
173```ts
174import { BusinessError } from '@ohos.base';
175
176updater.checkNewVersion()
177      .then((result: update.CheckResult) => {
178        console.log(`checkNewVersion isExistNewVersion: ${result.isExistNewVersion}`);
179        // Version digest information
180        console.log(`checkNewVersion versionDigestInfo: ${result.newVersionInfo.versionDigestInfo.versionDigest}`);
181      })
182      .catch((err: BusinessError)=>{
183        console.log(`checkNewVersion promise error ${JSON.stringify(err)}`);
184      })
185```
186
187###  getNewVersionInfo
188
189getNewVersionInfo(callback: AsyncCallback\<NewVersionInfo>): void
190
191Obtains information about the new version. This API uses an asynchronous callback to return the result.
192
193**System capability**: SystemCapability.Update.UpdateService
194
195**Required permission**: ohos.permission.UPDATE_SYSTEM
196
197**Parameters**
198
199| Name     | Type                                      | Mandatory  | Description             |
200| -------- | ---------------------------------------- | ---- | --------------- |
201| callback | AsyncCallback\<[NewVersionInfo](#newversioninfo)> | Yes   | Callback used to return the result.|
202
203**Error codes**
204
205For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
206
207| ID      | Error Message                                                 |
208| -------  | ---------------------------------------------------- |
209| 11500104 | IPC error.               |
210
211**Example**
212
213```ts
214import { BusinessError } from '@ohos.base';
215
216updater.getNewVersionInfo((err: BusinessError, info: update.NewVersionInfo) => {
217      console.log(`info displayVersion = ${info?.versionComponents[0].displayVersion}`);
218      console.log(`info innerVersion = ${info?.versionComponents[0].innerVersion}`);
219});
220```
221
222### getNewVersionInfo
223
224getNewVersionInfo(): Promise\<NewVersionInfo>
225
226Obtains information about the new version. This API uses a promise to return the result.
227
228**System capability**: SystemCapability.Update.UpdateService
229
230**Required permission**: ohos.permission.UPDATE_SYSTEM
231
232**Return value**
233
234| Type                                      | Description                  |
235| ---------------------------------------- | -------------------- |
236| Promise\<[NewVersionInfo](#newversioninfo)> | Promise used to return the result.|
237
238**Error codes**
239
240For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
241
242| ID      | Error Message                                                 |
243| -------  | ---------------------------------------------------- |
244| 11500104 | IPC error.               |
245
246**Example**
247
248```ts
249import { BusinessError } from '@ohos.base';
250
251updater.getNewVersionInfo().then((info: update.NewVersionInfo) => {
252    console.log(`info displayVersion = ${info.versionComponents[0].displayVersion}`);
253    console.log(`info innerVersion = ${info.versionComponents[0].innerVersion}`);
254}).catch((err: BusinessError) => {
255    console.log(`getNewVersionInfo promise error ${JSON.stringify(err)}`);
256});
257```
258
259###  getNewVersionDescription
260
261getNewVersionDescription(versionDigestInfo: VersionDigestInfo, descriptionOptions: DescriptionOptions, callback: AsyncCallback\<Array\<ComponentDescription>>): void
262
263Obtains the description file of the new version. This API uses an asynchronous callback to return the result.
264
265**System capability**: SystemCapability.Update.UpdateService
266
267**Required permission**: ohos.permission.UPDATE_SYSTEM
268
269**Parameters**
270
271| Name               | Type                                      | Mandatory  | Description            |
272| ------------------ | ---------------------------------------- | ---- | -------------- |
273| versionDigestInfo  | [VersionDigestInfo](#versiondigestinfo)  | Yes   | Version digest information.        |
274| descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes   | Options of the description file.       |
275| callback           | AsyncCallback\<Array\<[ComponentDescription](#componentdescription)>> | Yes   | Callback used to return the result.|
276
277**Error codes**
278
279For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
280
281| ID      | Error Message                                                 |
282| -------  | ---------------------------------------------------- |
283| 11500104 | IPC error.               |
284
285**Example**
286
287```ts
288import { BusinessError } from '@ohos.base';
289
290// Version digest information
291const versionDigestInfo: update.VersionDigestInfo = {
292  versionDigest: "versionDigest" // Version digest information in the check result
293};
294
295// Options of the description file
296const descriptionOptions: update.DescriptionOptions = {
297  format: update.DescriptionFormat.STANDARD, // Standard format
298  language: "zh-cn" // Chinese
299};
300
301updater.getNewVersionDescription(versionDigestInfo, descriptionOptions).then((info: Array<update.ComponentDescription>)=> {
302  console.log(`getNewVersionDescription promise info ${JSON.stringify(info)}`);
303}).catch((err: BusinessError) => {
304  console.log(`getNewVersionDescription promise error ${JSON.stringify(err)}`);
305});
306```
307
308### getNewVersionDescription
309
310getNewVersionDescription(versionDigestInfo: VersionDigestInfo, descriptionOptions: DescriptionOptions): Promise\<Array\<ComponentDescription>>;
311
312Obtains the description file of the new version. This API uses a promise to return the result.
313
314**System capability**: SystemCapability.Update.UpdateService
315
316**Required permission**: ohos.permission.UPDATE_SYSTEM
317
318**Parameters**
319
320| Name               | Type                                      | Mandatory  | Description    |
321| ------------------ | ---------------------------------------- | ---- | ------ |
322| versionDigestInfo  | [VersionDigestInfo](#versiondigestinfo)  | Yes   | Version digest information.|
323| descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes   | Options of the description file.|
324
325**Return value**
326
327| Type                                      | Description                 |
328| ---------------------------------------- | ------------------- |
329| Promise\<Array\<[ComponentDescription](#componentdescription)>> | Promise used to return the result.|
330
331**Error codes**
332
333For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
334
335| ID      | Error Message                                                 |
336| -------  | ---------------------------------------------------- |
337| 11500104 | IPC error.               |
338
339**Example**
340
341```ts
342import { BusinessError } from '@ohos.base';
343
344// Version digest information
345const versionDigestInfo: update.VersionDigestInfo = {
346  versionDigest: "versionDigest" // Version digest information in the check result
347};
348
349// Options of the description file
350const descriptionOptions: update.DescriptionOptions = {
351  format: update.DescriptionFormat.STANDARD, // Standard format
352  language: "zh-cn" // Chinese
353};
354
355updater.getNewVersionDescription(versionDigestInfo, descriptionOptions).then((info: Array<update.ComponentDescription>)=> {
356  console.log(`getNewVersionDescription promise info ${JSON.stringify(info)}`);
357}).catch((err: BusinessError) => {
358  console.log(`getNewVersionDescription promise error ${JSON.stringify(err)}`);
359});
360```
361
362###  getCurrentVersionInfo
363
364getCurrentVersionInfo(callback: AsyncCallback\<CurrentVersionInfo>): void
365
366Obtains information about the current version. This API uses an asynchronous callback to return the result.
367
368**System capability**: SystemCapability.Update.UpdateService
369
370**Required permission**: ohos.permission.UPDATE_SYSTEM
371
372**Parameters**
373
374| Name     | Type                                      | Mandatory  | Description              |
375| -------- | ---------------------------------------- | ---- | ---------------- |
376| callback | AsyncCallback\<[CurrentVersionInfo](#currentversioninfo)> | Yes   | Callback used to return the result.|
377
378**Error codes**
379
380For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
381
382| ID      | Error Message                                                 |
383| -------  | ---------------------------------------------------- |
384| 11500104 | IPC error.               |
385
386**Example**
387
388```ts
389import { BusinessError } from '@ohos.base';
390
391updater.getCurrentVersionInfo((err: BusinessError, info: update.CurrentVersionInfo) => {
392  console.log(`info osVersion = ${info?.osVersion}`);
393  console.log(`info deviceName = ${info?.deviceName}`);
394  console.log(`info displayVersion = ${info?.versionComponents[0].displayVersion}`);
395});
396```
397
398### getCurrentVersionInfo
399
400getCurrentVersionInfo(): Promise\<CurrentVersionInfo>
401
402Obtains information about the current version. This API uses a promise to return the result.
403
404**System capability**: SystemCapability.Update.UpdateService
405
406**Required permission**: ohos.permission.UPDATE_SYSTEM
407
408**Return value**
409
410| Type                                      | Description                 |
411| ---------------------------------------- | ------------------- |
412| Promise\<[CurrentVersionInfo](#currentversioninfo)> | Promise used to return the result.|
413
414**Error codes**
415
416For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
417
418| ID      | Error Message                                                 |
419| -------  | ---------------------------------------------------- |
420| 11500104 | IPC error.               |
421
422**Example**
423
424```ts
425import { BusinessError } from '@ohos.base';
426
427updater.getCurrentVersionInfo().then((info: update.CurrentVersionInfo) => {
428  console.log(`info osVersion = ${info.osVersion}`);
429  console.log(`info deviceName = ${info.deviceName}`);
430  console.log(`info displayVersion = ${info.versionComponents[0].displayVersion}`);
431}).catch((err: BusinessError) => {
432  console.log(`getCurrentVersionInfo promise error ${JSON.stringify(err)}`);
433});
434```
435
436###  getCurrentVersionDescription
437
438getCurrentVersionDescription(descriptionOptions: DescriptionOptions, callback: AsyncCallback\<Array\<ComponentDescription>>): void
439
440Obtains the description file of the current version. This API uses an asynchronous callback to return the result.
441
442**System capability**: SystemCapability.Update.UpdateService
443
444**Required permission**: ohos.permission.UPDATE_SYSTEM
445
446**Parameters**
447
448| Name               | Type                                      | Mandatory  | Description             |
449| ------------------ | ---------------------------------------- | ---- | --------------- |
450| descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes   | Options of the description file.         |
451| callback           | AsyncCallback\<Array\<[ComponentDescription](#componentdescription)>> | Yes   | Callback used to return the result.|
452
453**Error codes**
454
455For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
456
457| ID      | Error Message                                                 |
458| -------  | ---------------------------------------------------- |
459| 11500104 | IPC error.               |
460
461**Example**
462
463```ts
464// Options of the description file
465const descriptionOptions: update.DescriptionOptions = {
466  format: update.DescriptionFormat.STANDARD, // Standard format
467  language: "zh-cn" // Chinese
468};
469
470updater.getCurrentVersionDescription(descriptionOptions, (err, info) => {
471  console.log(`getCurrentVersionDescription info ${JSON.stringify(info)}`);
472  console.log(`getCurrentVersionDescription err ${JSON.stringify(err)}`);
473});
474```
475
476### getCurrentVersionDescription
477
478getCurrentVersionDescription(descriptionOptions: DescriptionOptions): Promise\<Array\<ComponentDescription>>
479
480Obtains the description file of the current version. This API uses a promise to return the result.
481
482**System capability**: SystemCapability.Update.UpdateService
483
484**Required permission**: ohos.permission.UPDATE_SYSTEM
485
486**Parameters**
487
488| Name               | Type                                      | Mandatory  | Description    |
489| ------------------ | ---------------------------------------- | ---- | ------ |
490| descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes   | Options of the description file.|
491
492**Return value**
493
494| Type                                      | Description                  |
495| ---------------------------------------- | -------------------- |
496| Promise\<Array\<[ComponentDescription](#componentdescription)>> | Promise used to return the result.|
497
498**Error codes**
499
500For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
501
502| ID      | Error Message                                                 |
503| -------  | ---------------------------------------------------- |
504| 11500104 | IPC error.               |
505
506**Example**
507
508```ts
509import { BusinessError } from '@ohos.base';
510
511// Options of the description file
512const descriptionOptions: update.DescriptionOptions = {
513  format: update.DescriptionFormat.STANDARD, // Standard format
514  language: "zh-cn" // Chinese
515};
516updater.getCurrentVersionDescription(descriptionOptions).then((info: Array<update.ComponentDescription>) => {
517  console.log(`getCurrentVersionDescription promise info ${JSON.stringify(info)}`);
518}).catch((err: BusinessError) => {
519  console.log(`getCurrentVersionDescription promise error ${JSON.stringify(err)}`);
520});
521```
522
523###  getTaskInfo
524
525getTaskInfo(callback: AsyncCallback\<TaskInfo>): void
526
527Obtains information about the update task. This API uses an asynchronous callback to return the result.
528
529**System capability**: SystemCapability.Update.UpdateService
530
531**Required permission**: ohos.permission.UPDATE_SYSTEM
532
533**Parameters**
534
535| Name     | Type                                   | Mandatory  | Description              |
536| -------- | ------------------------------------- | ---- | ---------------- |
537| callback | AsyncCallback\<[TaskInfo](#taskinfo)> | Yes   | Callback used to return the result.|
538
539**Error codes**
540
541For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
542
543| ID      | Error Message                                                 |
544| -------  | ---------------------------------------------------- |
545| 11500104 | IPC error.               |
546
547**Example**
548
549```ts
550import { BusinessError } from '@ohos.base';
551
552updater.getTaskInfo((err: BusinessError, info: update.TaskInfo) => {
553  console.log(`getTaskInfo isexistTask= ${info?.existTask}`);
554});
555```
556
557### getTaskInfo
558
559getTaskInfo(): Promise\<TaskInfo>
560
561Obtains information about the update task. This API uses a promise to return the result.
562
563**System capability**: SystemCapability.Update.UpdateService
564
565**Required permission**: ohos.permission.UPDATE_SYSTEM
566
567**Return value**
568
569| Type                             | Description                 |
570| ------------------------------- | ------------------- |
571| Promise\<[TaskInfo](#taskinfo)> | Promise used to return the result.|
572
573**Error codes**
574
575For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
576
577| ID      | Error Message                                                 |
578| -------  | ---------------------------------------------------- |
579| 11500104 | IPC error.               |
580
581**Example**
582
583```ts
584import { BusinessError } from '@ohos.base';
585
586updater.getTaskInfo().then((info: update.TaskInfo) => {
587  console.log(`getTaskInfo isexistTask= ${info.existTask}`);
588}).catch((err: BusinessError) => {
589  console.log(`getTaskInfo promise error ${JSON.stringify(err)}`);
590});
591```
592
593###  download
594
595download(versionDigestInfo: VersionDigestInfo, downloadOptions: DownloadOptions, callback: AsyncCallback\<void>): void
596
597Downloads the new version. This API uses an asynchronous callback to return the result.
598
599**System capability**: SystemCapability.Update.UpdateService
600
601**Required permission**: ohos.permission.UPDATE_SYSTEM
602
603**Parameters**
604
605| Name              | Type                                     | Mandatory  | Description                                |
606| ----------------- | --------------------------------------- | ---- | ---------------------------------- |
607| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes   | Version digest information.                            |
608| downloadOptions   | [DownloadOptions](#downloadoptions)     | Yes   | Download options.                              |
609| callback          | AsyncCallback\<void>                    | Yes   | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
610
611**Error codes**
612
613For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
614
615| ID      | Error Message                                                 |
616| -------  | ---------------------------------------------------- |
617| 11500104 | IPC error.               |
618
619**Example**
620
621```ts
622import { BusinessError } from '@ohos.base';
623
624// Version digest information
625const versionDigestInfo: update.VersionDigestInfo = {
626  versionDigest: "versionDigest" // Version digest information in the check result
627};
628
629// Download options
630const downloadOptions: update.DownloadOptions = {
631  allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network
632  order: update.Order.DOWNLOAD // Download
633};
634updater.download(versionDigestInfo, downloadOptions, (err: BusinessError) => {
635  console.log(`download error ${JSON.stringify(err)}`);
636});
637```
638
639### download
640
641download(versionDigestInfo: VersionDigestInfo, downloadOptions: DownloadOptions): Promise\<void>
642
643Downloads the new version. This API uses a promise to return the result.
644
645**System capability**: SystemCapability.Update.UpdateService
646
647**Required permission**: ohos.permission.UPDATE_SYSTEM
648
649**Parameters**
650
651| Name              | Type                                     | Mandatory  | Description    |
652| ----------------- | --------------------------------------- | ---- | ------ |
653| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes   | Version digest information.|
654| downloadOptions   | [DownloadOptions](#downloadoptions)     | Yes   | Download options.  |
655
656**Return value**
657
658| Type            | Description                        |
659| -------------- | -------------------------- |
660| Promise\<void> | Promise that returns no value.|
661
662**Error codes**
663
664For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
665
666| ID      | Error Message                                                 |
667| -------  | ---------------------------------------------------- |
668| 11500104 | IPC error.               |
669
670**Example**
671
672```ts
673import { BusinessError } from '@ohos.base';
674
675// Version digest information
676const versionDigestInfo: update.VersionDigestInfo = {
677  versionDigest: "versionDigest" // Version digest information in the check result
678};
679
680// Download options
681const downloadOptions: update.DownloadOptions = {
682  allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network
683   order: update.Order.DOWNLOAD // Download
684};
685updater.download(versionDigestInfo, downloadOptions).then(() => {
686  console.log(`download start`);
687}).catch((err: BusinessError) => {
688  console.log(`download error ${JSON.stringify(err)}`);
689});
690```
691
692###  resumeDownload
693
694resumeDownload(versionDigestInfo: VersionDigestInfo, resumeDownloadOptions: ResumeDownloadOptions, callback: AsyncCallback\<void>): void
695
696Resumes download of the new version. This API uses an asynchronous callback to return the result.
697
698**System capability**: SystemCapability.Update.UpdateService
699
700**Required permission**: ohos.permission.UPDATE_SYSTEM
701
702**Parameters**
703
704| Name                  | Type                                      | Mandatory  | Description                                  |
705| --------------------- | ---------------------------------------- | ---- | ------------------------------------ |
706| versionDigestInfo     | [VersionDigestInfo](#versiondigestinfo)  | Yes   | Version digest information.                              |
707| resumeDownloadOptions | [ResumeDownloadOptions](#resumedownloadoptions) | Yes   | Options for resuming download.                              |
708| callback              | AsyncCallback\<void>                     | Yes   | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
709
710**Error codes**
711
712For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
713
714| ID      | Error Message                                                 |
715| -------  | ---------------------------------------------------- |
716| 11500104 | IPC error.               |
717
718**Example**
719
720```ts
721import { BusinessError } from '@ohos.base';
722
723// Version digest information
724const versionDigestInfo : update.VersionDigestInfo= {
725  versionDigest: "versionDigest" // Version digest information in the check result
726};
727
728// Options for resuming download
729const resumeDownloadOptions : update.ResumeDownloadOptions= {
730  allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network
731};
732updater.resumeDownload(versionDigestInfo, resumeDownloadOptions, (err: BusinessError) => {
733  console.log(`resumeDownload error ${JSON.stringify(err)}`);
734});
735```
736
737### resumeDownload
738
739resumeDownload(versionDigestInfo: VersionDigestInfo, resumeDownloadOptions: ResumeDownloadOptions): Promise\<void>
740
741Resumes download of the new version. This API uses a promise to return the result.
742
743**System capability**: SystemCapability.Update.UpdateService
744
745**Required permission**: ohos.permission.UPDATE_SYSTEM
746
747**Parameters**
748
749| Name                  | Type                                      | Mandatory  | Description    |
750| --------------------- | ---------------------------------------- | ---- | ------ |
751| versionDigestInfo     | [VersionDigestInfo](#versiondigestinfo)  | Yes   | Version digest information.|
752| resumeDownloadOptions | [ResumeDownloadOptions](#resumedownloadoptions) | Yes   | Options for resuming download.|
753
754**Return value**
755
756| Type            | Description                        |
757| -------------- | -------------------------- |
758| Promise\<void> | Promise that returns no value.|
759
760**Error codes**
761
762For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
763
764| ID      | Error Message                                                 |
765| -------  | ---------------------------------------------------- |
766| 11500104 | IPC error.               |
767
768**Example**
769
770```ts
771import { BusinessError } from '@ohos.base';
772
773// Version digest information
774const versionDigestInfo: update.VersionDigestInfo = {
775  versionDigest: "versionDigest" // Version digest information in the check result
776};
777
778// Options for resuming download
779const resumeDownloadOptions: update.ResumeDownloadOptions = {
780  allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network
781};
782updater.resumeDownload(versionDigestInfo, resumeDownloadOptions).then(() => {
783  console.log(`resumeDownload start`);
784}).catch((err: BusinessError) => {
785  console.log(`resumeDownload error ${JSON.stringify(err)}`);
786});
787```
788
789###  pauseDownload
790
791pauseDownload(versionDigestInfo: VersionDigestInfo, pauseDownloadOptions: PauseDownloadOptions, callback: AsyncCallback\<void>): void
792
793Pauses download of the new version. This API uses an asynchronous callback to return the result.
794
795**System capability**: SystemCapability.Update.UpdateService
796
797**Required permission**: ohos.permission.UPDATE_SYSTEM
798
799**Parameters**
800
801| Name                 | Type                                      | Mandatory  | Description                                  |
802| -------------------- | ---------------------------------------- | ---- | ------------------------------------ |
803| versionDigestInfo    | [VersionDigestInfo](#versiondigestinfo)  | Yes   | Version digest information.                              |
804| pauseDownloadOptions | [PauseDownloadOptions](#pausedownloadoptions) | Yes   | Options for pausing download.                              |
805| callback             | AsyncCallback\<void>                     | Yes   | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
806
807**Error codes**
808
809For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
810
811| ID      | Error Message                                                 |
812| -------  | ---------------------------------------------------- |
813| 11500104 | IPC error.               |
814
815**Example**
816
817```ts
818import { BusinessError } from '@ohos.base';
819
820// Version digest information
821const versionDigestInfo: update.VersionDigestInfo = {
822  versionDigest: "versionDigest" // Version digest information in the check result
823};
824
825// Options for pausing download
826const pauseDownloadOptions: update.PauseDownloadOptions = {
827  isAllowAutoResume: true // Whether to allow automatic resuming of download
828};
829updater.pauseDownload(versionDigestInfo, pauseDownloadOptions, (err: BusinessError) => {
830  console.log(`pauseDownload error ${JSON.stringify(err)}`);
831});
832```
833
834### pauseDownload
835
836pauseDownload(versionDigestInfo: VersionDigestInfo, pauseDownloadOptions: PauseDownloadOptions): Promise\<void>
837
838Resumes download of the new version. This API uses a promise to return the result.
839
840**System capability**: SystemCapability.Update.UpdateService
841
842**Required permission**: ohos.permission.UPDATE_SYSTEM
843
844**Parameters**
845
846| Name                 | Type                                      | Mandatory  | Description    |
847| -------------------- | ---------------------------------------- | ---- | ------ |
848| versionDigestInfo    | [VersionDigestInfo](#versiondigestinfo)  | Yes   | Version digest information.|
849| pauseDownloadOptions | [PauseDownloadOptions](#pausedownloadoptions) | Yes   | Options for pausing download.|
850
851**Return value**
852
853| Type            | Description                        |
854| -------------- | -------------------------- |
855| Promise\<void> | Promise that returns no value.|
856
857**Error codes**
858
859For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
860
861| ID      | Error Message                                                 |
862| -------  | ---------------------------------------------------- |
863| 11500104 | IPC error.               |
864
865**Example**
866
867```ts
868import { BusinessError } from '@ohos.base';
869
870// Version digest information
871const versionDigestInfo: update.VersionDigestInfo = {
872  versionDigest: "versionDigest" // Version digest information in the check result
873};
874
875// Options for pausing download
876const pauseDownloadOptions: update.PauseDownloadOptions = {
877  isAllowAutoResume: true // Whether to allow automatic resuming of download
878};
879updater.pauseDownload(versionDigestInfo, pauseDownloadOptions).then(() => {
880  console.log(`pauseDownload`);
881}).catch((err: BusinessError)  => {
882  console.log(`pauseDownload error ${JSON.stringify(err)}`);
883});
884```
885
886###  upgrade
887
888upgrade(versionDigestInfo: VersionDigestInfo, upgradeOptions: UpgradeOptions, callback: AsyncCallback\<void>): void
889
890Updates the version. This API uses an asynchronous callback to return the result.
891
892**System capability**: SystemCapability.Update.UpdateService
893
894**Required permission**: ohos.permission.UPDATE_SYSTEM
895
896**Parameters**
897
898| Name              | Type                                     | Mandatory  | Description                                  |
899| ----------------- | --------------------------------------- | ---- | ------------------------------------ |
900| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes   | Version digest information.                              |
901| upgradeOptions    | [UpgradeOptions](#upgradeoptions)       | Yes   | Update options.                                |
902| callback          | AsyncCallback\<void>                    | Yes   | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
903
904**Error codes**
905
906For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
907
908| ID      | Error Message                                                 |
909| -------  | ---------------------------------------------------- |
910| 11500104 | IPC error.               |
911
912**Example**
913
914```ts
915import { BusinessError } from '@ohos.base';
916
917// Version digest information
918const versionDigestInfo: update.VersionDigestInfo = {
919  versionDigest: "versionDigest" // Version digest information in the check result
920};
921
922// Installation options
923const upgradeOptions: update.UpgradeOptions = {
924  order: update.Order.INSTALL // Installation command
925};
926updater.upgrade(versionDigestInfo, upgradeOptions, (err: BusinessError) => {
927  console.log(`upgrade error ${JSON.stringify(err)}`);
928});
929```
930
931### upgrade
932
933upgrade(versionDigestInfo: VersionDigestInfo, upgradeOptions: UpgradeOptions): Promise\<void>
934
935Updates the version. This API uses a promise to return the result.
936
937**System capability**: SystemCapability.Update.UpdateService
938
939**Required permission**: ohos.permission.UPDATE_SYSTEM
940
941**Parameters**
942
943| Name              | Type                                     | Mandatory  | Description    |
944| ----------------- | --------------------------------------- | ---- | ------ |
945| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes   | Version digest information.|
946| upgradeOptions    | [UpgradeOptions](#upgradeoptions)       | Yes   | Update options.  |
947
948**Return value**
949
950| Type            | Description                        |
951| -------------- | -------------------------- |
952| Promise\<void> | Promise that returns no value.|
953
954**Error codes**
955
956For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
957
958| ID      | Error Message                                                 |
959| -------  | ---------------------------------------------------- |
960| 11500104 | IPC error.               |
961
962**Example**
963
964```ts
965import { BusinessError } from '@ohos.base';
966
967// Version digest information
968const versionDigestInfo: update.VersionDigestInfo = {
969  versionDigest: "versionDigest" // Version digest information in the check result
970};
971
972// Installation options
973const upgradeOptions: update.UpgradeOptions = {
974  order: update.Order.INSTALL // Installation command
975};
976updater.upgrade(versionDigestInfo, upgradeOptions).then(() => {
977  console.log(`upgrade start`);
978}).catch((err: BusinessError) => {
979  console.log(`upgrade error ${JSON.stringify(err)}`);
980});
981```
982
983###  clearError
984
985clearError(versionDigestInfo: VersionDigestInfo, clearOptions: ClearOptions, callback: AsyncCallback\<void>): void
986
987Clears errors. This API uses an asynchronous callback to return the result.
988
989**System capability**: SystemCapability.Update.UpdateService
990
991**Required permission**: ohos.permission.UPDATE_SYSTEM
992
993**Parameters**
994
995| Name              | Type                                     | Mandatory  | Description                                  |
996| ----------------- | --------------------------------------- | ---- | ------------------------------------ |
997| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes   | Version digest information.                              |
998| clearOptions      | [ClearOptions](#clearoptions)           | Yes   | Clear options.                                |
999| callback          | AsyncCallback\<void>                    | Yes   | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
1000
1001**Error codes**
1002
1003For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
1004
1005| ID      | Error Message                                                 |
1006| -------  | ---------------------------------------------------- |
1007| 11500104 | IPC error.               |
1008
1009**Example**
1010
1011```ts
1012import { BusinessError } from '@ohos.base';
1013
1014// Version digest information
1015const versionDigestInfo: update.VersionDigestInfo = {
1016  versionDigest: "versionDigest" // Version digest information in the check result
1017};
1018
1019// Options for clearing errors
1020const clearOptions: update.ClearOptions = {
1021  status: update.UpgradeStatus.UPGRADE_FAIL,
1022};
1023updater.clearError(versionDigestInfo, clearOptions, (err: BusinessError) => {
1024  console.log(`clearError error ${JSON.stringify(err)}`);
1025});
1026```
1027
1028### clearError
1029
1030clearError(versionDigestInfo: VersionDigestInfo, clearOptions: ClearOptions): Promise\<void>
1031
1032Clears errors. This API uses a promise to return the result.
1033
1034**System capability**: SystemCapability.Update.UpdateService
1035
1036**Required permission**: ohos.permission.UPDATE_SYSTEM
1037
1038**Parameters**
1039
1040| Name              | Type                                     | Mandatory  | Description    |
1041| ----------------- | --------------------------------------- | ---- | ------ |
1042| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes   | Version digest information.|
1043| clearOptions      | [ClearOptions](#clearoptions)           | Yes   | Update options.  |
1044
1045**Return value**
1046
1047| Type            | Description                        |
1048| -------------- | -------------------------- |
1049| Promise\<void> | Promise that returns no value.|
1050
1051**Error codes**
1052
1053For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
1054
1055| ID      | Error Message                                                 |
1056| -------  | ---------------------------------------------------- |
1057| 11500104 | IPC error.               |
1058
1059**Example**
1060
1061```ts
1062import { BusinessError } from '@ohos.base';
1063
1064// Version digest information
1065const versionDigestInfo: update.VersionDigestInfo = {
1066  versionDigest: "versionDigest" // Version digest information in the check result
1067};
1068
1069// Options for clearing errors
1070const clearOptions: update.ClearOptions = {
1071  status: update.UpgradeStatus.UPGRADE_FAIL,
1072};
1073updater.clearError(versionDigestInfo, clearOptions).then(() => {
1074  console.log(`clearError success`);
1075}).catch((err: BusinessError) => {
1076  console.log(`clearError error ${JSON.stringify(err)}`);
1077});
1078```
1079
1080### getUpgradePolicy
1081
1082getUpgradePolicy(callback: AsyncCallback\<UpgradePolicy>): void
1083
1084Obtains the update policy. This API uses an asynchronous callback to return the result.
1085
1086**System capability**: SystemCapability.Update.UpdateService
1087
1088**Required permission**: ohos.permission.UPDATE_SYSTEM
1089
1090**Parameters**
1091
1092| Name     | Type                                      | Mandatory  | Description             |
1093| -------- | ---------------------------------------- | ---- | --------------- |
1094| callback | AsyncCallback\<[UpgradePolicy](#upgradepolicy)> | Yes   | Callback used to return the result.|
1095
1096**Error codes**
1097
1098For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
1099
1100| ID      | Error Message                                                 |
1101| -------  | ---------------------------------------------------- |
1102| 11500104 | IPC error.               |
1103
1104**Example**
1105
1106```ts
1107import { BusinessError } from '@ohos.base';
1108
1109updater.getUpgradePolicy(err: BusinessError, policy: update.UpgradePolicy) => {
1110  console.log(`policy downloadStrategy = ${policy?.downloadStrategy}`);
1111  console.log(`policy autoUpgradeStrategy = ${policy?.autoUpgradeStrategy}`);
1112});
1113```
1114
1115### getUpgradePolicy
1116
1117getUpgradePolicy(): Promise\<UpgradePolicy>
1118
1119Obtains the update policy. This API uses a promise to return the result.
1120
1121**System capability**: SystemCapability.Update.UpdateService
1122
1123**Required permission**: ohos.permission.UPDATE_SYSTEM
1124
1125**Return value**
1126
1127| Type                                      | Description                   |
1128| ---------------------------------------- | --------------------- |
1129| Promise\<[UpgradePolicy](#upgradepolicy)> | Promise used to return the result.|
1130
1131**Error codes**
1132
1133For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
1134
1135| ID      | Error Message                                                 |
1136| -------  | ---------------------------------------------------- |
1137| 11500104 | IPC error.               |
1138
1139**Example**
1140
1141```ts
1142import { BusinessError } from '@ohos.base';
1143
1144updater.getUpgradePolicy().then((policy: update.UpgradePolicy) => {
1145  console.log(`policy downloadStrategy = ${policy.downloadStrategy}`);
1146  console.log(`policy autoUpgradeStrategy = ${policy.autoUpgradeStrategy}`);
1147}).catch((err: BusinessError)  => {
1148  console.log(`getUpgradePolicy promise error ${JSON.stringify(err)}`);
1149});
1150```
1151
1152### setUpgradePolicy
1153
1154setUpgradePolicy(policy: UpgradePolicy, callback: AsyncCallback\<void>): void
1155
1156Sets the update policy. This API uses an asynchronous callback to return the result.
1157
1158**System capability**: SystemCapability.Update.UpdateService
1159
1160**Required permission**: ohos.permission.UPDATE_SYSTEM
1161
1162**Parameters**
1163
1164| Name     | Type                             | Mandatory  | Description           |
1165| -------- | ------------------------------- | ---- | ------------- |
1166| policy   | [UpgradePolicy](#upgradepolicy) | Yes   | Update policy.         |
1167| callback | AsyncCallback\<void>            | Yes   | Callback used to return the result.|
1168
1169**Error codes**
1170
1171For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
1172
1173| ID      | Error Message                                                 |
1174| -------  | ---------------------------------------------------- |
1175| 11500104 | IPC error.               |
1176
1177**Example**
1178
1179```ts
1180import { BusinessError } from '@ohos.base';
1181
1182const policy: update.UpgradePolicy = {
1183  downloadStrategy: false,
1184  autoUpgradeStrategy: false,
1185  autoUpgradePeriods: [ { start: 120, end: 240 }] // Automatic update period, in minutes
1186};
1187updater.setUpgradePolicy(policy, (err: BusinessError) => {
1188  console.log(`setUpgradePolicy result: ${err}`);
1189});
1190```
1191
1192### setUpgradePolicy
1193
1194setUpgradePolicy(policy: UpgradePolicy): Promise\<void>
1195
1196Sets the update policy. This API uses a promise to return the result.
1197
1198**System capability**: SystemCapability.Update.UpdateService
1199
1200**Required permission**: ohos.permission.UPDATE_SYSTEM
1201
1202**Parameters**
1203
1204| Name   | Type                             | Mandatory  | Description  |
1205| ------ | ------------------------------- | ---- | ---- |
1206| policy | [UpgradePolicy](#upgradepolicy) | Yes   | Update policy.|
1207
1208**Return value**
1209
1210| Type            | Description                 |
1211| -------------- | ------------------- |
1212| Promise\<void> | Promise that returns no value.|
1213
1214**Error codes**
1215
1216For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
1217
1218| ID      | Error Message                                                 |
1219| -------  | ---------------------------------------------------- |
1220| 11500104 | IPC error.               |
1221
1222**Example**
1223
1224```ts
1225import { BusinessError } from '@ohos.base';
1226
1227const policy: update.UpgradePolicy = {
1228  downloadStrategy: false,
1229  autoUpgradeStrategy: false,
1230  autoUpgradePeriods: [ { start: 120, end: 240 }] // Automatic update period, in minutes
1231};
1232updater.setUpgradePolicy(policy).then(() => {
1233  console.log(`setUpgradePolicy success`);
1234}).catch((err: BusinessError) => {
1235  console.log(`setUpgradePolicy promise error ${JSON.stringify(err)}`);
1236});
1237```
1238
1239###  terminateUpgrade
1240
1241terminateUpgrade(callback: AsyncCallback\<void>): void
1242
1243Terminates the update. This API uses an asynchronous callback to return the result.
1244
1245**System capability**: SystemCapability.Update.UpdateService
1246
1247**Required permission**: ohos.permission.UPDATE_SYSTEM
1248
1249**Parameters**
1250
1251| Name     | Type                  | Mandatory  | Description                                    |
1252| -------- | -------------------- | ---- | -------------------------------------- |
1253| callback | AsyncCallback\<void> | Yes   | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
1254
1255**Error codes**
1256
1257For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
1258
1259| ID      | Error Message                                                 |
1260| -------  | ---------------------------------------------------- |
1261| 11500104 | IPC error.               |
1262
1263**Example**
1264
1265```ts
1266import { BusinessError } from '@ohos.base';
1267
1268updater.terminateUpgrade((err: BusinessError) => {
1269  console.log(`terminateUpgrade error ${JSON.stringify(err)}`);
1270});
1271```
1272
1273### terminateUpgrade
1274
1275terminateUpgrade(): Promise\<void>
1276
1277Terminates the update. This API uses a promise to return the result.
1278
1279**System capability**: SystemCapability.Update.UpdateService
1280
1281**Required permission**: ohos.permission.UPDATE_SYSTEM
1282
1283**Return value**
1284
1285| Type            | Description                        |
1286| -------------- | -------------------------- |
1287| Promise\<void> | Promise that returns no value.|
1288
1289**Error codes**
1290
1291For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
1292
1293| ID      | Error Message                                                 |
1294| -------  | ---------------------------------------------------- |
1295| 11500104 | IPC error.               |
1296
1297**Example**
1298
1299```ts
1300import { BusinessError } from '@ohos.base';
1301
1302updater.terminateUpgrade().then(() => {
1303  console.log(`terminateUpgrade success`);
1304}).catch((err: BusinessError) => {
1305  console.log(`terminateUpgrade error ${JSON.stringify(err)}`);
1306});
1307```
1308
1309
1310### on
1311on(eventClassifyInfo: EventClassifyInfo, taskCallback: UpgradeTaskCallback): void
1312
1313Enables listening for update events. This API uses an asynchronous callback to return the result.
1314
1315**System capability**: SystemCapability.Update.UpdateService
1316
1317**Parameters**
1318
1319| Name              | Type                                      | Mandatory  | Description  |
1320| ----------------- | ---------------------------------------- | ---- | ---- |
1321| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo)  | Yes   | Event information.|
1322| taskCallback      | [UpgradeTaskCallback](#upgradetaskcallback) | Yes   | Event callback.|
1323
1324
1325**Example**
1326
1327```ts
1328const eventClassifyInfo: update.EventClassifyInfo = {
1329  eventClassify: update.EventClassify.TASK, // Listening for update events
1330  extraInfo: ""
1331};
1332
1333updater.on(eventClassifyInfo, (eventInfo: update.EventInfo) => {
1334  console.log("updater on " + JSON.stringify(eventInfo));
1335});
1336```
1337
1338### off
1339off(eventClassifyInfo: EventClassifyInfo, taskCallback?: UpgradeTaskCallback): void
1340
1341Disables listening for update events. This API uses an asynchronous callback to return the result.
1342
1343**System capability**: SystemCapability.Update.UpdateService
1344
1345**Parameters**
1346
1347| Name              | Type                                      | Mandatory  | Description  |
1348| ----------------- | ---------------------------------------- | ---- | ---- |
1349| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo)  | Yes   | Event information.|
1350| taskCallback      | [UpgradeTaskCallback](#upgradetaskcallback) | No   | Event callback.|
1351
1352
1353**Example**
1354
1355```ts
1356const eventClassifyInfo: update.EventClassifyInfo = {
1357  eventClassify: update.EventClassify.TASK, // Listening for update events
1358  extraInfo: ""
1359};
1360
1361updater.off(eventClassifyInfo, (eventInfo: update.EventInfo) => {
1362  console.log("updater off " + JSON.stringify(eventInfo));
1363});
1364```
1365
1366## Restorer
1367
1368### factoryReset
1369
1370factoryReset(callback: AsyncCallback\<void>): void
1371
1372Restores the scale to its factory settings. This API uses an asynchronous callback to return the result.
1373
1374**System capability**: SystemCapability.Update.UpdateService
1375
1376**Required permission**: ohos.permission.FACTORY_RESET
1377
1378**Parameters**
1379
1380| Name     | Type                  | Mandatory  | Description                                    |
1381| -------- | -------------------- | ---- | -------------------------------------- |
1382| callback | AsyncCallback\<void> | Yes   | Callback used to return the result. If the operation fails, **err** is an error object and a callback is returned. If the the operation is successful, **err** is undefined and no callback is returned.|
1383
1384**Error codes**
1385
1386For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
1387
1388| ID      | Error Message                                                 |
1389| -------  | ---------------------------------------------------- |
1390| 11500104 | IPC error.               |
1391
1392**Example**
1393
1394```ts
1395restorer.factoryReset((err) => {
1396  console.log(`factoryReset error ${JSON.stringify(err)}`);
1397});
1398```
1399
1400### factoryReset
1401
1402factoryReset(): Promise\<void>
1403
1404Restores the scale to its factory settings. This API uses a promise to return the result.
1405
1406**System capability**: SystemCapability.Update.UpdateService
1407
1408**Required permission**: ohos.permission.FACTORY_RESET
1409
1410**Return value**
1411
1412| Type            | Description                        |
1413| -------------- | -------------------------- |
1414| Promise\<void> | Promise that returns no value. If the operation fails, a callback is returned. If the the operation is successful, no callback is returned.|
1415
1416**Error codes**
1417
1418For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
1419
1420| ID      | Error Message                                                 |
1421| -------  | ---------------------------------------------------- |
1422| 11500104 | IPC error.               |
1423
1424**Example**
1425
1426```ts
1427import { BusinessError } from '@ohos.base';
1428
1429restorer.factoryReset().then(() => {
1430  console.log(`factoryReset success`);
1431}).catch((err: BusinessError) => {
1432  console.log(`factoryReset error ${JSON.stringify(err)}`);
1433});
1434```
1435
1436## LocalUpdater
1437
1438### verifyUpgradePackage
1439
1440verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string, callback: AsyncCallback\<void>): void
1441
1442Verifies the update package. This API uses an asynchronous callback to return the result.
1443
1444**System capability**: SystemCapability.Update.UpdateService
1445
1446**Required permission**: ohos.permission.UPDATE_SYSTEM
1447
1448**Parameters**
1449
1450| Name        | Type                         | Mandatory  | Description              |
1451| ----------- | --------------------------- | ---- | ---------------- |
1452| upgradeFile | [UpgradeFile](#upgradefile) | Yes   | Update file.            |
1453| certsFile   | string                      | Yes   | Path of the certificate file.          |
1454| callback    | AsyncCallback\<void>        | Yes   | Callback used to return the result.|
1455
1456**Error codes**
1457
1458For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
1459
1460| ID      | Error Message                                                 |
1461| -------  | ---------------------------------------------------- |
1462| 11500104 | IPC error.               |
1463
1464**Example**
1465
1466```ts
1467const upgradeFile: update.UpgradeFile = {
1468  fileType: update.ComponentType.OTA, // OTA package
1469  filePath: "path" // Path of the local update package
1470};
1471
1472localUpdater.verifyUpgradePackage(upgradeFile, "cerstFilePath", (err) => {
1473  console.log(`factoryReset error ${JSON.stringify(err)}`);
1474});
1475```
1476
1477### verifyUpgradePackage
1478
1479verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string): Promise\<void>
1480
1481Verifies the update package. This API uses a promise to return the result.
1482
1483**System capability**: SystemCapability.Update.UpdateService
1484
1485**Required permission**: ohos.permission.UPDATE_SYSTEM
1486
1487**Parameters**
1488
1489| Name        | Type                         | Mandatory  | Description    |
1490| ----------- | --------------------------- | ---- | ------ |
1491| upgradeFile | [UpgradeFile](#upgradefile) | Yes   | Update file.  |
1492| certsFile   | string                      | Yes   | Path of the certificate file.|
1493
1494**Return value**
1495
1496| Type            | Description                    |
1497| -------------- | ---------------------- |
1498| Promise\<void> | Promise used to return the result.|
1499
1500**Error codes**
1501
1502For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
1503
1504| ID      | Error Message                                                 |
1505| -------  | ---------------------------------------------------- |
1506| 11500104 | IPC error.               |
1507
1508**Example**
1509
1510```ts
1511import { BusinessError } from '@ohos.base';
1512
1513const upgradeFile: update.UpgradeFile = {
1514  fileType: update.ComponentType.OTA, // OTA package
1515  filePath: "path" // Path of the local update package
1516};
1517localUpdater.verifyUpgradePackage(upgradeFile, "cerstFilePath").then(() => {
1518  console.log(`verifyUpgradePackage success`);
1519}).catch((err: BusinessError) => {
1520  console.log(`verifyUpgradePackage error ${JSON.stringify(err)}`);
1521});
1522```
1523
1524### applyNewVersion
1525applyNewVersion(upgradeFiles: Array<[UpgradeFile](#upgradefile)>, callback: AsyncCallback\<void>): void
1526
1527Installs the update package. This API uses an asynchronous callback to return the result.
1528
1529**System capability**: SystemCapability.Update.UpdateService
1530
1531**Required permission**: ohos.permission.UPDATE_SYSTEM
1532
1533**Parameters**
1534
1535| Name        | Type                                | Mandatory  | Description                                     |
1536| ----------- | ---------------------------------- | ---- | --------------------------------------- |
1537| upgradeFile | Array<[UpgradeFile](#upgradefile)> | Yes   | Update file.                                   |
1538| callback    | AsyncCallback\<void>               | Yes   | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
1539
1540**Error codes**
1541
1542For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
1543
1544| ID      | Error Message                                                 |
1545| -------  | ---------------------------------------------------- |
1546| 11500104 | IPC error.               |
1547
1548**Example**
1549
1550```ts
1551const upgradeFiles: Array<update.UpgradeFile> = [{
1552  fileType: update.ComponentType.OTA, // OTA package
1553  filePath: "path" // Path of the local update package
1554}];
1555
1556localUpdater.applyNewVersion(upgradeFiles, (err) => {
1557  console.log(`applyNewVersion error ${JSON.stringify(err)}`);
1558});
1559```
1560
1561### applyNewVersion
1562
1563applyNewVersion(upgradeFiles: Array<[UpgradeFile](#upgradefile)>): Promise\<void>
1564
1565Installs the update package. This API uses a promise to return the result.
1566
1567**System capability**: SystemCapability.Update.UpdateService
1568
1569**Required permission**: ohos.permission.UPDATE_SYSTEM
1570
1571**Return value**
1572
1573| Type            | Description                        |
1574| -------------- | -------------------------- |
1575| Promise\<void> | Promise that returns no value.|
1576
1577**Error codes**
1578
1579For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
1580
1581| ID      | Error Message                                                 |
1582| -------  | ---------------------------------------------------- |
1583| 11500104 | IPC error.               |
1584
1585**Example**
1586
1587```ts
1588import { BusinessError } from '@ohos.base';
1589
1590const upgradeFiles: Array<update.UpgradeFile> = [{
1591  fileType: update.ComponentType.OTA, // OTA package
1592  filePath: "path" // Path of the local update package
1593}];
1594localUpdater.applyNewVersion(upgradeFiles).then(() => {
1595  console.log(`applyNewVersion success`);
1596}).catch((err: BusinessError) => {
1597  console.log(`applyNewVersion error ${JSON.stringify(err)}`);
1598});
1599```
1600
1601### on
1602on(eventClassifyInfo: EventClassifyInfo, taskCallback: UpgradeTaskCallback): void
1603
1604Enables listening for update events. This API uses an asynchronous callback to return the result.
1605
1606**System capability**: SystemCapability.Update.UpdateService
1607
1608**Parameters**
1609
1610| Name              | Type                                      | Mandatory  | Description  |
1611| ----------------- | ---------------------------------------- | ---- | ---- |
1612| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo)  | Yes   | Event information.|
1613| taskCallback      | [UpgradeTaskCallback](#upgradetaskcallback) | Yes   | Event callback.|
1614
1615
1616**Example**
1617
1618```ts
1619const eventClassifyInfo: update.EventClassifyInfo = {
1620  eventClassify: update.EventClassify.TASK, // Listening for update events
1621  extraInfo: ""
1622};
1623
1624let onTaskUpdate: update.UpgradeTaskCallback = (eventInfo: update.EventInfo) => {
1625  console.log(`on eventInfo id `, eventInfo.eventId);
1626};
1627
1628localUpdater.on(eventClassifyInfo, onTaskUpdate);
1629```
1630
1631### off
1632off(eventClassifyInfo: EventClassifyInfo, taskCallback?: UpgradeTaskCallback): void
1633
1634Disables listening for update events. This API uses an asynchronous callback to return the result.
1635
1636**System capability**: SystemCapability.Update.UpdateService
1637
1638**Parameters**
1639
1640| Name              | Type                                      | Mandatory  | Description  |
1641| ----------------- | ---------------------------------------- | ---- | ---- |
1642| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo)  | Yes   | Event information.|
1643| taskCallback      | [UpgradeTaskCallback](#upgradetaskcallback) | No   | Event callback.|
1644
1645
1646**Example**
1647
1648```ts
1649const eventClassifyInfo: update.EventClassifyInfo = {
1650  eventClassify: update.EventClassify.TASK, // Listening for update events
1651  extraInfo: ""
1652};
1653
1654let onTaskUpdate: update.UpgradeTaskCallback = (eventInfo: update.EventInfo) => {
1655  console.log(`on eventInfo id `, eventInfo.eventId);
1656};
1657
1658localUpdater.off(eventClassifyInfo, onTaskUpdate);
1659```
1660
1661## UpgradeInfo
1662
1663Represents update information.
1664
1665**System capability**: SystemCapability.Update.UpdateService
1666
1667| Name          | Type                         | Mandatory  | Description    |
1668| ------------ | ----------------------------- | ---- | ------ |
1669| upgradeApp   | string                        | Yes   | Application package name. |
1670| businessType | [BusinessType](#businesstype) | Yes   | Update service type.|
1671
1672## BusinessType
1673
1674Enumerates update service types.
1675
1676**System capability**: SystemCapability.Update.UpdateService
1677
1678| Name     | Type                               | Mandatory  | Description  |
1679| ------- | ----------------------------------- | ---- | ---- |
1680| vendor  | [BusinessVendor](#businessvendor)   | Yes   | Supplier or vendor. |
1681| subType | [BusinessSubType](#businesssubtype) | Yes   | Represents an update type. |
1682
1683## CheckResult
1684
1685Represents the package check result.
1686
1687**System capability**: SystemCapability.Update.UpdateService
1688
1689| Name               | Type                             | Mandatory  | Description    |
1690| ----------------- | --------------------------------- | ---- | ------ |
1691| isExistNewVersion | boolean                              | Yes   | Whether a new version is available.<br>The value **true** indicates that a new version is available, and the value **false** indicates the opposite.|
1692| newVersionInfo    | [NewVersionInfo](#newversioninfo) | No   | Information about the new version. |
1693
1694## NewVersionInfo
1695
1696Represents information about the new version.
1697
1698**System capability**: SystemCapability.Update.UpdateService
1699
1700| Name               | Type                                    | Mandatory  | Description  |
1701| ----------------- | ---------------------------------------- | ---- | ---- |
1702| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo)  | Yes   | Version digest information.|
1703| versionComponents | Array\<[VersionComponent](#versioncomponent)> | Yes   | Version components.|
1704
1705## VersionDigestInfo
1706
1707Represents version digest information.
1708
1709**System capability**: SystemCapability.Update.UpdateService
1710
1711| Name           | Type  | Mandatory  | Description  |
1712| ------------- | ------ | ---- | ---- |
1713| versionDigest | string | Yes   | Version digest information.|
1714
1715## VersionComponent
1716
1717Represents a version component.
1718
1719**System capability**: SystemCapability.Update.UpdateService
1720
1721| Name             | Type                               | Mandatory  | Description      |
1722| --------------- | ----------------------------------- | ---- | -------- |
1723| componentId     | string                              | Yes   | Component ID.    |
1724| componentType   | [ComponentType](#componenttype)     | Yes   | Component type.    |
1725| upgradeAction   | [UpgradeAction](#upgradeaction)     | Yes   | Update mode.    |
1726| displayVersion  | string                              | Yes   | Display version number.   |
1727| innerVersion    | string                              | Yes   | Internal version number.     |
1728| size            | number                              | Yes   | Size of the update package, in bytes.   |
1729| effectiveMode   | [EffectiveMode](#effectivemode)     | Yes   | Effective mode.    |
1730| descriptionInfo | [DescriptionInfo](#descriptioninfo) | Yes   | Information about the version description file.|
1731
1732## DescriptionOptions
1733
1734Represents options of the description file.
1735
1736**System capability**: SystemCapability.Update.UpdateService
1737
1738| Name      | Type                                   | Mandatory  | Description    |
1739| -------- | --------------------------------------- | ---- | ------ |
1740| format   | [DescriptionFormat](#descriptionformat) | Yes   | Format of the description file.|
1741| language | string                                  | Yes   | Language of the description file.|
1742
1743## ComponentDescription
1744
1745Represents a component description file.
1746
1747**System capability**: SystemCapability.Update.UpdateService
1748
1749| Name             | Type                               | Mandatory  | Description    |
1750| --------------- | ----------------------------------- | ---- | ------ |
1751| componentId     | string                              | Yes   | Component ID.  |
1752| descriptionInfo | [DescriptionInfo](#descriptioninfo) | Yes   | Information about the description file.|
1753
1754## DescriptionInfo
1755
1756Represents information about the version description file.
1757
1758**System capability**: SystemCapability.Update.UpdateService
1759
1760| Name             | Type                               | Mandatory  | Description    |
1761| --------------- | ----------------------------------- | ---- | ------ |
1762| descriptionType | [DescriptionType](#descriptiontype) | Yes   | Type of the description file.|
1763| content         | string                              | Yes   | Content of the description file.|
1764
1765## CurrentVersionInfo
1766
1767Represents information about the current version.
1768
1769**System capability**: SystemCapability.Update.UpdateService
1770
1771| Name               | Type                                    | Mandatory  | Description   |
1772| ----------------- | ---------------------------------------- | ---- | ----- |
1773| osVersion         | string                                   | Yes   | System version number.|
1774| deviceName        | string                                   | Yes   | Device name.  |
1775| versionComponents | Array\<[VersionComponent](#versioncomponent)> | No   | Version components. |
1776
1777## DownloadOptions
1778
1779Represents download options.
1780
1781**System capability**: SystemCapability.Update.UpdateService
1782
1783| Name          | Type               | Mandatory  | Description  |
1784| ------------ | ------------------- | ---- | ---- |
1785| allowNetwork | [NetType](#nettype) | Yes   | Network type.|
1786| order        | [Order](#order)     | Yes   | Update command.|
1787
1788## ResumeDownloadOptions
1789
1790Represents options for resuming download.
1791
1792**System capability**: SystemCapability.Update.UpdateService
1793
1794| Name          | Type               | Mandatory  | Description  |
1795| ------------ | ------------------- | ---- | ---- |
1796| allowNetwork | [NetType](#nettype) | Yes   | Network type.|
1797
1798## PauseDownloadOptions
1799
1800Represents options for pausing download.
1801
1802**System capability**: SystemCapability.Update.UpdateService
1803
1804| Name               | Type| Mandatory  | Description      |
1805| ----------------- | ---- | ---- | -------- |
1806| isAllowAutoResume | boolean | Yes   | Whether to allow automatic resuming of download.<br>The value **true** indicates that automatic resuming is allowed, and the value **false** indicates the opposite.|
1807
1808## UpgradeOptions
1809
1810Represents update options.
1811
1812**System capability**: SystemCapability.Update.UpdateService
1813
1814| Name   | Type           | Mandatory  | Description  |
1815| ----- | --------------- | ---- | ---- |
1816| order | [Order](#order) | Yes   | Update command.|
1817
1818## ClearOptions
1819
1820Represents options for clearing errors.
1821
1822**System capability**: SystemCapability.Update.UpdateService
1823
1824| Name    | Type                           | Mandatory  | Description  |
1825| ------ | ------------------------------- | ---- | ---- |
1826| status | [UpgradeStatus](#upgradestatus) | Yes   | Error status.|
1827
1828## UpgradePolicy
1829
1830Represents an update policy.
1831
1832**System capability**: SystemCapability.Update.UpdateService
1833
1834| Name                 | Type                                   | Mandatory  | Description     |
1835| ------------------- | --------------------------------------- | ---- | ------- |
1836| downloadStrategy    | boolean                        | Yes   | Automatic download policy.<br>The value **true** indicates that automatic download is supported, and the value **false** indicates the opposite.|
1837| autoUpgradeStrategy | boolean                        | Yes   | Automatic update policy.<br>The value **true** indicates that automatic update is supported, and the value **false** indicates the opposite.|
1838| autoUpgradePeriods  | Array\<[UpgradePeriod](#upgradeperiod)> | Yes   | Automatic update period.|
1839
1840## UpgradePeriod
1841
1842Represents an automatic update period.
1843
1844**System capability**: SystemCapability.Update.UpdateService
1845
1846| Name   | Type  | Mandatory  | Description  |
1847| ----- | ------ | ---- | ---- |
1848| start | number | Yes   | Start time.|
1849| end   | number | Yes   | End time.|
1850
1851## TaskInfo
1852
1853Task information.
1854
1855**System capability**: SystemCapability.Update.UpdateService
1856
1857| Name       | Type                 | Mandatory  | Description    |
1858| --------- | --------------------- | ---- | ------ |
1859| existTask |  boolean                  | Yes   | Whether a task exists.<br>The value **true** indicates that the task exists, and the value **false** indicates the opposite.|
1860| taskBody  | [TaskBody](#taskbody) | Yes   | Task data.  |
1861
1862## EventInfo
1863
1864Represents event information.
1865
1866**System capability**: SystemCapability.Update.UpdateService
1867
1868| Name      | Type                 | Mandatory  | Description  |
1869| -------- | --------------------- | ---- | ---- |
1870| eventId  | [EventId](#eventid)   | Yes   | Event ID.|
1871| taskBody | [TaskBody](#taskbody) | Yes   | Task data.|
1872
1873## TaskBody
1874
1875Represents task data.
1876
1877**System capability**: SystemCapability.Update.UpdateService
1878
1879| Name               | Type                                    | Mandatory  | Description  |
1880| ----------------- | ---------------------------------------- | ---- | ---- |
1881| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo)  | Yes   | Version digest information.|
1882| status            | [UpgradeStatus](#upgradestatus)          | Yes   | Update status.|
1883| subStatus         | number                                   | No   | Sub-status. |
1884| progress          | number                                   | Yes   | Progress.  |
1885| installMode       | number                                   | Yes   | Installation mode.|
1886| errorMessages     | Array\<[ErrorMessage](#errormessage)>    | No   | Error message.|
1887| versionComponents | Array\<[VersionComponent](#versioncomponent)> | Yes   | Version components.|
1888
1889## ErrorMessage
1890
1891Represents an error message.
1892
1893**System capability**: SystemCapability.Update.UpdateService
1894
1895| Name          | Type  | Mandatory  | Description  |
1896| ------------ | ------ | ---- | ---- |
1897| errorCode    | number | Yes   | Error code. |
1898| errorMessage | string | Yes   | Error message.|
1899
1900## EventClassifyInfo
1901
1902Represents event type information.
1903
1904**System capability**: SystemCapability.Update.UpdateService
1905
1906| Name           | Type                           | Mandatory  | Description  |
1907| ------------- | ------------------------------- | ---- | ---- |
1908| eventClassify | [EventClassify](#eventclassify) | Yes   | Event type.|
1909| extraInfo     | string                          | Yes   | Additional information.|
1910
1911## UpgradeFile
1912
1913Represents an update file.
1914
1915**System capability**: SystemCapability.Update.UpdateService
1916
1917| Name      | Type                           | Mandatory  | Description  |
1918| -------- | ------------------------------- | ---- | ---- |
1919| fileType | [ComponentType](#componenttype) | Yes   | File type.|
1920| filePath | string                          | Yes   | File path.|
1921
1922## UpgradeTaskCallback
1923
1924(eventInfo: EventInfo): void
1925
1926Represents an event callback.
1927
1928**System capability**: SystemCapability.Update.UpdateService
1929
1930| Name       | Type                   | Mandatory  | Description  |
1931| --------- | ----------------------- | ---- | ---- |
1932| eventInfo | [EventInfo](#eventinfo) | Yes   | Event information.|
1933
1934## BusinessVendor
1935
1936Represents a device vendor.
1937
1938**System capability**: SystemCapability.Update.UpdateService
1939
1940| Name   | Value     | Description  |
1941| ------ | -------- | ---- |
1942| PUBLIC | "public" | Open source.  |
1943
1944## BusinessSubType
1945
1946Represents an update type.
1947
1948**System capability**: SystemCapability.Update.UpdateService
1949
1950| Name     | Value | Description  |
1951| -------- | ---- | ---- |
1952| FIRMWARE | 1    | Firmware.  |
1953
1954## ComponentType
1955
1956Represents a component type.
1957
1958**System capability**: SystemCapability.Update.UpdateService
1959
1960| Name | Value | Description  |
1961| ---- | ---- | ---- |
1962| OTA  | 1    | Firmware.  |
1963
1964## UpgradeAction
1965
1966Represents an update mode.
1967
1968**System capability**: SystemCapability.Update.UpdateService
1969
1970| Name     | Value       | Description  |
1971| -------- | ---------- | ---- |
1972| UPGRADE  | "upgrade"  | Differential package. |
1973| RECOVERY | "recovery" | Recovery package. |
1974
1975## EffectiveMode
1976
1977Represents an effective mode.
1978
1979**System capability**: SystemCapability.Update.UpdateService
1980
1981| Name          | Value | Description  |
1982| ------------- | ---- | ---- |
1983| COLD          | 1    | Cold update. |
1984| LIVE          | 2    | Live update. |
1985| LIVE_AND_COLD | 3    | Hybrid live and cold update.|
1986
1987## DescriptionType
1988
1989Represents a description file type.
1990
1991**System capability**: SystemCapability.Update.UpdateService
1992
1993| Name    | Value | Description  |
1994| ------- | ---- | ---- |
1995| CONTENT | 0    | Content.  |
1996| URI     | 1    | Link.  |
1997
1998## DescriptionFormat
1999
2000Represents a description file format.
2001
2002**System capability**: SystemCapability.Update.UpdateService
2003
2004| Name       | Value | Description  |
2005| ---------- | ---- | ---- |
2006| STANDARD   | 0    | Standard format.|
2007| SIMPLIFIED | 1    | Simple format.|
2008
2009## NetType
2010
2011Represents a network type.
2012
2013**System capability**: SystemCapability.Update.UpdateService
2014
2015| Name              | Value | Description       |
2016| ----------------- | ---- | --------- |
2017| CELLULAR          | 1    | Data network.     |
2018| METERED_WIFI      | 2    | Wi-Fi hotspot.   |
2019| NOT_METERED_WIFI  | 4    | Non Wi-Fi hotspot.  |
2020| WIFI              | 6    | Wi-Fi.     |
2021| CELLULAR_AND_WIFI | 7    | Data network and Wi-Fi.|
2022
2023## Order
2024
2025Represents an update command.
2026
2027**System capability**: SystemCapability.Update.UpdateService
2028
2029| Name                 | Value | Description   |
2030| -------------------- | ---- | ----- |
2031| DOWNLOAD             | 1    | Download.   |
2032| INSTALL              | 2    | Install.   |
2033| DOWNLOAD_AND_INSTALL | 3    | Download and install.|
2034| APPLY                | 4    | Apply.   |
2035| INSTALL_AND_APPLY    | 6    | Install and apply.|
2036
2037## UpgradeStatus
2038
2039Enumerates update states.
2040
2041**System capability**: SystemCapability.Update.UpdateService
2042
2043| Name             | Value | Description  |
2044| ---------------- | ---- | ---- |
2045| WAITING_DOWNLOAD | 20   | Waiting for download. |
2046| DOWNLOADING      | 21   | Downloading. |
2047| DOWNLOAD_PAUSED  | 22   | Download paused.|
2048| DOWNLOAD_FAIL    | 23   | Download failed.|
2049| WAITING_INSTALL  | 30   | Waiting for installation. |
2050| UPDATING         | 31   | Updating. |
2051| WAITING_APPLY    | 40   | Waiting for applying the update. |
2052| APPLYING         | 41   | Applying the update. |
2053| UPGRADE_SUCCESS  | 50   | Update succeeded.|
2054| UPGRADE_FAIL     | 51   | Update failed.|
2055
2056## EventClassify
2057
2058Represents an event type.
2059
2060**System capability**: SystemCapability.Update.UpdateService
2061
2062| Name  | Value       | Description  |
2063| ---- | ---------- | ---- |
2064| TASK | 0x01000000 | Task event.|
2065
2066## EventId
2067
2068Enumerates event IDs.
2069
2070**System capability**: SystemCapability.Update.UpdateService
2071
2072| Name                    | Value       | Description    |
2073| ---------------------- | ---------- | ------ |
2074| EVENT_TASK_BASE        | EventClassify.TASK | Task event.  |
2075| EVENT_TASK_RECEIVE     | 0x01000001 | Task received.  |
2076| EVENT_TASK_CANCEL      | 0x01000002 | Task cancelled.  |
2077| EVENT_DOWNLOAD_WAIT    | 0x01000003 | Waiting for download.   |
2078| EVENT_DOWNLOAD_START   | 0x01000004 | Download started.  |
2079| EVENT_DOWNLOAD_UPDATE  | 0x01000005 | Download progress update.|
2080| EVENT_DOWNLOAD_PAUSE   | 0x01000006 | Download paused.  |
2081| EVENT_DOWNLOAD_RESUME  | 0x01000007 | Download resumed.  |
2082| EVENT_DOWNLOAD_SUCCESS | 0x01000008 | Download succeeded.  |
2083| EVENT_DOWNLOAD_FAIL    | 0x01000009 | Download failed.  |
2084| EVENT_UPGRADE_WAIT     | 0x0100000A | Waiting for update.   |
2085| EVENT_UPGRADE_START    | 0x0100000B | Update started.  |
2086| EVENT_UPGRADE_UPDATE   | 0x0100000C | Update in progress.   |
2087| EVENT_APPLY_WAIT       | 0x0100000D | Waiting for applying the update.   |
2088| EVENT_APPLY_START      | 0x0100000E | Applying the update.  |
2089| EVENT_UPGRADE_SUCCESS  | 0x0100000F | Update succeeded.  |
2090| EVENT_UPGRADE_FAIL     | 0x01000010 | Update failed.  |
2091