* * * reSetOaid预置配置

Signed-off-by: lipan <lipan111@huawei.com>
This commit is contained in:
lipan 2023-12-15 16:52:04 +08:00
parent 208533097a
commit 8c122adcc2
3 changed files with 10 additions and 6 deletions

View File

@ -42,6 +42,7 @@ static const std::string OAID_DATA_BASE_APP_ID = "oaid_service_manager";
static const std::string OAID_DATA_BASE_STORE_ID = "oaidservice";
static const std::string OAID_KVSTORE_KEY = "oaid_key";
static const std::string OAID_TRUSTLIST_CONFIG_PATH = "/etc/advertising/oaid/oaid_service_config.json";
static const std::string OAID_TRUSTLIST_EXTENSION_CONFIG_PATH = "/etc/advertising/oaid/oaid_service_config_ext.json";
} // namespace Cloud
} // namespace OHOS
#endif // OHOS_CLOUD_OAID_SERVICE_DEFINE_H

View File

@ -89,14 +89,17 @@ bool OAIDServiceStub::CheckSystemApp()
return false;
}
bool LoadAndCheckOaidWhiteList(const std::string &bundleName)
bool LoadAndCheckOaidTrustList(const std::string &bundleName)
{
char pathBuff[MAX_PATH_LEN];
GetOneCfgFile(OAID_TRUSTLIST_CONFIG_PATH.c_str(), pathBuff, MAX_PATH_LEN);
GetOneCfgFile(OAID_TRUSTLIST_EXTENSION_CONFIG_PATH.c_str(), pathBuff, MAX_PATH_LEN);
char realPath[PATH_MAX];
if (realpath(pathBuff, realPath) == nullptr) {
OAID_HILOGE(OAID_MODULE_SERVICE, "Parse realpath fail");
return false;
GetOneCfgFile(OAID_TRUSTLIST_CONFIG_PATH.c_str(), pathBuff, MAX_PATH_LEN);
if (realpath(pathBuff, realPath) == nullptr) {
OAID_HILOGE(OAID_MODULE_SERVICE, "Parse realpath fail");
return false;
}
}
std::ifstream ifs;
@ -150,7 +153,7 @@ int32_t OAIDServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Mes
}
if (code == static_cast<uint32_t>(OAIDInterfaceCode::RESET_OAID)) {
if (!LoadAndCheckOaidWhiteList(bundleName)) {
if (!LoadAndCheckOaidTrustList(bundleName)) {
OAID_HILOGW(OAID_MODULE_SERVICE, "CheckOaidTrustList fail");
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
}

View File

@ -33,7 +33,7 @@ namespace Cloud {
enum OAIDError : int32_t {
ERR_OK = 0,
ERR_INVALID_PARAM = 401,
ERR_SYSYTEM_ERROR = 17200001,
ERR_SYSYTEM_ERROR = 17300001,
};
static std::map<int32_t, std::string> oaidErrCodeMsgMap = {