diff --git a/frameworks/ans/src/notification_request.cpp b/frameworks/ans/src/notification_request.cpp index 96ce61f2b890ffd13332c7a2d148fc24f2ad961c..c41bfca0f1ce8aaf3338b52d9ea7a996ecb183f2 100644 --- a/frameworks/ans/src/notification_request.cpp +++ b/frameworks/ans/src/notification_request.cpp @@ -765,6 +765,16 @@ uint32_t NotificationRequest::GetCollaboratedReminderFlag() const return collaboratedReminderFlag_; } +void SetIsSkipDoNotDisturbMode(bool isSkipDoNotDisturbMode) +{ + isSkipDoNotDisturbMode_ = isSkipDoNotDisturbMode; +} + +bool IsSkipDoNotDisturbMode() const +{ + return isSkipDoNotDisturbMode_; +} + std::string NotificationRequest::Dump() { return "NotificationRequest{ " diff --git a/interfaces/inner_api/notification_request.h b/interfaces/inner_api/notification_request.h index eaabdb4f9ccceba3aa50ae17e7718f0f3da6e919..7267d864f9dcb93f33fa38932b5a7214ab272d71 100644 --- a/interfaces/inner_api/notification_request.h +++ b/interfaces/inner_api/notification_request.h @@ -1466,6 +1466,10 @@ public: uint32_t GetCollaboratedReminderFlag() const; + void SetIsSkipDoNotDisturbMode(bool isSkipDoNotDisturbMode); + + bool IsSkipDoNotDisturbMode() const; + private: /** * Indicates the color mask, used for calculation with the ARGB value set by setColor(int32_t). @@ -1595,6 +1599,7 @@ private: bool forceDistributed_ {false}; bool notDistributed_ {false}; bool isSystemApp_ {false}; + bool isSkipDoNotDisturbMode_ {false}; std::shared_ptr wantAgent_ {}; std::shared_ptr removalWantAgent_ {}; diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp index 46195854939d1d4be7f9708083307d28ebc8219f..a154c6d2bd36fecebb056c672cd4fc10363b5680 100644 --- a/services/ans/src/advanced_notification_publish_service.cpp +++ b/services/ans/src/advanced_notification_publish_service.cpp @@ -381,7 +381,9 @@ ErrCode AdvancedNotificationService::PublishNotificationForIndirectProxy(const s return; } - CheckDoNotDisturbProfile(record); + if (!request->IsSkipDoNotDisturbMode()) { + CheckDoNotDisturbProfile(record); + } ChangeNotificationByControlFlags(record, isAgentController); if (IsSaCreateSystemLiveViewAsBundle(record, ipcUid) && (std::static_pointer_cast( @@ -2624,8 +2626,9 @@ ErrCode AdvancedNotificationService::PublishNotificationBySa(const sptrIsSkipDoNotDisturbMode()) { + CheckDoNotDisturbProfile(record); + } ChangeNotificationByControlFlags(record, isAgentController); if (IsSaCreateSystemLiveViewAsBundle(record, ipcUid) && (std::static_pointer_cast(