diff --git a/services/ans/src/advanced_notification_slot_service.cpp b/services/ans/src/advanced_notification_slot_service.cpp index 61e2eafbd3962ad6f311e3d34e7b0b6512c90abd..8621e25f9abf31d0a3f6c562e1970fdc1bf57823 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 f4398a8fb34d4fad445168e13502c0f1365d8ff5..616be540e669c9f8eb4c2fde91cd9d21a8ecbdd7 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;