From 3df110067fa861cc54b5687c1c55333401ec01f3 Mon Sep 17 00:00:00 2001 From: songbao1 Date: Thu, 22 Aug 2024 11:46:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=BA=94=E7=94=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=AE=9A=E6=97=B6=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: songbao1 --- ...dvanced_notification_live_view_service.cpp | 43 +++++++++---------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/services/ans/src/advanced_notification_live_view_service.cpp b/services/ans/src/advanced_notification_live_view_service.cpp index e5d7810c0..4293a9737 100644 --- a/services/ans/src/advanced_notification_live_view_service.cpp +++ b/services/ans/src/advanced_notification_live_view_service.cpp @@ -612,11 +612,9 @@ void AdvancedNotificationService::UpdateRecordByOwner( if (oldRecord == nullptr) { oldRecord = GetFromNotificationList(creatorUid, notificationId); } - if (oldRecord == nullptr) { return; } - auto downloadTemplate = record->notification->GetNotificationRequest().GetTemplate(); auto content = record->notification->GetNotificationRequest().GetContent(); auto wantAgent = record->notification->GetNotificationRequest().GetWantAgent(); @@ -629,28 +627,27 @@ void AdvancedNotificationService::UpdateRecordByOwner( record->request->SetContent(content); } else { record->request->SetTemplate(downloadTemplate); - auto data = downloadTemplate->GetTemplateData(); - AAFwk::WantParamWrapper wrapper(*data); - ANS_LOGD("Update the template data: %{public}s.", wrapper.ToString().c_str()); - - CancelTimer(oldRecord->notification->GetFinishTimer()); - - uint64_t process = 0; - if (data->HasParam(PROGRESS_VALUE)) { - process = data->GetIntParam(PROGRESS_VALUE, 0); - } - - if (process == NotificationConstant::FINISH_PER) { - record->finish_status = UploadStatus::FINISH; - StartFinishTimer(record, GetCurrentTime() + NotificationConstant::THIRTY_MINUTES, - NotificationConstant::TRIGGER_FIFTEEN_MINUTES_REASON_DELETE); - } else { - record->finish_status = UploadStatus::CONTINUOUS_UPDATE_TIME_OUT; - StartFinishTimer(record, GetCurrentTime() + NotificationConstant::FIFTEEN_MINUTES, - NotificationConstant::TRIGGER_THIRTY_MINUTES_REASON_DELETE); - } - timerId = record->notification->GetFinishTimer(); } + auto data = downloadTemplate->GetTemplateData(); + AAFwk::WantParamWrapper wrapper(*data); + ANS_LOGD("Update the template data: %{public}s.", wrapper.ToString().c_str()); + CancelTimer(oldRecord->notification->GetFinishTimer()); + uint64_t process = 0; + if (data->HasParam(PROGRESS_VALUE)) { + process = data->GetIntParam(PROGRESS_VALUE, 0); + } + if (process == NotificationConstant::FINISH_PER) { + record->finish_status = UploadStatus::FINISH; + StartFinishTimer(record, GetCurrentTime() + NotificationConstant::THIRTY_MINUTES, + NotificationConstant::TRIGGER_FIFTEEN_MINUTES_REASON_DELETE); + } else { + record->finish_status = UploadStatus::CONTINUOUS_UPDATE_TIME_OUT; + StartFinishTimer(record, GetCurrentTime() + NotificationConstant::FIFTEEN_MINUTES, + NotificationConstant::TRIGGER_THIRTY_MINUTES_REASON_DELETE); + } + timerId = record->notification->GetFinishTimer(); + ANS_LOGI("CancelTimer: %{public}d,GetFinisher:%{public}d", + (int)oldRecord->notification->GetFinishTimer(), (int)timerId); record->notification = new (std::nothrow) Notification(record->request); if (record->notification == nullptr) { ANS_LOGE("Failed to create notification."); -- Gitee