diff --git a/services/ans/src/advanced_notification_manager/advanced_notification_publish.cpp b/services/ans/src/advanced_notification_manager/advanced_notification_publish.cpp index c3acd3d21bc04b7db2a8b612517a9bb94ae6edf0..3693702523ecdeec9baea655284242b390763bde 100644 --- a/services/ans/src/advanced_notification_manager/advanced_notification_publish.cpp +++ b/services/ans/src/advanced_notification_manager/advanced_notification_publish.cpp @@ -419,18 +419,14 @@ ErrCode AdvancedNotificationService::CheckNotificationRequestLineWantAgents( if (multiLineContent != nullptr) { auto lineWantAgents = multiLineContent->GetLineWantAgents(); if (lineWantAgents.size() > 0) { + if (!isSystemComp) { + ANS_LOGE("Local wantAgent does not support non system app"); + return ERR_ANS_NON_SYSTEM_APP; + } if (!isAgentController) { ANS_LOGE("LineWantAgents does not support permission denied"); return ERR_ANS_PERMISSION_DENIED; } - auto lineWantAgentsIter = std::find_if(lineWantAgents.begin(), lineWantAgents.end(), - [&](auto& lineWantAgent) { - return (lineWantAgent != nullptr && lineWantAgent->IsLocal()); - }); - if (lineWantAgentsIter != lineWantAgents.end() && !isSystemComp) { - ANS_LOGE("Local wantAgent does not support non system app"); - return ERR_ANS_NON_SYSTEM_APP; - } } } return ERR_OK;