From 0b0979e67e3e069078a6468bd8a10f71690defbf Mon Sep 17 00:00:00 2001 From: q30043944 Date: Fri, 8 Aug 2025 16:25:09 +0800 Subject: [PATCH] =?UTF-8?q?init=E6=97=B6=E5=BA=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: q30043944 --- commondependency/include/deviceprofile_connector.h | 1 + commondependency/src/deviceprofile_connector.cpp | 9 +++++++-- .../src/authentication_v2/dm_auth_state.cpp | 6 +++++- services/service/src/ipc/standard/ipc_server_stub.cpp | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/commondependency/include/deviceprofile_connector.h b/commondependency/include/deviceprofile_connector.h index 3923a314d..d472c7350 100644 --- a/commondependency/include/deviceprofile_connector.h +++ b/commondependency/include/deviceprofile_connector.h @@ -165,6 +165,7 @@ public: DM_EXPORT int32_t PutAccessControlList(DmAclInfo aclInfo, DmAccesser dmAccesser, DmAccessee dmAccessee); int32_t UpdateAccessControlList(int32_t userId, std::string &oldAccountId, std::string &newAccountId); + void UpdateAccessControlList(const DistributedDeviceProfile::AccessControlProfile &profile); DM_EXPORT std::unordered_map GetAppTrustDeviceList( const std::string &pkgName, const std::string &deviceId); DM_EXPORT std::vector GetBindTypeByPkgName(std::string pkgName, diff --git a/commondependency/src/deviceprofile_connector.cpp b/commondependency/src/deviceprofile_connector.cpp index b43bd68c1..3e9fbffe5 100644 --- a/commondependency/src/deviceprofile_connector.cpp +++ b/commondependency/src/deviceprofile_connector.cpp @@ -1593,6 +1593,11 @@ void DeviceProfileConnector::DeleteServiceBindLevel(DmOfflineParam &offlineParam offlineParam.leftAclNumber = bindNums - deleteNums; } +void DeviceProfileConnector::UpdateAccessControlList(const DistributedDeviceProfile::AccessControlProfile &profile) +{ + DistributedDeviceProfileClient::GetInstance().UpdateAccessControlProfile(profile); +} + int32_t DeviceProfileConnector::UpdateAccessControlList(int32_t userId, std::string &oldAccountId, std::string &newAccountId) { @@ -3118,7 +3123,7 @@ DM_EXPORT bool DeviceProfileConnector::CheckSrcAccessControl(const DmAccessCalle std::string trustUdid = (localUdid == srcUdid ? sinkUdid : srcUdid); for (const auto &item : profiles) { PrintProfile(item); - if (item.GetTrustDeviceId() != trustUdid || item.GetStatus() != ACTIVE) { + if (item.GetTrustDeviceId() != trustUdid) { continue; } switch (item.GetBindType()) { @@ -3243,7 +3248,7 @@ DM_EXPORT bool DeviceProfileConnector::CheckSinkAccessControl(const DmAccessCall std::string trustUdid = (localUdid == srcUdid ? sinkUdid : srcUdid); for (const auto &item : profiles) { PrintProfile(item); - if (item.GetTrustDeviceId() != trustUdid || item.GetStatus() != ACTIVE) { + if (item.GetTrustDeviceId() != trustUdid) { continue; } switch (item.GetBindType()) { diff --git a/services/implementation/src/authentication_v2/dm_auth_state.cpp b/services/implementation/src/authentication_v2/dm_auth_state.cpp index c51087201..b3de1341c 100644 --- a/services/implementation/src/authentication_v2/dm_auth_state.cpp +++ b/services/implementation/src/authentication_v2/dm_auth_state.cpp @@ -607,7 +607,7 @@ void DmAuthState::FilterProfilesByContext( { CHECK_NULL_VOID(context); std::vector aclProfilesVec; - for (const auto &item : profiles) { + for (auto &item : profiles) { std::string accesserDeviceIdHash = Crypto::GetUdidHash(item.GetAccesser().GetAccesserDeviceId()); std::string accesseeDeviceIdHash = Crypto::GetUdidHash(item.GetAccessee().GetAccesseeDeviceId()); if ((context->accesser.deviceIdHash == accesserDeviceIdHash && @@ -618,6 +618,10 @@ void DmAuthState::FilterProfilesByContext( context->accesser.deviceIdHash == accesseeDeviceIdHash && context->accessee.userId == item.GetAccesser().GetAccesserUserId() && context->accesser.userId == item.GetAccessee().GetAccesseeUserId())) { + if (item.GetStatus() == INACTIVE) { + item.SetStatus(ACTIVE); + DeviceProfileConnector::GetInstance().UpdateAccessControlList(item); + } aclProfilesVec.push_back(item); } } diff --git a/services/service/src/ipc/standard/ipc_server_stub.cpp b/services/service/src/ipc/standard/ipc_server_stub.cpp index acc8499e7..6f0fc375c 100644 --- a/services/service/src/ipc/standard/ipc_server_stub.cpp +++ b/services/service/src/ipc/standard/ipc_server_stub.cpp @@ -228,6 +228,7 @@ void IpcServerStub::OnRemoveSystemAbility(int32_t systemAbilityId, const std::st bool IpcServerStub::Init() { LOGI("IpcServerStub::Init ready to init."); + KVAdapterManager::GetInstance().Init(); DeviceManagerService::GetInstance().InitDMServiceListener(); if (!registerToService_) { bool ret = Publish(this); @@ -237,7 +238,6 @@ bool IpcServerStub::Init() return false; } registerToService_ = true; - KVAdapterManager::GetInstance().Init(); } return true; } -- Gitee