diff --git a/services/accountmgr/src/osaccount/inner_os_account_manager.cpp b/services/accountmgr/src/osaccount/inner_os_account_manager.cpp index 8c5eb0fb5..2033f1f70 100644 --- a/services/accountmgr/src/osaccount/inner_os_account_manager.cpp +++ b/services/accountmgr/src/osaccount/inner_os_account_manager.cpp @@ -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(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(); }