diff --git a/services/distributeddataservice/adapter/network/src/network_delegate_normal_impl.cpp b/services/distributeddataservice/adapter/network/src/network_delegate_normal_impl.cpp index 1edda03330c630f75b7f8de452fc6efe86210dd9..5f6d25db0d70b67be96e8117ea9c8e762fcdb5fb 100644 --- a/services/distributeddataservice/adapter/network/src/network_delegate_normal_impl.cpp +++ b/services/distributeddataservice/adapter/network/src/network_delegate_normal_impl.cpp @@ -121,7 +121,7 @@ void NetworkDelegateNormalImpl::RegOnNetworkChange() void NetworkDelegateNormalImpl::BindExecutor(std::shared_ptr executors) { - executors_ = executors; + executors_ = std::move(executors); } ExecutorPool::Task NetworkDelegateNormalImpl::GetTask(uint32_t retry) diff --git a/services/distributeddataservice/app/BUILD.gn b/services/distributeddataservice/app/BUILD.gn index 084cbb75e4cceddd76db9d286434490604f41fe3..4c0087d0663ecfa5b8235948dae01f39b30f8409 100644 --- a/services/distributeddataservice/app/BUILD.gn +++ b/services/distributeddataservice/app/BUILD.gn @@ -125,6 +125,7 @@ ohos_shared_library("distributeddataservice") { configs = [ ":module_private_config" ] deps = [ + "${data_service_path}/adapter/network:distributeddata_network", "${data_service_path}/adapter/utils:distributeddata_utils", "${data_service_path}/app/src/checker:distributeddata_checker", "${data_service_path}/app/src/installer:distributeddata_installer", diff --git a/services/distributeddataservice/app/src/kvstore_data_service.cpp b/services/distributeddataservice/app/src/kvstore_data_service.cpp index 2c26686d8ad61f6aa75db9a2d49f447d50e0375a..b64886f8dc95b20a9b1902a44d04ddefe0d895e8 100755 --- a/services/distributeddataservice/app/src/kvstore_data_service.cpp +++ b/services/distributeddataservice/app/src/kvstore_data_service.cpp @@ -322,6 +322,7 @@ void KvStoreDataService::OnStart() AddSystemAbilityListener(COMMON_EVENT_SERVICE_ID); AddSystemAbilityListener(MEMORY_MANAGER_SA_ID); AddSystemAbilityListener(COMM_NET_CONN_MANAGER_SYS_ABILITY_ID); + AddSystemAbilityListener(SUBSYS_ACCOUNT_SYS_ABILITY_ID_BEGIN); RegisterStoreInfo(); Handler handlerStoreInfo = std::bind(&KvStoreDataService::DumpStoreInfo, this, std::placeholders::_1, std::placeholders::_2); @@ -356,9 +357,10 @@ void KvStoreDataService::OnAddSystemAbility(int32_t systemAbilityId, const std:: ZLOGI("add system abilityid:%{public}d", systemAbilityId); (void)deviceId; if (systemAbilityId == COMMON_EVENT_SERVICE_ID) { - AccountDelegate::GetInstance()->SubscribeAccountEvent(); Installer::GetInstance().Init(this, executors_); ScreenManager::GetInstance()->SubscribeScreenEvent(); + } else if (systemAbilityId == SUBSYS_ACCOUNT_SYS_ABILITY_ID_BEGIN) { + AccountDelegate::GetInstance()->SubscribeAccountEvent(); } else if (systemAbilityId == MEMORY_MANAGER_SA_ID) { Memory::MemMgrClient::GetInstance().NotifyProcessStatus(getpid(), 1, 1, DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID); @@ -372,10 +374,12 @@ void KvStoreDataService::OnRemoveSystemAbility(int32_t systemAbilityId, const st { ZLOGI("remove system abilityid:%{public}d", systemAbilityId); (void)deviceId; + if (systemAbilityId == SUBSYS_ACCOUNT_SYS_ABILITY_ID_BEGIN) { + AccountDelegate::GetInstance()->UnsubscribeAccountEvent(); + } if (systemAbilityId != COMMON_EVENT_SERVICE_ID) { return; } - AccountDelegate::GetInstance()->UnsubscribeAccountEvent(); ScreenManager::GetInstance()->UnsubscribeScreenEvent(); Installer::GetInstance().UnsubscribeEvent(); } diff --git a/services/distributeddataservice/framework/include/network/network_delegate.h b/services/distributeddataservice/framework/include/network/network_delegate.h index 505902a4f4e5aafd646ade612dcac6a620f894bf..38763f58d68e1cff6b7d90c66b64709af52481b0 100644 --- a/services/distributeddataservice/framework/include/network/network_delegate.h +++ b/services/distributeddataservice/framework/include/network/network_delegate.h @@ -20,7 +20,7 @@ #include #include "executor_pool.h" -#include "types.h" +#include "visibility.h" namespace OHOS { namespace DistributedData {