diff --git a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets b/feature/ota/src/main/ets/manager/OtaUpdateManager.ets index a176b455e68a6a35d0471a339aa9a0a7c8fbf609..21b0e0edde932dd3c206da49489e7a1225312ecf 100644 --- a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets +++ b/feature/ota/src/main/ets/manager/OtaUpdateManager.ets @@ -323,6 +323,7 @@ export class OtaUpdateManager { await this.getNewVersion(); } + this.log('notifyUpdateStatus' + 'notify start'); await StateManager.createInstance(otaStatus).notify(context, eventId); } @@ -373,7 +374,7 @@ export class OtaUpdateManager { return; } let eventInfo = this.wantParser(want); - this.log('handleWant:' + ' eventInfo is ${FormatUtils.stringify(eventInfo)}'); + this.log('handleWant: eventInfo is ' + FormatUtils.stringify(eventInfo)); if (!eventInfo?.eventId) { this.log('eventInfo?.eventId is null'); return; diff --git a/feature/ota/src/main/ets/manager/StateManager.ets b/feature/ota/src/main/ets/manager/StateManager.ets index ebdd7dda52481967739980cfa6dedb6e84703276..3dc36744158907a608ac7117097b02ea124d6200 100644 --- a/feature/ota/src/main/ets/manager/StateManager.ets +++ b/feature/ota/src/main/ets/manager/StateManager.ets @@ -577,12 +577,16 @@ export class UpgradeSuccess extends BaseState { this.isButtonClickable = false; } - async notify(context?: common.Context): Promise { - AppStorage.Set('installStatusRefresh', JSON.stringify(this.otaStatus)); - await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); - let versionName = globalThis.lastVersionName; - LogUtils.log('StateManager', 'UpgradeSuccess versionName is ' + versionName); - await UpgradeAdapter.getInstance().getNotifyInstance()?.showUpgradeSuccess(versionName, context); + async notify(context?: common.Context, eventId?: update.EventId): Promise { + if (eventId == update.EventId.EVENT_UPGRADE_SUCCESS) { + AppStorage.Set('installStatusRefresh', JSON.stringify(this.otaStatus)); + await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); + let versionName = globalThis.lastVersionName; + LogUtils.info('StateManager', 'UpgradeSuccess versionName is ' + versionName); + await UpgradeAdapter.getInstance().getNotifyInstance()?.showUpgradeSuccess(versionName, context); + } else { + LogUtils.error('StateManager', 'Upgrade EventId error'); + } } }