diff --git a/commondependency/include/deviceprofile_connector.h b/commondependency/include/deviceprofile_connector.h index 3923a314d7a56f349674d0e3b69db2417a284201..d472c7350ec2714fdfb559da0051b598205a92b0 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 b43bd68c156e7ed2a60c59b7122a8066f3c343d6..3e9fbffe53d15cac2c8e9671a90d1ab4cc7b66a8 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 c51087201146cd1aaff624fb66d3d11b293b5dcc..b3de1341c50f25aa8cce476921d44083f8bceff7 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 acc8499e74fc3f0e1a283b0c4a5e5c60f9b88311..6f0fc375ca1ebf29f85c71c3ca9c74357c1a5ff0 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; }