diff --git a/frameworks/ans/IAnsManager.idl b/frameworks/ans/IAnsManager.idl index d7ec4e81fee23918075aa3e5ceb071a460e363f7..87d8151ce43734be8cc27ab2755fa6e2ed27baf3 100644 --- a/frameworks/ans/IAnsManager.idl +++ b/frameworks/ans/IAnsManager.idl @@ -309,6 +309,4 @@ interface OHOS.Notification.IAnsManager { void SetHashCodeRule([in] unsigned int type); [macrodef NOTIFICATION_SMART_REMINDER_SUPPORTED] void RegisterSwingCallback([in] IRemoteObject swingCallback); - - void GetOverlayIconScaleSize([out] unsigned int scaleSize); } diff --git a/frameworks/ans/src/notification_request.cpp b/frameworks/ans/src/notification_request.cpp index a4de9d3c9c898633273f76a88c0a89d4177d9c22..d98cbcf318ed069a981c43cde8d47a55b4273872 100644 --- a/frameworks/ans/src/notification_request.cpp +++ b/frameworks/ans/src/notification_request.cpp @@ -343,11 +343,6 @@ const std::shared_ptr NotificationRequest::GetOverlayIcon() con return overlayIcon_; } -void NotificationRequest::ResetOverlayIcon() const -{ - overlayIcon_ = nullptr; -} - void NotificationRequest::SetClassification(const std::string &classification) { classification_ = classification; diff --git a/frameworks/core/include/ans_image_util.h b/frameworks/core/include/ans_image_util.h index e87db21651a8de0643a579f91ea6be2824bd24cb..350bdd187f059e2c6d8dca7ac7300c4d1e74f3aa 100644 --- a/frameworks/core/include/ans_image_util.h +++ b/frameworks/core/include/ans_image_util.h @@ -76,8 +76,6 @@ public: static bool ImageScale(const std::shared_ptr &pixelMap, int32_t width, int32_t height); - static bool HandleOverSizeOverlayIcon(const std::shared_ptr &pixelMap); - /** * @brief Converts a binary string to a hexadecimal string. * diff --git a/frameworks/core/include/ans_notification.h b/frameworks/core/include/ans_notification.h index 18e13d5fedf34506a5a95eba6ed8a82969c29a0a..e3caa8cab96d2a46bd369180110ba44dc1af9582 100644 --- a/frameworks/core/include/ans_notification.h +++ b/frameworks/core/include/ans_notification.h @@ -1343,14 +1343,6 @@ public: */ ErrCode SetHashCodeRule(const uint32_t type); - /** - * @brief get the scale size of overlay icon. - * - * @param scaleSize the scale size of overlay icon. - * @return Returns ERR_OK on success, others on failure. - */ - ErrCode GetOverlayIconScaleSize(uint32_t &scaleSize); - private: /** * @brief Gets Ans Manager proxy. diff --git a/frameworks/core/include/distributed_notification_service_ipc_interface_code.h b/frameworks/core/include/distributed_notification_service_ipc_interface_code.h index 787a3a29c7b822153c341db814fe3a4586a33a20..1738c062cb69c5e410a8cf32299fb418ce5d8b22 100644 --- a/frameworks/core/include/distributed_notification_service_ipc_interface_code.h +++ b/frameworks/core/include/distributed_notification_service_ipc_interface_code.h @@ -111,7 +111,6 @@ namespace Notification { REGISTER_PUSH_CALLBACK, UNREGISTER_PUSH_CALLBACK, DISTRIBUTE_OPERATION, - GET_OVERLAY_ICON_SCALE_SIZE, // ans_subscriber_interface ON_CONNECTED, ON_DISCONNECTED, diff --git a/frameworks/core/src/ans_image_util.cpp b/frameworks/core/src/ans_image_util.cpp index c9a4504842228d47b1fb1b2150ce5102c9af777d..f5c2458bbae60e7d27ff957b8607eed600609c3f 100644 --- a/frameworks/core/src/ans_image_util.cpp +++ b/frameworks/core/src/ans_image_util.cpp @@ -16,8 +16,6 @@ #include "ans_log_wrapper.h" #include "image_packer.h" #include "image_source.h" -#include "ans_notification.h" -#include "singleton.h" namespace OHOS { namespace Notification { @@ -185,30 +183,6 @@ bool AnsImageUtil::ImageScale(const std::shared_ptr &pixelMap, return true; } -bool AnsImageUtil::HandleOverSizeOverlayIcon(const std::shared_ptr &pixelMap) -{ - uint32_t ccmScaleSize = 0; - - ErrCode code = DelayedSingleton::GetInstance()->GetOverlayIconScaleSize(ccmScaleSize); - if (code != ERR_OK || ccmScaleSize == 0) { - ANS_LOGW("get overlayIcon scale size failed."); - return false; - } - ANS_LOGD("overlayIcon size before scale: %{public}d", pixelMap->GetByteCount()); - auto icon = AnsImageUtil::ImageScale(pixelMap, ccmScaleSize, ccmScaleSize); - if (!icon) { - ANS_LOGE("overlayIcon is null after scale."); - return false; - } - ANS_LOGD("overlayIcon size after scale: %{public}d", pixelMap->GetByteCount()); - auto size = static_cast(pixelMap->GetByteCount()); - if (size > MAX_ICON_SIZE) { - ANS_LOGW("overlayIcon oversize after scale."); - return false; - } - return true; -} - std::shared_ptr AnsImageUtil::CreatePixelMapByString(const std::string &imagedata) { if (imagedata.empty()) { diff --git a/frameworks/core/src/ans_notification.cpp b/frameworks/core/src/ans_notification.cpp index 6bd054f9c1026c60affca7704cc3e9380dc9cd4a..d91ca8db7d427477608fb1e0ee459e58718ffad9 100644 --- a/frameworks/core/src/ans_notification.cpp +++ b/frameworks/core/src/ans_notification.cpp @@ -26,7 +26,6 @@ #include "notification_local_live_view_subscriber.h" #include "system_ability_definition.h" #include "unique_fd.h" -#include "ans_image_util.h" #include #include @@ -1599,10 +1598,7 @@ ErrCode AnsNotification::CheckImageSize(const NotificationRequest &request) auto overlayIcon = request.GetOverlayIcon(); if (overlayIcon && NotificationRequest::CheckImageOverSizeForPixelMap(overlayIcon, MAX_ICON_SIZE)) { ANS_LOGE("The size of overlay icon exceeds limit"); - if (!AnsImageUtil::HandleOverSizeOverlayIcon(overlayIcon)) { - ANS_LOGE("HandleOverSizeOverlayIcon failed."); - request.ResetOverlayIcon(); - } + return ERR_ANS_ICON_OVER_SIZE; } ErrCode err = request.CheckImageSizeForContent(); @@ -2360,19 +2356,6 @@ ErrCode AnsNotification::DisableNotificationFeature(const NotificationDisable &n return proxy->DisableNotificationFeature(reqPtr); } -ErrCode AnsNotification::GetOverlayIconScaleSize(uint32_t& scale) -{ - ANS_LOGI("GetOverlayIconScaleSize proxy called."); - HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); - - sptr proxy = GetAnsManagerProxy(); - if (!proxy) { - ANS_LOGE("GetAnsManagerProxy fail."); - return ERR_ANS_SERVICE_NOT_CONNECTED; - } - return proxy->GetOverlayIconScaleSize(scale); -} - ErrCode AnsNotification::DistributeOperation(sptr& operationInfo, const sptr &callback) { @@ -2440,6 +2423,5 @@ ErrCode AnsNotification::GetAllNotificationsBySlotType(std::vectorGetAllNotificationsBySlotType(notifications, slotType); } - } // namespace Notification } // namespace OHOS diff --git a/frameworks/core/test/unittest/ans_image_util_test/BUILD.gn b/frameworks/core/test/unittest/ans_image_util_test/BUILD.gn index ef82e6858a99bad6a7bcfc8a8d156356cf3f1f11..ce61789ec22b8cc9c956389a3f20bf481e92327a 100644 --- a/frameworks/core/test/unittest/ans_image_util_test/BUILD.gn +++ b/frameworks/core/test/unittest/ans_image_util_test/BUILD.gn @@ -23,7 +23,6 @@ ohos_unittest("ans_image_util_test") { include_dirs = [ "${core_path}/include", "${core_path}/common/include", - "${interfaces_path}/kits/native", "../mock", ] @@ -35,7 +34,7 @@ ohos_unittest("ans_image_util_test") { "ans_image_util_unit_test.cpp", ] - deps = [ "${frameworks_module_ans_path}:ans_innerkits" ] + deps = [] external_deps = [ "ability_base:want", diff --git a/frameworks/core/test/unittest/ans_notification_branch_test/ans_notification_branch_test.cpp b/frameworks/core/test/unittest/ans_notification_branch_test/ans_notification_branch_test.cpp index 540706e7c12a0a6d085a6811bd6acb485420881b..42f37eca23e22dc802dfc96ef39857a5fc0c3903 100644 --- a/frameworks/core/test/unittest/ans_notification_branch_test/ans_notification_branch_test.cpp +++ b/frameworks/core/test/unittest/ans_notification_branch_test/ans_notification_branch_test.cpp @@ -719,11 +719,6 @@ public: { return ERR_ANS_INVALID_PARAM; } - - ErrCode GetOverlayIconScaleSize(uint32_t& scaleSize) - { - return ERR_ANS_INVALID_PARAM; - } }; class AnsNotificationBranchTest : public testing::Test { diff --git a/interfaces/inner_api/notification_request.h b/interfaces/inner_api/notification_request.h index 21b6e8a32bb780536742e215e7fda1ae66510e3d..6bf541bfe7fa85a9f0fbf1b95507dd22081780af 100644 --- a/interfaces/inner_api/notification_request.h +++ b/interfaces/inner_api/notification_request.h @@ -567,12 +567,6 @@ public: */ void SetOverlayIcon(const std::shared_ptr &overlayIcon); - /** - * @brief reset the overlay icon of this notification. - * - */ - void ResetOverlayIcon() const; - /** * @brief Obtains the overlay icon of this notification. * @@ -1636,7 +1630,7 @@ private: std::shared_ptr littleIcon_ {}; std::string littleIconType_ {}; mutable std::shared_ptr bigIcon_ {}; - mutable std::shared_ptr overlayIcon_ {}; + std::shared_ptr overlayIcon_ {}; std::shared_ptr notificationContent_ {}; std::vector> actionButtons_ {}; diff --git a/services/ans/include/advanced_notification_service.h b/services/ans/include/advanced_notification_service.h index eeabb3f17bb0d8f6e1bbbf0a4e97a9b99ec5e892..389b5bb2414b696ed2592faf3abd421c52c3b5f2 100644 --- a/services/ans/include/advanced_notification_service.h +++ b/services/ans/include/advanced_notification_service.h @@ -1343,8 +1343,6 @@ public: */ ErrCode SetHashCodeRule(const uint32_t type) override; - ErrCode GetOverlayIconScaleSize(uint32_t& scaleSize) override; - protected: /** * @brief Query whether there is a agent relationship between the two apps. diff --git a/services/ans/include/notification_config_parse.h b/services/ans/include/notification_config_parse.h index b8ba792a4e0fd985796bac31a95bf65886b65b1b..77b9f77450eee8045099742a594fa6dd6f1c358d 100644 --- a/services/ans/include/notification_config_parse.h +++ b/services/ans/include/notification_config_parse.h @@ -61,7 +61,6 @@ public: void GetCollaborationFilter(); bool IsInCollaborationFilter(const std::string &bundleName, int32_t uid) const; uint32_t GetStartAbilityTimeout(); - uint32_t GetOverlayIconScaleSize() const; private: std::map defaultCurrentSlotReminder_; @@ -96,7 +95,6 @@ public: #endif constexpr static const char* CFG_KEY_COLLABORATIVE_DELETE_TYPES = "collaborativeDeleteTypes"; constexpr static const char* CFG_KEY_START_ABILITY_TIMEOUT = "startAbilityTimeout"; - constexpr static const char* CFG_KEY_OVERLAYICON_SCALE_SIZE = "overlayIconScaleSize"; }; } // namespace Notification } // namespace OHOS diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp index 39c8078d1ba371fd795437c21f03712475f771bb..6dabce6780a41c885bded7bede1554d7b668b18b 100644 --- a/services/ans/src/advanced_notification_publish_service.cpp +++ b/services/ans/src/advanced_notification_publish_service.cpp @@ -1228,12 +1228,5 @@ ErrCode AdvancedNotificationService::SetHashCodeRule(const uint32_t type) return result; } - -ErrCode AdvancedNotificationService::GetOverlayIconScaleSize(uint32_t& scaleSize) -{ - ANS_LOGD("%{public}s", __FUNCTION__); - scaleSize = NotificationConfigParse::GetInstance()->GetOverlayIconScaleSize(); - return ERR_OK; -} } // namespace Notification } // namespace OHOS diff --git a/services/ans/src/common/notification_config_parse.cpp b/services/ans/src/common/notification_config_parse.cpp index 2863c12edee4bb6288b5ca5fa11aa88cbd6f0254..e7a444355f58c233dafe917798823235a5245a27 100644 --- a/services/ans/src/common/notification_config_parse.cpp +++ b/services/ans/src/common/notification_config_parse.cpp @@ -477,31 +477,6 @@ void NotificationConfigParse::GetReportTrustListConfig() return; } -uint32_t NotificationConfigParse::GetOverlayIconScaleSize() const -{ - uint32_t ret; - nlohmann::json root; - std::string JsonPoint = "/"; - JsonPoint.append(CFG_KEY_NOTIFICATION_SERVICE); - if (!GetConfigJson(JsonPoint, root)) { - ANS_LOGE("Fail to get JsonPoint CCM config file"); - return 0; - } - if (!root.contains(CFG_KEY_NOTIFICATION_SERVICE)) { - ANS_LOGW("GetOverlayIconScaleSize not found jsonKey"); - return 0; - } - nlohmann::json affects = root[CFG_KEY_NOTIFICATION_SERVICE]; - if (affects.is_null() || affects.empty()) { - ANS_LOGE("GetOverlayIconScaleSize failed as invalid json key."); - return 0; - } - if (affects.contains(CFG_KEY_OVERLAYICON_SCALE_SIZE)) { - return affects[CFG_KEY_OVERLAYICON_SCALE_SIZE]; - } - return 0; -} - bool NotificationConfigParse::IsReportTrustList(const std::string& bundleName) const { return reporteTrustSet_.count(bundleName); diff --git a/tools/test/mock/mock_ans_manager_stub.h b/tools/test/mock/mock_ans_manager_stub.h index f886c0e74de48686fceb81155caf6aa66c584e65..6e602d4b5b85f6bb2d8f82daff3c3bb4c0acef83 100644 --- a/tools/test/mock/mock_ans_manager_stub.h +++ b/tools/test/mock/mock_ans_manager_stub.h @@ -701,11 +701,6 @@ public: return ERR_ANS_INVALID_PARAM; } - ErrCode GetOverlayIconScaleSize(uint32_t &scaleSize) override - { - return ERR_ANS_INVALID_PARAM; - } - private: std::string cmd_; std::string bundle_;