Signed-off-by: yangliu <yangliu178@huawei.com>
This commit is contained in:
yangliu 2024-08-23 10:17:45 +08:00
parent 8b89df01fa
commit 2f0ddb5eb9
7 changed files with 22 additions and 13 deletions

View File

@ -274,13 +274,7 @@ void KvStoreDataService::OnStart()
ZLOGW("GetLocalDeviceId failed, retry count:%{public}d", static_cast<int>(retry));
}
ZLOGI("Bootstrap configs and plugins.");
Bootstrap::GetInstance().LoadComponents();
Bootstrap::GetInstance().LoadDirectory();
Bootstrap::GetInstance().LoadCheckers();
Bootstrap::GetInstance().LoadNetworks();
Bootstrap::GetInstance().LoadBackup(executors_);
Bootstrap::GetInstance().LoadCloud();
Bootstrap::GetInstance().LoadPkgWhiteList();
LoadConfigMsg();
Initialize();
auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (samgr != nullptr) {
@ -309,6 +303,17 @@ void KvStoreDataService::OnStart()
StartService();
}
void KvStoreDataService::LoadConfigMsg()
{
Bootstrap::GetInstance().LoadComponents();
Bootstrap::GetInstance().LoadDirectory();
Bootstrap::GetInstance().LoadCheckers();
Bootstrap::GetInstance().LoadNetworks();
Bootstrap::GetInstance().LoadBackup(executors_);
Bootstrap::GetInstance().LoadCloud();
Bootstrap::GetInstance().LoadPkgWhiteList();
}
void KvStoreDataService::OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId)
{
ZLOGI("add system abilityid:%{public}d", systemAbilityId);

View File

@ -169,6 +169,8 @@ private:
bool ResolveAutoLaunchParamByIdentifier(const std::string &identifier, DistributedDB::AutoLaunchParam &param);
void ResolveAutoLaunchCompatible(const StoreMetaData &storeMeta, const std::string &identifier,
const std::string &accountId);
void LoadConfigMsg();
static DistributedDB::SecurityOption ConvertSecurity(int securityLevel);
static Status InitNbDbOption(const Options &options, const std::vector<uint8_t> &cipherKey,
DistributedDB::KvStoreNbDelegate::Option &dbOption);

View File

@ -131,7 +131,8 @@ void UpgradeManager::SetCompatibleIdentifyByType(DistributedDB::KvStoreNbDelegat
if (!defaultAccountDevs.empty()) {
auto trueDualTuple = WhiteListConfigManager::GetInstance().FindTrueDualTuple(tuple.appId, defaultAccountId);
auto syncIdentifier =
DistributedDB::KvStoreDelegateManager::GetKvStoreIdentifier(trueDualTuple.second, trueDualTuple.first, tuple.storeId);
DistributedDB::KvStoreDelegateManager::GetKvStoreIdentifier(trueDualTuple.second,
trueDualTuple.first, tuple.storeId);
ZLOGI("no account set compatible identifier, store:%{public}s, device:%{public}.10s",
Anonymous::Change(tuple.storeId).c_str(),
DistributedData::Serializable::Marshall(defaultAccountDevs).c_str());

View File

@ -101,7 +101,7 @@ ohos_shared_library("distributeddatasvcfwk") {
"utils/converter.cpp",
"utils/crypto.cpp",
"utils/ref_count.cpp",
"whitelist/whitelist_config_manager.cpp"
"whitelist/whitelist_config_manager.cpp",
]
cflags = [ "-Wno-multichar" ]

View File

@ -30,7 +30,8 @@ void WhiteListConfigManager::Initialize(const std::vector<BundleInfo> &mapper)
}
}
std::pair<std::string, std::string> WhiteListConfigManager::FindTrueDualTuple(const std::string &appId, const std::string &accountId)
std::pair<std::string, std::string> WhiteListConfigManager::FindTrueDualTuple(const std::string &appId,
const std::string &accountId)
{
auto it = toDstMapper_.find(appId);
if (it == toDstMapper_.end()) {

View File

@ -37,7 +37,7 @@ public:
DirectoryConfig *directory = nullptr;
BackupConfig *backup = nullptr;
CloudConfig *cloud = nullptr;
WhiteListConfig *Whitelist = nullptr;
WhiteListConfig *whitelist = nullptr;
~GlobalConfig();
bool Marshal(json &node) const override;
bool Unmarshal(const json &node) override;

View File

@ -31,13 +31,13 @@ bool WhiteListConfig::Unmarshal(const json &node)
bool WhiteListConfig::BundleInfo::Marshal(Serializable::json &node) const
{
SetValue(node[GET_NAME(srcAppId)], srcAppId);
SetValue(node[GET_NAME(DstAppId)], DstAppId);
SetValue(node[GET_NAME(dstAppId)], dstAppId);
return true;
}
bool WhiteListConfig::BundleInfo::Unmarshal(const Serializable::json &node)
{
GetValue(node, GET_NAME(srcAppId), srcAppId);
GetValue(node, GET_NAME(DstAppId), DstAppId);
GetValue(node, GET_NAME(dstAppId), dstAppId);
return true;
}
} // namespace DistributedData