diff --git a/commondependency/src/deviceprofile_connector.cpp b/commondependency/src/deviceprofile_connector.cpp index 66a809a343eb9bad4588774fa4c9b8662961f28a..2d7890f6669c56bc0fd00fd7db859137fd4a8452 100644 --- a/commondependency/src/deviceprofile_connector.cpp +++ b/commondependency/src/deviceprofile_connector.cpp @@ -1621,19 +1621,23 @@ void DeviceProfileConnector::HandleSyncBackgroundUserIdEvent(const std::vector profiles = GetAllAccessControlProfile(); std::vector activeProfiles; std::vector inActiveProfiles; + std::vector delActiveProfiles; for (auto &item : profiles) { if (std::find(deviceVec.begin(), deviceVec.end(), item.GetTrustDeviceId()) == deviceVec.end()) { continue; } if ((item.GetAccesser().GetAccesserDeviceId() == localUdid && (find(backgroundUserIds.begin(), backgroundUserIds.end(), - item.GetAccesser().GetAccesserUserId()) != backgroundUserIds.end()) && item.GetStatus() == ACTIVE) || + item.GetAccesser().GetAccesserUserId()) != backgroundUserIds.end())) || (item.GetAccessee().GetAccesseeDeviceId() == localUdid && (find(backgroundUserIds.begin(), backgroundUserIds.end(), - item.GetAccessee().GetAccesseeUserId()) != backgroundUserIds.end()) && item.GetStatus() == ACTIVE)) { - item.SetStatus(INACTIVE); - inActiveProfiles.push_back(item); + item.GetAccessee().GetAccesseeUserId()) != backgroundUserIds.end()))) { + if (item.GetStatus() == ACTIVE) { + item.SetStatus(INACTIVE); + inActiveProfiles.push_back(item); + } + if (item.GetBindType() != DM_IDENTICAL_ACCOUNT) { + delActiveProfiles.push_back(item); + } continue; } if ((item.GetAccesser().GetAccesserDeviceId() == localUdid && @@ -1893,15 +1905,7 @@ int32_t DeviceProfileConnector::HandleUserSwitched(const std::string &localUdid, continue; } } - for (auto &item : inActiveProfiles) { - DistributedDeviceProfileClient::GetInstance().UpdateAccessControlProfile(item); - if (item.GetBindType() != DM_IDENTICAL_ACCOUNT) { - DistributedDeviceProfileClient::GetInstance().DeleteAccessControlProfile(item.GetAccessControlId()); - } - } - for (auto &item : activeProfiles) { - DistributedDeviceProfileClient::GetInstance().UpdateAccessControlProfile(item); - } + HandleUserSwitched(activeProfiles, inActiveProfiles, delActiveProfiles); return DM_OK; } diff --git a/services/service/src/device_manager_service.cpp b/services/service/src/device_manager_service.cpp index 493f45f5536f3ec6aaa61f1cfd2809021f8181d8..7c9108569d12e935e7d162c701d49c1676ca7237 100644 --- a/services/service/src/device_manager_service.cpp +++ b/services/service/src/device_manager_service.cpp @@ -2209,7 +2209,7 @@ void DeviceManagerService::HandleUserIdsBroadCast(const std::vector int32_t retFront = MultipleUserConnector::GetForegroundUserIds(foregroundUserVec); int32_t retBack = MultipleUserConnector::GetBackgroundUserIds(backgroundUserVec); if (IsPC()) { - MultipleUserConnector::ClearLockedUser(foregroundUserVec, backgroundUserVec); + MultipleUserConnector::ClearLockedUser(foregroundUserVec); } if (retFront != DM_OK || retBack!= DM_OK) { LOGE("Get userid failed, retFront: %{public}d, retBack: %{public}d, frontUserNum:%{public}d," diff --git a/services/service/src/relationshipsyncmgr/dm_comm_tool.cpp b/services/service/src/relationshipsyncmgr/dm_comm_tool.cpp index 01a64b6723649cd6fa12b21627f7e295a564f09f..5fb82c255f4a937c425eeb066d3f637589184f95 100644 --- a/services/service/src/relationshipsyncmgr/dm_comm_tool.cpp +++ b/services/service/src/relationshipsyncmgr/dm_comm_tool.cpp @@ -213,7 +213,7 @@ void DMCommTool::ProcessReceiveUserIdsEvent(const std::shared_ptr MultipleUserConnector::GetForegroundUserIds(foregroundUserIds); MultipleUserConnector::GetBackgroundUserIds(backgroundUserIds); if (DeviceManagerService::GetInstance().IsPC()) { - MultipleUserConnector::ClearLockedUser(foregroundUserIds, backgroundUserIds); + MultipleUserConnector::ClearLockedUser(foregroundUserIds); } std::vector foregroundUserIdsU32; std::vector backgroundUserIdsU32;