diff --git a/frameworks/ans/src/notification_helper.cpp b/frameworks/ans/src/notification_helper.cpp index e4ad026e28f3dcb97c982ad81474b11b1be90889..0bcec88ee3efbfe8def611dcd9b083cd7a5435de 100644 --- a/frameworks/ans/src/notification_helper.cpp +++ b/frameworks/ans/src/notification_helper.cpp @@ -70,11 +70,6 @@ ErrCode NotificationHelper::PublishNotification(const std::string &label, const return DelayedSingleton::GetInstance()->PublishNotification(label, request); } -ErrCode NotificationHelper::PublishNotification(const NotificationRequest &request, const std::string &deviceId) -{ - return DelayedSingleton::GetInstance()->PublishNotification(request, deviceId); -} - ErrCode NotificationHelper::CancelNotification(int32_t notificationId) { return DelayedSingleton::GetInstance()->CancelNotification(notificationId); @@ -154,11 +149,6 @@ ErrCode NotificationHelper::RequestEnableNotification(std::string &deviceId) return DelayedSingleton::GetInstance()->RequestEnableNotification(deviceId); } -ErrCode NotificationHelper::AreNotificationsSuspended(bool &suspended) -{ - return DelayedSingleton::GetInstance()->AreNotificationsSuspended(suspended); -} - ErrCode NotificationHelper::HasNotificationPolicyAccessPermission(bool &hasPermission) { return DelayedSingleton::GetInstance()->HasNotificationPolicyAccessPermission(hasPermission); diff --git a/frameworks/ans/test/unittest/notification_helper_test.cpp b/frameworks/ans/test/unittest/notification_helper_test.cpp index 0cedd5985581a677e5b3568c1c83d739a8aba4be..0a655cba0bd4573d83a78b844192bf2cecace1e0 100644 --- a/frameworks/ans/test/unittest/notification_helper_test.cpp +++ b/frameworks/ans/test/unittest/notification_helper_test.cpp @@ -185,21 +185,6 @@ HWTEST_F(NotificationHelperTest, PublishNotification_00001, Function | SmallTest EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); } -/** - * @tc.name: PublishNotification_00002 - * @tc.desc: Test PublishNotification parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, PublishNotification_00002, Function | SmallTest | Level1) -{ - NotificationRequest request; - std::string deviceId = "DeviceId"; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.PublishNotification(request, deviceId); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - /** * @tc.name: PublishNotification_00003 * @tc.desc: Test PublishNotification parameters. @@ -428,20 +413,6 @@ HWTEST_F(NotificationHelperTest, RequestEnableNotification_00001, Function | Sma EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); } -/** - * @tc.name: AreNotificationsSuspended_00001 - * @tc.desc: Test AreNotificationsSuspended parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, AreNotificationsSuspended_00001, Function | SmallTest | Level1) -{ - bool suspended = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.AreNotificationsSuspended(suspended); - EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION); -} - /** * @tc.name: HasNotificationPolicyAccessPermission_00001 * @tc.desc: Test HasNotificationPolicyAccessPermission parameters. diff --git a/frameworks/core/include/ans_manager_interface.h b/frameworks/core/include/ans_manager_interface.h index dbbc85daa286042d37ed5dba749f0d6177d38f0d..b526b66646da01d2a0fbef02fe87b5bd73553e37 100644 --- a/frameworks/core/include/ans_manager_interface.h +++ b/frameworks/core/include/ans_manager_interface.h @@ -51,19 +51,6 @@ public: */ virtual ErrCode Publish(const std::string &label, const sptr ¬ification) = 0; - /** - * @brief Publishes a notification on a specified remote device. - * @note If a notification with the same ID has been published by the current application and has not been deleted, - * this method will update the notification. - * - * @param notification Indicates the NotificationRequest object for setting the notification content. - * This parameter must be specified. - * @param deviceId Indicates the ID of the remote device. If this parameter is null or an empty string, - * the notification will be published on the local device. - * @return Returns ERR_OK on success, others on failure. - */ - virtual ErrCode PublishToDevice(const sptr ¬ification, const std::string &deviceId) = 0; - /** * @brief Cancels a published notification matching the specified label and notificationId. * @@ -421,14 +408,6 @@ public: virtual ErrCode Unsubscribe( const sptr &subscriber, const sptr &info) = 0; - /** - * @brief Obtains whether notifications are suspended. - * - * @param suspended Indicates the suspended status. - * @return Returns ERR_OK on success, others on failure. - */ - virtual ErrCode AreNotificationsSuspended(bool &suspended) = 0; - /** * @brief Checks whether this device is allowed to publish notifications. * @@ -696,7 +675,7 @@ public: protected: enum TransactId : uint32_t { PUBLISH_NOTIFICATION = FIRST_CALL_TRANSACTION, - PUBLISH_NOTIFICATION_TO_DEVICE, + PUBLISH_NOTIFICATION_TO_DEVICE, // Obsolete CANCEL_NOTIFICATION, CANCEL_ALL_NOTIFICATIONS, CANCEL_AS_BUNDLE, @@ -741,7 +720,7 @@ protected: GET_SHOW_BADGE_ENABLED, SUBSCRIBE_NOTIFICATION, UNSUBSCRIBE_NOTIFICATION, - ARE_NOTIFICATION_SUSPENDED, + ARE_NOTIFICATION_SUSPENDED, // Obsolete GET_CURRENT_APP_SORTING, // Obsolete IS_ALLOWED_NOTIFY, IS_ALLOWED_NOTIFY_SELF, diff --git a/frameworks/core/include/ans_manager_proxy.h b/frameworks/core/include/ans_manager_proxy.h index fa922c65ccddd317cf0d3ca9b32d64eb8791a6b9..a2746a94ea205c86838405dd6a989b084f7cafdd 100644 --- a/frameworks/core/include/ans_manager_proxy.h +++ b/frameworks/core/include/ans_manager_proxy.h @@ -40,19 +40,6 @@ public: */ ErrCode Publish(const std::string &label, const sptr ¬ification) override; - /** - * @brief Publishes a notification on a specified remote device. - * @note If a notification with the same ID has been published by the current application and has not been deleted, - * this method will update the notification. - * - * @param notification Indicates the NotificationRequest object for setting the notification content. - * This parameter must be specified. - * @param deviceId Indicates the ID of the remote device. If this parameter is null or an empty string, - * the notification will be published on the local device. - * @return Returns ERR_OK on success, others on failure. - */ - ErrCode PublishToDevice(const sptr ¬ification, const std::string &deviceId) override; - /** * @brief Cancels a published notification matching the specified label and notificationId. * @@ -409,14 +396,6 @@ public: ErrCode Unsubscribe(const sptr &subscriber, const sptr &info) override; - /** - * @brief Obtains whether notifications are suspended. - * - * @param suspended Indicates the suspended status. - * @return Returns ERR_OK on success, others on failure. - */ - ErrCode AreNotificationsSuspended(bool &suspended) override; - /** * @brief Checks whether this device is allowed to publish notifications. * diff --git a/frameworks/core/include/ans_manager_stub.h b/frameworks/core/include/ans_manager_stub.h index 256fc2be882c1daef9b00674d5faf30b1df605f5..45b08aa899869cea895336495656f567afc653cb 100644 --- a/frameworks/core/include/ans_manager_stub.h +++ b/frameworks/core/include/ans_manager_stub.h @@ -53,20 +53,6 @@ public: */ virtual ErrCode Publish(const std::string &label, const sptr ¬ification) override; - /** - * @brief Publishes a notification on a specified remote device. - * @note If a notification with the same ID has been published by the current application and has not been deleted, - * this method will update the notification. - * - * @param notification Indicates the NotificationRequest object for setting the notification content. - * This parameter must be specified. - * @param deviceId Indicates the ID of the remote device. If this parameter is null or an empty string, - * the notification will be published on the local device. - * @return Returns ERR_OK on success, others on failure. - */ - virtual ErrCode PublishToDevice( - const sptr ¬ification, const std::string &deviceId) override; - /** * @brief Cancels a published notification matching the specified label and notificationId. * @@ -428,14 +414,6 @@ public: virtual ErrCode Unsubscribe( const sptr &subscriber, const sptr &info) override; - /** - * @brief Obtains whether notifications are suspended. - * - * @param suspended Indicates the suspended status. - * @return Returns ERR_OK on success, others on failure. - */ - virtual ErrCode AreNotificationsSuspended(bool &suspended) override; - /** * @brief Checks whether this device is allowed to publish notifications. * @@ -708,7 +686,6 @@ private: interfaces_; ErrCode HandlePublish(MessageParcel &data, MessageParcel &reply); - ErrCode HandlePublishToDevice(MessageParcel &data, MessageParcel &reply); ErrCode HandleCancel(MessageParcel &data, MessageParcel &reply); ErrCode HandleCancelAll(MessageParcel &data, MessageParcel &reply); ErrCode HandleCancelAsBundle(MessageParcel &data, MessageParcel &reply); @@ -748,7 +725,6 @@ private: ErrCode HandleGetShowBadgeEnabled(MessageParcel &data, MessageParcel &reply); ErrCode HandleSubscribe(MessageParcel &data, MessageParcel &reply); ErrCode HandleUnsubscribe(MessageParcel &data, MessageParcel &reply); - ErrCode HandleAreNotificationsSuspended(MessageParcel &data, MessageParcel &reply); ErrCode HandleIsAllowedNotify(MessageParcel &data, MessageParcel &reply); ErrCode HandleIsAllowedNotifySelf(MessageParcel &data, MessageParcel &reply); ErrCode HandleIsSpecialBundleAllowedNotify(MessageParcel &data, MessageParcel &reply); diff --git a/frameworks/core/include/ans_notification.h b/frameworks/core/include/ans_notification.h index 3df29e298c0aa19ab6f8786ad78dbe246f76d388..78e42e1f647492ca1793d8290535567eb3ef7dcb 100644 --- a/frameworks/core/include/ans_notification.h +++ b/frameworks/core/include/ans_notification.h @@ -123,19 +123,6 @@ public: */ ErrCode PublishNotification(const std::string &label, const NotificationRequest &request); - /** - * @brief Publishes a notification on a specified remote device. - * @note If a notification with the same ID has been published by the current application and has not been deleted, - * this method will update the notification. - * - * @param request Indicates the NotificationRequest object for setting the notification content. - * This parameter must be specified. - * @param deviceId Indicates the ID of the remote device. If this parameter is null or an empty string, - * the notification will be published on the local device. - * @return Returns publish notification result. - */ - ErrCode PublishNotification(const NotificationRequest &request, const std::string &deviceId); - /** * @brief Cancels a published notification. * @@ -277,15 +264,6 @@ public: */ ErrCode RequestEnableNotification(std::string &deviceId); - /** - * @brief Checks whether this application is in the suspended state.Applications in this state cannot publish - * notifications. - * - * @param suspended True if this application is suspended; returns false otherwise. - * @return Returns are notifications suspended. - */ - ErrCode AreNotificationsSuspended(bool &suspended); - /** * @brief Checks whether this application has permission to modify the Do Not Disturb (DND) notification policy. * diff --git a/frameworks/core/src/ans_manager_proxy.cpp b/frameworks/core/src/ans_manager_proxy.cpp index 0636b5a1eccbb405421c4ef838219d81286c9311..55ab4264ee1ff01ae32ca44d7d9c594f0381d5c6 100644 --- a/frameworks/core/src/ans_manager_proxy.cpp +++ b/frameworks/core/src/ans_manager_proxy.cpp @@ -73,45 +73,6 @@ ErrCode AnsManagerProxy::Publish(const std::string &label, const sptr ¬ification, const std::string &deviceId) -{ - if (notification == nullptr) { - ANS_LOGE("[PublishToDevice] fail: notification is null ptr."); - return ERR_ANS_INVALID_PARAM; - } - - MessageParcel data; - if (!data.WriteInterfaceToken(AnsManagerProxy::GetDescriptor())) { - ANS_LOGE("[PublishToDevice] fail: write interface token failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!data.WriteParcelable(notification)) { - ANS_LOGE("[PublishToDevice] fail: write notification parcelable failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!data.WriteString(deviceId)) { - ANS_LOGE("[PublishToDevice] fail: write deviceId failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - MessageParcel reply; - MessageOption option = {MessageOption::TF_SYNC}; - ErrCode result = InnerTransact(PUBLISH_NOTIFICATION_TO_DEVICE, option, data, reply); - if (result != ERR_OK) { - ANS_LOGE("[PublishToDevice] fail: transact ErrCode=%{public}d", result); - return ERR_ANS_TRANSACT_FAILED; - } - - if (!reply.ReadInt32(result)) { - ANS_LOGE("[PublishToDevice] fail: read result failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - return result; -} - ErrCode AnsManagerProxy::Cancel(int32_t notificationId, const std::string &label) { MessageParcel data; @@ -1447,35 +1408,6 @@ ErrCode AnsManagerProxy::Unsubscribe( return result; } -ErrCode AnsManagerProxy::AreNotificationsSuspended(bool &suspended) -{ - MessageParcel data; - if (!data.WriteInterfaceToken(AnsManagerProxy::GetDescriptor())) { - ANS_LOGE("[AreNotificationsSuspended] fail: write interface token failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - MessageParcel reply; - MessageOption option = {MessageOption::TF_SYNC}; - ErrCode result = InnerTransact(ARE_NOTIFICATION_SUSPENDED, option, data, reply); - if (result != ERR_OK) { - ANS_LOGE("[AreNotificationsSuspended] fail: transact ErrCode=%{public}d", result); - return ERR_ANS_TRANSACT_FAILED; - } - - if (!reply.ReadInt32(result)) { - ANS_LOGE("[AreNotificationsSuspended] fail: read result failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.ReadBool(suspended)) { - ANS_LOGE("[AreNotificationsSuspended] fail: read suspended failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - - return result; -} - ErrCode AnsManagerProxy::IsAllowedNotify(bool &allowed) { MessageParcel data; diff --git a/frameworks/core/src/ans_manager_stub.cpp b/frameworks/core/src/ans_manager_stub.cpp index 545cc24ec4c3e686c871dc5e630d9ad27d6a9f20..7cb5e25b85f43774cce7b1e8e05dabea3d25743c 100644 --- a/frameworks/core/src/ans_manager_stub.cpp +++ b/frameworks/core/src/ans_manager_stub.cpp @@ -31,9 +31,6 @@ const std::map notification = data.ReadParcelable(); - if (!notification) { - ANS_LOGE("[HandlePublishToDevice] fail: notification ReadParcelable failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - std::string deviceId; - if (!data.ReadString(deviceId)) { - ANS_LOGE("[HandlePublishToDevice] fail: read deviceId failed"); - return ERR_ANS_PARCELABLE_FAILED; - } - - ErrCode result = PublishToDevice(notification, deviceId); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandlePublishToDevice] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - ErrCode AnsManagerStub::HandleCancel(MessageParcel &data, MessageParcel &reply) { int32_t notificationId = 0; @@ -1145,22 +1117,6 @@ ErrCode AnsManagerStub::HandleUnsubscribe(MessageParcel &data, MessageParcel &re return ERR_OK; } -ErrCode AnsManagerStub::HandleAreNotificationsSuspended(MessageParcel &data, MessageParcel &reply) -{ - bool suspended = false; - ErrCode result = AreNotificationsSuspended(suspended); - if (!reply.WriteInt32(result)) { - ANS_LOGE("[HandleAreNotificationsSuspended] fail: write result failed, ErrCode=%{public}d", result); - return ERR_ANS_PARCELABLE_FAILED; - } - - if (!reply.WriteBool(suspended)) { - ANS_LOGE("[HandleAreNotificationsSuspended] fail: write suspended failed."); - return ERR_ANS_PARCELABLE_FAILED; - } - return ERR_OK; -} - ErrCode AnsManagerStub::HandleIsAllowedNotify(MessageParcel &data, MessageParcel &reply) { bool allowed = false; @@ -1802,12 +1758,6 @@ ErrCode AnsManagerStub::Publish(const std::string &label, const sptr ¬ification, const std::string &deviceId) -{ - ANS_LOGE("AnsManagerStub::PublishToDevice called!"); - return ERR_INVALID_OPERATION; -} - ErrCode AnsManagerStub::Cancel(int notificationId, const std::string &label) { ANS_LOGE("AnsManagerStub::Cancel called!"); @@ -2050,12 +2000,6 @@ ErrCode AnsManagerStub::Unsubscribe(const sptr &subscrib return ERR_INVALID_OPERATION; } -ErrCode AnsManagerStub::AreNotificationsSuspended(bool &suspended) -{ - ANS_LOGE("AnsManagerStub::AreNotificationsSuspended called!"); - return ERR_INVALID_OPERATION; -} - ErrCode AnsManagerStub::IsAllowedNotify(bool &allowed) { ANS_LOGE("AnsManagerStub::IsAllowedNotify called!"); diff --git a/frameworks/core/src/ans_notification.cpp b/frameworks/core/src/ans_notification.cpp index 4756c76e16e82410bbf46df2fbc83fcd1d8ab78e..4250175f3f27b60d5af41dd5200e83e757ec95ed 100644 --- a/frameworks/core/src/ans_notification.cpp +++ b/frameworks/core/src/ans_notification.cpp @@ -163,44 +163,6 @@ ErrCode AnsNotification::PublishNotification(const std::string &label, const Not return ansManagerProxy_->Publish(label, reqPtr); } -ErrCode AnsNotification::PublishNotification(const NotificationRequest &request, const std::string &deviceId) -{ - if (request.GetContent() == nullptr || request.GetNotificationType() == NotificationContent::Type::NONE) { - ANS_LOGE("Refuse to publish the notification without valid content"); - return ERR_ANS_INVALID_PARAM; - } - - if (!deviceId.empty() && - (IsNonDistributedNotificationType(request.GetNotificationType()))) { - ANS_LOGE("Refuse to publish the conversational and picture notification to the remote device"); - return ERR_ANS_INVALID_PARAM; - } - - if (!CanPublishMediaContent(request)) { - ANS_LOGE("Refuse to publish the notification because the sequence numbers actions not match those assigned to " - "added action buttons."); - return ERR_ANS_INVALID_PARAM; - } - - ErrCode checkErr = CheckImageSize(request); - if (checkErr != ERR_OK) { - ANS_LOGE("The size of one picture exceeds the limit"); - return checkErr; - } - - if (!GetAnsManagerProxy()) { - ANS_LOGE("GetAnsManagerProxy fail."); - return ERR_ANS_SERVICE_NOT_CONNECTED; - } - - sptr reqPtr = new (std::nothrow) NotificationRequest(request); - if (reqPtr == nullptr) { - ANS_LOGE("Failed to create NotificationRequest ptr"); - return ERR_ANS_NO_MEMORY; - } - return ansManagerProxy_->PublishToDevice(reqPtr, deviceId); -} - ErrCode AnsNotification::CancelNotification(int32_t notificationId) { return CancelNotification("", notificationId); @@ -374,15 +336,6 @@ ErrCode AnsNotification::RequestEnableNotification(std::string &deviceId) return ansManagerProxy_->RequestEnableNotification(deviceId); } -ErrCode AnsNotification::AreNotificationsSuspended(bool &suspended) -{ - if (!GetAnsManagerProxy()) { - ANS_LOGE("GetAnsManagerProxy fail."); - return ERR_ANS_SERVICE_NOT_CONNECTED; - } - return ansManagerProxy_->AreNotificationsSuspended(suspended); -} - ErrCode AnsNotification::HasNotificationPolicyAccessPermission(bool &hasPermission) { if (!GetAnsManagerProxy()) { diff --git a/frameworks/core/test/unittest/ans_manager_proxy_test/ans_manager_proxy_unit_test.cpp b/frameworks/core/test/unittest/ans_manager_proxy_test/ans_manager_proxy_unit_test.cpp index ce059b99dfc20f59a89ea052cc1fd1a195b96fa2..0a5923d3b3d2194c54d2a1c456c4fecd38973e60 100644 --- a/frameworks/core/test/unittest/ans_manager_proxy_test/ans_manager_proxy_unit_test.cpp +++ b/frameworks/core/test/unittest/ans_manager_proxy_test/ans_manager_proxy_unit_test.cpp @@ -354,146 +354,6 @@ HWTEST_F(AnsManagerProxyUnitTest, PublishTest_0600, Function | MediumTest | Leve EXPECT_EQ(ERR_ANS_PARCELABLE_FAILED, result); } -/* - * @tc.name: PublishToDeviceTest_0100 - * @tc.desc: test PublishToDevice function - * @tc.type: FUNC - * @tc.require: #I5XO2O - */ -HWTEST_F(AnsManagerProxyUnitTest, PublishToDeviceTest_0100, Function | MediumTest | Level1) -{ - GTEST_LOG_(INFO) - << "AnsManagerProxyUnitTest, PublishToDeviceTest_0100, TestSize.Level1"; - sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); - ASSERT_NE(nullptr, iremoteObject); - std::shared_ptr proxy = std::make_shared(iremoteObject); - ASSERT_NE(nullptr, proxy); - sptr notification = nullptr; - std::string deviceId = "Device"; - int32_t result = proxy->PublishToDevice(notification, deviceId); - EXPECT_EQ(ERR_ANS_INVALID_PARAM, result); -} - -/* - * @tc.name: PublishToDeviceTest_0200 - * @tc.desc: test PublishToDevice function - * @tc.type: FUNC - * @tc.require: #I5XO2O - */ -HWTEST_F(AnsManagerProxyUnitTest, PublishToDeviceTest_0200, Function | MediumTest | Level1) -{ - GTEST_LOG_(INFO) - << "AnsManagerProxyUnitTest, PublishToDeviceTest_0200, TestSize.Level1"; - MockWriteInterfaceToken(false); - sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); - ASSERT_NE(nullptr, iremoteObject); - std::shared_ptr proxy = std::make_shared(iremoteObject); - ASSERT_NE(nullptr, proxy); - NotificationRequest request(1); - sptr notification = new (std::nothrow) NotificationRequest(request); - ASSERT_NE(nullptr, notification); - std::string deviceId = "Device"; - int32_t result = proxy->PublishToDevice(notification, deviceId); - EXPECT_EQ(ERR_ANS_PARCELABLE_FAILED, result); -} - -/* - * @tc.name: PublishToDeviceTest_0300 - * @tc.desc: test PublishToDevice function - * @tc.type: FUNC - * @tc.require: #I5XO2O - */ -HWTEST_F(AnsManagerProxyUnitTest, PublishToDeviceTest_0300, Function | MediumTest | Level1) -{ - GTEST_LOG_(INFO) - << "AnsManagerProxyUnitTest, PublishToDeviceTest_0300, TestSize.Level1"; - MockWriteInterfaceToken(true); - sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); - ASSERT_NE(nullptr, iremoteObject); - std::shared_ptr proxy = std::make_shared(iremoteObject); - ASSERT_NE(nullptr, proxy); - NotificationRequest request(1); - sptr notification = new (std::nothrow) NotificationRequest(request); - ASSERT_NE(nullptr, notification); - std::string deviceId = ""; - int32_t result = proxy->PublishToDevice(notification, deviceId); - EXPECT_EQ(ERR_ANS_PARCELABLE_FAILED, result); -} - -/* - * @tc.name: PublishToDeviceTest_0400 - * @tc.desc: test PublishToDevice function - * @tc.type: FUNC - * @tc.require: #I5XO2O - */ -HWTEST_F(AnsManagerProxyUnitTest, PublishToDeviceTest_0400, Function | MediumTest | Level1) -{ - GTEST_LOG_(INFO) - << "AnsManagerProxyUnitTest, PublishToDeviceTest_0400, TestSize.Level1"; - sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); - ASSERT_NE(nullptr, iremoteObject); - EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)) - .WillRepeatedly(DoAll(Invoke(std::bind(SendRequestReplace, _1, _2, _3, _4, - ERR_OK, true, false, false)), Return(NO_ERROR))); - std::shared_ptr proxy = std::make_shared(iremoteObject); - ASSERT_NE(nullptr, proxy); - NotificationRequest request(1); - sptr notification = new (std::nothrow) NotificationRequest(request); - ASSERT_NE(nullptr, notification); - std::string deviceId = "Device"; - int32_t result = proxy->PublishToDevice(notification, deviceId); - EXPECT_EQ(ERR_OK, result); -} - -/* - * @tc.name: PublishToDeviceTest_0500 - * @tc.desc: test PublishToDevice function - * @tc.type: FUNC - * @tc.require: #I5XO2O - */ -HWTEST_F(AnsManagerProxyUnitTest, PublishToDeviceTest_0500, Function | MediumTest | Level1) -{ - GTEST_LOG_(INFO) - << "AnsManagerProxyUnitTest, PublishToDeviceTest_0500, TestSize.Level1"; - sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); - ASSERT_NE(nullptr, iremoteObject); - EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)).Times(1) - .WillRepeatedly(DoAll(Return(DEAD_OBJECT))); - std::shared_ptr proxy = std::make_shared(iremoteObject); - ASSERT_NE(nullptr, proxy); - NotificationRequest request(1); - sptr notification = new (std::nothrow) NotificationRequest(request); - ASSERT_NE(nullptr, notification); - std::string deviceId = "Device"; - int32_t result = proxy->PublishToDevice(notification, deviceId); - EXPECT_EQ(ERR_ANS_TRANSACT_FAILED, result); -} - -/* - * @tc.name: PublishToDeviceTest_0600 - * @tc.desc: test PublishToDevice function - * @tc.type: FUNC - * @tc.require: #I5XO2O - */ -HWTEST_F(AnsManagerProxyUnitTest, PublishToDeviceTest_0600, Function | MediumTest | Level1) -{ - GTEST_LOG_(INFO) - << "AnsManagerProxyUnitTest, PublishToDeviceTest_0600, TestSize.Level1"; - sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); - ASSERT_NE(nullptr, iremoteObject); - EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)).Times(1) - .WillRepeatedly(DoAll(Invoke(std::bind(SendRequestReplace, _1, _2, _3, _4, - ERR_OK, false, false, false)), Return(NO_ERROR))); - std::shared_ptr proxy = std::make_shared(iremoteObject); - ASSERT_NE(nullptr, proxy); - NotificationRequest request(1); - sptr notification = new (std::nothrow) NotificationRequest(request); - ASSERT_NE(nullptr, notification); - std::string deviceId = "Device"; - int32_t result = proxy->PublishToDevice(notification, deviceId); - EXPECT_EQ(ERR_ANS_PARCELABLE_FAILED, result); -} - /* * @tc.name: CancelTest_0100 * @tc.desc: test Cancel function @@ -1531,7 +1391,7 @@ HWTEST_F(AnsManagerProxyUnitTest, GetSlotNumAsBundleTest_0100, Function | Medium /* * @tc.name: GetSlotNumAsBundleTest_0200 - * @tc.desc: test PublishToDevice function + * @tc.desc: test GetSlotNumAsBundle function * @tc.type: FUNC * @tc.require: #I5XO2O */ @@ -4724,115 +4584,6 @@ HWTEST_F(AnsManagerProxyUnitTest, UnsubscribeTest_0500, Function | MediumTest | EXPECT_EQ(ERR_ANS_INVALID_PARAM, result); } -/* - * @tc.name: AreNotificationsSuspendedTest_0100 - * @tc.desc: test AreNotificationsSuspended function - * @tc.type: FUNC - * @tc.require: #I5XO2O - */ -HWTEST_F(AnsManagerProxyUnitTest, AreNotificationsSuspendedTest_0100, Function | MediumTest | Level1) -{ - GTEST_LOG_(INFO) - << "AnsManagerProxyUnitTest, AreNotificationsSuspendedTest_0100, TestSize.Level1"; - MockWriteInterfaceToken(false); - sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); - ASSERT_NE(nullptr, iremoteObject); - std::shared_ptr proxy = std::make_shared(iremoteObject); - ASSERT_NE(nullptr, proxy); - bool suspended = false; - int32_t result = proxy->AreNotificationsSuspended(suspended); - EXPECT_EQ(ERR_ANS_PARCELABLE_FAILED, result); -} - -/* - * @tc.name: AreNotificationsSuspendedTest_0200 - * @tc.desc: test AreNotificationsSuspended function - * @tc.type: FUNC - * @tc.require: #I5XO2O - */ -HWTEST_F(AnsManagerProxyUnitTest, AreNotificationsSuspendedTest_0200, Function | MediumTest | Level1) -{ - GTEST_LOG_(INFO) - << "AnsManagerProxyUnitTest, AreNotificationsSuspendedTest_0200, TestSize.Level1"; - MockWriteInterfaceToken(true); - sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); - ASSERT_NE(nullptr, iremoteObject); - EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)) - .WillRepeatedly(DoAll(Invoke(std::bind(SendRequestReplace, _1, _2, _3, _4, - ERR_OK, true, true, true)), Return(NO_ERROR))); - std::shared_ptr proxy = std::make_shared(iremoteObject); - ASSERT_NE(nullptr, proxy); - bool suspended = false; - int32_t result = proxy->AreNotificationsSuspended(suspended); - EXPECT_EQ(ERR_OK, result); - EXPECT_EQ(true, suspended); -} - -/* - * @tc.name: AreNotificationsSuspendedTest_0300 - * @tc.desc: test AreNotificationsSuspended function - * @tc.type: FUNC - * @tc.require: #I5XO2O - */ -HWTEST_F(AnsManagerProxyUnitTest, AreNotificationsSuspendedTest_0300, Function | MediumTest | Level1) -{ - GTEST_LOG_(INFO) - << "AnsManagerProxyUnitTest, AreNotificationsSuspendedTest_0300, TestSize.Level1"; - sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); - ASSERT_NE(nullptr, iremoteObject); - EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)).Times(1) - .WillRepeatedly(DoAll(Return(DEAD_OBJECT))); - std::shared_ptr proxy = std::make_shared(iremoteObject); - ASSERT_NE(nullptr, proxy); - bool suspended = false; - int32_t result = proxy->AreNotificationsSuspended(suspended); - EXPECT_EQ(ERR_ANS_TRANSACT_FAILED, result); -} - -/* - * @tc.name: AreNotificationsSuspendedTest_0400 - * @tc.desc: test AreNotificationsSuspended function - * @tc.type: FUNC - * @tc.require: #I5XO2O - */ -HWTEST_F(AnsManagerProxyUnitTest, AreNotificationsSuspendedTest_0400, Function | MediumTest | Level1) -{ - GTEST_LOG_(INFO) - << "AnsManagerProxyUnitTest, AreNotificationsSuspendedTest_0400, TestSize.Level1"; - sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); - ASSERT_NE(nullptr, iremoteObject); - EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)).Times(1) - .WillRepeatedly(DoAll(Invoke(std::bind(SendRequestReplace, _1, _2, _3, _4, - ERR_OK, false, true, true)), Return(NO_ERROR))); - std::shared_ptr proxy = std::make_shared(iremoteObject); - ASSERT_NE(nullptr, proxy); - bool suspended = false; - int32_t result = proxy->AreNotificationsSuspended(suspended); - EXPECT_EQ(ERR_ANS_PARCELABLE_FAILED, result); -} - -/* - * @tc.name: AreNotificationsSuspendedTest_0500 - * @tc.desc: test AreNotificationsSuspended function - * @tc.type: FUNC - * @tc.require: #I5XO2O - */ -HWTEST_F(AnsManagerProxyUnitTest, AreNotificationsSuspendedTest_0500, Function | MediumTest | Level1) -{ - GTEST_LOG_(INFO) - << "AnsManagerProxyUnitTest, AreNotificationsSuspendedTest_0500, TestSize.Level1"; - sptr iremoteObject = new (std::nothrow) MockIRemoteObject(); - ASSERT_NE(nullptr, iremoteObject); - EXPECT_CALL(*iremoteObject, SendRequest(_, _, _, _)).Times(1) - .WillRepeatedly(DoAll(Invoke(std::bind(SendRequestReplace, _1, _2, _3, _4, - ERR_OK, true, true, false)), Return(NO_ERROR))); - std::shared_ptr proxy = std::make_shared(iremoteObject); - ASSERT_NE(nullptr, proxy); - bool suspended = false; - int32_t result = proxy->AreNotificationsSuspended(suspended); - EXPECT_EQ(ERR_ANS_PARCELABLE_FAILED, result); -} - /* * @tc.name: IsAllowedNotifyTest_0100 * @tc.desc: test IsAllowedNotify function @@ -6049,7 +5800,7 @@ HWTEST_F(AnsManagerProxyUnitTest, IsDistributedEnableByBundleTest_0100, Function /* * @tc.name: IsDistributedEnableByBundleTest_0200 - * @tc.desc: test PublishToDevice function + * @tc.desc: test IsDistributedEnableByBundle function * @tc.type: FUNC * @tc.require: #I5XO2O */ diff --git a/frameworks/core/test/unittest/ans_manager_stub_test/ans_manager_stub_test.cpp b/frameworks/core/test/unittest/ans_manager_stub_test/ans_manager_stub_test.cpp index ab12c0e3ed93b6abd1edd07a64d80e86e5782d73..d3a867d9d7f279b2c724bc46c15903740d3f43d7 100644 --- a/frameworks/core/test/unittest/ans_manager_stub_test/ans_manager_stub_test.cpp +++ b/frameworks/core/test/unittest/ans_manager_stub_test/ans_manager_stub_test.cpp @@ -145,71 +145,6 @@ HWTEST_F(AnsManagerStubTest, HandlePublish03, Function | SmallTest | Level1) EXPECT_EQ(ret, (int)ERR_ANS_PARCELABLE_FAILED); } -/** - * @tc.name: HandlePublishToDevice01 - * @tc.desc: Test HandlePublishToDevice succeeds; - * @tc.type: FUNC - * @tc.require: issueI5XQ4E - */ -HWTEST_F(AnsManagerStubTest, HandlePublishToDevice01, Function | SmallTest | Level1) -{ - uint32_t code = static_cast(AnsManagerInterface::TransactId::PUBLISH_NOTIFICATION_TO_DEVICE); - MessageParcel data; - MessageParcel reply; - MessageOption option = {MessageOption::TF_SYNC}; - - std::string deviceId = "this is a deviceId"; - sptr notification = new NotificationRequest(); - data.WriteInterfaceToken(AnsManagerStub::GetDescriptor()); - data.WriteParcelable(notification); - data.WriteString(deviceId); - - ErrCode ret = ansManagerStub_->OnRemoteRequest(code, data, reply, option); - EXPECT_EQ(ret, (int)NO_ERROR); -} - -/** - * @tc.name: HandlePublishToDevice02 - * @tc.desc: Test if the notification is null. - * @tc.type: FUNC - * @tc.require: issueI5XQ4E - */ -HWTEST_F(AnsManagerStubTest, HandlePublishToDevice02, Function | SmallTest | Level1) -{ - uint32_t code = static_cast(AnsManagerInterface::TransactId::PUBLISH_NOTIFICATION_TO_DEVICE); - MessageParcel data; - MessageParcel reply; - MessageOption option = {MessageOption::TF_SYNC}; - - std::string deviceId = "this is a deviceId"; - data.WriteInterfaceToken(AnsManagerStub::GetDescriptor()); - data.WriteString(deviceId); - - ErrCode ret = ansManagerStub_->OnRemoteRequest(code, data, reply, option); - EXPECT_EQ(ret, (int)ERR_ANS_PARCELABLE_FAILED); -} - -/** - * @tc.name: HandlePublishToDevice03 - * @tc.desc: Test if the deviceId in data is null. - * @tc.type: FUNC - * @tc.require: issueI5XQ4E - */ -HWTEST_F(AnsManagerStubTest, HandlePublishToDevice03, Function | SmallTest | Level1) -{ - uint32_t code = static_cast(AnsManagerInterface::TransactId::PUBLISH_NOTIFICATION_TO_DEVICE); - MessageParcel data; - MessageParcel reply; - MessageOption option = {MessageOption::TF_SYNC}; - - sptr notification = new NotificationRequest(); - data.WriteInterfaceToken(AnsManagerStub::GetDescriptor()); - data.WriteParcelable(notification); - - ErrCode ret = ansManagerStub_->OnRemoteRequest(code, data, reply, option); - EXPECT_EQ(ret, (int)ERR_ANS_PARCELABLE_FAILED); -} - /** * @tc.name: HandleCancel01 * @tc.desc: Test HandleCancel succeeds @@ -2165,28 +2100,6 @@ HWTEST_F(AnsManagerStubTest, HandleUnsubscribe04, Function | SmallTest | Level1) EXPECT_EQ(ret, (int)ERR_ANS_PARCELABLE_FAILED); } -/** - * @tc.name: HandleAreNotificationsSuspended01 - * @tc.desc: Test HandleAreNotificationsSuspended succeed. - * @tc.type: FUNC - * @tc.require: issueI620XB - */ -HWTEST_F(AnsManagerStubTest, HandleAreNotificationsSuspended01, Function | SmallTest | Level1) -{ - uint32_t code = static_cast(AnsManagerInterface::TransactId::ARE_NOTIFICATION_SUSPENDED); - MessageParcel data; - MessageParcel reply; - MessageOption option = {MessageOption::TF_SYNC}; - - bool suspended = true; - - data.WriteInterfaceToken(AnsManagerStub::GetDescriptor()); - data.WriteBool(suspended); - - ErrCode ret = ansManagerStub_->OnRemoteRequest(code, data, reply, option); - EXPECT_EQ(ret, (int)ERR_OK); -} - /** * @tc.name: HandleIsAllowedNotify01 * @tc.desc: Test HandleIsAllowedNotify succeed. @@ -3861,20 +3774,6 @@ HWTEST_F(AnsManagerStubTest, GetShowBadgeEnabled01, Function | SmallTest | Level EXPECT_EQ(result, (int)ERR_INVALID_OPERATION); } -/** - * @tc.name: AreNotificationsSuspended01 - * @tc.desc: Test AreNotificationsSuspended return. - * @tc.type: FUNC - * @tc.require: issueI620XB - */ -HWTEST_F(AnsManagerStubTest, AreNotificationsSuspended01, Function | SmallTest | Level1) -{ - bool suspended = true; - - ErrCode result = ansManagerStub_->AreNotificationsSuspended(suspended); - EXPECT_EQ(result, (int)ERR_INVALID_OPERATION); -} - /** * @tc.name: IsAllowedNotify01 * @tc.desc: Test IsAllowedNotify return. diff --git a/frameworks/core/test/unittest/ans_notification_annex_test/ans_notification_annex_test.cpp b/frameworks/core/test/unittest/ans_notification_annex_test/ans_notification_annex_test.cpp index d83c3d43703ba03cdace81ecfdbc8c560a9d7202..950d8f081f04bb7389cc02148aad612fa2657353 100644 --- a/frameworks/core/test/unittest/ans_notification_annex_test/ans_notification_annex_test.cpp +++ b/frameworks/core/test/unittest/ans_notification_annex_test/ans_notification_annex_test.cpp @@ -99,41 +99,6 @@ HWTEST_F(AnsNotificationUnitAnnexTest, PublishNotification_0100, Function | Medi EXPECT_EQ(ret1, ERR_ANS_INVALID_PARAM); } -/* - * @tc.name: PublishNotification_0200 - * @tc.desc: test PublishNotification ErrCode ERR_ANS_INVALID_PARAM. - * @tc.type: FUNC - * @tc.require: #I62SME - */ -HWTEST_F(AnsNotificationUnitAnnexTest, PublishNotification_0200, Function | MediumTest | Level1) -{ - std::string deviceId = "this is deviceId"; - NotificationRequest request; - request.SetContent(nullptr); - - ErrCode ret1 = ans_->PublishNotification(request, deviceId); - EXPECT_EQ(ret1, ERR_ANS_INVALID_PARAM); -} - -/* - * @tc.name: PublishNotification_0300 - * @tc.desc: test PublishNotification ErrCode ERR_ANS_INVALID_PARAM. - * @tc.type: FUNC - * @tc.require: #I62SME - */ -HWTEST_F(AnsNotificationUnitAnnexTest, PublishNotification_0300, Function | MediumTest | Level1) -{ - std::string deviceId = ""; - NotificationRequest request; - std::shared_ptr normalContent = std::make_shared(); - std::shared_ptr content = std::make_shared(normalContent); - request.SetContent(content); - bool res = ans_->CanPublishMediaContent(request); - EXPECT_EQ(res, true); - ErrCode ret1 = ans_->PublishNotification(request, deviceId); - EXPECT_EQ(ret1, ERR_INVALID_OPERATION); -} - /* * @tc.name: PublishNotificationAsBundle_0100 * @tc.desc: test PublishNotificationAsBundle ErrCode ERR_ANS_INVALID_PARAM. diff --git a/frameworks/core/test/unittest/ans_notification_test/ans_notification_unit_test.cpp b/frameworks/core/test/unittest/ans_notification_test/ans_notification_unit_test.cpp index dc05f95c53e52655ea0b22c1b702d26cb87a5da4..ed2b116786cbc09218a9e34c2f993668133c966a 100644 --- a/frameworks/core/test/unittest/ans_notification_test/ans_notification_unit_test.cpp +++ b/frameworks/core/test/unittest/ans_notification_test/ans_notification_unit_test.cpp @@ -224,9 +224,6 @@ HWTEST_F(AnsNotificationUnitTest, PublishNotification_0100, Function | MediumTes request.SetContent(content); ErrCode ret1 = ans_->PublishNotification(label, request); EXPECT_EQ(ret1, ERR_ANS_SERVICE_NOT_CONNECTED); - std::string deviceId = "this is deviceId"; - ErrCode ret2 = ans_->PublishNotification(request, deviceId); - EXPECT_EQ(ret2, ERR_ANS_SERVICE_NOT_CONNECTED); int32_t notificationId = 10; ErrCode ret3 = ans_->CancelNotification(label, notificationId); EXPECT_EQ(ret3, ERR_ANS_SERVICE_NOT_CONNECTED); @@ -360,9 +357,6 @@ HWTEST_F(AnsNotificationUnitTest, RequestEnableNotification_0100, Function | Med std::string deviceId = "this is deviceId"; ErrCode ret1 = ans_->RequestEnableNotification(deviceId); EXPECT_EQ(ret1, ERR_ANS_SERVICE_NOT_CONNECTED); - bool suspended = true; - ErrCode ret2 = ans_->AreNotificationsSuspended(suspended); - EXPECT_EQ(ret2, ERR_ANS_SERVICE_NOT_CONNECTED); bool hasPermission = true; ErrCode ret3 = ans_->HasNotificationPolicyAccessPermission(hasPermission); EXPECT_EQ(ret3, ERR_ANS_SERVICE_NOT_CONNECTED); diff --git a/interfaces/inner_api/notification_helper.h b/interfaces/inner_api/notification_helper.h index 05a8e8f753bdc3941b0168e59c53e9004f093ec4..73d6c7e186d23f15086ff7993c8555956538b61d 100644 --- a/interfaces/inner_api/notification_helper.h +++ b/interfaces/inner_api/notification_helper.h @@ -124,19 +124,6 @@ public: */ static ErrCode PublishNotification(const std::string &label, const NotificationRequest &request); - /** - * @brief Publishes a notification on a specified remote device. - * @note If a notification with the same ID has been published by the current application and has not been deleted, - * this method will update the notification. - * - * @param request Indicates the NotificationRequest object for setting the notification content. - * This parameter must be specified. - * @param deviceId Indicates the ID of the remote device. If this parameter is null or an empty string, - * the notification will be published on the local device. - * @return Returns publish notification result. - */ - static ErrCode PublishNotification(const NotificationRequest &request, const std::string &deviceId); - /** * @brief Cancels a published notification. * @@ -279,15 +266,6 @@ public: */ static ErrCode RequestEnableNotification(std::string &deviceId); - /** - * @brief Checks whether this application is in the suspended state.Applications in this state cannot publish - * notifications. - * - * @param suspended True if this application is suspended; false otherwise. - * @return Returns are notifications suspended. - */ - static ErrCode AreNotificationsSuspended(bool &suspended); - /** * @brief Checks whether this application has permission to modify the Do Not Disturb (DND) notification policy. * diff --git a/test/fuzztest/ansmanagerstub_fuzzer/ansmanagerstub_fuzzer.cpp b/test/fuzztest/ansmanagerstub_fuzzer/ansmanagerstub_fuzzer.cpp index 75cf95b1f3f3a184e2ec840c91afe44ce71f585a..346b645a45dd27a4c98d0bf6619a69969b8d6e9b 100644 --- a/test/fuzztest/ansmanagerstub_fuzzer/ansmanagerstub_fuzzer.cpp +++ b/test/fuzztest/ansmanagerstub_fuzzer/ansmanagerstub_fuzzer.cpp @@ -34,7 +34,6 @@ namespace OHOS { MessageOption flags; ansManagerStub.OnRemoteRequest(code, datas, reply, flags); ansManagerStub.HandlePublish(datas, reply); - ansManagerStub.HandlePublishToDevice(datas, reply); ansManagerStub.HandleCancel(datas, reply); ansManagerStub.HandleCancelAll(datas, reply); ansManagerStub.HandleCancelAsBundle(datas, reply); @@ -79,7 +78,6 @@ namespace OHOS { ansManagerStub.HandleGetShowBadgeEnabled(datas, reply); ansManagerStub.HandleSubscribe(datas, reply); ansManagerStub.HandleUnsubscribe(datas, reply); - ansManagerStub.HandleAreNotificationsSuspended(datas, reply); ansManagerStub.HandleIsAllowedNotify(datas, reply); ansManagerStub.HandleIsAllowedNotifySelf(datas, reply); ansManagerStub.HandleIsSpecialBundleAllowedNotify(datas, reply); @@ -110,7 +108,6 @@ namespace OHOS { const std::string label = "this is a notification label"; ansManagerStub.Publish(label, notification); const std::string deviceId = "this is a notification deviceId"; - ansManagerStub.PublishToDevice(notification, deviceId); int notificationId = 1; ansManagerStub.Cancel(notificationId, label); ansManagerStub.CancelAll(); @@ -167,8 +164,6 @@ namespace OHOS { ansManagerStub.SetShowBadgeEnabledForBundle(bundleOption, enabled); ansManagerStub.GetShowBadgeEnabledForBundle(bundleOption, enabled); ansManagerStub.GetShowBadgeEnabled(enabled); - bool suspended = true; - ansManagerStub.AreNotificationsSuspended(suspended); bool allowed = true; ansManagerStub.IsAllowedNotify(allowed); ansManagerStub.IsSpecialBundleAllowedNotify(bundleOption, allowed); diff --git a/test/fuzztest/ansmanagerstubannex_fuzzer/ansmanagerstubannex_fuzzer.cpp b/test/fuzztest/ansmanagerstubannex_fuzzer/ansmanagerstubannex_fuzzer.cpp index 6f38a8ff510265c5acab6177b70786f385954e49..5b88683ab4f6f763fa8c6c7e191b37300833bb32 100644 --- a/test/fuzztest/ansmanagerstubannex_fuzzer/ansmanagerstubannex_fuzzer.cpp +++ b/test/fuzztest/ansmanagerstubannex_fuzzer/ansmanagerstubannex_fuzzer.cpp @@ -40,7 +40,6 @@ namespace OHOS { ansManagerStub.HandleGetShowBadgeEnabled(datas, reply); ansManagerStub.HandleSubscribe(datas, reply); ansManagerStub.HandleUnsubscribe(datas, reply); - ansManagerStub.HandleAreNotificationsSuspended(datas, reply); ansManagerStub.HandleIsAllowedNotify(datas, reply); ansManagerStub.HandleIsAllowedNotifySelf(datas, reply); ansManagerStub.HandleIsSpecialBundleAllowedNotify(datas, reply); diff --git a/test/fuzztest/ansmanagerstubannexthree_fuzzer/ansmanagerstubannexthree_fuzzer.cpp b/test/fuzztest/ansmanagerstubannexthree_fuzzer/ansmanagerstubannexthree_fuzzer.cpp index ef99f9d9d647efbc3b7a1a487297fafd051e958a..712eab91232ca1937db5bce4ef6b89514b97fdf0 100644 --- a/test/fuzztest/ansmanagerstubannexthree_fuzzer/ansmanagerstubannexthree_fuzzer.cpp +++ b/test/fuzztest/ansmanagerstubannexthree_fuzzer/ansmanagerstubannexthree_fuzzer.cpp @@ -47,7 +47,6 @@ namespace OHOS { ansManagerStub.SetShowBadgeEnabledForBundle(bundleOption, allow); ansManagerStub.GetShowBadgeEnabledForBundle(bundleOption, allow); ansManagerStub.GetShowBadgeEnabled(allow); - ansManagerStub.AreNotificationsSuspended(allow); ansManagerStub.IsAllowedNotify(allow); ansManagerStub.IsAllowedNotifySelf(allow); ansManagerStub.IsSpecialBundleAllowedNotify(bundleOption, allow); diff --git a/test/fuzztest/ansmanagerstubannextwo_fuzzer/ansmanagerstubannextwo_fuzzer.cpp b/test/fuzztest/ansmanagerstubannextwo_fuzzer/ansmanagerstubannextwo_fuzzer.cpp index e310e1843609586b6d13a5445319ca08e1b9eb57..bece687cf1ef56f19a8e992f907cb2b6ea0fc2ef 100644 --- a/test/fuzztest/ansmanagerstubannextwo_fuzzer/ansmanagerstubannextwo_fuzzer.cpp +++ b/test/fuzztest/ansmanagerstubannextwo_fuzzer/ansmanagerstubannextwo_fuzzer.cpp @@ -36,7 +36,6 @@ namespace OHOS { std::string stringData(data); sptr notification = new Notification::NotificationRequest(); ansManagerStub.Publish(stringData, notification); - ansManagerStub.PublishToDevice(notification, stringData); int notificationId = 1; ansManagerStub.Cancel(notificationId, stringData); ansManagerStub.CancelAll(); diff --git a/test/fuzztest/publishnotification_fuzzer/publishnotification_fuzzer.cpp b/test/fuzztest/publishnotification_fuzzer/publishnotification_fuzzer.cpp index e22f9aec83d76cd19b7ece9f6cb309287d61e3fe..4cf4e067ec728c4f70e8cc5fabbdbbd78c93aded 100644 --- a/test/fuzztest/publishnotification_fuzzer/publishnotification_fuzzer.cpp +++ b/test/fuzztest/publishnotification_fuzzer/publishnotification_fuzzer.cpp @@ -75,8 +75,6 @@ namespace OHOS { Notification::NotificationConstant::SlotType slotType = Notification::NotificationConstant::SlotType(types); request.SetSlotType(slotType); - Notification::NotificationHelper::PublishNotification(request, stringData); - Notification::NotificationHelper::PublishNotification(request); // test GetActiveNotifications function sptr requester = new Notification::NotificationRequest(request); diff --git a/test/fuzztest/setnotificationbadgenum_fuzzer/setnotificationbadgenum_fuzzer.cpp b/test/fuzztest/setnotificationbadgenum_fuzzer/setnotificationbadgenum_fuzzer.cpp index 2ba0e8a3cc28649a675dd68ca6c72ed5fdbf0785..08dafc8cb2bb8b84cc596c42a4626266bd04440c 100644 --- a/test/fuzztest/setnotificationbadgenum_fuzzer/setnotificationbadgenum_fuzzer.cpp +++ b/test/fuzztest/setnotificationbadgenum_fuzzer/setnotificationbadgenum_fuzzer.cpp @@ -22,9 +22,6 @@ namespace OHOS { // test RequestEnableNotification function std::string deviceId(data); Notification::NotificationHelper::RequestEnableNotification(deviceId); - // test AreNotificationsSuspended function - bool suspended = true; - Notification::NotificationHelper::AreNotificationsSuspended(suspended); // test HasNotificationPolicyAccessPermission function bool hasPermission = true; Notification::NotificationHelper::HasNotificationPolicyAccessPermission(hasPermission); diff --git a/test/resource/notificationfuzztest/notificationfuzzconfig/config.json b/test/resource/notificationfuzztest/notificationfuzzconfig/config.json index fa0543ecb3e764f09b99e6e4fa3eb3792f207eef..d5c2c34c0168eafc730442e5793f0d39ba83fa57 100644 --- a/test/resource/notificationfuzztest/notificationfuzzconfig/config.json +++ b/test/resource/notificationfuzztest/notificationfuzzconfig/config.json @@ -53,7 +53,6 @@ "SetNotificationBadgeNum": [], "SetNotificationBadgeNumint32_t": [], "IsAllowedNotifybool": [], - "AreNotificationsSuspended": [], "HasNotificationPolicyAccessPermission": [], "GetBundleImportance": [], "SubscribeNotificationNotificationSubscriber": [], diff --git a/test/resource/notificationfuzztest/src/notificationfuzztestmanager.cpp b/test/resource/notificationfuzztest/src/notificationfuzztestmanager.cpp index 70ef0884211ec2c254b1a4f0cfbc71071334a089..63dd8a272eb23e051a339b464d1e8a91100506a9 100644 --- a/test/resource/notificationfuzztest/src/notificationfuzztestmanager.cpp +++ b/test/resource/notificationfuzztest/src/notificationfuzztestmanager.cpp @@ -64,10 +64,6 @@ void NotificationFuzzTestManager::RegisterNotificationHelper() OHOS::Notification::NotificationHelper::PublishNotification(GetStringParam(), *GetParamNotificationRequest()); }); - callFunctionMap_.emplace("NotificationHelperPublishNotificationNotificationRequeststring", []() { - OHOS::Notification::NotificationHelper::PublishNotification(*GetParamNotificationRequest(), GetStringParam()); - }); - callFunctionMap_.emplace("NotificationHelperCancelNotificationint32_t", []() { OHOS::Notification::NotificationHelper::CancelNotification(GetS32Param()); }); @@ -118,11 +114,6 @@ void NotificationFuzzTestManager::RegisterNotificationHelper() OHOS::Notification::NotificationHelper::IsAllowedNotify(allowed); }); - callFunctionMap_.emplace("NotificationHelperAreNotificationsSuspended", []() { - bool suspended = GetBoolParam(); - OHOS::Notification::NotificationHelper::AreNotificationsSuspended(suspended); - }); - callFunctionMap_.emplace("NotificationHelperHasNotificationPolicyAccessPermission", []() { bool hasPermission = GetBoolParam(); OHOS::Notification::NotificationHelper::HasNotificationPolicyAccessPermission(hasPermission);