diff --git a/frameworks/core/src/ans_notification.cpp b/frameworks/core/src/ans_notification.cpp index 8de5bc0fe85d77b2b92e32a814f080b8f3b9a7d7..d59947731858fd62dfd3a12e300e48d546b0ca58 100644 --- a/frameworks/core/src/ans_notification.cpp +++ b/frameworks/core/src/ans_notification.cpp @@ -656,7 +656,9 @@ ErrCode AnsNotification::SubscribeNotification( ANS_LOGE("Failed to subscribe with SubscriberImpl null ptr."); return ERR_ANS_INVALID_PARAM; } - subscriberSptr->subscriber_.SetDeviceType(subscribeInfo.GetDeviceType()); + if (!subscribeInfo.GetDeviceType().empty()) { + subscriberSptr->subscriber_.SetDeviceType(subscribeInfo.GetDeviceType()); + } return proxy->Subscribe(subscriberSptr, sptrInfo); } @@ -752,7 +754,7 @@ ErrCode AnsNotification::SubscribeNotification(const std::shared_ptrGetDeviceType().empty()) { subscriber->SetDeviceType(subscribeInfo->GetDeviceType()); } DelayedSingleton::GetInstance()->SubscribeSAManager();