From 32b5b5a916d868c379113893c75961c4f68267a0 Mon Sep 17 00:00:00 2001 From: z00454238 Date: Mon, 7 Jul 2025 15:19:16 +0800 Subject: [PATCH] =?UTF-8?q?lineWantAgents=E5=AD=97=E6=AE=B5=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9=E4=BC=98=E5=8C=96?= =?UTF-8?q?=20Signed-off-by:=20z00454238=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../advanced_notification_publish.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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 c3acd3d21..369370252 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; -- Gitee