diff --git a/services/ans/include/notification_analytics_util.h b/services/ans/include/notification_analytics_util.h index b87e711f0f9e3d686028a94476a0749f474862af..ee131ce421ad81af16d5bfab2511af285df4caad 100644 --- a/services/ans/include/notification_analytics_util.h +++ b/services/ans/include/notification_analytics_util.h @@ -171,9 +171,6 @@ private: static std::string BuildExtraInfoWithReq(const HaMetaMessage& message, const sptr& request); - - static std::string BuildExtraInfoWithReqPublishFail(const HaMetaMessage& message, - const sptr& request); static void SetCommonWant(EventFwk::Want& want, const HaMetaMessage& message, std::string& extraInfo); diff --git a/services/ans/src/common/notification_analytics_util.cpp b/services/ans/src/common/notification_analytics_util.cpp index b194a6fbcc8a65326c2fabfcf5acfebc024ff217..dabbb059b471b86ea64ba0dc3e3e7d6825898223 100644 --- a/services/ans/src/common/notification_analytics_util.cpp +++ b/services/ans/src/common/notification_analytics_util.cpp @@ -398,11 +398,7 @@ void NotificationAnalyticsUtil::CommonNotificationEvent(const sptrGetContent()->GetNotificationContent(); auto liveViewContent = std::static_pointer_cast(content); reason["status"] = static_cast(liveViewContent->GetLiveViewStatus()); + if (liveViewContent->GetExtraInfo() != nullptr) { + reason["et"] = liveViewContent->GetExtraInfo()->GetStringParam("event"); + } } reason["scene"] = message.sceneId_; @@ -623,60 +622,6 @@ std::string NotificationAnalyticsUtil::BuildExtraInfoWithReq(const HaMetaMessage return wWrapper.ToString(); } -std::string NotificationAnalyticsUtil::BuildExtraInfoWithReqPublishFail(const HaMetaMessage& message, - const sptr& request) -{ - NotificationNapi::ContentType contentType; - NotificationNapi::AnsEnumUtil::ContentTypeCToJS( - static_cast(request->GetNotificationType()), contentType); - nlohmann::json reason; - if (contentType == NotificationNapi::ContentType::NOTIFICATION_CONTENT_LIVE_VIEW) { - auto content = request->GetContent()->GetNotificationContent(); - auto liveViewContent = std::static_pointer_cast(content); - reason["status"] = static_cast(liveViewContent->GetLiveViewStatus()); - } - - reason["scene"] = message.sceneId_; - reason["branch"] = message.branchId_; - reason["innerErr"] = message.errorCode_; - reason["detail"] = message.message_; - reason["fg"] = std::to_string(request->GetNotificationControlFlags()); - - auto now = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); - reason["time"] = now; - - std::shared_ptr extraInfo = nullptr; - if (request->GetUnifiedGroupInfo() != nullptr && - request->GetUnifiedGroupInfo()->GetExtraInfo() != nullptr) { - const auto originExtraInfo = request->GetUnifiedGroupInfo()->GetExtraInfo(); - extraInfo = std::make_shared(*originExtraInfo); - } else { - extraInfo = std::make_shared(); - } - - reason["detail"] = ""; - int32_t reasonFixedSize = - static_cast(reason.dump(-1, ' ', false, nlohmann::json::error_handler_t::replace).size()); - int32_t leftSpace = REASON_MAX_LENGTH - reasonFixedSize; - if (leftSpace < 0) { - std::string basicInfo = std::to_string(message.sceneId_) + MESSAGE_DELIMITER + - std::to_string(message.branchId_) + MESSAGE_DELIMITER + - std::to_string(message.errorCode_) + MESSAGE_DELIMITER + - std::to_string(now) + " Reason fixed size exceeds limit"; - extraInfo->SetParam("reason", AAFwk::String::Box(basicInfo)); - ANS_LOGI("%{public}s", basicInfo.c_str()); - } else { - reason["detail"] = message.message_.substr(0, leftSpace); - extraInfo->SetParam("reason", - AAFwk::String::Box(reason.dump(-1, ' ', false, nlohmann::json::error_handler_t::replace))); - } - - AAFwk::WantParamWrapper wWrapper(*extraInfo); - - return wWrapper.ToString(); -} - void NotificationAnalyticsUtil::SetCommonWant(EventFwk::Want& want, const HaMetaMessage& message, std::string& extraInfo) {