!2243 添加账号生命周期事件

Merge pull request !2243 from 周士淼/fix_1107_event
This commit is contained in:
openharmony_ci 2024-11-14 06:58:55 +00:00 committed by Gitee
commit 3f5eef0b5c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

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();
}