!2159 账号启动激活默认用户, 判断用户状态

Merge pull request !2159 from 周士淼/fix_1014_activeDefult
This commit is contained in:
openharmony_ci 2024-10-28 10:14:18 +00:00 committed by Gitee
commit 7943281d06
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -153,7 +153,7 @@ void IInnerOsAccountManager::RetryToGetAccount(OsAccountInfo &osAccountInfo)
while (retryTimes < MAX_RETRY_TIMES) {
std::vector<OsAccountInfo> osAccountInfos;
QueryAllCreatedOsAccounts(osAccountInfos);
if (!osAccountInfos.empty() && !osAccountInfos[0].GetToBeRemoved()) {
if (!osAccountInfos.empty() && (IsValidOsAccount(osAccountInfos[0]) == ERR_OK)) {
osAccountInfo = osAccountInfos[0];
return;
}
@ -206,7 +206,7 @@ ErrCode IInnerOsAccountManager::ActivateDefaultOsAccount()
ACCOUNT_LOGI("start to activate default account");
OsAccountInfo osAccountInfo;
ErrCode errCode = GetRealOsAccountInfoById(defaultActivatedId_, osAccountInfo);
if (errCode != ERR_OK || osAccountInfo.GetToBeRemoved()) {
if ((errCode != ERR_OK) || (IsValidOsAccount(osAccountInfo) != ERR_OK)) {
ACCOUNT_LOGE("account not found, localId: %{public}d, error: %{public}d", defaultActivatedId_, errCode);
RetryToGetAccount(osAccountInfo);
SetDefaultActivatedOsAccount(osAccountInfo.GetLocalId());