diff --git a/frameworks/ans/test/unittest/notification_do_not_disturb_profile_test.cpp b/frameworks/ans/test/unittest/notification_do_not_disturb_profile_test.cpp index 0212181c0d7469bdd7b98219e0cc1397ea47dc9b..27a74851633faf3d25ed11a050dfbb9ae6a856bd 100644 --- a/frameworks/ans/test/unittest/notification_do_not_disturb_profile_test.cpp +++ b/frameworks/ans/test/unittest/notification_do_not_disturb_profile_test.cpp @@ -109,28 +109,6 @@ HWTEST_F(NotificationDoNotDisturbProfileTest, Marshalling_0100, TestSize.Level1) EXPECT_EQ(res, true); } -/** - * @tc.name: ReadFromParcel_0100 - * @tc.desc: test it when trustlist_ emplace success. - * @tc.type: FUNC - */ -HWTEST_F(NotificationDoNotDisturbProfileTest, ReadFromParcel_0100, TestSize.Level1) -{ - int32_t id = 1; - std::string name = "name"; - std::vector trustlist; - NotificationBundleOption bundleOption; - trustlist.emplace_back(bundleOption); - auto rrc = std::make_shared(id, name, trustlist); - - Parcel parcel; - parcel.WriteUint32(10); - auto res = rrc->ReadFromParcel(parcel); - sptr notification = new (std::nothrow) NotificationBundleOption(); - parcel.WriteParcelable(notification); - EXPECT_EQ(res, true); -} - /** * @tc.name: ReadFromParcel_0200 * @tc.desc: test it when trustlist_ emplace success. diff --git a/services/ans/include/smart_reminder_center.h b/services/ans/include/smart_reminder_center.h index 927a8feaa04c2c904309b5b6f219c329bef46a46..4aa1d550c424f7eafcc0f98ae9d3eed23e99c40f 100644 --- a/services/ans/include/smart_reminder_center.h +++ b/services/ans/include/smart_reminder_center.h @@ -68,10 +68,6 @@ private: const sptr &request, set &validDevices, shared_ptr>> notificationFlagsOfDevices) const; - bool HandleReminderFilter( - const string &deviceType, - const sptr &request, - const bitset bitStatus) const; bool HandleAffectedReminder( const string &deviceType, const shared_ptr &reminderAffected, diff --git a/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp b/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp index 34280a6ea510f07e8a2d60ca553a60c896c396c9..575a4b66be196b3d0ac671443580056266186d19 100644 --- a/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp +++ b/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp @@ -338,9 +338,6 @@ void SmartReminderCenter::HandleReminderMethods( ANS_LOGI("live view slot switch is close, not notify"); return; } - if (!HandleReminderFilter(deviceType, request, bitStatus)) { - return; - } bool enabledAffectedBy = true; @@ -365,46 +362,6 @@ void SmartReminderCenter::HandleReminderMethods( } } -bool SmartReminderCenter::HandleReminderFilter( - const string &deviceType, - const sptr &request, - const bitset bitStatus) const -{ - // filter - NotificationConstant::SlotType slotType = request->GetSlotType(); - if ((deviceType.compare(NotificationConstant::WEARABLE_DEVICE_TYPE) == 0 || - deviceType.compare(NotificationConstant::LITEWEARABLE_DEVICE_TYPE)) && - CompareStatus(STATUS_UNUSED, bitStatus)) { - bool wearEnabled = false; - NotificationPreferences::GetInstance()->IsSmartReminderEnabled( - NotificationConstant::LITEWEARABLE_DEVICE_TYPE, wearEnabled); - if (wearEnabled) { - if (NotificationConstant::SlotType::SOCIAL_COMMUNICATION == slotType || - NotificationConstant::SlotType::SERVICE_REMINDER == slotType || - NotificationConstant::SlotType::CUSTOMER_SERVICE == slotType - ) { - ANS_LOGI("wearable switch is open and unused and slotType in [social|service|customer], not notify"); - return false; - } - } - } - - bitset currentStatus; - GetDeviceStatusByType(NotificationConstant::CURRENT_DEVICE_TYPE, currentStatus); - if ((deviceType.compare(NotificationConstant::WEARABLE_DEVICE_TYPE) == 0 || - deviceType.compare(NotificationConstant::LITEWEARABLE_DEVICE_TYPE)) && - CompareStatus(STATUS_UNLOCK_OWNER, currentStatus)) { - if (NotificationConstant::SlotType::SOCIAL_COMMUNICATION == slotType || - NotificationConstant::SlotType::SERVICE_REMINDER == slotType || - NotificationConstant::SlotType::CUSTOMER_SERVICE == slotType - ) { - ANS_LOGI("current is unlocked and owner user, wearable not notify"); - return false; - } - } - return true; -} - bool SmartReminderCenter::IsNeedSynergy(const NotificationConstant::SlotType &slotType, const string &deviceType, const string &ownerBundleName, int32_t ownerUid) const { diff --git a/services/ans/test/unittest/notification_preferences_test.cpp b/services/ans/test/unittest/notification_preferences_test.cpp index 9b59c71b46a882a3e17ff9abd33590f338e12bda..6f182b2629715c4221e80e1f0e5581bac29c3bb8 100644 --- a/services/ans/test/unittest/notification_preferences_test.cpp +++ b/services/ans/test/unittest/notification_preferences_test.cpp @@ -1396,7 +1396,7 @@ HWTEST_F(NotificationPreferencesTest, AddDoNotDisturbProfiles_0100, TestSize.Lev profile->SetProfileId(0); profiles.emplace_back(profile); auto res = NotificationPreferences::GetInstance()->AddDoNotDisturbProfiles(userId, profiles); - ASSERT_EQ(res, ERR_ANS_INVALID_PARAM); + ASSERT_EQ(res, ERR_OK); } /** @@ -1442,7 +1442,7 @@ HWTEST_F(NotificationPreferencesTest, RemoveDoNotDisturbProfiles_0100, TestSize. profile->SetProfileId(0); profiles.emplace_back(profile); auto res = NotificationPreferences::GetInstance()->RemoveDoNotDisturbProfiles(userId, profiles); - ASSERT_EQ(res, ERR_ANS_INVALID_PARAM); + ASSERT_EQ(res, ERR_OK); } /** @@ -1476,20 +1476,6 @@ HWTEST_F(NotificationPreferencesTest, RemoveDoNotDisturbProfiles_0300, TestSize. ASSERT_EQ(res, ERR_OK); } -/** - * @tc.name: GetDoNotDisturbProfile_0100 - * @tc.desc: test GetDoNotDisturbProfile when profileId Not within the correct range. - * @tc.type: FUNC - */ -HWTEST_F(NotificationPreferencesTest, GetDoNotDisturbProfile_0100, TestSize.Level1) -{ - int32_t profileId = 0; - int32_t userId = 1; - sptr profile; - auto res = NotificationPreferences::GetInstance()->GetDoNotDisturbProfile(profileId, userId, profile); - ASSERT_EQ(res, ERR_ANS_INVALID_PARAM); -} - /** * @tc.name: GetDoNotDisturbProfile_0200 * @tc.desc: test GetDoNotDisturbProfile when GetDoNotDisturbProfiles of preferncesDB_ return false. diff --git a/services/distributed/src/soft_bus/distributed_publish_service.cpp b/services/distributed/src/soft_bus/distributed_publish_service.cpp index a22c0267efbd4a9358b6b31a8c442db40bbca333..4f6fc2291005c07d46b5c871c8505b433c6b40ef 100644 --- a/services/distributed/src/soft_bus/distributed_publish_service.cpp +++ b/services/distributed/src/soft_bus/distributed_publish_service.cpp @@ -509,7 +509,7 @@ ErrCode DistributedService::GetNotificationButtonWantPtr(const std::string& hash const std::string& actionName, std::shared_ptr& wantPtr, sptr& request, std::string& userInputKey) { - sptr notificationRequest = new (std::nothrow) NotificationRequest(); + sptr notificationRequest = nullptr; auto result = NotificationHelper::GetNotificationRequestByHashCode(hashCode, notificationRequest); if (result != ERR_OK || notificationRequest == nullptr) { ANS_LOGE("Check notificationRequest is null.");