From e9ecb8aaa34b40eba2ed3af9be3ab410912e323b Mon Sep 17 00:00:00 2001 From: yangwei_814916 Date: Mon, 30 Jun 2025 10:37:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E5=8F=8C=E7=94=A8=E6=88=B7=E5=88=87?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangwei_814916 --- services/service/include/device_manager_service.h | 1 + services/service/src/device_manager_service.cpp | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/services/service/include/device_manager_service.h b/services/service/include/device_manager_service.h index 687029f7e..8282d93ed 100644 --- a/services/service/include/device_manager_service.h +++ b/services/service/include/device_manager_service.h @@ -255,6 +255,7 @@ public: DMLocalServiceInfo &serviceInfo); void ClearPublishIdCache(const std::string &pkgName); bool IsPC(); + bool IsPhone(); int32_t GetDeviceNetworkIdList(const std::string &pkgName, const NetworkIdQueryFilter &queryFilter, std::vector &networkIds); void ProcessSyncAccountLogout(const std::string &accountId, const std::string &peerUdid, int32_t userId); diff --git a/services/service/src/device_manager_service.cpp b/services/service/src/device_manager_service.cpp index 367e4bdd3..772c91944 100644 --- a/services/service/src/device_manager_service.cpp +++ b/services/service/src/device_manager_service.cpp @@ -2133,7 +2133,7 @@ DM_EXPORT void DeviceManagerService::AccountCommonEventCallback( [this, commonEventType] () { DeviceManagerService::HandleAccountCommonEvent(commonEventType); }); - } else if (commonEventType == CommonEventSupport::COMMON_EVENT_USER_UNLOCKED && IsPC()) { + } else if (commonEventType == CommonEventSupport::COMMON_EVENT_USER_UNLOCKED) { DeviceNameManager::GetInstance().AccountSysReady(beforeUserId); DMCommTool::GetInstance()->StartCommonEvent(commonEventType, [this, commonEventType] () { @@ -2209,7 +2209,7 @@ void DeviceManagerService::HandleAccountCommonEvent(const std::string commonEven std::vector backgroundUserVec; int32_t retBack = MultipleUserConnector::GetBackgroundUserIds(backgroundUserVec); MultipleUserConnector::ClearLockedUser(foregroundUserVec, backgroundUserVec); - if (retFront != DM_OK || retBack != DM_OK) { + if (retFront != DM_OK || retBack != DM_OK || (foregroundUserVec.empty() && IsPhone())) { LOGE("retFront: %{public}d, retBack: %{public}d, frontuserids: %{public}s, backuserids: %{public}s", retFront, retBack, GetIntegerList(foregroundUserVec).c_str(), GetIntegerList(backgroundUserVec).c_str()); return; @@ -4204,6 +4204,17 @@ bool DeviceManagerService::IsPC() return (info.deviceTypeId == DmDeviceType::DEVICE_TYPE_PC || info.deviceTypeId == DmDeviceType::DEVICE_TYPE_2IN1); } +bool DeviceManagerService::IsPhone() +{ + if (softbusListener_ == nullptr) { + LOGE("softbusListener_ is null."); + return false; + } + DmDeviceInfo info; + GetLocalDeviceInfo(info); + return (info.deviceTypeId == DmDeviceType::DEVICE_TYPE_PHONE); +} + int32_t DeviceManagerService::GetDeviceNetworkIdList(const std::string &pkgName, const NetworkIdQueryFilter &queryFilter, std::vector &networkIds) { -- Gitee