From a2d71fb68ce4897207a73dfd84263f1869185024 Mon Sep 17 00:00:00 2001 From: gaoqiang_strong Date: Thu, 22 May 2025 10:42:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A6=BB=E7=BA=BF=E5=8F=AF?= =?UTF-8?q?=E4=BF=A1=E8=AE=BE=E5=A4=87=E5=8C=B9=E9=85=8D=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: gaoqiang_strong --- services/service/src/softbus/softbus_listener.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/services/service/src/softbus/softbus_listener.cpp b/services/service/src/softbus/softbus_listener.cpp index d604a642f..f3d2facef 100644 --- a/services/service/src/softbus/softbus_listener.cpp +++ b/services/service/src/softbus/softbus_listener.cpp @@ -31,6 +31,7 @@ #if !(defined(__LITEOS_M__) || defined(LITE_DEVICE)) #include "dm_transport_msg.h" #include "ffrt.h" +#include "multiple_user_connector.h" #endif #include "ipc_skeleton.h" #include "parameter.h" @@ -1309,21 +1310,27 @@ int32_t SoftbusListener::GetAllTrustedDeviceList(const std::string &pkgName, con { #if !(defined(__LITEOS_M__) || defined(LITE_DEVICE)) (void)extra; + int32_t currentUserId = MultipleUserConnector::GetCurrentAccountUserID(); + char localDeviceId[DEVICE_UUID_LENGTH] = {0}; + GetDevUdid(localDeviceId, DEVICE_UUID_LENGTH); + std::string localUdid = std::string(localDeviceId); std::vector allProfile = - DeviceProfileConnector::GetInstance().GetAccessControlProfile(); + DeviceProfileConnector::GetInstance().GetAllAccessControlProfile(); for (DistributedDeviceProfile::AccessControlProfile profile : allProfile) { if (profile.GetBindType() == GROUP_TYPE_IDENTICAL_ACCOUNT_GROUP) { continue; } DistributedDeviceProfile::Accesser acer = profile.GetAccesser(); - if (pkgName == acer.GetAccesserBundleName()) { + if (pkgName == acer.GetAccesserBundleName() && currentUserId == acer.GetAccesserUserId() && + localUdid == acer.GetAccesserDeviceId()) { DmDeviceInfo deviceinfo; ConvertAclToDeviceInfo(profile, deviceinfo); deviceList.push_back(deviceinfo); continue; } DistributedDeviceProfile::Accessee acee = profile.GetAccessee(); - if (pkgName == acee.GetAccesseeBundleName()) { + if (pkgName == acee.GetAccesseeBundleName() && currentUserId == acee.GetAccesseeUserId() && + localUdid == acee.GetAccesseeDeviceId()) { DmDeviceInfo deviceinfo; ConvertAclToDeviceInfo(profile, deviceinfo); deviceList.push_back(deviceinfo); -- Gitee