From c65a3b45c12e93afb31f8f6c6ba69978e77235af Mon Sep 17 00:00:00 2001 From: songbao1 Date: Wed, 19 Mar 2025 16:33:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=89=8B=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: songbao1 --- services/ans/include/smart_reminder_center.h | 4 -- .../smart_reminder_center.cpp | 43 ------------------- 2 files changed, 47 deletions(-) diff --git a/services/ans/include/smart_reminder_center.h b/services/ans/include/smart_reminder_center.h index 927a8feaa..4aa1d550c 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 34280a6ea..575a4b66b 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 { -- Gitee From 8d7778e4adcb4235dcac08c2fd7f7d3e0c88a4a1 Mon Sep 17 00:00:00 2001 From: markYao Date: Fri, 28 Mar 2025 10:29:54 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E3=80=90=E5=90=8C=E6=AD=A5=E5=88=B05.1.0?= =?UTF-8?q?=E3=80=91=E9=80=82=E9=85=8DTDD=EF=BC=8C=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=97=A0=E6=95=88=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: markYao --- ...tification_do_not_disturb_profile_test.cpp | 22 ------------------- .../notification_preferences_test.cpp | 18 ++------------- 2 files changed, 2 insertions(+), 38 deletions(-) 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 0212181c0..27a748516 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/test/unittest/notification_preferences_test.cpp b/services/ans/test/unittest/notification_preferences_test.cpp index 9b59c71b4..6f182b262 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. -- Gitee From 5ee5a5e6b6603d2ae078c53ece794ac95cdd7960 Mon Sep 17 00:00:00 2001 From: wangsen1994 Date: Sat, 29 Mar 2025 10:39:09 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E5=90=88=E5=85=A55.1.0=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangsen1994 --- .../distributed/src/soft_bus/distributed_publish_service.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/distributed/src/soft_bus/distributed_publish_service.cpp b/services/distributed/src/soft_bus/distributed_publish_service.cpp index a22c0267e..4f6fc2291 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."); -- Gitee