mirror of
https://gitee.com/openharmony/account_os_account
synced 2024-11-23 10:10:11 +00:00
!2207 IsOsAccountCompleted错误码判断
Merge pull request !2207 from xuqian0131/onstart
This commit is contained in:
commit
2977ddf4f4
@ -290,15 +290,16 @@ void AccountMgrService::OnAddSystemAbility(int32_t systemAbilityId, const std::s
|
||||
return;
|
||||
}
|
||||
bool isAccountCompleted = false;
|
||||
IInnerOsAccountManager::GetInstance().IsOsAccountCompleted(Constants::START_USER_ID, isAccountCompleted);
|
||||
if (!isAccountCompleted) {
|
||||
ErrCode errCode =
|
||||
IInnerOsAccountManager::GetInstance().IsOsAccountCompleted(Constants::START_USER_ID, isAccountCompleted);
|
||||
if (errCode == ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR || (errCode == ERR_OK && !isAccountCompleted)) {
|
||||
if (!isBmsReady_) {
|
||||
return;
|
||||
}
|
||||
IInnerOsAccountManager::GetInstance().Init();
|
||||
}
|
||||
if (!isDefaultOsAccountActivated_ && isAmsReady_) {
|
||||
ErrCode errCode = IInnerOsAccountManager::GetInstance().ActivateDefaultOsAccount();
|
||||
errCode = IInnerOsAccountManager::GetInstance().ActivateDefaultOsAccount();
|
||||
if (errCode == ERR_OK) {
|
||||
isDefaultOsAccountActivated_ = true;
|
||||
}
|
||||
|
@ -537,19 +537,22 @@ ErrCode OsAccountControlFileManager::GetOsAccountInfoById(const int id, OsAccoun
|
||||
InsertOsAccount(osAccountInfo);
|
||||
return ERR_OK;
|
||||
}
|
||||
return ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR;
|
||||
return errno == ENOENT ? ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR : ERR_ACCOUNT_COMMON_FILE_READ_FAILED;
|
||||
}
|
||||
std::string accountInfoStr;
|
||||
if (accountFileOperator_->GetFileContentByPath(path, accountInfoStr) != ERR_OK) {
|
||||
ACCOUNT_LOGE("get content from file %{public}s failed!", path.c_str());
|
||||
return ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR;
|
||||
if (GetOsAccountFromDatabase("", id, osAccountInfo) == ERR_OK) {
|
||||
return ERR_OK;
|
||||
}
|
||||
return ERR_ACCOUNT_COMMON_FILE_READ_FAILED;
|
||||
}
|
||||
Json osAccountInfoJson = Json::parse(accountInfoStr, nullptr, false);
|
||||
if (osAccountInfoJson.is_discarded() || !osAccountInfo.FromJson(osAccountInfoJson)) {
|
||||
ACCOUNT_LOGE("parse os account info json for %{public}d failed", id);
|
||||
if (GetOsAccountFromDatabase("", id, osAccountInfo) != ERR_OK) {
|
||||
ACCOUNT_LOGE("GetOsAccountFromDatabase failed id=%{public}d", id);
|
||||
return ERR_ACCOUNT_COMMON_BAD_JSON_FORMAT_ERROR;
|
||||
return ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR;
|
||||
}
|
||||
}
|
||||
return ERR_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user