From 9e7cf93996d65d5ba0f151646d1dc81fd7cca6bc Mon Sep 17 00:00:00 2001 From: wufarong Date: Sun, 30 Mar 2025 15:10:08 +0800 Subject: [PATCH] HA Signed-off-by:wufarong --- .../ans/src/advanced_notification_slot_service.cpp | 11 +++++++++++ services/ans/src/notification_preferences.cpp | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/services/ans/src/advanced_notification_slot_service.cpp b/services/ans/src/advanced_notification_slot_service.cpp index 61e2eafbd..8621e25f9 100644 --- a/services/ans/src/advanced_notification_slot_service.cpp +++ b/services/ans/src/advanced_notification_slot_service.cpp @@ -208,13 +208,19 @@ ErrCode AdvancedNotificationService::UpdateSlots( { ANS_LOGD("%{public}s", __FUNCTION__); + HaMetaMessage message = HaMetaMessage(EventSceneId::SCENE_6, EventBranchId::BRANCH_6); bool isSubsystem = AccessTokenHelper::VerifyNativeToken(IPCSkeleton::GetCallingTokenID()); if (!isSubsystem && !AccessTokenHelper::IsSystemApp()) { + message.ErrorCode(ERR_ANS_NON_SYSTEM_APP).Message("Not system app."); + NotificationAnalyticsUtil::ReportModifyEvent(message); + ANS_LOGE("Not system app."); return ERR_ANS_NON_SYSTEM_APP; } if (!AccessTokenHelper::CheckPermission(OHOS_PERMISSION_NOTIFICATION_CONTROLLER)) { ANS_LOGD("AccessTokenHelper::CheckPermission is false."); + message.ErrorCode(ERR_ANS_NON_SYSTEM_APP).Message("CheckPermission is false."); + NotificationAnalyticsUtil::ReportModifyEvent(message); return ERR_ANS_PERMISSION_DENIED; } @@ -233,6 +239,9 @@ ErrCode AdvancedNotificationService::UpdateSlots( result = NotificationPreferences::GetInstance()->UpdateNotificationSlots(bundle, slots); if (result == ERR_ANS_PREFERENCES_NOTIFICATION_BUNDLE_NOT_EXIST) { result = ERR_ANS_PREFERENCES_NOTIFICATION_SLOT_TYPE_NOT_EXIST; + message.ErrorCode(result).Message("Slot type not exist."); + NotificationAnalyticsUtil::ReportModifyEvent(message); + ANS_LOGE("Slot type not exist."); } })); notificationSvrQueue_->wait(handler); @@ -532,6 +541,8 @@ ErrCode AdvancedNotificationService::UpdateSlotReminderModeBySlotFlags( ret = NotificationPreferences::GetInstance()->UpdateNotificationSlots(bundle, slots); if (ret == ERR_ANS_PREFERENCES_NOTIFICATION_BUNDLE_NOT_EXIST) { ret = ERR_ANS_PREFERENCES_NOTIFICATION_SLOT_TYPE_NOT_EXIST; + message.ErrorCode(ERR_ANS_PREFERENCES_NOTIFICATION_SLOT_TYPE_NOT_EXIST).Message("Slot type not exist."); + NotificationAnalyticsUtil::ReportModifyEvent(message); } return ret; } diff --git a/services/ans/src/notification_preferences.cpp b/services/ans/src/notification_preferences.cpp index f4398a8fb..616be540e 100644 --- a/services/ans/src/notification_preferences.cpp +++ b/services/ans/src/notification_preferences.cpp @@ -258,16 +258,22 @@ ErrCode NotificationPreferences::GetNotificationSlot(const sptr lock(preferenceMutex_); if (GetBundleInfo(preferencesInfo_, bundleOption, bundleInfo)) { if (!bundleInfo.GetSlot(type, slot)) { result = ERR_ANS_PREFERENCES_NOTIFICATION_SLOT_TYPE_NOT_EXIST; + message.ErrorCode(ERR_ANS_PREFERENCES_NOTIFICATION_SLOT_TYPE_NOT_EXIST).Message("Slot type not exist."); + NotificationAnalyticsUtil::ReportModifyEvent(message); + ANS_LOGE("Slot type not exist."); } } else { ANS_LOGW("bundle not exist"); result = ERR_ANS_PREFERENCES_NOTIFICATION_SLOT_TYPE_NOT_EXIST; + message.ErrorCode(ERR_ANS_PREFERENCES_NOTIFICATION_SLOT_TYPE_NOT_EXIST).Message("Slot type not exist."); + NotificationAnalyticsUtil::ReportModifyEvent(message); } ANS_LOGD("%{public}s status = %{public}d ", __FUNCTION__, result); return result; -- Gitee