账号生命周期事件

Signed-off-by: fundavid <fangjiawei8@huawei.com>
Change-Id: I558ea5d1d4c1ca5203791737faf41cd181b2b971
This commit is contained in:
ZhouShimiao 2024-11-14 14:20:15 +08:00
parent 432f7f2c3e
commit 97f2d52a05

View File

@ -1865,6 +1865,7 @@ ErrCode IInnerOsAccountManager::DeactivateOsAccount(const int id, bool isStopSto
OsAccountInterface::PublishCommonEvent(osAccountInfo, OHOS::EventFwk::CommonEventSupport::COMMON_EVENT_USER_STOPPED,
Constants::OPERATION_STOP);
subscribeManager_.Publish(id, OS_ACCOUNT_SUBSCRIBE_TYPE::STOPPED);
ReportOsAccountLifeCycle(id, Constants::OPERATION_STOP);
RemoveLocalIdToOperating(id);
ACCOUNT_LOGI("IInnerOsAccountManager DeactivateOsAccount end");
@ -1878,6 +1879,7 @@ ErrCode IInnerOsAccountManager::SendMsgForAccountActivate(OsAccountInfo &osAccou
int32_t oldId = -1;
bool oldIdExist = foregroundAccountMap_.Find(displayId, oldId);
int32_t localId = static_cast<int32_t>(osAccountInfo.GetLocalId());
bool preActivated = osAccountInfo.GetIsActived();
if (oldId != localId) {
subscribeManager_.Publish(localId, oldId, OS_ACCOUNT_SUBSCRIBE_TYPE::SWITCHING);
}
@ -1912,6 +1914,9 @@ ErrCode IInnerOsAccountManager::SendMsgForAccountActivate(OsAccountInfo &osAccou
subscribeManager_.Publish(localId, oldId, OS_ACCOUNT_SUBSCRIBE_TYPE::SWITCHED);
ReportOsAccountSwitch(localId, oldId);
}
if (!preActivated) {
ReportOsAccountLifeCycle(defaultActivatedId_, Constants::OPERATION_ACTIVATE);
}
ACCOUNT_LOGI("SendMsgForAccountActivate ok");
return errCode;
}
@ -1936,6 +1941,7 @@ ErrCode IInnerOsAccountManager::SendToStorageAccountStart(OsAccountInfo &osAcco
OsAccountInterface::PublishCommonEvent(osAccountInfo,
OHOS::EventFwk::CommonEventSupport::COMMON_EVENT_USER_UNLOCKED, Constants::OPERATION_UNLOCK);
subscribeManager_.Publish(localId, OS_ACCOUNT_SUBSCRIBE_TYPE::UNLOCKED);
ReportOsAccountLifeCycle(localId, Constants::OPERATION_UNLOCK);
}
return ERR_OK;
}
@ -2088,6 +2094,7 @@ ErrCode IInnerOsAccountManager::SetOsAccountIsVerified(const int id, const bool
OsAccountInterface::PublishCommonEvent(osAccountInfo,
OHOS::EventFwk::CommonEventSupport::COMMON_EVENT_USER_UNLOCKED, Constants::OPERATION_UNLOCK);
subscribeManager_.Publish(id, OS_ACCOUNT_SUBSCRIBE_TYPE::UNLOCKED);
ReportOsAccountLifeCycle(id, Constants::OPERATION_UNLOCK);
CleanGarbageOsAccountsAsync();
}