1# 升级服务子系统JS API变更 2 3OpenHarmony 3.2 Beta2版本相较于OpenHarmony 3.2 Beta1版本,升级服务子系统的API变更如下: 4 5## 接口变更 6 7| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | 8|---|---|---|---| 9| ohos.update | EventId | EVENT_UPGRADE_FAIL | 新增 | 10| ohos.update | EventId | EVENT_UPGRADE_SUCCESS | 新增 | 11| ohos.update | EventId | EVENT_APPLY_START | 新增 | 12| ohos.update | EventId | EVENT_APPLY_WAIT | 新增 | 13| ohos.update | EventId | EVENT_UPGRADE_UPDATE | 新增 | 14| ohos.update | EventId | EVENT_UPGRADE_START | 新增 | 15| ohos.update | EventId | EVENT_UPGRADE_WAIT | 新增 | 16| ohos.update | EventId | EVENT_DOWNLOAD_FAIL | 新增 | 17| ohos.update | EventId | EVENT_DOWNLOAD_SUCCESS | 新增 | 18| ohos.update | EventId | EVENT_DOWNLOAD_RESUME | 新增 | 19| ohos.update | EventId | EVENT_DOWNLOAD_PAUSE | 新增 | 20| ohos.update | EventId | EVENT_DOWNLOAD_UPDATE | 新增 | 21| ohos.update | EventId | EVENT_DOWNLOAD_START | 新增 | 22| ohos.update | EventId | EVENT_DOWNLOAD_WAIT | 新增 | 23| ohos.update | EventId | EVENT_TASK_CANCEL | 新增 | 24| ohos.update | EventId | EVENT_TASK_RECEIVE | 新增 | 25| ohos.update | EventId | EVENT_TASK_BASE = EventClassify.TASK | 新增 | 26| ohos.update | EventClassify | TASK = 0x01000000 | 新增 | 27| ohos.update | UpgradeStatus | UPGRADE_FAIL = 51 | 新增 | 28| ohos.update | UpgradeStatus | UPGRADE_SUCCESS = 50 | 新增 | 29| ohos.update | UpgradeStatus | APPLYING = 41 | 新增 | 30| ohos.update | UpgradeStatus | WAITING_APPLY = 40 | 新增 | 31| ohos.update | UpgradeStatus | UPDATING = 31 | 新增 | 32| ohos.update | UpgradeStatus | WAITING_INSTALL = 30 | 新增 | 33| ohos.update | UpgradeStatus | DOWNLOAD_FAIL = 23 | 新增 | 34| ohos.update | UpgradeStatus | DOWNLOAD_PAUSED = 22 | 新增 | 35| ohos.update | UpgradeStatus | DOWNLOADING = 21 | 新增 | 36| ohos.update | UpgradeStatus | WAITING_DOWNLOAD = 20 | 新增 | 37| ohos.update | Order | APPLY = 4 | 新增 | 38| ohos.update | Order | INSTALL = 2 | 新增 | 39| ohos.update | Order | DOWNLOAD = 1 | 新增 | 40| ohos.update | NetType | NOT_METERED_WIFI = 4 | 新增 | 41| ohos.update | NetType | METERED_WIFI = 2 | 新增 | 42| ohos.update | NetType | CELLULAR = 1 | 新增 | 43| ohos.update | DescriptionType | URI = 1 | 新增 | 44| ohos.update | DescriptionType | CONTENT = 0 | 新增 | 45| ohos.update | EffectiveMode | LIVE_AND_COLD = 3 | 新增 | 46| ohos.update | EffectiveMode | LIVE = 2 | 新增 | 47| ohos.update | EffectiveMode | COLD = 1 | 新增 | 48| ohos.update | UpgradeAction | RECOVERY = "recovery" | 新增 | 49| ohos.update | UpgradeAction | UPGRADE = "upgrade" | 新增 | 50| ohos.update | ComponentType | OTA = 1 | 新增 | 51| ohos.update | BusinessSubType | PARAM = 2 | 新增 | 52| ohos.update | BusinessSubType | FIRMWARE = 1 | 新增 | 53| ohos.update | BusinessVendor | PUBLIC = "public" | 新增 | 54| ohos.update | UpgradeTaskCallback | (eventInfo: EventInfo): void; | 新增 | 55| ohos.update | UpgradeFile | filePath: string; | 新增 | 56| ohos.update | UpgradeFile | fileType: ComponentType; | 新增 | 57| ohos.update | EventClassifyInfo | extraInfo: string; | 新增 | 58| ohos.update | EventClassifyInfo | eventClassify: EventClassify; | 新增 | 59| ohos.update | ErrorMessage | errorMessage: string; | 新增 | 60| ohos.update | ErrorMessage | errorCode: number; | 新增 | 61| ohos.update | TaskBody | versionComponents: Array\<VersionComponent>; | 新增 | 62| ohos.update | TaskBody | errorMessages: Array\<ErrorMessage>; | 新增 | 63| ohos.update | TaskBody | installMode: number; | 新增 | 64| ohos.update | TaskBody | progress: number; | 新增 | 65| ohos.update | TaskBody | subStatus: number; | 新增 | 66| ohos.update | TaskBody | status: UpgradeStatus; | 新增 | 67| ohos.update | TaskBody | versionDigestInfo: VersionDigestInfo; | 新增 | 68| ohos.update | EventInfo | taskBody: TaskBody; | 新增 | 69| ohos.update | EventInfo | eventId: EventId; | 新增 | 70| ohos.update | TaskInfo | taskBody: TaskBody; | 新增 | 71| ohos.update | TaskInfo | existTask: boolean; | 新增 | 72| ohos.update | UpgradePeriod | end: number; | 新增 | 73| ohos.update | UpgradePeriod | start: number; | 新增 | 74| ohos.update | UpgradePolicy | autoUpgradePeriods: Array\<UpgradePeriod>; | 新增 | 75| ohos.update | UpgradePolicy | autoUpgradeStrategy: boolean; | 新增 | 76| ohos.update | UpgradePolicy | downloadStrategy: boolean; | 新增 | 77| ohos.update | ClearOptions | status: UpgradeStatus; | 新增 | 78| ohos.update | UpgradeOptions | order: Order; | 新增 | 79| ohos.update | PauseDownloadOptions | isAllowAutoResume: boolean; | 新增 | 80| ohos.update | ResumeDownloadOptions | allowNetwork: NetType; | 新增 | 81| ohos.update | DownloadOptions | order: Order; | 新增 | 82| ohos.update | DownloadOptions | allowNetwork: NetType; | 新增 | 83| ohos.update | CurrentVersionInfo | versionComponents: Array\<VersionComponent>; | 新增 | 84| ohos.update | CurrentVersionInfo | deviceName: string; | 新增 | 85| ohos.update | CurrentVersionInfo | osVersion: string; | 新增 | 86| ohos.update | DescriptionInfo | descriptionType: DescriptionType; | 新增 | 87| ohos.update | VersionComponent | descriptionInfo: DescriptionInfo; | 新增 | 88| ohos.update | VersionComponent | effectiveMode: EffectiveMode; | 新增 | 89| ohos.update | VersionComponent | size: number; | 新增 | 90| ohos.update | VersionComponent | innerVersion: string; | 新增 | 91| ohos.update | VersionComponent | displayVersion: string; | 新增 | 92| ohos.update | VersionComponent | upgradeAction: UpgradeAction; | 新增 | 93| ohos.update | VersionComponent | componentType: ComponentType; | 新增 | 94| ohos.update | VersionDigestInfo | versionDigest: string; | 新增 | 95| ohos.update | NewVersionInfo | versionComponents: Array\<VersionComponent>; | 新增 | 96| ohos.update | NewVersionInfo | versionDigestInfo: VersionDigestInfo; | 新增 | 97| ohos.update | CheckResult | newVersionInfo: NewVersionInfo; | 新增 | 98| ohos.update | CheckResult | isExistNewVersion: boolean; | 新增 | 99| ohos.update | BusinessType | subType: BusinessSubType; | 新增 | 100| ohos.update | BusinessType | vendor: BusinessVendor; | 新增 | 101| ohos.update | UpgradeInfo | businessType: BusinessType; | 新增 | 102| ohos.update | UpgradeInfo | upgradeApp: string; | 新增 | 103| ohos.update | LocalUpdater | off(eventClassifyInfo: EventClassifyInfo, taskCallback?: UpgradeTaskCallback): void; | 新增 | 104| ohos.update | LocalUpdater | on(eventClassifyInfo: EventClassifyInfo, taskCallback: UpgradeTaskCallback): void; | 新增 | 105| ohos.update | LocalUpdater | applyNewVersion(upgradeFiles: Array\<UpgradeFile>, callback: AsyncCallback\<void>): void;<br>applyNewVersion(upgradeFiles: Array\<UpgradeFile>): Promise\<void>; | 新增 | 106| ohos.update | LocalUpdater | verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string, callback: AsyncCallback\<number>): void;<br>verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string): Promise\<number>; | 新增 | 107| ohos.update | Restorer | factoryReset(callback: AsyncCallback\<void>): void;<br>factoryReset(): Promise\<void>; | 新增 | 108| ohos.update | Updater | off(eventClassifyInfo: EventClassifyInfo, taskCallback?: UpgradeTaskCallback): void; | 新增 | 109| ohos.update | Updater | on(eventClassifyInfo: EventClassifyInfo, taskCallback: UpgradeTaskCallback): void; | 新增 | 110| ohos.update | Updater | terminateUpgrade(callback: AsyncCallback\<void>): void;<br>terminateUpgrade(): Promise\<void>; | 新增 | 111| ohos.update | Updater | setUpgradePolicy(policy: UpgradePolicy, callback: AsyncCallback\<number>): void;<br>setUpgradePolicy(policy: UpgradePolicy): Promise\<number>; | 新增 | 112| ohos.update | Updater | getUpgradePolicy(callback: AsyncCallback\<UpgradePolicy>): void;<br>getUpgradePolicy(): Promise\<UpgradePolicy>; | 新增 | 113| ohos.update | Updater | clearError(versionDigestInfo: VersionDigestInfo, clearOptions: ClearOptions, callback: AsyncCallback\<void>): void;<br>clearError(versionDigestInfo: VersionDigestInfo, clearOptions: ClearOptions): Promise\<void>; | 新增 | 114| ohos.update | Updater | pauseDownload(versionDigestInfo: VersionDigestInfo, pauseDownloadOptions: PauseDownloadOptions, callback: AsyncCallback\<void>): void;<br>pauseDownload(versionDigestInfo: VersionDigestInfo, pauseDownloadOptions: PauseDownloadOptions): Promise\<void>; | 新增 | 115| ohos.update | Updater | resumeDownload(versionDigestInfo: VersionDigestInfo, resumeDownloadOptions: ResumeDownloadOptions, callback: AsyncCallback\<void>): void;<br>resumeDownload(versionDigestInfo: VersionDigestInfo, resumeDownloadOptions: ResumeDownloadOptions): Promise\<void>; | 新增 | 116| ohos.update | Updater | getTaskInfo(callback: AsyncCallback\<TaskInfo>): void;<br>getTaskInfo(): Promise\<TaskInfo>; | 新增 | 117| ohos.update | Updater | getCurrentVersionInfo(callback: AsyncCallback\<CurrentVersionInfo>): void;<br>getCurrentVersionInfo(): Promise\<CurrentVersionInfo>; | 新增 | 118| ohos.update | update | getLocalUpdater(): LocalUpdater; | 新增 | 119| ohos.update | update | getRestorer(): Restorer; | 新增 | 120| ohos.update | update | getOnlineUpdater(upgradeInfo: UpgradeInfo): Updater; | 新增 | 121| ohos.update | update | getUpdaterFromOther(upgradeFile: string, device: string, updateType?: UpdateTypes): Updater; | 删除 | 122| ohos.update | update | getUpdaterForOther(upgradeFile: string, device: string, updateType?: UpdateTypes): Updater; | 删除 | 123| ohos.update | update | getUpdater(upgradeFile: string, updateType?: UpdateTypes): Updater; | 删除 | 124| ohos.update | Updater | cancel(): void; | 删除 | 125| ohos.update | Updater | verifyUpdatePackage(upgradeFile: string, certsFile: string): void; | 删除 | 126| ohos.update | Updater | rebootAndCleanUserData(callback: AsyncCallback\<number>): void;<br>rebootAndCleanUserData(): Promise\<number>; | 删除 | 127| ohos.update | Updater | rebootAndCleanCache(callback: AsyncCallback\<number>): void;<br>rebootAndCleanCache(): Promise\<number>; | 删除 | 128| ohos.update | Updater | applyNewVersion(callback: AsyncCallback\<number>): void;<br>applyNewVersion(): Promise\<number>; | 删除 | 129| ohos.update | Updater | setUpdatePolicy(policy: UpdatePolicy, callback: AsyncCallback\<number>): void;<br>setUpdatePolicy(policy: UpdatePolicy): Promise\<number>; | 删除 | 130| ohos.update | Updater | getUpdatePolicy(callback: AsyncCallback\<UpdatePolicy>): void;<br>getUpdatePolicy(): Promise\<UpdatePolicy>; | 删除 | 131| ohos.update | UpdateProgressCallback | (progress: Progress): void; | 删除 | 132| ohos.update | UpdatePolicy | autoUpgradeInterval: Array\<number>; | 删除 | 133| ohos.update | UpdatePolicy | installMode: INSTALL_MODE; | 删除 | 134| ohos.update | UpdatePolicy | autoDownload: boolean; | 删除 | 135| ohos.update | InstallMode | INSTALL_MODE_AUTO | 删除 | 136| ohos.update | InstallMode | INSTALL_MODE_NIGHT | 删除 | 137| ohos.update | InstallMode | INSTALL_MODE_NORMAL | 删除 | 138| ohos.update | Progress | endReason: string; | 删除 | 139| ohos.update | Progress | status: UpdateState; | 删除 | 140| ohos.update | Progress | percent: number; | 删除 | 141| ohos.update | UpdateState | UPDATE_STATE_UPDATE_SUCCESS | 删除 | 142| ohos.update | UpdateState | UPDATE_STATE_UPDATE_FAIL | 删除 | 143| ohos.update | UpdateState | UPDATE_STATE_UPDATE_ON = 90 | 删除 | 144| ohos.update | UpdateState | UPDATE_STATE_INSTALL_SUCCESS | 删除 | 145| ohos.update | UpdateState | UPDATE_STATE_INSTALL_FAIL | 删除 | 146| ohos.update | UpdateState | UPDATE_STATE_INSTALL_ON = 80 | 删除 | 147| ohos.update | UpdateState | UPDATE_STATE_PACKAGE_TRANS_SUCCESS | 删除 | 148| ohos.update | UpdateState | UPDATE_STATE_PACKAGE_TRANS_FAIL | 删除 | 149| ohos.update | UpdateState | UPDATE_STATE_PACKAGE_TRANS_ON = 70 | 删除 | 150| ohos.update | UpdateState | UPDATE_STATE_VERIFY_SUCCESS | 删除 | 151| ohos.update | UpdateState | UPDATE_STATE_VERIFY_FAIL | 删除 | 152| ohos.update | UpdateState | UPDATE_STATE_VERIFY_ON = 30 | 删除 | 153| ohos.update | UpdateState | UPDATE_STATE_DOWNLOAD_SUCCESS | 删除 | 154| ohos.update | UpdateState | UPDATE_STATE_DOWNLOAD_FAIL | 删除 | 155| ohos.update | UpdateState | UPDATE_STATE_DOWNLOAD_CANCEL | 删除 | 156| ohos.update | UpdateState | UPDATE_STATE_DOWNLOAD_PAUSE | 删除 | 157| ohos.update | UpdateState | UPDATE_STATE_DOWNLOAD_ON = 20 | 删除 | 158| ohos.update | UpdateState | UPDATE_STATE_CHECK_VERSION_SUCCESS | 删除 | 159| ohos.update | UpdateState | UPDATE_STATE_CHECK_VERSION_FAIL | 删除 | 160| ohos.update | UpdateState | UPDATE_STATE_CHECK_VERSION_ON = 10 | 删除 | 161| ohos.update | UpdateState | UPDATE_STATE_INIT = 0 | 删除 | 162| ohos.update | NewVersionInfo | descriptionInfo: Array\<DescriptionInfo>; | 删除 | 163| ohos.update | NewVersionInfo | checkResults: Array\<CheckResult>; | 删除 | 164| ohos.update | NewVersionInfo | errMsg: string; | 删除 | 165| ohos.update | NewVersionInfo | status: NewVersionStatus; | 删除 | 166| ohos.update | NewVersionStatus | VERSION_STATUS_BUSY = 2 | 删除 | 167| ohos.update | NewVersionStatus | VERSION_STATUS_NONE = 1 | 删除 | 168| ohos.update | NewVersionStatus | VERSION_STATUS_NEW = 0 | 删除 | 169| ohos.update | NewVersionStatus | VERSION_STATUS_ERR = -1 | 删除 | 170| ohos.update | DescriptionInfo | descriptionId: string; | 删除 | 171| ohos.update | CheckResult | descriptionId: string; | 删除 | 172| ohos.update | CheckResult | packageType: PackageTypes; | 删除 | 173| ohos.update | CheckResult | verifyInfo: string; | 删除 | 174| ohos.update | CheckResult | size: number; | 删除 | 175| ohos.update | CheckResult | versionCode: string; | 删除 | 176| ohos.update | CheckResult | versionName: number; | 删除 | 177| ohos.update | PackageTypes | PACKAGE_TYPE_PATCH = 7 | 删除 | 178| ohos.update | PackageTypes | PACKAGE_TYPE_VERSION = 6 | 删除 | 179| ohos.update | PackageTypes | PACKAGE_TYPE_COTA = 5 | 删除 | 180| ohos.update | PackageTypes | PACKAGE_TYPE_PRELOAD = 4 | 删除 | 181| ohos.update | PackageTypes | PACKAGE_TYPE_CUST = 3 | 删除 | 182| ohos.update | PackageTypes | PACKAGE_TYPE_BASE = 2 | 删除 | 183| ohos.update | PackageTypes | PACKAGE_TYPE_NORMAL = 1 | 删除 | 184