From 1829e7201cf3a4655f225bf5ab6cffa5fe449820 Mon Sep 17 00:00:00 2001 From: wyuanchao Date: Mon, 30 May 2022 08:46:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=94=E7=94=A8=E9=80=9A=E7=9F=A5=E6=AC=A1?= =?UTF-8?q?=E6=95=B0=E7=BB=9F=E8=AE=A1=E6=89=93=E6=A1=A9=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wyuanchao --- services/ans/BUILD.gn | 1 + services/ans/src/advanced_notification_service.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/services/ans/BUILD.gn b/services/ans/BUILD.gn index bfa66da97..45345a948 100644 --- a/services/ans/BUILD.gn +++ b/services/ans/BUILD.gn @@ -79,6 +79,7 @@ ohos_shared_library("libans") { "ability_runtime:app_manager", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", + "device_usage_statistics:usagestatsinner", "distributeddatamgr:distributeddata_inner", "multimedia_image_standard:image_native", "multimedia_media_standard:media_client", diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index 8fe812c69..7ddff2252 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -28,6 +28,7 @@ #include "ans_log_wrapper.h" #include "ans_watchdog.h" #include "ans_permission_def.h" +#include "bundle_active_client.h" #include "bundle_manager_helper.h" #include "common_event_manager.h" #include "common_event_support.h" @@ -477,6 +478,10 @@ ErrCode AdvancedNotificationService::Publish(const std::string &label, const spt if (result != ERR_OK) { return result; } + int32_t userId = request->GetCreatorUserId(); + std::string bundleName = bundleOption->GetBundleName(); + DeviceUsageStats::BundleActiveEvent event(DeviceUsageStats::BundleActiveEvent::NOTIFICATION_SEEN, bundleName); + DeviceUsageStats::BundleActiveClient::GetInstance().ReportEvent(event, userId); return PublishPreparedNotification(request, bundleOption); } -- Gitee