Signed-off-by: tantingting <tantingting5@huawei.com>
This commit is contained in:
tantingting
2024-08-31 18:21:35 +08:00
parent 49114447b1
commit af5086c42d
7 changed files with 1076 additions and 1081 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -64,7 +64,7 @@ bool DeepLinkReserveConfig::LoadConfiguration()
return false;
}
if (!LoadReservedUriList(jsonBuf)) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "LoadConfiguration failed.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "load fail");
return false;
}
@@ -77,7 +77,7 @@ bool DeepLinkReserveConfig::isLinkReserved(const std::string &linkString, std::s
for (auto it = deepLinkReserveUris_.begin(); it != deepLinkReserveUris_.end(); ++it) {
for (auto &itemUri : it->second) {
if (isUriMatched(itemUri, linkString)) {
TAG_LOGI(AAFwkTag::ABILITYMGR, "link is: %{public}s, linkReserved is: %{public}s, matched!",
TAG_LOGI(AAFwkTag::ABILITYMGR, "link:%{public}s, linkReserved:%{public}s, matched",
linkString.c_str(), itemUri.scheme.c_str());
bundleName = it->first;
return true;
@@ -180,42 +180,42 @@ void DeepLinkReserveConfig::LoadReservedUrilItem(const nlohmann::json &jsonUriOb
if (jsonUriObject.contains(SCHEME_NAME) && jsonUriObject.at(SCHEME_NAME).is_string()) {
std::string schemeName = jsonUriObject.at(SCHEME_NAME).get<std::string>();
reserveUri.scheme = schemeName;
TAG_LOGD(AAFwkTag::ABILITYMGR, "scheme is: %{public}s", reserveUri.scheme.c_str());
TAG_LOGD(AAFwkTag::ABILITYMGR, "scheme:%{public}s", reserveUri.scheme.c_str());
}
if (jsonUriObject.contains(HOST_NAME) && jsonUriObject.at(HOST_NAME).is_string()) {
std::string hostName = jsonUriObject.at(HOST_NAME).get<std::string>();
reserveUri.host = hostName;
TAG_LOGD(AAFwkTag::ABILITYMGR, "host is: %{public}s", reserveUri.host.c_str());
TAG_LOGD(AAFwkTag::ABILITYMGR, "host:%{public}s", reserveUri.host.c_str());
}
if (jsonUriObject.contains(PORT_NAME) && jsonUriObject.at(PORT_NAME).is_string()) {
std::string portName = jsonUriObject.at(PORT_NAME).get<std::string>();
reserveUri.port = portName;
TAG_LOGD(AAFwkTag::ABILITYMGR, "port is: %{public}s", reserveUri.port.c_str());
TAG_LOGD(AAFwkTag::ABILITYMGR, "port:%{public}s", reserveUri.port.c_str());
}
if (jsonUriObject.contains(PATH_NAME) && jsonUriObject.at(PATH_NAME).is_string()) {
std::string pathName = jsonUriObject.at(PATH_NAME).get<std::string>();
reserveUri.path = PATH_NAME;
TAG_LOGD(AAFwkTag::ABILITYMGR, "path is: %{public}s", reserveUri.path.c_str());
TAG_LOGD(AAFwkTag::ABILITYMGR, "path:%{public}s", reserveUri.path.c_str());
}
if (jsonUriObject.contains(PATH_START_WITH_NAME) && jsonUriObject.at(PATH_START_WITH_NAME).is_string()) {
std::string pathStartWithName = jsonUriObject.at(PATH_START_WITH_NAME).get<std::string>();
reserveUri.pathStartWith = pathStartWithName;
TAG_LOGD(AAFwkTag::ABILITYMGR, "pathStartWith is: %{public}s", reserveUri.pathStartWith.c_str());
TAG_LOGD(AAFwkTag::ABILITYMGR, "pathStartWith:%{public}s", reserveUri.pathStartWith.c_str());
}
if (jsonUriObject.contains(PATH_REGEX_NAME) && jsonUriObject.at(PATH_REGEX_NAME).is_string()) {
std::string pathRegexName = jsonUriObject.at(PATH_REGEX_NAME).get<std::string>();
reserveUri.pathRegex = pathRegexName;
TAG_LOGD(AAFwkTag::ABILITYMGR, "pathRegex is: %{public}s", reserveUri.pathRegex.c_str());
TAG_LOGD(AAFwkTag::ABILITYMGR, "pathRegex:%{public}s", reserveUri.pathRegex.c_str());
}
if (jsonUriObject.contains(TYPE_NAME) && jsonUriObject.at(TYPE_NAME).is_string()) {
std::string typeName = jsonUriObject.at(TYPE_NAME).get<std::string>();
reserveUri.type = typeName;
TAG_LOGD(AAFwkTag::ABILITYMGR, "type is: %{public}s", reserveUri.type.c_str());
TAG_LOGD(AAFwkTag::ABILITYMGR, "type:%{public}s", reserveUri.type.c_str());
}
if (jsonUriObject.contains(UTD_NAME) && jsonUriObject.at(UTD_NAME).is_string()) {
std::string utdName = jsonUriObject.at(UTD_NAME).get<std::string>();
reserveUri.utd = utdName;
TAG_LOGD(AAFwkTag::ABILITYMGR, "utd is: %{public}s", reserveUri.utd.c_str());
TAG_LOGD(AAFwkTag::ABILITYMGR, "utd:%{public}s", reserveUri.utd.c_str());
}
uriList.emplace_back(reserveUri);
@@ -224,18 +224,18 @@ void DeepLinkReserveConfig::LoadReservedUrilItem(const nlohmann::json &jsonUriOb
bool DeepLinkReserveConfig::LoadReservedUriList(const nlohmann::json &object)
{
if (!object.contains(DEEPLINK_RESERVED_URI_NAME)) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Deeplink reserved uri config not existed.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "uri config absent");
return false;
}
for (auto &item : object.at(DEEPLINK_RESERVED_URI_NAME).items()) {
const nlohmann::json& jsonObject = item.value();
if (!jsonObject.contains(BUNDLE_NAME) || !jsonObject.at(BUNDLE_NAME).is_string()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Wrong deeplink reserve bundleName.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "reserve bundleName fail");
return false;
}
if (!jsonObject.contains(URIS_NAME) || !jsonObject.at(URIS_NAME).is_array()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Wrong deeplink reserve uris.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "reserve uris fail");
return false;
}
std::string bundleName = jsonObject.at(BUNDLE_NAME).get<std::string>();
@@ -252,18 +252,18 @@ bool DeepLinkReserveConfig::LoadReservedUriList(const nlohmann::json &object)
bool DeepLinkReserveConfig::ReadFileInfoJson(const std::string &filePath, nlohmann::json &jsonBuf)
{
if (access(filePath.c_str(), F_OK) != 0) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Deeplink reserve config not exist.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "reserve config absent");
return false;
}
if (filePath.empty()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "File path is empty.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "file path empty");
return false;
}
char path[PATH_MAX] = {0};
if (realpath(filePath.c_str(), path) == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "realpath error, errno is %{public}d.", errno);
TAG_LOGE(AAFwkTag::ABILITYMGR, "realpath error:%{public}d", errno);
return false;
}
@@ -273,14 +273,14 @@ bool DeepLinkReserveConfig::ReadFileInfoJson(const std::string &filePath, nlohma
in.open(path, std::ios_base::in);
if (!in.is_open()) {
strerror_r(errno, errBuf, sizeof(errBuf));
TAG_LOGE(AAFwkTag::ABILITYMGR, "the file cannot be open due to %{public}s", errBuf);
TAG_LOGE(AAFwkTag::ABILITYMGR, "open error:%{public}s", errBuf);
return false;
}
in.seekg(0, std::ios::end);
int64_t size = in.tellg();
if (size <= 0) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "the file is an empty file");
TAG_LOGE(AAFwkTag::ABILITYMGR, "file empty");
in.close();
return false;
}
@@ -35,14 +35,14 @@ AmsResidentProcessRdbCallBack::AmsResidentProcessRdbCallBack(const AmsRdbConfig
int32_t AmsResidentProcessRdbCallBack::OnCreate(NativeRdb::RdbStore &rdbStore)
{
TAG_LOGI(AAFwkTag::ABILITYMGR, "OnCreate");
TAG_LOGI(AAFwkTag::ABILITYMGR, "call");
std::string createTableSql = "CREATE TABLE IF NOT EXISTS " + rdbConfig_.tableName +
" (KEY_BUNDLE_NAME TEXT NOT NULL PRIMARY KEY," +
"KEEP_ALIVE_ENABLE TEXT NOT NULL, KEEP_ALIVE_CONFIGURED_LIST TEXT NOT NULL);";
auto sqlResult = rdbStore.ExecuteSql(createTableSql);
if (sqlResult != NativeRdb::E_OK) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Ability mgr rdb execute sql error");
TAG_LOGE(AAFwkTag::ABILITYMGR, "execute sql error");
return sqlResult;
}
@@ -64,7 +64,7 @@ int32_t AmsResidentProcessRdbCallBack::OnCreate(NativeRdb::RdbStore &rdbStore)
int64_t insertNum = 0;
int32_t ret = rdbStore.BatchInsert(insertNum, rdbConfig_.tableName, valuesBuckets);
if (ret != NativeRdb::E_OK) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Ability mgr rdb batch insert error[%{public}d]", ret);
TAG_LOGE(AAFwkTag::ABILITYMGR, "batch insert error[%{public}d]", ret);
return ret;
}
return NativeRdb::E_OK;
@@ -72,14 +72,14 @@ int32_t AmsResidentProcessRdbCallBack::OnCreate(NativeRdb::RdbStore &rdbStore)
int32_t AmsResidentProcessRdbCallBack::OnUpgrade(NativeRdb::RdbStore &rdbStore, int currentVersion, int targetVersion)
{
TAG_LOGI(AAFwkTag::ABILITYMGR, "OnUpgrade currentVersion: %{plubic}d, targetVersion: %{plubic}d", currentVersion,
TAG_LOGI(AAFwkTag::ABILITYMGR, "onUpgrade current:%{plubic}d, target:%{plubic}d", currentVersion,
targetVersion);
return NativeRdb::E_OK;
}
int32_t AmsResidentProcessRdbCallBack::OnDowngrade(NativeRdb::RdbStore &rdbStore, int currentVersion, int targetVersion)
{
TAG_LOGI(AAFwkTag::ABILITYMGR, "OnDowngrade currentVersion: %{plubic}d, targetVersion: %{plubic}d", currentVersion,
TAG_LOGI(AAFwkTag::ABILITYMGR, "onDowngrade current:%{plubic}d, target:%{plubic}d", currentVersion,
targetVersion);
return NativeRdb::E_OK;
}
@@ -99,7 +99,7 @@ int32_t AmsResidentProcessRdbCallBack::onCorruption(std::string databaseFile)
int32_t AmsResidentProcessRdb::Init()
{
if (rdbMgr_ != nullptr) {
TAG_LOGD(AAFwkTag::ABILITYMGR, "Rdb mgr existed.");
TAG_LOGD(AAFwkTag::ABILITYMGR, "rdb mgr existed");
return Rdb_OK;
}
@@ -107,7 +107,7 @@ int32_t AmsResidentProcessRdb::Init()
config.tableName = ABILITY_RDB_TABLE_NAME;
rdbMgr_ = std::make_unique<RdbDataManager>(config);
if (rdbMgr_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to create database mgr object.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "create object fail");
return Rdb_Init_Err;
}
@@ -129,7 +129,7 @@ int32_t AmsResidentProcessRdb::VerifyConfigurationPermissions(
const std::string &bundleName, const std::string &callerBundleName)
{
if (bundleName.empty() || callerBundleName.empty()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Bundle name is null.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "null bundle name");
return Rdb_Parameter_Err;
}
@@ -139,7 +139,7 @@ int32_t AmsResidentProcessRdb::VerifyConfigurationPermissions(
}
if (rdbMgr_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Rdb mgr error.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "rdb mgr error");
return Rdb_Parameter_Err;
}
@@ -147,21 +147,21 @@ int32_t AmsResidentProcessRdb::VerifyConfigurationPermissions(
absRdbPredicates.EqualTo(KEY_BUNDLE_NAME, bundleName);
auto absSharedResultSet = rdbMgr_->QueryData(absRdbPredicates);
if (absSharedResultSet == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Ability mgr rdb query data failed.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "null absSharedResultSet");
return Rdb_Permissions_Err;
}
ScopeGuard stateGuard([absSharedResultSet] { absSharedResultSet->Close(); });
auto ret = absSharedResultSet->GoToFirstRow();
if (ret != NativeRdb::E_OK) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Go to first row failed, ret: %{public}d", ret);
TAG_LOGE(AAFwkTag::ABILITYMGR, "fail, ret:%{public}d", ret);
return Rdb_Search_Record_Err;
}
std::string KeepAliveConfiguredList;
ret = absSharedResultSet->GetString(INDEX_KEEP_ALIVE_CONFIGURED_LIST, KeepAliveConfiguredList);
if (ret != NativeRdb::E_OK) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Get configured list failed, ret: %{public}d", ret);
TAG_LOGE(AAFwkTag::ABILITYMGR, "fail, ret: %{public}d", ret);
return Rdb_Search_Record_Err;
}
@@ -175,12 +175,12 @@ int32_t AmsResidentProcessRdb::VerifyConfigurationPermissions(
int32_t AmsResidentProcessRdb::GetResidentProcessEnable(const std::string &bundleName, bool &enable)
{
if (bundleName.empty()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Bundle name is null.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "null bundleName");
return Rdb_Parameter_Err;
}
if (rdbMgr_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Rdb mgr error.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "rdb mgr error");
return Rdb_Parameter_Err;
}
@@ -188,21 +188,21 @@ int32_t AmsResidentProcessRdb::GetResidentProcessEnable(const std::string &bundl
absRdbPredicates.EqualTo(KEY_BUNDLE_NAME, bundleName);
auto absSharedResultSet = rdbMgr_->QueryData(absRdbPredicates);
if (absSharedResultSet == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Ability mgr rdb query data failed.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "rdb query fail");
return Rdb_Permissions_Err;
}
ScopeGuard stateGuard([absSharedResultSet] { absSharedResultSet->Close(); });
auto ret = absSharedResultSet->GoToFirstRow();
if (ret != NativeRdb::E_OK) {
TAG_LOGD(AAFwkTag::ABILITYMGR, "Go to first row failed, ret: %{public}d", ret);
TAG_LOGD(AAFwkTag::ABILITYMGR, "fail, ret: %{public}d", ret);
return Rdb_Search_Record_Err;
}
std::string flag;
ret = absSharedResultSet->GetString(INDEX_KEEP_ALIVE_ENABLE, flag);
if (ret != NativeRdb::E_OK) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Get enable status failed, ret: %{public}d", ret);
TAG_LOGE(AAFwkTag::ABILITYMGR, "fail, ret: %{public}d", ret);
return Rdb_Search_Record_Err;
}
@@ -213,12 +213,12 @@ int32_t AmsResidentProcessRdb::GetResidentProcessEnable(const std::string &bundl
int32_t AmsResidentProcessRdb::UpdateResidentProcessEnable(const std::string &bundleName, bool enable)
{
if (bundleName.empty()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Bundle name is null.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "null bundleName");
return Rdb_Parameter_Err;
}
if (rdbMgr_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Rdb mgr error.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "rdb mgr error");
return Rdb_Parameter_Err;
}
@@ -232,12 +232,12 @@ int32_t AmsResidentProcessRdb::UpdateResidentProcessEnable(const std::string &bu
int32_t AmsResidentProcessRdb::RemoveData(std::string &bundleName)
{
if (bundleName.empty()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Bundle name is null.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "null bundleName");
return Rdb_Parameter_Err;
}
if (rdbMgr_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Rdb mgr error.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "rdb mgr error");
return Rdb_Parameter_Err;
}
NativeRdb::AbsRdbPredicates absRdbPredicates(ABILITY_RDB_TABLE_NAME);
+9 -9
View File
@@ -71,18 +71,18 @@ bool ParserUtil::FilterInfoFromJson(
nlohmann::json &jsonBuf, std::vector<std::tuple<std::string, std::string, std::string>> &list)
{
if (jsonBuf.is_discarded()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Profile format error");
TAG_LOGE(AAFwkTag::ABILITYMGR, "format error");
return false;
}
if (jsonBuf.find(INSTALL_LIST) == jsonBuf.end()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "InstallList not exist");
TAG_LOGE(AAFwkTag::ABILITYMGR, "installList absent");
return false;
}
auto arrays = jsonBuf.at(INSTALL_LIST);
if (!arrays.is_array() || arrays.empty()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Array not found");
TAG_LOGE(AAFwkTag::ABILITYMGR, "not found");
return false;
}
@@ -147,31 +147,31 @@ void ParserUtil::GetPreInstallRootDirList(std::vector<std::string> &rootDirList)
bool ParserUtil::ReadFileIntoJson(const std::string &filePath, nlohmann::json &jsonBuf)
{
if (access(filePath.c_str(), F_OK) != 0) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "File path is not exist.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "path not exist");
return false;
}
if (filePath.empty()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "File path empty.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "empty path");
return false;
}
char path[PATH_MAX] = {0};
if (realpath(filePath.c_str(), path) == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "realpath error, errno is %{public}d.", errno);
TAG_LOGE(AAFwkTag::ABILITYMGR, "realpath error:%{public}d", errno);
return false;
}
std::ifstream fin(path);
if (!fin.is_open()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "File path exception.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "path exception");
return false;
}
fin.seekg(0, std::ios::end);
int64_t size = fin.tellg();
if (size <= 0) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "The file is an empty file!");
TAG_LOGE(AAFwkTag::ABILITYMGR, "empty file");
fin.close();
return false;
}
@@ -180,7 +180,7 @@ bool ParserUtil::ReadFileIntoJson(const std::string &filePath, nlohmann::json &j
jsonBuf = nlohmann::json::parse(fin, nullptr, false);
fin.close();
if (jsonBuf.is_discarded()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Bad profile file");
TAG_LOGE(AAFwkTag::ABILITYMGR, "bad profile");
return false;
}
return true;
@@ -33,7 +33,7 @@ int32_t RdbDataManager::Init(NativeRdb::RdbOpenCallback &rdbCallback)
int32_t ret = NativeRdb::E_OK;
rdbStore_ = NativeRdb::RdbHelper::GetRdbStore(rdbStoreConfig, amsRdbConfig_.version, rdbCallback, ret);
if (rdbStore_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Ability mgr rdb init fail");
TAG_LOGE(AAFwkTag::ABILITYMGR, "null rdbStore_");
return NativeRdb::E_ERROR;
}
@@ -44,7 +44,7 @@ int32_t RdbDataManager::InsertData(const NativeRdb::ValuesBucket &valuesBucket)
{
std::lock_guard<std::mutex> lock(rdbMutex_);
if (rdbStore_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Rdb store is null");
TAG_LOGE(AAFwkTag::ABILITYMGR, "null rdbStore_");
return NativeRdb::E_ERROR;
}
@@ -57,7 +57,7 @@ int32_t RdbDataManager::BatchInsert(int64_t &outInsertNum, const std::vector<Nat
{
std::lock_guard<std::mutex> lock(rdbMutex_);
if (rdbStore_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Rdb store is null");
TAG_LOGE(AAFwkTag::ABILITYMGR, "null rdbStore_");
return NativeRdb::E_ERROR;
}
auto ret = rdbStore_->BatchInsert(outInsertNum, amsRdbConfig_.tableName, valuesBuckets);
@@ -69,11 +69,11 @@ int32_t RdbDataManager::UpdateData(
{
std::lock_guard<std::mutex> lock(rdbMutex_);
if (rdbStore_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Rdb store is null");
TAG_LOGE(AAFwkTag::ABILITYMGR, "null rdbStore_");
return NativeRdb::E_ERROR;
}
if (absRdbPredicates.GetTableName() != amsRdbConfig_.tableName) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Rdb store table is invalid");
TAG_LOGE(AAFwkTag::ABILITYMGR, "invalid rdb store table");
return NativeRdb::E_ERROR;
}
int32_t rowId = -1;
@@ -84,11 +84,11 @@ int32_t RdbDataManager::DeleteData(const NativeRdb::AbsRdbPredicates &absRdbPred
{
std::lock_guard<std::mutex> lock(rdbMutex_);
if (rdbStore_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Rdb store is null");
TAG_LOGE(AAFwkTag::ABILITYMGR, "null rdbStore_");
return NativeRdb::E_ERROR;
}
if (absRdbPredicates.GetTableName() != amsRdbConfig_.tableName) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Rdb store table is invalid");
TAG_LOGE(AAFwkTag::ABILITYMGR, "invalid rdb store table");
return NativeRdb::E_ERROR;
}
int32_t rowId = -1;
@@ -100,16 +100,16 @@ std::shared_ptr<NativeRdb::AbsSharedResultSet> RdbDataManager::QueryData(
{
std::lock_guard<std::mutex> lock(rdbMutex_);
if (rdbStore_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Rdb store is null");
TAG_LOGE(AAFwkTag::ABILITYMGR, "null rdbStore_");
return nullptr;
}
if (absRdbPredicates.GetTableName() != amsRdbConfig_.tableName) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Rdb store table is invalid");
TAG_LOGE(AAFwkTag::ABILITYMGR, "invalid rdb store table");
return nullptr;
}
auto absSharedResultSet = rdbStore_->Query(absRdbPredicates, std::vector<std::string>());
if (absSharedResultSet == nullptr || !absSharedResultSet->HasBlock()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Query data failed.");
TAG_LOGE(AAFwkTag::ABILITYMGR, "query data fail");
return nullptr;
}
return absSharedResultSet;
+3 -3
View File
@@ -156,7 +156,7 @@ int AppfreezeManager::AppfreezeHandleWithStack(const FaultData& faultData, const
|| faultData.errorObject.name == AppFreezeType::APP_INPUT_BLOCK
|| faultData.errorObject.name == AppFreezeType::THREAD_BLOCK_6S) {
if (AppExecFwk::AppfreezeManager::GetInstance()->IsNeedIgnoreFreezeEvent(appInfo.pid)) {
TAG_LOGE(AAFwkTag::APPDFR, "AppFreeze happend");
TAG_LOGE(AAFwkTag::APPDFR, "appFreeze happend");
return 0;
}
}
@@ -199,14 +199,14 @@ std::string AppfreezeManager::WriteToFile(const std::string& fileName, std::stri
}
std::string realPath;
if (!OHOS::PathToRealPath(dir_path, realPath)) {
TAG_LOGE(AAFwkTag::APPDFR, "PathToRealPath Failed:%{public}s", dir_path.c_str());
TAG_LOGE(AAFwkTag::APPDFR, "pathToRealPath failed:%{public}s", dir_path.c_str());
return "";
}
std::string stackPath = realPath + "/" + fileName;
constexpr mode_t defaultLogFileMode = 0644;
auto fd = open(stackPath.c_str(), O_CREAT | O_WRONLY | O_TRUNC, defaultLogFileMode);
if (fd < 0) {
TAG_LOGI(AAFwkTag::APPDFR, "Failed to create stackPath");
TAG_LOGI(AAFwkTag::APPDFR, "stackPath create failed");
return "";
} else {
TAG_LOGI(AAFwkTag::APPDFR, "stackPath: %{public}s", stackPath.c_str());