From 01aea98cc8225784f2bdd340e9769ad71e010873 Mon Sep 17 00:00:00 2001 From: songbao1 Date: Fri, 9 Aug 2024 14:10:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=BA=94=E7=94=A8=E4=B8=ADRe?= =?UTF-8?q?movalWantAgent=E7=9A=84operationType=E5=8F=AA=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E4=B8=BA4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: songbao1 --- .../ans/src/advanced_notification_publish_service.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp index 1815504e4..2db3a873d 100644 --- a/services/ans/src/advanced_notification_publish_service.cpp +++ b/services/ans/src/advanced_notification_publish_service.cpp @@ -61,6 +61,7 @@ constexpr int32_t RSS_PID = 3051; constexpr int32_t TYPE_CODE_DOWNLOAD = 8; constexpr const char *FOCUS_MODE_REPEAT_CALLERS_ENABLE = "1"; constexpr const char *CONTACT_DATA = "datashare:///com.ohos.contactsdataability/contacts/contact_data?Proxy=true"; +constexpr int32_t OPERATION_TYPE_COMMON_EVENT = 4; ErrCode AdvancedNotificationService::SetDefaultNotificationEnabled( const sptr &bundleOption, bool enabled) @@ -120,7 +121,15 @@ ErrCode AdvancedNotificationService::Publish(const std::string &label, const spt if (isSubsystem) { return PublishNotificationBySa(request); } - + if (request->GetRemovalWantAgent() != nullptr) { + uint32_t operationType = (uint32_t)(request->GetRemovalWantAgent()->GetPendingWant() + ->GetType(request->GetRemovalWantAgent()->GetPendingWant()->GetTarget())); + bool isSystemApp = AccessTokenHelper::IsSystemApp(); + if (!isSubsystem && !isSystemApp && operationType != OPERATION_TYPE_COMMON_EVENT) { + ANS_LOGI("SetRemovalWantAgent as nullptr"); + request->GetRemovalWantAgent(nullptr); + } + } do { result = publishProcess_[request->GetSlotType()]->PublishNotificationByApp(request); if (result != ERR_OK) { -- Gitee