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