Signed-off-by: lihuihui <lihuihui29@huawei.com>
This commit is contained in:
lihuihui 2023-07-10 18:14:03 +08:00
parent 4a00950476
commit ff85556cec
4 changed files with 15 additions and 4 deletions

View File

@ -53,6 +53,7 @@
"common_event_service",
"c_utils",
"device_manager",
"ffrt",
"hilog",
"hitrace",
"huks",

View File

@ -43,6 +43,8 @@ public:
int32_t GetArea() const;
bool IsSystemAppCalled();
bool IsHasProxyDataConfig() const;
int GetSystemDatabaseDir(const std::string &dataGroupId, std::string &databaseDir);
bool IsStageMode() const;
private:
int32_t area_ = 0;
@ -54,6 +56,8 @@ private:
std::string writePermission_;
bool hasProxyDataConfig_ = false;
bool isSystemAppCalled_ = false;
bool isStageMode_ = false;
};
class JSAbility final {

View File

@ -117,5 +117,15 @@ bool Context::IsHasProxyDataConfig() const
{
return hasProxyDataConfig_;
}
bool Context::IsStageMode() const
{
return isStageMode_;
}
int Context::GetSystemDatabaseDir(const std::string &dataGroupId, std::string &databaseDir)
{
return false;
}
} // namespace AppDataMgrJsKit
} // namespace OHOS

View File

@ -98,10 +98,8 @@ int ParseDatabaseDir(const napi_env &env, const napi_value &object, std::shared_
}
std::string databaseDir;
#if !defined(WINDOWS_PLATFORM) && !defined(MAC_PLATFORM) && !defined(ANDROID_PLATFORM) && !defined(IOS_PLATFORM)
errorCode = context->abilitycontext->GetSystemDatabaseDir(context->config.GetDataGroupId(), databaseDir);
CHECK_RETURN_SET((errorCode == E_OK), std::make_shared<InnerError>(E_DATA_GROUP_ID_INVALID));
#endif
std::string realPath = RdbSqlUtils::GetDefaultDatabasePath(databaseDir, databaseName, errorCode);
CHECK_RETURN_SET(errorCode == E_OK, std::make_shared<ParamError>("config", "a StoreConfig."));
@ -144,9 +142,7 @@ int ParseDataGroupId(const napi_env &env, const napi_value &object, std::shared_
std::string dataGroupId = JSUtils::Convert2String(env, value);
CHECK_RETURN_SET(!dataGroupId.empty(), std::make_shared<ParamError>
("StoreConfig.dataGroupId", "not empty."));
#if !defined(WINDOWS_PLATFORM) && !defined(MAC_PLATFORM) && !defined(ANDROID_PLATFORM) && !defined(IOS_PLATFORM)
CHECK_RETURN_SET(context->abilitycontext->IsStageMode(), std::make_shared<InnerError>(E_NOT_STAGE_MODE));
#endif
context->config.SetDataGroupId(JSUtils::Convert2String(env, value));
}
return OK;