!2108 clean garbage after unlock

Merge pull request !2108 from Jasonye/clean
This commit is contained in:
openharmony_ci 2024-09-20 06:40:21 +00:00 committed by Gitee
commit 0057aa89cb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 11 additions and 3 deletions

View File

@ -297,9 +297,6 @@ void AccountMgrService::OnAddSystemAbility(int32_t systemAbilityId, const std::s
isDefaultOsAccountActivated_ = true;
}
}
if (isBmsReady_ && isAmsReady_) {
IInnerOsAccountManager::GetInstance().CleanGarbageOsAccounts();
}
}
bool AccountMgrService::Init()

View File

@ -1697,6 +1697,11 @@ ErrCode IInnerOsAccountManager::SendMsgForAccountActivate(OsAccountInfo &osAccou
subscribeManager_.Publish(localId, OS_ACCOUNT_SUBSCRIBE_TYPE::UNLOCKED);
}
auto task = [] { IInnerOsAccountManager::GetInstance().CleanGarbageOsAccounts(); };
std::thread cleanThread(task);
pthread_setname_np(cleanThread.native_handle(), "CleanGarbageOsAccounts");
cleanThread.detach();
if (oldIdExist && (oldId != localId)) {
errCode = UpdateAccountToBackground(oldId);
if (errCode != ERR_OK) {
@ -1837,6 +1842,12 @@ ErrCode IInnerOsAccountManager::SetOsAccountIsVerified(const int id, const bool
OHOS::EventFwk::CommonEventSupport::COMMON_EVENT_USER_UNLOCKED, Constants::OPERATION_UNLOCK);
subscribeManager_.Publish(id, OS_ACCOUNT_SUBSCRIBE_TYPE::UNLOCKED);
}
auto task = [] { IInnerOsAccountManager::GetInstance().CleanGarbageOsAccounts(); };
std::thread cleanThread(task);
pthread_setname_np(cleanThread.native_handle(), "CleanGarbageOsAccounts");
cleanThread.detach();
return ERR_OK;
}