1 Star 0 Fork 358

luojingsong/notification_distributed_notification_service_2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
0001-.patch 6.55 KB
一键复制 编辑 原始数据 按行查看 历史
luojingsong 提交于 2025-04-21 11:09 +08:00 . 11
From e8c961c14892c5f563d6fb68f04477911af20c50 Mon Sep 17 00:00:00 2001
From: l30060944 <l30060944@notesmail.huawei.com/>
Date: Mon, 21 Apr 2025 09:07:01 +0800
Subject: [PATCH] =?UTF-8?q?=E8=81=94=E8=B0=83=20TicketNo:=20DTS00000000000?=
=?UTF-8?q?00=20Description:=20=E8=81=94=E8=B0=83=20Team:OTHERS=20Feature?=
=?UTF-8?q?=20or=20Bugfix:=20Bugfix=20Binary=20Source:=20sync=20from=20git?=
=?UTF-8?q?ee=20PrivateCode(Yes/No):No?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Change-Id: Ia3cc286969cb064b6e11c73c7e9c230992b4e185
---
frameworks/ans/src/notification_request.cpp | 18 ++++++++++++++++++
.../ans/test/unittest/notification_test.cpp | 3 ++-
interfaces/inner_api/notification_request.h | 5 +++++
.../advanced_notification_publish_service.cpp | 8 ++++++--
4 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/frameworks/ans/src/notification_request.cpp b/frameworks/ans/src/notification_request.cpp
index 399e8595..06784ad7 100644
--- a/frameworks/ans/src/notification_request.cpp
+++ b/frameworks/ans/src/notification_request.cpp
@@ -804,6 +804,7 @@ std::string NotificationRequest::Dump()
", updateOnly = " + (updateOnly_ ? "true" : "false") +
", isForceDistributed = " + (forceDistributed_ ? "true" : "false") +
", isNotDistributed = " + (notDistributed_ ? "true" : "false") +
+ ", isSkipDoNotDisturbMode = " + (isSkipDoNotDisturbMode_ ? "true" : "false") +
", removalWantAgent = " + (removalWantAgent_ ? "not null" : "null") +
", maxScreenWantAgent = " + (maxScreenWantAgent_ ? "not null" : "null") +
", additionalParams = " + (additionalParams_ ? "not null" : "null") +
@@ -1243,6 +1244,11 @@ bool NotificationRequest::Marshalling(Parcel &parcel) const
return false;
}
+ if (!parcel.WriteBool(isSkipDoNotDisturbMode_)) {
+ ANS_LOGE("Failed to write flag notDistributed");
+ return false;
+ }
+
// write objects which managed by std::shared_ptr
bool valid {false};
@@ -1667,6 +1673,7 @@ bool NotificationRequest::ReadFromParcel(Parcel &parcel)
isRemoveAllowed_ = parcel.ReadBool();
forceDistributed_ = parcel.ReadBool();
notDistributed_ = parcel.ReadBool();
+ isSkipDoNotDisturbMode_ = parcel.ReadBool();
bool valid {false};
@@ -1970,6 +1977,16 @@ void NotificationRequest::SetIsSystemApp(bool isSystemApp)
isSystemApp_ = isSystemApp;
}
+bool NotificationRequest::IsSkipDoNotDisturbMode() const
+{
+ return isSkipDoNotDisturbMode_;
+}
+
+void NotificationRequest::SetIsSkipDoNotDisturbMode(bool isSkipDoNotDisturbMode)
+{
+ isSkipDoNotDisturbMode_ = isSkipDoNotDisturbMode;
+}
+
void NotificationRequest::CopyBase(const NotificationRequest &other)
{
this->notificationId_ = other.notificationId_;
@@ -1997,6 +2014,7 @@ void NotificationRequest::CopyBase(const NotificationRequest &other)
this->forceDistributed_ = other.forceDistributed_;
this->notDistributed_ = other.notDistributed_;
this->isSystemApp_ = other.isSystemApp_;
+ this->isSkipDoNotDisturbMode_ = other.isSkipDoNotDisturbMode_;
this->isCoverActionButtons_ = other.isCoverActionButtons_;
this->isUpdateByOwnerAllowed_ = other.isUpdateByOwnerAllowed_;
this->distributedCollaborate_ = other.distributedCollaborate_;
diff --git a/frameworks/ans/test/unittest/notification_test.cpp b/frameworks/ans/test/unittest/notification_test.cpp
index 7346ad23..dc93ff4c 100644
--- a/frameworks/ans/test/unittest/notification_test.cpp
+++ b/frameworks/ans/test/unittest/notification_test.cpp
@@ -314,7 +314,8 @@ HWTEST_F(NotificationTest, Dump_00001, Function | SmallTest | Level1)
"isCountdown = false, inProgress = false, groupOverview = false, isRemoveAllowed = true, "
"progressIndeterminate = false, unremovable = false, floatingIcon = false, onlyLocal = false, "
"permitted = true, isAgent = false, updateOnly = false, isForceDistributed = false, "
- "isNotDistributed = false, removalWantAgent = null, maxScreenWantAgent = null, "
+ "isNotDistributed = false, isSkipDoNotDisturbMode = isSkipDoNotDisturbMode_, "
+ "removalWantAgent = null, maxScreenWantAgent = null, "
"additionalParams = null, littleIcon = null, bigIcon = null, overlayIcon = null, "
"notificationContent = null, notificationTemplate = null, actionButtons = empty, "
"messageUsers = empty, userInputHistory = empty, distributedOptions = "
diff --git a/interfaces/inner_api/notification_request.h b/interfaces/inner_api/notification_request.h
index d5574450..3ff5ce28 100644
--- a/interfaces/inner_api/notification_request.h
+++ b/interfaces/inner_api/notification_request.h
@@ -1255,6 +1255,10 @@ public:
void SetIsSystemApp(bool isSystemApp);
+ bool IsSkipDoNotDisturbMode() const;
+
+ void SetIsSkipDoNotDisturbMode(bool isSkipDoNotDisturbMode);
+
bool IsCommonLiveView() const;
bool IsSystemLiveView() const;
@@ -1595,6 +1599,7 @@ private:
bool forceDistributed_ {false};
bool notDistributed_ {false};
bool isSystemApp_ {false};
+ bool isSkipDoNotDisturbMode_ {false};
std::shared_ptr<AbilityRuntime::WantAgent::WantAgent> wantAgent_ {};
std::shared_ptr<AbilityRuntime::WantAgent::WantAgent> removalWantAgent_ {};
diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp
index cfb6850c..72049377 100644
--- a/services/ans/src/advanced_notification_publish_service.cpp
+++ b/services/ans/src/advanced_notification_publish_service.cpp
@@ -378,7 +378,9 @@ ErrCode AdvancedNotificationService::PublishNotificationForIndirectProxy(const s
ANS_LOGE("Can not assign valid slot!");
}
- CheckDoNotDisturbProfile(record);
+ if (!request->IsSkipDoNotDisturbMode()) {
+ CheckDoNotDisturbProfile(record);
+ }
ChangeNotificationByControlFlags(record, isAgentController);
if (IsSaCreateSystemLiveViewAsBundle(record, ipcUid) &&
(std::static_pointer_cast<OHOS::Notification::NotificationLocalLiveViewContent>(
@@ -2619,7 +2621,9 @@ ErrCode AdvancedNotificationService::PublishNotificationBySa(const sptr<Notifica
}
}
- CheckDoNotDisturbProfile(record);
+ if (!request->IsSkipDoNotDisturbMode()) {
+ CheckDoNotDisturbProfile(record);
+ }
ChangeNotificationByControlFlags(record, isAgentController);
if (IsSaCreateSystemLiveViewAsBundle(record, ipcUid) &&
(std::static_pointer_cast<OHOS::Notification::NotificationLocalLiveViewContent>(
--
2.34.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/songbao1/notification_distributed_notification_service_2.git
git@gitee.com:songbao1/notification_distributed_notification_service_2.git
songbao1
notification_distributed_notification_service_2
notification_distributed_notification_service_2
master

搜索帮助