From 9686bfeff7f031c19568b05045bdd117e9f5af8d Mon Sep 17 00:00:00 2001 From: fangJinliang1 Date: Tue, 22 Nov 2022 21:49:53 +0800 Subject: [PATCH] remove dead code Signed-off-by: fangJinliang1 Change-Id: Iecaa820fe15c5178f0110744b9e113f17947d417 --- frameworks/ans/src/notification_request.cpp | 34 ------------------- .../ans_innerkits_module_publish_test.cpp | 8 ----- interfaces/inner_api/notification_request.h | 17 ---------- .../settemplate_fuzzer/settemplate_fuzzer.cpp | 3 -- 4 files changed, 62 deletions(-) diff --git a/frameworks/ans/src/notification_request.cpp b/frameworks/ans/src/notification_request.cpp index 5dff5384a..c046ff2af 100644 --- a/frameworks/ans/src/notification_request.cpp +++ b/frameworks/ans/src/notification_request.cpp @@ -545,16 +545,6 @@ std::vector NotificationRequest::GetNotificationUserInputHistory() return userInputHistory_; } -void NotificationRequest::SetPublicNotification(const std::shared_ptr &other) -{ - publicNotification_ = other; -} - -const std::shared_ptr NotificationRequest::GetPublicNotification() const -{ - return publicNotification_; -} - std::string NotificationRequest::GetNotificationHashCode() const { if (creatorBundleName_.empty() || (creatorUid_ == 0) || ownerBundleName_.empty()) { @@ -706,7 +696,6 @@ std::string NotificationRequest::Dump() ", littleIcon = " + (littleIcon_ ? "not null" : "null") + ", bigIcon = " + (bigIcon_ ? "not null" : "null") + ", notificationContent = " + (notificationContent_ ? notificationContent_->Dump() : "null") + - ", publicNotification = " + (publicNotification_ ? "not null" : "null") + ", notificationTemplate = " + (notificationTemplate_ ? "not null" : "null") + ", actionButtons = " + (!actionButtons_.empty() ? actionButtons_.at(0)->Dump() : "empty") + ", messageUsers = " + (!messageUsers_.empty() ? messageUsers_.at(0)->Dump() : "empty") + @@ -1140,19 +1129,6 @@ bool NotificationRequest::Marshalling(Parcel &parcel) const } } - valid = publicNotification_ ? true : false; - if (!parcel.WriteBool(valid)) { - ANS_LOGE("Failed to write the flag which indicate whether publicNotification is null"); - return false; - } - - if (valid) { - if (!parcel.WriteParcelable(publicNotification_.get())) { - ANS_LOGE("Failed to write publicNotification"); - return false; - } - } - // write std::vector if (!parcel.WriteUint64(actionButtons_.size())) { ANS_LOGE("Failed to write the size of actionButtons"); @@ -1380,15 +1356,6 @@ bool NotificationRequest::ReadFromParcel(Parcel &parcel) } } - valid = parcel.ReadBool(); - if (valid) { - publicNotification_ = std::shared_ptr(parcel.ReadParcelable()); - if (!publicNotification_) { - ANS_LOGE("Failed to read publicNotification"); - return false; - } - } - auto vsize = parcel.ReadUint64(); for (uint64_t it = 0; it < vsize; ++it) { auto member = parcel.ReadParcelable(); @@ -1542,7 +1509,6 @@ void NotificationRequest::CopyOther(const NotificationRequest &other) this->littleIcon_ = other.littleIcon_; this->bigIcon_ = other.bigIcon_; this->notificationContent_ = other.notificationContent_; - this->publicNotification_ = other.publicNotification_; this->actionButtons_ = other.actionButtons_; this->messageUsers_ = other.messageUsers_; diff --git a/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp b/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp index 22de02b1b..58531df1a 100644 --- a/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp +++ b/frameworks/test/moduletest/ans_innerkits_module_publish_test.cpp @@ -179,10 +179,6 @@ private: EXPECT_EQ("bundleName", notificationRequest.GetOwnerBundleName()); EXPECT_EQ("bundleName", notificationRequest.GetCreatorBundleName()); EXPECT_EQ("ANS_Interface_MT_Publish_00100", notificationRequest.GetLabel()); - std::shared_ptr NotificationRequestPtr = notificationRequest.GetPublicNotification(); - if (NotificationRequestPtr != nullptr) { - EXPECT_EQ("ANS_Interface_MT_Publish_00100_REQUEST", NotificationRequestPtr->GetLabel()); - } // pixelmap auto littleIcon = notificationRequest.GetLittleIcon(); @@ -582,10 +578,6 @@ HWTEST_F(AnsInnerKitsModulePublishTest, ANS_Interface_MT_Publish_00100, Function req.SetOwnerBundleName("bundleName"); req.SetCreatorBundleName("creatorbundlename"); req.SetLabel("ANS_Interface_MT_Publish_00100"); - std::shared_ptr requestPtr = std::make_shared(); - EXPECT_NE(requestPtr, nullptr); - requestPtr->SetLabel("ANS_Interface_MT_Publish_00100_REQUEST"); - req.SetPublicNotification(requestPtr); // pixelmap auto pixelMap = std::make_shared(); diff --git a/interfaces/inner_api/notification_request.h b/interfaces/inner_api/notification_request.h index 502de66a9..0124bda67 100644 --- a/interfaces/inner_api/notification_request.h +++ b/interfaces/inner_api/notification_request.h @@ -832,22 +832,6 @@ public: */ std::vector GetNotificationUserInputHistory() const; - /** - * @brief Sets an alternative notification to be displayed on the lock screen for this notification. - * The display effect (whether and how this alternative notification will be displayed) is subject to - * the configuration in NotificationSlot::setLockscreenVisibleness(int). - * - * @param other Indicates the alternative notification to be displayed on the lock screen. - */ - void SetPublicNotification(const std::shared_ptr &other); - - /** - * @brief Obtains the alternative notification to be displayed on the lock screen for this notification. - * - * @return Returns the alternative notification to be displayed on the lock screen for this notification. - */ - const std::shared_ptr GetPublicNotification() const; - /** * @brief Obtains the unique hash code of a notification in the current application. * To obtain a valid hash code, you must have subscribed to and received the notification. @@ -1188,7 +1172,6 @@ private: std::shared_ptr littleIcon_ {}; std::shared_ptr bigIcon_ {}; std::shared_ptr notificationContent_ {}; - std::shared_ptr publicNotification_ {}; std::vector> actionButtons_ {}; std::vector> messageUsers_ {}; diff --git a/test/fuzztest/settemplate_fuzzer/settemplate_fuzzer.cpp b/test/fuzztest/settemplate_fuzzer/settemplate_fuzzer.cpp index d280ccb2f..229807ebd 100644 --- a/test/fuzztest/settemplate_fuzzer/settemplate_fuzzer.cpp +++ b/test/fuzztest/settemplate_fuzzer/settemplate_fuzzer.cpp @@ -50,9 +50,6 @@ namespace OHOS { text.emplace_back(stringData); request.SetNotificationUserInputHistory(text); request.GetNotificationUserInputHistory(); - std::shared_ptr other = nullptr; - request.SetPublicNotification(other); - request.GetPublicNotification(); request.GetNotificationHashCode(); request.GetOwnerBundleName(); request.GetCreatorBundleName(); -- Gitee