From a0cd5707991b89cf80b4314c8fdfd2a7fc74ad07 Mon Sep 17 00:00:00 2001 From: shu-xin0115 Date: Fri, 11 Jul 2025 17:46:42 +0800 Subject: [PATCH] add OTA whiteList Signed-off-by: shu-xin0115 --- .../config/include/model/datashare_config.h | 3 +- .../config/src/model/datashare_config.cpp | 4 +- .../data_share/data_share_service_impl.cpp | 36 +++- .../data_share/data_share_service_impl.h | 3 +- .../data_share/sys_event_subscriber.cpp | 12 +- .../service/data_share/sys_event_subscriber.h | 6 +- .../service/test/BUILD.gn | 143 ++++++++++++++- .../test/data_share_service_impl_test.cpp | 24 +++ .../data_share_sys_event_subscriber_test.cpp | 67 +++++++ .../service/test/mock/config_factory_mock.cpp | 173 +++++++++--------- 10 files changed, 377 insertions(+), 94 deletions(-) create mode 100644 services/distributeddataservice/service/test/data_share_sys_event_subscriber_test.cpp diff --git a/services/distributeddataservice/service/config/include/model/datashare_config.h b/services/distributeddataservice/service/config/include/model/datashare_config.h index 4487c0d1b..29ef8e6a4 100644 --- a/services/distributeddataservice/service/config/include/model/datashare_config.h +++ b/services/distributeddataservice/service/config/include/model/datashare_config.h @@ -23,7 +23,8 @@ public: bool Marshal(json &node) const override; bool Unmarshal(const json &node) override; std::vector dataShareExtNames; + std::vector updateLaunchNames; }; } // namespace DistributedData } // namespace OHOS -#endif //OHOS_DISTRIBUTED_DATA_SERVICES_CONFIG_MODEL_DATASHARE_CONFIG_H \ No newline at end of file +#endif //OHOS_DISTRIBUTED_DATA_SERVICES_CONFIG_MODEL_DATASHARE_CONFIG_H diff --git a/services/distributeddataservice/service/config/src/model/datashare_config.cpp b/services/distributeddataservice/service/config/src/model/datashare_config.cpp index 0eae37a2b..4bdfb6c04 100644 --- a/services/distributeddataservice/service/config/src/model/datashare_config.cpp +++ b/services/distributeddataservice/service/config/src/model/datashare_config.cpp @@ -18,13 +18,15 @@ namespace DistributedData { bool DataShareConfig::Marshal(json &node) const { SetValue(node[GET_NAME(dataShareExtNames)], dataShareExtNames); + SetValue(node[GET_NAME(updateLaunchNames)], updateLaunchNames); return true; } bool DataShareConfig::Unmarshal(const json &node) { GetValue(node, GET_NAME(dataShareExtNames), dataShareExtNames); + GetValue(node, GET_NAME(updateLaunchNames), updateLaunchNames); return true; } } // namespace DistributedData -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/services/distributeddataservice/service/data_share/data_share_service_impl.cpp b/services/distributeddataservice/service/data_share/data_share_service_impl.cpp index 4a70e670f..e00ac7c17 100644 --- a/services/distributeddataservice/service/data_share/data_share_service_impl.cpp +++ b/services/distributeddataservice/service/data_share/data_share_service_impl.cpp @@ -25,6 +25,7 @@ #include "common_event_manager.h" #include "common_event_support.h" #include "concurrent_task_client.h" +#include "config_factory.h" #include "data_ability_observer_interface.h" #include "data_share_profile_config.h" #include "dataobs_mgr_client.h" @@ -72,6 +73,7 @@ using namespace OHOS::DistributedData; __attribute__((used)) DataShareServiceImpl::Factory DataShareServiceImpl::factory_; // decimal base static constexpr int DECIMAL_BASE = 10; +DataShareServiceImpl::BindInfo DataShareServiceImpl::binderInfo_; class DataShareServiceImpl::SystemAbilityStatusChangeListener : public SystemAbilityStatusChangeStub { public: @@ -807,6 +809,38 @@ int32_t DataShareServiceImpl::DataShareStatic::OnAppUpdate(const std::string &bu return E_OK; } +void DataShareServiceImpl::UpdateLaunchInfo() +{ + DataShareConfig *config = ConfigFactory::GetInstance().GetDataShareConfig(); + if (config == nullptr) { + ZLOGE("DataShareConfig is nullptr"); + return; + } + + ZLOGI("UpdateLaunchInfo begin."); + for (auto &bundleName : config->updateLaunchNames) { + std::string prefix = StoreMetaData::GetPrefix( + { DeviceManagerAdapter::GetInstance().GetLocalDevice().uuid }); + std::vector storeMetaData; + MetaDataManager::GetInstance().LoadMeta(prefix, storeMetaData, true); + std::vector updateMetaData; + for (auto &meta : storeMetaData) { + if (meta.bundleName != bundleName) { + continue; + } + updateMetaData.push_back(meta); + } + for (auto &meta : updateMetaData) { + MetaDataManager::GetInstance().DelMeta(meta.GetAutoLaunchKey(), true); + } + for (auto &meta : updateMetaData) { + BundleMgrProxy::GetInstance()->Delete(bundleName, atoi(meta.user.c_str()), 0); + SaveLaunchInfo(meta.bundleName, meta.user, DeviceManagerAdapter::GetInstance().GetLocalDevice().uuid); + } + ZLOGI("update bundleName %{public}s, size:%{public}zu.", bundleName.c_str(), storeMetaData.size()); + } +} + int32_t DataShareServiceImpl::DataShareStatic::OnClearAppStorage(const std::string &bundleName, int32_t user, int32_t index, int32_t tokenId) { @@ -1247,7 +1281,7 @@ void DataShareServiceImpl::InitSubEvent() matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_REMOVED); EventFwk::CommonEventSubscribeInfo subscribeInfo(matchingSkills); subscribeInfo.SetThreadMode(EventFwk::CommonEventSubscribeInfo::COMMON); - auto sysEventSubscriber = std::make_shared(subscribeInfo); + auto sysEventSubscriber = std::make_shared(subscribeInfo, binderInfo_.executors); if (!EventFwk::CommonEventManager::SubscribeCommonEvent(sysEventSubscriber)) { ZLOGE("Subscribe sys event failed."); alreadySubscribe = false; diff --git a/services/distributeddataservice/service/data_share/data_share_service_impl.h b/services/distributeddataservice/service/data_share/data_share_service_impl.h index d39912924..04448e729 100644 --- a/services/distributeddataservice/service/data_share/data_share_service_impl.h +++ b/services/distributeddataservice/service/data_share/data_share_service_impl.h @@ -101,6 +101,7 @@ public: const DataProxyConfig &proxyConfig, const sptr observer) override; std::vector UnsubscribeProxyData(const std::vector &uris, const DataProxyConfig &proxyConfig) override; + static void UpdateLaunchInfo(); private: class SystemAbilityStatusChangeListener; using StaticActs = DistributedData::StaticActs; @@ -165,7 +166,7 @@ private: SubscribeStrategy subscribeStrategy_; TemplateStrategy templateStrategy_; RdbNotifyStrategy rdbNotifyStrategy_; - BindInfo binderInfo_; + static BindInfo binderInfo_; std::shared_ptr timerReceiver_ = nullptr; DataShareSilentConfig dataShareSilentConfig_; }; diff --git a/services/distributeddataservice/service/data_share/sys_event_subscriber.cpp b/services/distributeddataservice/service/data_share/sys_event_subscriber.cpp index deb855590..156a1f474 100644 --- a/services/distributeddataservice/service/data_share/sys_event_subscriber.cpp +++ b/services/distributeddataservice/service/data_share/sys_event_subscriber.cpp @@ -21,8 +21,8 @@ #include "proxy_data_manager.h" namespace OHOS::DataShare { -SysEventSubscriber::SysEventSubscriber(const EventFwk::CommonEventSubscribeInfo& info) - : CommonEventSubscriber(info) +SysEventSubscriber::SysEventSubscriber(const EventFwk::CommonEventSubscribeInfo& info, + std::shared_ptr executors): CommonEventSubscriber(info), executors_(executors) { callbacks_ = { { EventFwk::CommonEventSupport::COMMON_EVENT_BUNDLE_SCAN_FINISHED, @@ -67,6 +67,14 @@ void SysEventSubscriber::OnReceiveEvent(const EventFwk::CommonEventData& event) void SysEventSubscriber::OnBMSReady() { NotifyDataShareReady(); + auto executors = executors_; + if (executors == nullptr) { + ZLOGE("executors is null."); + return; + } + executors->Execute([]() { + DataShareServiceImpl::UpdateLaunchInfo(); + }); } void SysEventSubscriber::OnAppInstall(const std::string &bundleName, diff --git a/services/distributeddataservice/service/data_share/sys_event_subscriber.h b/services/distributeddataservice/service/data_share/sys_event_subscriber.h index 71e11bd01..d686de70f 100644 --- a/services/distributeddataservice/service/data_share/sys_event_subscriber.h +++ b/services/distributeddataservice/service/data_share/sys_event_subscriber.h @@ -24,8 +24,9 @@ class SysEventSubscriber : public EventFwk::CommonEventSubscriber { public: using SysEventCallback = void (SysEventSubscriber::*)(); using InstallEventCallback = void (SysEventSubscriber::*)(const std::string &bundleName, - int32_t userId, int32_t appIndex, int32_t tokenId, bool isCrossAppSharedConfig); - explicit SysEventSubscriber(const EventFwk::CommonEventSubscribeInfo &info); + int32_t userId, int32_t appIndex, uint32_t tokenId, bool isCrossAppSharedConfig); + explicit SysEventSubscriber(const EventFwk::CommonEventSubscribeInfo &info, + std::shared_ptr executors); ~SysEventSubscriber() {} void OnReceiveEvent(const EventFwk::CommonEventData& event) override; void OnBMSReady(); @@ -44,6 +45,7 @@ private: static constexpr const char *APP_INDEX = "appIndex"; static constexpr const char *ACCESS_TOKEN_ID = "accessTokenId"; static constexpr const char *CROSS_APP_SHARED_CONFIG = "crossAppSharedConfig"; + std::shared_ptr executors_ = nullptr; }; } #endif \ No newline at end of file diff --git a/services/distributeddataservice/service/test/BUILD.gn b/services/distributeddataservice/service/test/BUILD.gn index c93164adb..abd57a4f4 100644 --- a/services/distributeddataservice/service/test/BUILD.gn +++ b/services/distributeddataservice/service/test/BUILD.gn @@ -1024,7 +1024,10 @@ ohos_unittest("DataShareServiceImplTest") { } module_out_path = module_output_path - include_dirs = [ "${data_service_path}/service/config/include" ] + include_dirs = [ + "${data_service_path}/service/config/include", + "${data_service_path}/framework/include/metadata", + ] sources = [ "${data_service_path}/service/common/xcollie.cpp", @@ -1146,6 +1149,139 @@ ohos_unittest("DataShareServiceImplTest") { ] } +ohos_unittest("DataShareServiceImplMockTest") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "${datamgr_service_path}/cfi_blocklist.txt" + } + module_out_path = module_output_path + + include_dirs = [ "${data_service_path}/service/config/include" ] + + sources = [ + "${data_service_path}/service/common/xcollie.cpp", + "${data_service_path}/service/config/src/model/app_access_check_config.cpp", + "${data_service_path}/service/config/src/model/app_id_mapping_config.cpp", + "${data_service_path}/service/config/src/model/backup_config.cpp", + "${data_service_path}/service/config/src/model/checker_config.cpp", + "${data_service_path}/service/config/src/model/cloud_config.cpp", + "${data_service_path}/service/config/src/model/component_config.cpp", + "${data_service_path}/service/config/src/model/datashare_config.cpp", + "${data_service_path}/service/config/src/model/device_sync_app_white_list_config.cpp", + "${data_service_path}/service/config/src/model/directory_config.cpp", + "${data_service_path}/service/config/src/model/global_config.cpp", + "${data_service_path}/service/config/src/model/network_config.cpp", + "${data_service_path}/service/config/src/model/protocol_config.cpp", + "${data_service_path}/service/config/src/model/thread_config.cpp", + "${data_service_path}/service/data_share/common/app_connect_manager.cpp", + "${data_service_path}/service/data_share/common/bundle_mgr_proxy.cpp", + "${data_service_path}/service/data_share/common/common_utils.cpp", + "${data_service_path}/service/data_share/common/db_delegate.cpp", + "${data_service_path}/service/data_share/common/div_strategy.cpp", + "${data_service_path}/service/data_share/common/extension_ability_manager.cpp", + "${data_service_path}/service/data_share/common/extension_connect_adaptor.cpp", + "${data_service_path}/service/data_share/common/extension_mgr_proxy.cpp", + "${data_service_path}/service/data_share/common/proxy_data_manager.cpp", + "${data_service_path}/service/data_share/common/kv_delegate.cpp", + "${data_service_path}/service/data_share/common/rdb_delegate.cpp", + "${data_service_path}/service/data_share/common/scheduler_manager.cpp", + "${data_service_path}/service/data_share/common/seq_strategy.cpp", + "${data_service_path}/service/data_share/common/uri_utils.cpp", + "${data_service_path}/service/data_share/data/published_data.cpp", + "${data_service_path}/service/data_share/data/resultset_json_formatter.cpp", + "${data_service_path}/service/data_share/data/template_data.cpp", + "${data_service_path}/service/data_share/data_provider_config.cpp", + "${data_service_path}/service/data_share/data_share_db_config.cpp", + "${data_service_path}/service/data_share/data_share_obs_proxy.cpp", + "${data_service_path}/service/data_share/data_share_profile_config.cpp", + "${data_service_path}/service/data_share/data_share_service_impl.cpp", + "${data_service_path}/service/data_share/data_share_service_stub.cpp", + "${data_service_path}/service/data_share/data_share_silent_config.cpp", + "${data_service_path}/service/data_share/dfx/hiview_adapter.cpp", + "${data_service_path}/service/data_share/dfx/hiview_fault_adapter.cpp", + "${data_service_path}/service/data_share/strategies/data_proxy/load_config_from_data_proxy_node_strategy.cpp", + "${data_service_path}/service/data_share/strategies/data_share/load_config_from_data_share_bundle_info_strategy.cpp", + "${data_service_path}/service/data_share/strategies/general/check_is_data_proxy_strategy.cpp", + "${data_service_path}/service/data_share/strategies/general/check_is_single_app_strategy.cpp", + "${data_service_path}/service/data_share/strategies/general/cross_permission_strategy.cpp", + "${data_service_path}/service/data_share/strategies/general/load_config_common_strategy.cpp", + "${data_service_path}/service/data_share/strategies/general/load_config_data_info_strategy.cpp", + "${data_service_path}/service/data_share/strategies/general/load_config_from_bundle_info_strategy.cpp", + "${data_service_path}/service/data_share/strategies/general/permission_strategy.cpp", + "${data_service_path}/service/data_share/strategies/get_data_strategy.cpp", + "${data_service_path}/service/data_share/strategies/publish_strategy.cpp", + "${data_service_path}/service/data_share/strategies/rdb_notify_strategy.cpp", + "${data_service_path}/service/data_share/strategies/subscribe_strategy.cpp", + "${data_service_path}/service/data_share/strategies/template_strategy.cpp", + "${data_service_path}/service/data_share/subscriber_managers/proxy_data_subscriber_manager.cpp", + "${data_service_path}/service/data_share/subscriber_managers/published_data_subscriber_manager.cpp", + "${data_service_path}/service/data_share/subscriber_managers/rdb_subscriber_manager.cpp", + "${data_service_path}/service/data_share/sys_event_subscriber.cpp", + "data_share_sys_event_subscriber_test.cpp", + "mock/config_factory_mock.cpp", + ] + + configs = [ ":module_private_config" ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + "-Wno-multichar", + "-Wno-c99-designator", + "-Dprivate=public", + "-Dprotected=public", + ] + + external_deps = [ + "ability_base:base", + "ability_base:want", + "ability_base:zuri", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtoken_setproc", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", + "data_share:datashare_common_lite", + "data_share:datashare_consumer", + "device_manager:devicemanagersdk", + "googletest:gmock_main", + "googletest:gtest_main", + "hicollie:libhicollie", + "hilog:libhilog", + "hisysevent:libhisysevent", + "huks:libhukssdk", + "init:libbegetutil", + "ipc:ipc_core", + "cJSON:cjson", + "kv_store:distributeddata_inner", + "kv_store:distributeddb", + "kv_store:distributeddb", + "qos_manager:concurrent_task_client", + "qos_manager:qos", + "relational_store:native_rdb", + "relational_store:rdb_data_share_adapter", + "resource_management:global_resmgr", + "samgr:samgr_proxy", + "time_service:time_client", + ] + + deps = [ + "${data_service_path}/adapter/utils:distributeddata_utils", + "${data_service_path}/framework:distributeddatasvcfwk", + "${data_service_path}/service:distributeddatasvc", + ] +} + ohos_unittest("KvdbServicePasswordTest") { module_out_path = module_output_path sanitize = { @@ -2267,7 +2403,10 @@ group("unittest") { } if (datamgr_service_data_share) { - deps += [ ":DataShareServiceImplTest" ] + deps += [ + ":DataShareServiceImplTest", + ":DataShareServiceImplMockTest", + ] } deps += [ diff --git a/services/distributeddataservice/service/test/data_share_service_impl_test.cpp b/services/distributeddataservice/service/test/data_share_service_impl_test.cpp index 394e3e54c..9eecec988 100644 --- a/services/distributeddataservice/service/test/data_share_service_impl_test.cpp +++ b/services/distributeddataservice/service/test/data_share_service_impl_test.cpp @@ -22,11 +22,13 @@ #include "accesstoken_kit.h" #include "account_delegate_mock.h" #include "data_share_service_stub.h" +#include "device_manager_adapter.h" #include "dump/dump_manager.h" #include "hap_token_info.h" #include "ipc_skeleton.h" #include "iservice_registry.h" #include "log_print.h" +#include "metadata/meta_data_manager.h" #include "system_ability_definition.h" #include "token_setproc.h" @@ -541,4 +543,26 @@ HWTEST_F(DataShareServiceImplTest, DataProviderConfig001, TestSize.Level1) SetSelfTokenInfo(USER_TEST); ZLOGI("DataShareServiceImplTest DataProviderConfig001 end"); } + +/** +* @tc.name: UpdateLaunchInfoMock001 +* @tc.desc: mock GetInstance return nullptr +* @tc.type: FUNC +* @tc.require: +*/ +HWTEST_F(DataShareServiceImplTest, UpdateLaunchInfo001, TestSize.Level1) +{ + ZLOGI("DataShareServiceImplTest UpdateLaunchInfo001 start"); + + DataShareServiceImpl dataShareServiceImpl; + // cover branch of config is nullptr + dataShareServiceImpl.UpdateLaunchInfo(); + + std::string prefix = StoreMetaData::GetPrefix( + { DeviceManagerAdapter::GetInstance().GetLocalDevice().uuid }); + std::vector storeMetaData; + MetaDataManager::GetInstance().LoadMeta(prefix, storeMetaData, true); + EXPECT_EQ(storeMetaData.size(), 0); + ZLOGI("DataShareServiceImplTest UpdateLaunchInfo001 end"); +} } // namespace OHOS::Test \ No newline at end of file diff --git a/services/distributeddataservice/service/test/data_share_sys_event_subscriber_test.cpp b/services/distributeddataservice/service/test/data_share_sys_event_subscriber_test.cpp new file mode 100644 index 000000000..cfea876c2 --- /dev/null +++ b/services/distributeddataservice/service/test/data_share_sys_event_subscriber_test.cpp @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2025 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#define LOG_TAG "DataShareSysEventSubscriberTest" + +#include "sys_event_subscriber.h" + +#include + +#include "data_share_service_impl.h" +#include "common_event_manager.h" +#include "common_event_support.h" +#include "log_print.h" +#include "mock/meta_data_manager_mock.h" +#include "proxy_data_manager.h" + +namespace OHOS::Test { +using namespace OHOS::DataShare; +using namespace testing::ext; +class DataShareSysEventSubscriberTest : public testing::Test { +public: + static void SetUpTestCase(void){}; + static void TearDownTestCase(void){}; + void SetUp(){}; + void TearDown(){}; +}; + +/** +* @tc.name: OnBMSReady001 +* @tc.desc: test OnBMSReady func +* @tc.type: FUNC +*/ +HWTEST_F(DataShareSysEventSubscriberTest, OnBMSReady001, TestSize.Level1) +{ + ZLOGI("DataShareSysEventSubscriberTest OnBMSReady001 start"); + EventFwk::MatchingSkills testMatchingSkills; + testMatchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_BUNDLE_SCAN_FINISHED); + testMatchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_ADDED); + testMatchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_REMOVED); + EventFwk::CommonEventSubscribeInfo subscribeInfo(testMatchingSkills); + subscribeInfo.SetThreadMode(EventFwk::CommonEventSubscribeInfo::COMMON); + // executors not null + auto executors = std::make_shared(1, 0); + // make sysEventSubscriber not null + auto sysEventSubscriber = std::make_shared(subscribeInfo, executors);\ + ASSERT_NE(sysEventSubscriber, nullptr); + sysEventSubscriber->OnBMSReady(); + ASSERT_NE(sysEventSubscriber->executors_, nullptr); + + // cover executors == nullptr branch + sysEventSubscriber->executors_ = nullptr; + ASSERT_EQ(sysEventSubscriber->executors_, nullptr); + sysEventSubscriber->OnBMSReady(); + ZLOGI("DataShareSysEventSubscriberTest OnBMSReady001 end"); +} +} // namespace OHOS::Test \ No newline at end of file diff --git a/services/distributeddataservice/service/test/mock/config_factory_mock.cpp b/services/distributeddataservice/service/test/mock/config_factory_mock.cpp index aa685cd25..0e47506f9 100644 --- a/services/distributeddataservice/service/test/mock/config_factory_mock.cpp +++ b/services/distributeddataservice/service/test/mock/config_factory_mock.cpp @@ -1,85 +1,90 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "config_factory.h" -#include - -namespace OHOS { -namespace DistributedData { -ConfigFactory::ConfigFactory() : file_(std::string(CONF_PATH) + "/config.json") -{ -} - -ConfigFactory::~ConfigFactory() -{ -} - -ConfigFactory &ConfigFactory::GetInstance() -{ - static ConfigFactory factory; - return factory; -} - -int32_t ConfigFactory::Initialize() -{ - return 0; -} - -std::vector *ConfigFactory::GetComponentConfig() -{ - return nullptr; -} - -NetworkConfig *ConfigFactory::GetNetworkConfig() -{ - return nullptr; -} - -CheckerConfig *ConfigFactory::GetCheckerConfig() -{ - return nullptr; -} - -GlobalConfig *ConfigFactory::GetGlobalConfig() -{ - return nullptr; -} - -DirectoryConfig *ConfigFactory::GetDirectoryConfig() -{ - return nullptr; -} - -BackupConfig *ConfigFactory::GetBackupConfig() -{ - return nullptr; -} - -CloudConfig *ConfigFactory::GetCloudConfig() -{ - return nullptr; -} - -std::vector *ConfigFactory::GetAppIdMappingConfig() -{ - return nullptr; -} - -ThreadConfig *ConfigFactory::GetThreadConfig() -{ - return nullptr; -} -} // namespace DistributedData +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config_factory.h" +#include + +namespace OHOS { +namespace DistributedData { +ConfigFactory::ConfigFactory() : file_(std::string(CONF_PATH) + "/config.json") +{ +} + +ConfigFactory::~ConfigFactory() +{ +} + +ConfigFactory &ConfigFactory::GetInstance() +{ + static ConfigFactory factory; + return factory; +} + +int32_t ConfigFactory::Initialize() +{ + return 0; +} + +std::vector *ConfigFactory::GetComponentConfig() +{ + return nullptr; +} + +NetworkConfig *ConfigFactory::GetNetworkConfig() +{ + return nullptr; +} + +CheckerConfig *ConfigFactory::GetCheckerConfig() +{ + return nullptr; +} + +GlobalConfig *ConfigFactory::GetGlobalConfig() +{ + return nullptr; +} + +DirectoryConfig *ConfigFactory::GetDirectoryConfig() +{ + return nullptr; +} + +BackupConfig *ConfigFactory::GetBackupConfig() +{ + return nullptr; +} + +CloudConfig *ConfigFactory::GetCloudConfig() +{ + return nullptr; +} + +std::vector *ConfigFactory::GetAppIdMappingConfig() +{ + return nullptr; +} + +ThreadConfig *ConfigFactory::GetThreadConfig() +{ + return nullptr; +} + +DataShareConfig *ConfigFactory::GetDataShareConfig() +{ + return nullptr; +} +} // namespace DistributedData } // namespace OHOS \ No newline at end of file -- Gitee