diff --git a/services/ans/include/advanced_notification_service.h b/services/ans/include/advanced_notification_service.h index fb86fd4e03edb176fdb86f1bfb8ed486fe0115f5..69fc2cece3b23e3c290ac1d07c94785273afe749 100644 --- a/services/ans/include/advanced_notification_service.h +++ b/services/ans/include/advanced_notification_service.h @@ -198,6 +198,7 @@ private: const sptr bundleOption, const std::shared_ptr record); ErrCode DoDistributedDelete(const std::string deviceId, const sptr notification); std::string GetNotificationDeviceId(const std::string &key); + bool CheckDistributedNotificationType(const sptr &request); void OnDistributedPublish( const std::string &deviceId, const std::string &bundleName, sptr &request); void OnDistributedUpdate( diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index 59938a34f00d2fd29a0317629a7ee17e95d4c204..095bcba1f792a1bba9897fd64ac5746c4db73ddc 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -2745,11 +2745,15 @@ ErrCode AdvancedNotificationService::DoDistributedDelete( return ERR_OK; } -inline bool CheckDistributedNotificationType(const sptr &request) +bool AdvancedNotificationService::CheckDistributedNotificationType(const sptr &request) { + auto deviceTypeList = request->GetNotificationDistributedOptions().GetDevicesSupportDisplay(); + if (deviceTypeList.empty()) { + return true; + } + DistributedDatabase::DeviceInfo localDeviceInfo; DistributedNotificationManager::GetInstance()->GetLocalDeviceInfo(localDeviceInfo); - auto deviceTypeList = request->GetNotificationDistributedOptions().GetDevicesSupportDisplay(); for (auto device : deviceTypeList) { if (device == localDeviceInfo.deviceType) { return true;