mirror of
https://gitee.com/openharmony/account_os_account
synced 2024-11-23 10:10:11 +00:00
修改、合并DFX事件类型
Signed-off-by: baoyang <baoyang9@huawei.com>
This commit is contained in:
parent
e69b6bb545
commit
8509d9597d
@ -61,70 +61,13 @@ void ReportPermissionFail(int32_t callerUid, int32_t callerPid, const std::strin
|
||||
#endif // HAS_HISYSEVENT_PART
|
||||
}
|
||||
|
||||
void ReportOhosAccountCESFail(int32_t oldStat, int32_t newStat, int32_t id)
|
||||
void ReportOsAccountOperationFail(
|
||||
int32_t id, const std::string& operationStr, int32_t errCode, const std::string& errMsg)
|
||||
{
|
||||
#ifdef HAS_HISYSEVENT_PART
|
||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "OHOS_ACCOUNT_COMMON_EVENT_FAILED",
|
||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "OS_ACCOUNT_FAILED",
|
||||
HiSysEventNameSpace::EventType::FAULT,
|
||||
"OLD_STATE", oldStat,
|
||||
"NEW_STATE", newStat,
|
||||
"USER_ID", id);
|
||||
if (ret != 0) {
|
||||
ACCOUNT_LOGE("hisysevent failed! ret %{public}d, oldStat %{public}d, newStat %{public}d, id %{public}d",
|
||||
ret, oldStat, newStat, id);
|
||||
}
|
||||
#else // HAS_HISYSEVENT_PART
|
||||
(void)oldStat;
|
||||
(void)newStat;
|
||||
(void)id;
|
||||
#endif // HAS_HISYSEVENT_PART
|
||||
}
|
||||
|
||||
void ReportOhosAccountStateChange(int32_t id, int32_t operateType, int32_t oldStat, int32_t newStat)
|
||||
{
|
||||
#ifdef HAS_HISYSEVENT_PART
|
||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "OHOS_ACCOUNT_STATE_CHANGE_EVENT",
|
||||
HiSysEventNameSpace::EventType::BEHAVIOR,
|
||||
"USER_ID", id,
|
||||
"OPERATION_TYPE", operateType,
|
||||
"OLD_STATE", oldStat,
|
||||
"NEW_STATE", newStat);
|
||||
if (ret != 0) {
|
||||
ACCOUNT_LOGE("hisysevent failed! ret %{public}d, [%{public}d, %{public}d, %{public}d, %{public}d]",
|
||||
ret, id, operateType, oldStat, newStat);
|
||||
}
|
||||
#else // HAS_HISYSEVENT_PART
|
||||
(void)id;
|
||||
(void)operateType;
|
||||
(void)oldStat;
|
||||
(void)newStat;
|
||||
#endif // HAS_HISYSEVENT_PART
|
||||
}
|
||||
|
||||
void ReportKvStoreAccessFail(int32_t status, const std::string& errMsg)
|
||||
{
|
||||
#ifdef HAS_HISYSEVENT_PART
|
||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "KVSTORE_ACCESS_FAILED",
|
||||
HiSysEventNameSpace::EventType::FAULT,
|
||||
"KVSTORE_STATUS", status,
|
||||
"ERROR_MSG", errMsg);
|
||||
if (ret != 0) {
|
||||
ACCOUNT_LOGE("hisysevent failed! ret %{public}d, status %{public}d, errMsg %{public}s.",
|
||||
ret, status, errMsg.c_str());
|
||||
}
|
||||
#else // HAS_HISYSEVENT_PART
|
||||
(void)status;
|
||||
(void)errMsg;
|
||||
#endif // HAS_HISYSEVENT_PART
|
||||
}
|
||||
|
||||
void ReportAccountOperationFail(int32_t id, int32_t errCode, const std::string& operationStr,
|
||||
const std::string& errMsg)
|
||||
{
|
||||
#ifdef HAS_HISYSEVENT_PART
|
||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "OS_ACCOUNT_OPERATE_FAILED",
|
||||
HiSysEventNameSpace::EventType::FAULT,
|
||||
"OSACCOUNT_ID", id,
|
||||
"ID", id,
|
||||
"OPERATE_TYPE", operationStr,
|
||||
"ERROR_TYPE", errCode,
|
||||
"ERROR_MSG", errMsg);
|
||||
@ -140,29 +83,58 @@ void ReportAccountOperationFail(int32_t id, int32_t errCode, const std::string&
|
||||
#endif // HAS_HISYSEVENT_PART
|
||||
}
|
||||
|
||||
void ReportFileOperationFail(int32_t errCode, const std::string& operationStr, const std::string& path)
|
||||
void ReportOhosAccountOperationFail(
|
||||
int32_t userId, const std::string& operationStr, int32_t errCode, const std::string& errMsg)
|
||||
{
|
||||
#ifdef HAS_HISYSEVENT_PART
|
||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "FILE_IO_OPERATE_FAILED",
|
||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "DISTRIBUTED_ACCOUNT_FAILED",
|
||||
HiSysEventNameSpace::EventType::FAULT,
|
||||
"USER_ID", userId,
|
||||
"OPERATE_TYPE", operationStr,
|
||||
"ERROR_TYPE", errCode,
|
||||
"TARGET_PATH", path);
|
||||
"ERROR_MSG", errMsg);
|
||||
if (ret != 0) {
|
||||
ACCOUNT_LOGE("ret %{public}d, opStr %{public}s, errCode %{public}d path %{public}s.",
|
||||
ret, operationStr.c_str(), errCode, path.c_str());
|
||||
ACCOUNT_LOGE("ret %{public}d, userId %{public}d, opStr %{public}s, errCode %{public}d errMsg %{public}s.",
|
||||
ret, userId, operationStr.c_str(), errCode, errMsg.c_str());
|
||||
}
|
||||
#else // HAS_HISYSEVENT_PART
|
||||
(void)errCode;
|
||||
(void)userId;
|
||||
(void)operationStr;
|
||||
(void)path;
|
||||
(void)errCode;
|
||||
(void)errMsg;
|
||||
#endif // HAS_HISYSEVENT_PART
|
||||
}
|
||||
|
||||
void ReportOsAccountLifeCycleEvent(int32_t id, const std::string& operationStr)
|
||||
void ReportAppAccountOperationFail(const std::string &name, const std::string &owner, const std::string& operationStr,
|
||||
int32_t errCode, const std::string& errMsg)
|
||||
{
|
||||
#ifdef HAS_HISYSEVENT_PART
|
||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "OS_ACCOUNT_LIFE_CYCLE_EVENT",
|
||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "APP_ACCOUNT_FAILED",
|
||||
HiSysEventNameSpace::EventType::FAULT,
|
||||
"NAME", name,
|
||||
"OWNER", owner,
|
||||
"OPERATE_TYPE", operationStr,
|
||||
"ERROR_TYPE", errCode,
|
||||
"ERROR_MSG", errMsg);
|
||||
if (ret != 0) {
|
||||
ACCOUNT_LOGE(
|
||||
"ret %{public}d, name %{public}s, owner %{public}s, opStr %{public}s, "
|
||||
"errCode %{public}d, errMsg %{public}s.",
|
||||
ret, name.c_str(), owner.c_str(), operationStr.c_str(), errCode, errMsg.c_str());
|
||||
}
|
||||
#else // HAS_HISYSEVENT_PART
|
||||
(void)name;
|
||||
(void)owner;
|
||||
(void)errCode;
|
||||
(void)operationStr;
|
||||
(void)errMsg;
|
||||
#endif // HAS_HISYSEVENT_PART
|
||||
}
|
||||
|
||||
void ReportOsAccountLifeCycle(int32_t id, const std::string& operationStr)
|
||||
{
|
||||
#ifdef HAS_HISYSEVENT_PART
|
||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "OS_ACCOUNT_LIFE_CYCLE",
|
||||
HiSysEventNameSpace::EventType::BEHAVIOR,
|
||||
"ACCOUNT_ID", id,
|
||||
"OPERATE_TYPE", operationStr);
|
||||
@ -176,10 +148,10 @@ void ReportOsAccountLifeCycleEvent(int32_t id, const std::string& operationStr)
|
||||
#endif // HAS_HISYSEVENT_PART
|
||||
}
|
||||
|
||||
void ReportOsAccountSwitchEvent(int32_t currentId, int32_t oldId)
|
||||
void ReportOsAccountSwitch(int32_t currentId, int32_t oldId)
|
||||
{
|
||||
#ifdef HAS_HISYSEVENT_PART
|
||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "OS_ACCOUNT_SWITCH_EVENT",
|
||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "OS_ACCOUNT_SWITCH",
|
||||
HiSysEventNameSpace::EventType::BEHAVIOR,
|
||||
"CURRENT_ID", currentId,
|
||||
"OLD_ID", oldId);
|
||||
@ -192,5 +164,26 @@ void ReportOsAccountSwitchEvent(int32_t currentId, int32_t oldId)
|
||||
(void)oldId;
|
||||
#endif // HAS_HISYSEVENT_PART
|
||||
}
|
||||
|
||||
void ReportOhosAccountStateChange(int32_t userId, int32_t operateType, int32_t oldStat, int32_t newStat)
|
||||
{
|
||||
#ifdef HAS_HISYSEVENT_PART
|
||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "DISTRIBUTED_ACCOUNT_CHANGE",
|
||||
HiSysEventNameSpace::EventType::BEHAVIOR,
|
||||
"USER_ID", userId,
|
||||
"OPERATION_TYPE", operateType,
|
||||
"OLD_STATE", oldStat,
|
||||
"NEW_STATE", newStat);
|
||||
if (ret != 0) {
|
||||
ACCOUNT_LOGE("ret %{public}d, [%{public}d, %{public}d, %{public}d, %{public}d]",
|
||||
ret, userId, operateType, oldStat, newStat);
|
||||
}
|
||||
#else // HAS_HISYSEVENT_PART
|
||||
(void)userId;
|
||||
(void)operateType;
|
||||
(void)oldStat;
|
||||
(void)newStat;
|
||||
#endif // HAS_HISYSEVENT_PART
|
||||
}
|
||||
} // AccountSA
|
||||
} // OHOS
|
||||
|
@ -22,14 +22,15 @@ namespace OHOS {
|
||||
namespace AccountSA {
|
||||
void ReportServiceStartFail(int32_t errCode, const std::string& errMsg);
|
||||
void ReportPermissionFail(int32_t callerUid, int32_t callerPid, const std::string& permName);
|
||||
void ReportOhosAccountCESFail(int32_t oldStat, int32_t newStat, int32_t id);
|
||||
void ReportOhosAccountStateChange(int32_t id, int32_t operateType, int32_t oldStat, int32_t newStat);
|
||||
void ReportKvStoreAccessFail(int32_t status, const std::string& errMsg);
|
||||
void ReportAccountOperationFail(int32_t id, int32_t errCode, const std::string& operationStr,
|
||||
const std::string& errMsg);
|
||||
void ReportFileOperationFail(int32_t errCode, const std::string& operationStr, const std::string& path);
|
||||
void ReportOsAccountLifeCycleEvent(int32_t id, const std::string& operationStr);
|
||||
void ReportOsAccountSwitchEvent(int32_t currentId, int32_t oldId);
|
||||
void ReportOsAccountOperationFail(
|
||||
int32_t id, const std::string& operationStr, int32_t errCode, const std::string& errMsg);
|
||||
void ReportOhosAccountOperationFail(
|
||||
int32_t userId, const std::string& operationStr, int32_t errCode, const std::string& errMsg);
|
||||
void ReportAppAccountOperationFail(const std::string &name, const std::string &owner, const std::string& operationStr,
|
||||
int32_t errCode, const std::string& errMsg);
|
||||
void ReportOsAccountLifeCycle(int32_t id, const std::string& operationStr);
|
||||
void ReportOsAccountSwitch(int32_t currentId, int32_t oldId);
|
||||
void ReportOhosAccountStateChange(int32_t userId, int32_t operateType, int32_t oldStat, int32_t newStat);
|
||||
} // AccountSA
|
||||
} // OHOS
|
||||
#endif // OS_ACCOUNT_DFX_HISYSEVENT_ADAPTER_H
|
||||
|
@ -39,7 +39,6 @@ ErrCode AccountFileOperator::CreateDir(const std::string &path)
|
||||
ACCOUNT_LOGD("enter");
|
||||
|
||||
if (!OHOS::ForceCreateDirectory(path)) {
|
||||
ReportFileOperationFail(errno, "ForceCreateDirectory", path);
|
||||
ACCOUNT_LOGE("failed to create %{public}s, errno %{public}d.", path.c_str(), errno);
|
||||
return ERR_OSACCOUNT_SERVICE_FILE_CREATE_DIR_ERROR;
|
||||
}
|
||||
@ -47,7 +46,6 @@ ErrCode AccountFileOperator::CreateDir(const std::string &path)
|
||||
bool createFlag = OHOS::ChangeModeDirectory(path, mode);
|
||||
if (!createFlag) {
|
||||
ACCOUNT_LOGE("failed to change mode for %{public}s, errno %{public}d.", path.c_str(), errno);
|
||||
ReportFileOperationFail(errno, "ChangeModeDirectory", path);
|
||||
return ERR_OSACCOUNT_SERVICE_FILE_CHANGE_DIR_MODE_ERROR;
|
||||
}
|
||||
|
||||
@ -64,7 +62,6 @@ ErrCode AccountFileOperator::DeleteDirOrFile(const std::string &path)
|
||||
delFlag = OHOS::ForceRemoveDirectory(path);
|
||||
}
|
||||
if (!delFlag) {
|
||||
ReportFileOperationFail(errno, "DeleteDirOrFile", path);
|
||||
ACCOUNT_LOGE("DeleteDirOrFile failed, path %{public}s errno %{public}d.", path.c_str(), errno);
|
||||
return ERR_OSACCOUNT_SERVICE_FILE_DELE_ERROR;
|
||||
}
|
||||
@ -86,7 +83,6 @@ ErrCode AccountFileOperator::InputFileByPathAndContent(const std::string &path,
|
||||
std::ofstream o(path);
|
||||
if (!o.is_open()) {
|
||||
ACCOUNT_LOGE("failed to open %{public}s, errno %{public}d.", path.c_str(), errno);
|
||||
ReportFileOperationFail(errno, "OpenFileToWrite", path);
|
||||
return ERR_OSACCOUNT_SERVICE_FILE_CREATE_FILE_FAILED_ERROR;
|
||||
}
|
||||
o << content;
|
||||
@ -97,7 +93,6 @@ ErrCode AccountFileOperator::InputFileByPathAndContent(const std::string &path,
|
||||
// change mode
|
||||
if (!ChangeModeFile(path, S_IRUSR | S_IWUSR)) {
|
||||
ACCOUNT_LOGW("failed to change mode for file %{public}s, errno %{public}d.", path.c_str(), errno);
|
||||
ReportFileOperationFail(errno, "ChangeModeFile", path);
|
||||
}
|
||||
|
||||
ACCOUNT_LOGI("end");
|
||||
@ -114,7 +109,6 @@ ErrCode AccountFileOperator::GetFileContentByPath(const std::string &path, std::
|
||||
std::ifstream i(path);
|
||||
if (!i.is_open()) {
|
||||
ACCOUNT_LOGE("cannot open file %{public}s, errno %{public}d.", path.c_str(), errno);
|
||||
ReportFileOperationFail(errno, "OpenFileToRead", path);
|
||||
return ERR_OSACCOUNT_SERVICE_FILE_CREATE_FILE_FAILED_ERROR;
|
||||
}
|
||||
buffer << i.rdbuf();
|
||||
|
@ -13,52 +13,50 @@
|
||||
|
||||
domain: ACCOUNT
|
||||
|
||||
SERVICE_START_FAILED:
|
||||
__BASE: {type: FAULT, level: CRITICAL, tag: usability, desc: service start errors}
|
||||
ERROR_TYPE: {type: INT32, desc: error code}
|
||||
ERROR_MSG: {type: STRING, desc: error message}
|
||||
|
||||
OHOS_ACCOUNT_COMMON_EVENT_FAILED:
|
||||
__BASE: {type: FAULT, level: MINOR, tag: usability, desc: ohosaccount publish event errors}
|
||||
OLD_STATE: {type: INT32, desc: ohos account old state}
|
||||
NEW_STATE: {type: INT32, desc: ohos account new state}
|
||||
USER_ID: {type: INT32, desc: local account id}
|
||||
|
||||
KVSTORE_ACCESS_FAILED:
|
||||
__BASE: {type: FAULT, level: MINOR, tag: usability, desc: kvstore related errors}
|
||||
KVSTORE_STATUS: {type: INT32, desc: the status returned by kvstore}
|
||||
ERROR_MSG: {type: STRING, desc: error message}
|
||||
|
||||
PERMISSION_EXCEPTION:
|
||||
__BASE: {type: SECURITY, level: CRITICAL, tag: security, desc: permission verification errors}
|
||||
CALLER_UID: {type: INT32, desc: caller uid}
|
||||
CALLER_PID: {type: INT32, desc: caller pid}
|
||||
PERMISSION_NAME: {type: STRING, desc: permission name}
|
||||
|
||||
OS_ACCOUNT_OPERATE_FAILED:
|
||||
SERVICE_START_FAILED:
|
||||
__BASE: {type: FAULT, level: CRITICAL, tag: usability, desc: service start errors}
|
||||
ERROR_TYPE: {type: INT32, desc: error code}
|
||||
ERROR_MSG: {type: STRING, desc: error message}
|
||||
|
||||
OS_ACCOUNT_FAILED:
|
||||
__BASE: {type: FAULT, level: CRITICAL, tag: usability, desc: osaccount operation errors}
|
||||
OSACCOUNT_ID: {type: INT32, desc: the id of os account}
|
||||
ID: {type: INT32, desc: the id of an os account}
|
||||
OPERATE_TYPE: {type: STRING, desc: operation type on an os account}
|
||||
ERROR_TYPE: {type: INT32, desc: error code}
|
||||
ERROR_MSG: {type: STRING, desc: error message}
|
||||
|
||||
FILE_IO_OPERATE_FAILED:
|
||||
__BASE: {type: FAULT, level: CRITICAL, tag: usability, desc: file operation errors}
|
||||
OPERATE_TYPE: {type: STRING, desc: operation type on a file or directory}
|
||||
DISTRIBUTED_ACCOUNT_FAILED:
|
||||
__BASE: {type: FAULT, level: MINOR, tag: usability, desc: kvstore related errors}
|
||||
USER_ID: {type: INT32, desc: the user id bound to a distributed account}
|
||||
OPERATE_TYPE: {type: STRING, desc: operation type on a distributed account}
|
||||
ERROR_TYPE: {type: INT32, desc: error code}
|
||||
TARGET_PATH: {type: STRING, desc: target path}
|
||||
ERROR_MSG: {type: STRING, desc: error message}
|
||||
|
||||
OS_ACCOUNT_LIFE_CYCLE_EVENT:
|
||||
APP_ACCOUNT_FAILED:
|
||||
__BASE: {type: SECURITY, level: CRITICAL, tag: security, desc: permission verification errors}
|
||||
NAME: {type: STRING, desc: the name of an app account}
|
||||
OWNER: {type: STRING, desc: the owner of an app account}
|
||||
OPERATE_TYPE: {type: STRING, desc: operation type on an app account}
|
||||
ERROR_TYPE: {type: INT32, desc: error code}
|
||||
ERROR_MSG: {type: STRING, desc: error message}
|
||||
|
||||
OS_ACCOUNT_LIFE_CYCLE:
|
||||
__BASE: {type: BEHAVIOR, level: MINOR, tag: usability, desc: osaccount create or delete event}
|
||||
ACCOUNT_ID: {type: INT32, desc: the id of os account which is created or deleted}
|
||||
ID: {type: INT32, desc: the id of os account which is created or deleted}
|
||||
OPERATE_TYPE: {type: STRING, desc: operation type on an os account create or delete}
|
||||
|
||||
OS_ACCOUNT_SWITCH_EVENT:
|
||||
OS_ACCOUNT_SWITCH:
|
||||
__BASE: {type: BEHAVIOR, level: MINOR, tag: usability, desc: osaccount switch event}
|
||||
CURRENT_ID: {type: INT32, desc: the id of os account after switch}
|
||||
OLD_ID: {type: INT32, desc: the id of os account before switch}
|
||||
|
||||
OHOS_ACCOUNT_STATE_CHANGE_EVENT:
|
||||
DISTRIBUTED_ACCOUNT_CHANGE:
|
||||
__BASE: {type: BEHAVIOR, level: MINOR, desc: ohosaccount state change events}
|
||||
USER_ID: {type: INT32, desc: local account id}
|
||||
OPERATION_TYPE: {type: INT32, desc: operation type}
|
||||
|
@ -38,10 +38,18 @@ typedef enum : std::int32_t {
|
||||
} OHOS_ACCOUNT_STATE;
|
||||
|
||||
// event string
|
||||
const std::string EVENT_PUBLISH = "event publish";
|
||||
const std::string OHOS_ACCOUNT_EVENT_LOGIN = "Ohos.account.event.LOGIN";
|
||||
const std::string OHOS_ACCOUNT_EVENT_LOGOUT = "Ohos.account.event.LOGOUT";
|
||||
const std::string OHOS_ACCOUNT_EVENT_TOKEN_INVALID = "Ohos.account.event.TOKEN_INVALID";
|
||||
const std::string OHOS_ACCOUNT_EVENT_LOGOFF = "Ohos.account.event.LOGOFF";
|
||||
const std::string OPERATION_INIT_OPEN_FILE_TO_READ = "InitOpenFileToRead";
|
||||
const std::string OPERATION_REMOVE_FILE = "RemoveFile";
|
||||
const std::string OPERATION_OPEN_FILE_TO_READ = "OpenFileToRead";
|
||||
const std::string OPERATION_OPEN_FILE_TO_WRITE = "OpenFileToWrite";
|
||||
const std::string OPERATION_CHANGE_MODE_FILE = "ChangeModeFile";
|
||||
const std::string OPERATION_FORCE_CREATE_DIRECTORY = "ForceCreateDirectory";
|
||||
const std::string OPERATION_CHANGE_MODE_DIRECTORY = "ChangeModeDirectory";
|
||||
/**
|
||||
* Account operation events
|
||||
*/
|
||||
|
@ -38,6 +38,11 @@ const std::string USER_PHOTO_FILE_JPG_NAME = "fase.jpg";
|
||||
const std::string USER_PHOTO_BASE_JPG_HEAD = "data:image/jpeg;base64,";
|
||||
const std::string USER_PHOTO_BASE_PNG_HEAD = "data:image/png;base64,";
|
||||
const std::string USER_INFO_FILE_NAME = "account_info.json";
|
||||
const std::string OPERATION_ACTIVATE = "activate";
|
||||
const std::string OPERATION_CREATE = "create";
|
||||
const std::string OPERATION_DELETE = "delete";
|
||||
const std::string OPERATION_SWITCH = "switch";
|
||||
const std::string OPERATION_STOP = "stop";
|
||||
|
||||
// distributed database
|
||||
const std::string APP_ID = "os_account_mgr_service";
|
||||
@ -77,7 +82,7 @@ const bool IS_SERIAL_NUMBER_FULL_INIT_VALUE = false;
|
||||
const int64_t TIME_WAIT_TIME_OUT = 5;
|
||||
const std::int32_t WAIT_ONE_TIME = 1000;
|
||||
|
||||
// type temeplate
|
||||
// type template
|
||||
const std::string DEVICE_OWNER_ID = "deviceOwnerId";
|
||||
const std::string ALL_GLOBAL_CONSTRAINTS = "allGlobalConstraints";
|
||||
const std::string ALL_SPECIFIC_CONSTRAINTS = "allSpecificConstraints";
|
||||
|
@ -93,7 +93,6 @@ bool AccountDataStorage::CheckKvStore()
|
||||
}
|
||||
|
||||
if (kvStorePtr_ == nullptr) {
|
||||
ReportKvStoreAccessFail(status, "GetSingleKvStore failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -119,11 +118,6 @@ ErrCode AccountDataStorage::LoadAllData(std::map<std::string, std::shared_ptr<IA
|
||||
|
||||
if (status != OHOS::DistributedKv::Status::SUCCESS) {
|
||||
ACCOUNT_LOGE("get entries error: %{public}d", status);
|
||||
// KEY_NOT_FOUND means no data in database, no need to report.
|
||||
if (status != OHOS::DistributedKv::Status::KEY_NOT_FOUND) {
|
||||
ACCOUNT_LOGE("status != OHOS::DistributedKv::Status::KEY_NOT_FOUND");
|
||||
ReportKvStoreAccessFail(status, "GetEntries failed!");
|
||||
}
|
||||
return OHOS::ERR_OSACCOUNT_SERVICE_MANAGER_QUERY_DISTRIBUTE_DATA_ERROR;
|
||||
}
|
||||
infos.clear();
|
||||
@ -183,10 +177,6 @@ ErrCode AccountDataStorage::RemoveValueFromKvStore(const std::string &keyStr)
|
||||
}
|
||||
if (status != OHOS::DistributedKv::Status::SUCCESS) {
|
||||
ACCOUNT_LOGI("key does not exist in kvStore.");
|
||||
// KEY_NOT_FOUND means no data in database, no need to report.
|
||||
if (status != OHOS::DistributedKv::Status::KEY_NOT_FOUND) {
|
||||
ReportKvStoreAccessFail(status, "get value from kvstore failed!");
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@ -238,7 +228,6 @@ ErrCode AccountDataStorage::DeleteKvStore()
|
||||
}
|
||||
if (status != OHOS::DistributedKv::Status::SUCCESS) {
|
||||
ACCOUNT_LOGE("error, status = %{public}d", status);
|
||||
ReportKvStoreAccessFail(status, "DeleteKvStore failed!");
|
||||
return OHOS::ERR_OSACCOUNT_SERVICE_MANAGER_QUERY_DISTRIBUTE_DATA_ERROR;
|
||||
}
|
||||
|
||||
@ -283,11 +272,6 @@ ErrCode AccountDataStorage::LoadDataByLocalFuzzyQuery(
|
||||
|
||||
if (status != OHOS::DistributedKv::Status::SUCCESS) {
|
||||
ACCOUNT_LOGE("get entries error: %{public}d", status);
|
||||
// KEY_NOT_FOUND means no data in database, no need to report.
|
||||
if (status != OHOS::DistributedKv::Status::KEY_NOT_FOUND) {
|
||||
ACCOUNT_LOGE("GetEntries failed! status %{public}d.", status);
|
||||
ReportKvStoreAccessFail(status, "GetEntries failed!");
|
||||
}
|
||||
return OHOS::ERR_OSACCOUNT_SERVICE_MANAGER_QUERY_DISTRIBUTE_DATA_ERROR;
|
||||
}
|
||||
infos.clear();
|
||||
@ -316,7 +300,6 @@ ErrCode AccountDataStorage::PutValueToKvStore(const std::string &keyStr, const s
|
||||
|
||||
if (status != OHOS::DistributedKv::Status::SUCCESS) {
|
||||
ACCOUNT_LOGE("put value to kvStore error, status = %{public}d", status);
|
||||
ReportKvStoreAccessFail(status, "put value to kvStore failed!");
|
||||
return OHOS::ERR_OSACCOUNT_SERVICE_MANAGER_QUERY_DISTRIBUTE_DATA_ERROR;
|
||||
}
|
||||
ACCOUNT_LOGD("put value to kvStore succeed!");
|
||||
@ -345,10 +328,6 @@ ErrCode AccountDataStorage::GetValueFromKvStore(const std::string &keyStr, std::
|
||||
|
||||
if (status != OHOS::DistributedKv::Status::SUCCESS) {
|
||||
ACCOUNT_LOGE("get value from kvstore error, status %{public}d.", status);
|
||||
// KEY_NOT_FOUND means no data in database, no need to report.
|
||||
if (status != OHOS::DistributedKv::Status::KEY_NOT_FOUND) {
|
||||
ReportKvStoreAccessFail(status, "get value from kvstore failed!");
|
||||
}
|
||||
return ERR_OSACCOUNT_SERVICE_MANAGER_QUERY_DISTRIBUTE_DATA_ERROR;
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "perf_stat.h"
|
||||
#include "string_ex.h"
|
||||
#include "system_ability_definition.h"
|
||||
#include "account_info.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
@ -46,10 +47,10 @@ void CreateDeviceDir()
|
||||
ACCOUNT_LOGI("Device owner dir not exist, create!");
|
||||
if (!OHOS::ForceCreateDirectory(DEVICE_OWNER_DIR)) {
|
||||
ACCOUNT_LOGW("Create device owner dir failure! errno %{public}d.", errno);
|
||||
ReportFileOperationFail(errno, "ForceCreateDirectory", DEVICE_OWNER_DIR);
|
||||
ReportOsAccountOperationFail(0, OPERATION_FORCE_CREATE_DIRECTORY, errno, DEVICE_OWNER_DIR);
|
||||
} else {
|
||||
if (!OHOS::ChangeModeDirectory(DEVICE_OWNER_DIR, S_IRWXU)) {
|
||||
ReportFileOperationFail(errno, "ChangeModeDirectory", DEVICE_OWNER_DIR);
|
||||
ReportOsAccountOperationFail(0, OPERATION_CHANGE_MODE_DIRECTORY, errno, DEVICE_OWNER_DIR);
|
||||
ACCOUNT_LOGW("failed to create dir, path = %{public}s errno %{public}d.",
|
||||
DEVICE_OWNER_DIR.c_str(), errno);
|
||||
}
|
||||
|
@ -128,9 +128,8 @@ ErrCode BundleManagerAdapter::CreateNewUser(int32_t userId)
|
||||
ErrCode result = Connect();
|
||||
if (result != ERR_OK) {
|
||||
ACCOUNT_LOGE("failed to connect bundle manager service.");
|
||||
ReportAccountOperationFail(userId,
|
||||
ReportOsAccountOperationFail(userId, "create",
|
||||
ERR_OSACCOUNT_SERVICE_INTERFACE_TO_BM_ACCOUNT_CREATE_ERROR,
|
||||
"create",
|
||||
"Connect bundle manager service failed!");
|
||||
return ERR_OSACCOUNT_SERVICE_INTERFACE_TO_BM_ACCOUNT_CREATE_ERROR;
|
||||
}
|
||||
@ -138,9 +137,8 @@ ErrCode BundleManagerAdapter::CreateNewUser(int32_t userId)
|
||||
auto bundleUserMgrProxy = proxy_->GetBundleUserMgr();
|
||||
if (!bundleUserMgrProxy) {
|
||||
ACCOUNT_LOGE("failed to get bundleUserMgrProxy");
|
||||
ReportAccountOperationFail(userId,
|
||||
ReportOsAccountOperationFail(userId, "create",
|
||||
ERR_OSACCOUNT_SERVICE_INTERFACE_TO_BM_ACCOUNT_CREATE_ERROR,
|
||||
"create",
|
||||
"GetBundleUserMgr from BundleManager proxy failed!");
|
||||
return ERR_OSACCOUNT_SERVICE_INTERFACE_TO_BM_ACCOUNT_CREATE_ERROR;
|
||||
}
|
||||
@ -158,17 +156,16 @@ ErrCode BundleManagerAdapter::RemoveUser(int32_t userId)
|
||||
ErrCode result = Connect();
|
||||
if (result != ERR_OK) {
|
||||
ACCOUNT_LOGE("failed to connect bundle manager service.");
|
||||
ReportAccountOperationFail(userId,
|
||||
result, "delete", "Connect bundle manager service failed!");
|
||||
ReportOsAccountOperationFail(userId, "delete",
|
||||
result, "Connect bundle manager service failed!");
|
||||
return result;
|
||||
}
|
||||
|
||||
auto bundleUserMgrProxy = proxy_->GetBundleUserMgr();
|
||||
if (!bundleUserMgrProxy) {
|
||||
ACCOUNT_LOGE("failed to get bundleUserMgrProxy");
|
||||
ReportAccountOperationFail(userId,
|
||||
ReportOsAccountOperationFail(userId, "delete",
|
||||
ERR_OSACCOUNT_SERVICE_INTERFACE_TO_BM_ACCOUNT_DELETE_ERROR,
|
||||
"delete",
|
||||
"GetBundleUserMgr from BundleManager proxy failed!");
|
||||
return ERR_OSACCOUNT_SERVICE_INTERFACE_TO_BM_ACCOUNT_DELETE_ERROR;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ ErrCode OhosAccountDataDeal::Init(std::int32_t userId)
|
||||
std::ifstream fin(configFile);
|
||||
if (!fin) {
|
||||
ACCOUNT_LOGE("Failed to open config file %{public}s, errno %{public}d.", configFile.c_str(), errno);
|
||||
ReportFileOperationFail(errno, "OhosAccountInitOpenFileToRead", configFile);
|
||||
ReportOhosAccountOperationFail(userId, OPERATION_INIT_OPEN_FILE_TO_READ, errno, configFile);
|
||||
return ERR_ACCOUNT_DATADEAL_INPUT_FILE_ERROR;
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ ErrCode OhosAccountDataDeal::Init(std::int32_t userId)
|
||||
ACCOUNT_LOGE("Invalid json file, remove");
|
||||
if (RemoveFile(configFile)) {
|
||||
ACCOUNT_LOGE("Remove invalid json file %{public}s failed, errno %{public}d.", configFile.c_str(), errno);
|
||||
ReportFileOperationFail(errno, "OhosAccountRemoveFile", configFile);
|
||||
ReportOhosAccountOperationFail(userId, OPERATION_REMOVE_FILE, errno, configFile);
|
||||
}
|
||||
return ERR_ACCOUNT_DATADEAL_JSON_FILE_CORRUPTION;
|
||||
}
|
||||
@ -96,7 +96,7 @@ ErrCode OhosAccountDataDeal::AccountInfoFromJson(AccountInfo &accountInfo, const
|
||||
std::ifstream fin(configFile);
|
||||
if (!fin) {
|
||||
ACCOUNT_LOGE("Failed to open config file %{public}s, errno %{public}d.", configFile.c_str(), errno);
|
||||
ReportFileOperationFail(errno, "OhosAccountOpenFileToRead", configFile);
|
||||
ReportOhosAccountOperationFail(userId, OPERATION_OPEN_FILE_TO_READ, errno, configFile);
|
||||
return ERR_ACCOUNT_DATADEAL_INPUT_FILE_ERROR;
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ void OhosAccountDataDeal::SaveAccountInfo(const AccountInfo &accountInfo) const
|
||||
std::ofstream out(configFile);
|
||||
if (!out) {
|
||||
ACCOUNT_LOGE("Failed to open file %{public}s, errno %{public}d.", configFile.c_str(), errno);
|
||||
ReportFileOperationFail(errno, "OhosAccountOpenFileToWrite", configFile);
|
||||
ReportOhosAccountOperationFail(accountInfo.userId_, OPERATION_OPEN_FILE_TO_WRITE, errno, configFile);
|
||||
return;
|
||||
}
|
||||
out << jsonData;
|
||||
@ -164,7 +164,7 @@ void OhosAccountDataDeal::SaveAccountInfo(const AccountInfo &accountInfo) const
|
||||
// change mode
|
||||
if (!ChangeModeFile(configFile, S_IRUSR | S_IWUSR)) {
|
||||
ACCOUNT_LOGW("failed to change mode for file %{public}s, errno %{public}d.", configFile.c_str(), errno);
|
||||
ReportFileOperationFail(errno, "ChangeModeFile", configFile);
|
||||
ReportOhosAccountOperationFail(accountInfo.userId_, OPERATION_CHANGE_MODE_FILE, errno, configFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,6 @@ bool OhosAccountManager::LoginOhosAccount(const std::string &name, const std::st
|
||||
return false;
|
||||
}
|
||||
|
||||
std::int32_t oldStatus = currOhosAccountInfo.ohosAccountStatus_;
|
||||
ret = HandleEvent(currOhosAccountInfo, eventStr); // update account status
|
||||
if (!ret) {
|
||||
ACCOUNT_LOGE("HandleEvent %{public}s failed! callingUserId %{public}d, ohosAccountUid %{public}s.",
|
||||
@ -283,7 +282,8 @@ bool OhosAccountManager::LoginOhosAccount(const std::string &name, const std::st
|
||||
if (!errCode) {
|
||||
ACCOUNT_LOGE("publish ohos account login event failed! callingUserId %{public}d, ohosAccountUid %{public}s.",
|
||||
callingUserId, ohosAccountUid.c_str());
|
||||
ReportOhosAccountCESFail(oldStatus, currOhosAccountInfo.ohosAccountStatus_, currOhosAccountInfo.userId_);
|
||||
ReportOhosAccountOperationFail(
|
||||
currOhosAccountInfo.userId_, EVENT_PUBLISH, errCode, "publish COMMON_EVENT_HWID_LOGIN failed");
|
||||
return false;
|
||||
}
|
||||
ACCOUNT_LOGI("LoginOhosAccount success! callingUserId %{public}d, ohosAccountUid %{public}s.",
|
||||
@ -311,7 +311,6 @@ bool OhosAccountManager::LogoutOhosAccount(const std::string &name, const std::s
|
||||
return false;
|
||||
}
|
||||
|
||||
std::int32_t oldStatus = currentAccount.ohosAccountStatus_;
|
||||
bool ret = HandleEvent(currentAccount, eventStr); // update account status
|
||||
if (!ret) {
|
||||
ACCOUNT_LOGE("HandleEvent %{public}s failed, callingUserId %{public}d, ohosAccountUid %{public}s.",
|
||||
@ -334,7 +333,8 @@ bool OhosAccountManager::LogoutOhosAccount(const std::string &name, const std::s
|
||||
if (!ret) {
|
||||
ACCOUNT_LOGE("publish account logout event failed, callingUserId %{public}d, ohosAccountUid %{public}s.",
|
||||
callingUserId, uid.c_str());
|
||||
ReportOhosAccountCESFail(oldStatus, currentAccount.ohosAccountStatus_, currentAccount.userId_);
|
||||
ReportOhosAccountOperationFail(
|
||||
currentAccount.userId_, EVENT_PUBLISH, ret, "publish COMMON_EVENT_HWID_LOGOUT failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -363,7 +363,6 @@ bool OhosAccountManager::LogoffOhosAccount(const std::string &name, const std::s
|
||||
return false;
|
||||
}
|
||||
|
||||
std::int32_t oldStatus = currentAccount.ohosAccountStatus_;
|
||||
bool ret = HandleEvent(currentAccount, eventStr); // update account status
|
||||
if (!ret) {
|
||||
ACCOUNT_LOGE("HandleEvent %{public}s failed, callingUserId %{public}d, ohosAccountUid %{public}s.",
|
||||
@ -386,7 +385,8 @@ bool OhosAccountManager::LogoffOhosAccount(const std::string &name, const std::s
|
||||
if (errCode != true) {
|
||||
ACCOUNT_LOGE("publish account logoff event failed, callingUserId %{public}d, ohosAccountUid %{public}s.",
|
||||
callingUserId, uid.c_str());
|
||||
ReportOhosAccountCESFail(oldStatus, currentAccount.ohosAccountStatus_, currentAccount.userId_);
|
||||
ReportOhosAccountOperationFail(
|
||||
currentAccount.userId_, EVENT_PUBLISH, errCode, "publish COMMON_EVENT_HWID_LOGOFF failed");
|
||||
return false;
|
||||
}
|
||||
ACCOUNT_LOGI("LogoffOhosAccount success, callingUserId %{public}d, ohosAccountUid %{public}s.",
|
||||
@ -415,7 +415,6 @@ bool OhosAccountManager::HandleOhosAccountTokenInvalidEvent(const std::string &n
|
||||
return false;
|
||||
}
|
||||
|
||||
std::int32_t oldStatus = currentOhosAccount.ohosAccountStatus_;
|
||||
bool ret = HandleEvent(currentOhosAccount, eventStr); // update account status
|
||||
if (!ret) {
|
||||
ACCOUNT_LOGE("HandleEvent %{public}s failed, callingUserId %{public}d, ohosAccountUid %{public}s.",
|
||||
@ -438,7 +437,8 @@ bool OhosAccountManager::HandleOhosAccountTokenInvalidEvent(const std::string &n
|
||||
if (errCode != true) {
|
||||
ACCOUNT_LOGE("publish token invalid event failed, callingUserId %{public}d, ohosAccountUid %{public}s.",
|
||||
callingUserId, uid.c_str());
|
||||
ReportOhosAccountCESFail(oldStatus, currentOhosAccount.ohosAccountStatus_, currentOhosAccount.userId_);
|
||||
ReportOhosAccountOperationFail(
|
||||
currentOhosAccount.userId_, EVENT_PUBLISH, errCode, "publish COMMON_EVENT_HWID_TOKEN_INVALID failed");
|
||||
return false;
|
||||
}
|
||||
ACCOUNT_LOGI("success, callingUserId %{public}d, ohosAccountUid %{public}s.", callingUserId, uid.c_str());
|
||||
|
@ -327,10 +327,11 @@ ErrCode IInnerOsAccountManager::SendMsgForAccountCreate(OsAccountInfo &osAccount
|
||||
errCode = osAccountControl_->UpdateOsAccount(osAccountInfo);
|
||||
if (errCode != ERR_OK) {
|
||||
ACCOUNT_LOGE("create os account when update isCreateCompleted");
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(), errCode, "create", "UpdateOsAccount failed!");
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_CREATE,
|
||||
errCode, "UpdateOsAccount failed!");
|
||||
return ERR_OSACCOUNT_SERVICE_INNER_UPDATE_ACCOUNT_ERROR;
|
||||
}
|
||||
ReportOsAccountLifeCycleEvent(osAccountInfo.GetLocalId(), "create");
|
||||
ReportOsAccountLifeCycle(osAccountInfo.GetLocalId(), Constants::OPERATION_CREATE);
|
||||
OsAccountInterface::SendToCESAccountCreate(osAccountInfo);
|
||||
ACCOUNT_LOGI("send other subsystem to create os account ok");
|
||||
return ERR_OK;
|
||||
@ -487,7 +488,7 @@ ErrCode IInnerOsAccountManager::SendMsgForAccountRemove(OsAccountInfo &osAccount
|
||||
return ERR_OSACCOUNT_SERVICE_INNER_CANNOT_DELE_OSACCOUNT_ERROR;
|
||||
}
|
||||
OsAccountInterface::SendToCESAccountDelete(osAccountInfo);
|
||||
ReportOsAccountLifeCycleEvent(osAccountInfo.GetLocalId(), "delete");
|
||||
ReportOsAccountLifeCycle(osAccountInfo.GetLocalId(), Constants::OPERATION_DELETE);
|
||||
return errCode;
|
||||
}
|
||||
|
||||
@ -1427,7 +1428,7 @@ void IInnerOsAccountManager::RefreshActiveList(int32_t newId)
|
||||
DeActivateOsAccount(activeAccountId_[i]);
|
||||
}
|
||||
int32_t oldId = (activeAccountId_.empty() ? -1 : activeAccountId_[0]);
|
||||
ReportOsAccountSwitchEvent(newId, oldId);
|
||||
ReportOsAccountSwitch(newId, oldId);
|
||||
activeAccountId_.clear();
|
||||
PushIdIntoActiveList(newId);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ ErrCode OsAccountInterface::SendToAMSAccountStart(OsAccountInfo &osAccountInfo)
|
||||
ErrCode code = AAFwk::AbilityManagerAdapter::GetInstance()->StartUser(osAccountInfo.GetLocalId());
|
||||
if (code != ERR_OK) {
|
||||
ACCOUNT_LOGE("AbilityManagerAdapter StartUser failed! errcode is %{public}d", code);
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(), code, "activate",
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_ACTIVATE, code,
|
||||
"AbilityManagerAdapter StartUser failed!");
|
||||
FinishTrace(HITRACE_TAG_ACCOUNT_MANAGER);
|
||||
return ERR_OSACCOUNT_SERVICE_INTERFACE_TO_AM_ACCOUNT_START_ERROR;
|
||||
@ -71,9 +71,8 @@ ErrCode OsAccountInterface::SendToAMSAccountStop(OsAccountInfo &osAccountInfo)
|
||||
sptr<OsAccountStopUserCallback> osAccountStopUserCallback = new (std::nothrow) OsAccountStopUserCallback();
|
||||
if (osAccountStopUserCallback == nullptr) {
|
||||
ACCOUNT_LOGE("alloc memory for stop user callback failed!");
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(),
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_STOP,
|
||||
ERR_ACCOUNT_COMMON_INSUFFICIENT_MEMORY_ERROR,
|
||||
"stop",
|
||||
"malloc for OsAccountStopUserCallback failed!");
|
||||
return ERR_ACCOUNT_COMMON_INSUFFICIENT_MEMORY_ERROR;
|
||||
}
|
||||
@ -82,7 +81,8 @@ ErrCode OsAccountInterface::SendToAMSAccountStop(OsAccountInfo &osAccountInfo)
|
||||
osAccountStopUserCallback);
|
||||
if (code != ERR_OK) {
|
||||
ACCOUNT_LOGE("failed to AbilityManagerAdapter stop errcode is %{public}d", code);
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(), code, "stop", "AbilityManagerService StopUser failed!");
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_STOP, code,
|
||||
"AbilityManagerService StopUser failed!");
|
||||
FinishTrace(HITRACE_TAG_ACCOUNT_MANAGER);
|
||||
return ERR_OSACCOUNT_SERVICE_INTERFACE_TO_AM_ACCOUNT_START_ERROR;
|
||||
}
|
||||
@ -97,7 +97,7 @@ ErrCode OsAccountInterface::SendToAMSAccountStop(OsAccountInfo &osAccountInfo)
|
||||
}
|
||||
if (!osAccountStopUserCallback->isReturnOk_) {
|
||||
ACCOUNT_LOGE("failed to AbilityManagerService stop in call back");
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(), -1, "stop",
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_STOP, -1,
|
||||
"AbilityManagerService StopUser timeout!");
|
||||
FinishTrace(HITRACE_TAG_ACCOUNT_MANAGER);
|
||||
return ERR_OSACCOUNT_SERVICE_INTERFACE_TO_AM_ACCOUNT_START_ERROR;
|
||||
@ -123,9 +123,8 @@ ErrCode OsAccountInterface::SendToIDMAccountDelete(OsAccountInfo &osAccountInfo)
|
||||
std::shared_ptr<OsAccountDeleteUserIdmCallback> callback = std::make_shared<OsAccountDeleteUserIdmCallback>();
|
||||
if (callback == nullptr) {
|
||||
ACCOUNT_LOGE("get idm callback ptr failed! insufficient memory!");
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(),
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_DELETE,
|
||||
ERR_ACCOUNT_COMMON_INSUFFICIENT_MEMORY_ERROR,
|
||||
"delete",
|
||||
"malloc for OsAccountDeleteUserIdmCallback failed!");
|
||||
return ERR_ACCOUNT_COMMON_INSUFFICIENT_MEMORY_ERROR;
|
||||
}
|
||||
@ -133,7 +132,8 @@ ErrCode OsAccountInterface::SendToIDMAccountDelete(OsAccountInfo &osAccountInfo)
|
||||
int32_t ret = UserIam::UserAuth::UserIdmClient::GetInstance().EraseUser(osAccountInfo.GetLocalId(), callback);
|
||||
if (ret != 0) {
|
||||
ACCOUNT_LOGE("idm enforce delete user failed! error %{public}d", ret);
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(), ret, "delete", "UserIDMClient EnforceDelUser failed!");
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_DELETE, ret,
|
||||
"UserIDMClient EnforceDelUser failed!");
|
||||
FinishTrace(HITRACE_TAG_ACCOUNT_MANAGER);
|
||||
return ERR_OK; // do not return fail
|
||||
}
|
||||
@ -150,7 +150,7 @@ ErrCode OsAccountInterface::SendToIDMAccountDelete(OsAccountInfo &osAccountInfo)
|
||||
}
|
||||
if (!callback->isIdmOnResultCallBack_) {
|
||||
ACCOUNT_LOGE("idm did not call back! timeout!");
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(), -1, "delete",
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_DELETE, -1,
|
||||
"UserIDMClient EnforceDelUser timeout!");
|
||||
FinishTrace(HITRACE_TAG_ACCOUNT_MANAGER);
|
||||
return ERR_OK; // do not return fail
|
||||
@ -173,7 +173,7 @@ void OsAccountInterface::SendToCESAccountCreate(OsAccountInfo &osAccountInfo)
|
||||
data.SetWant(want);
|
||||
if (!OHOS::EventFwk::CommonEventManager::PublishCommonEvent(data)) {
|
||||
ACCOUNT_LOGE("PublishCommonEvent for create account %{public}d failed!", osAccountID);
|
||||
ReportAccountOperationFail(osAccountID, -1, "create", "PublishCommonEvent failed!");
|
||||
ReportOsAccountOperationFail(osAccountID, Constants::OPERATION_CREATE, -1, "PublishCommonEvent failed!");
|
||||
} else {
|
||||
ACCOUNT_LOGI("PublishCommonEvent for create account %{public}d succeed!", osAccountID);
|
||||
}
|
||||
@ -195,7 +195,7 @@ void OsAccountInterface::SendToCESAccountDelete(OsAccountInfo &osAccountInfo)
|
||||
data.SetWant(want);
|
||||
if (!OHOS::EventFwk::CommonEventManager::PublishCommonEvent(data)) {
|
||||
ACCOUNT_LOGE("PublishCommonEvent for delete account %{public}d failed!", osAccountID);
|
||||
ReportAccountOperationFail(osAccountID, -1, "delete", "PublishCommonEvent failed!");
|
||||
ReportOsAccountOperationFail(osAccountID, Constants::OPERATION_DELETE, -1, "PublishCommonEvent failed!");
|
||||
} else {
|
||||
ACCOUNT_LOGI("PublishCommonEvent for delete account %{public}d succeed!", osAccountID);
|
||||
}
|
||||
@ -217,7 +217,7 @@ void OsAccountInterface::SendToCESAccountSwitched(OsAccountInfo &osAccountInfo)
|
||||
data.SetWant(want);
|
||||
if (!OHOS::EventFwk::CommonEventManager::PublishCommonEvent(data)) {
|
||||
ACCOUNT_LOGE("PublishCommonEvent for switched to account %{public}d failed!", osAccountID);
|
||||
ReportAccountOperationFail(osAccountID, -1, "switch", "PublishCommonEvent failed!");
|
||||
ReportOsAccountOperationFail(osAccountID, Constants::OPERATION_SWITCH, -1, "PublishCommonEvent failed!");
|
||||
} else {
|
||||
ACCOUNT_LOGI("PublishCommonEvent for switched to account %{public}d succeed!", osAccountID);
|
||||
}
|
||||
@ -234,18 +234,16 @@ ErrCode OsAccountInterface::SendToStorageAccountCreate(OsAccountInfo &osAccountI
|
||||
auto systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (!systemAbilityManager) {
|
||||
ACCOUNT_LOGE("failed to get system ability mgr.");
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(),
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_CREATE,
|
||||
ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_CREATE_ERROR,
|
||||
"create",
|
||||
"GetSystemAbilityManager for storage failed!");
|
||||
return ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_CREATE_ERROR;
|
||||
}
|
||||
auto remote = systemAbilityManager->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
|
||||
if (!remote) {
|
||||
ACCOUNT_LOGE("failed to get STORAGE_MANAGER_MANAGER_ID service.");
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(),
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_CREATE,
|
||||
ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_CREATE_ERROR,
|
||||
"create",
|
||||
"GetSystemAbility for storage failed!");
|
||||
return ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_CREATE_ERROR;
|
||||
}
|
||||
@ -258,7 +256,8 @@ ErrCode OsAccountInterface::SendToStorageAccountCreate(OsAccountInfo &osAccountI
|
||||
int err = proxy->PrepareAddUser(osAccountInfo.GetLocalId(),
|
||||
StorageManager::CRYPTO_FLAG_EL1 | StorageManager::CRYPTO_FLAG_EL2);
|
||||
if (err != 0) {
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(), err, "create", "Storage PrepareAddUser failed!");
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_CREATE,
|
||||
err, "Storage PrepareAddUser failed!");
|
||||
}
|
||||
|
||||
ACCOUNT_LOGI("end, Storage PrepareAddUser ret %{public}d.", err);
|
||||
@ -274,18 +273,16 @@ ErrCode OsAccountInterface::SendToStorageAccountRemove(OsAccountInfo &osAccountI
|
||||
auto systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (!systemAbilityManager) {
|
||||
ACCOUNT_LOGE("failed to get system ability mgr.");
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(),
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_DELETE,
|
||||
ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_REMOVE_ERROR,
|
||||
"delete",
|
||||
"GetSystemAbilityManager for storage failed!");
|
||||
return ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_REMOVE_ERROR;
|
||||
}
|
||||
auto remote = systemAbilityManager->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
|
||||
if (!remote) {
|
||||
ACCOUNT_LOGE("failed to get STORAGE_MANAGER_MANAGER_ID service.");
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(),
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_DELETE,
|
||||
ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_REMOVE_ERROR,
|
||||
"delete",
|
||||
"GetSystemAbility for storage failed!");
|
||||
return ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_REMOVE_ERROR;
|
||||
}
|
||||
@ -299,7 +296,8 @@ ErrCode OsAccountInterface::SendToStorageAccountRemove(OsAccountInfo &osAccountI
|
||||
int err = proxy->RemoveUser(osAccountInfo.GetLocalId(),
|
||||
StorageManager::CRYPTO_FLAG_EL1 | StorageManager::CRYPTO_FLAG_EL2);
|
||||
if (err != 0) {
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(), err, "delete", "Storage RemoveUser failed!");
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_DELETE,
|
||||
err, "Storage RemoveUser failed!");
|
||||
}
|
||||
|
||||
ACCOUNT_LOGI("end, Storage RemoveUser ret %{public}d.", err);
|
||||
@ -315,18 +313,16 @@ ErrCode OsAccountInterface::SendToStorageAccountStart(OsAccountInfo &osAccountIn
|
||||
auto systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (!systemAbilityManager) {
|
||||
ACCOUNT_LOGE("failed to get system ability mgr.");
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(),
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_ACTIVATE,
|
||||
ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_START_ERROR,
|
||||
"activate",
|
||||
"GetSystemAbilityManager for storage failed!");
|
||||
return ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_START_ERROR;
|
||||
}
|
||||
auto remote = systemAbilityManager->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
|
||||
if (!remote) {
|
||||
ACCOUNT_LOGE("failed to get STORAGE_MANAGER_MANAGER_ID service.");
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(),
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_ACTIVATE,
|
||||
ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_START_ERROR,
|
||||
"activate",
|
||||
"GetSystemAbility for storage failed!");
|
||||
return ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_START_ERROR;
|
||||
}
|
||||
@ -341,7 +337,8 @@ ErrCode OsAccountInterface::SendToStorageAccountStart(OsAccountInfo &osAccountIn
|
||||
proxy->ActiveUserKey(localId, emptyData, emptyData);
|
||||
int err = proxy->PrepareStartUser(localId);
|
||||
if (err != 0) {
|
||||
ReportAccountOperationFail(localId, err, "activate", "Storage PrepareStartUser failed!");
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_ACTIVATE,
|
||||
err, "Storage PrepareStartUser failed!");
|
||||
}
|
||||
ACCOUNT_LOGI("end, Storage PrepareStartUser ret %{public}d.", err);
|
||||
FinishTrace(HITRACE_TAG_ACCOUNT_MANAGER);
|
||||
@ -356,18 +353,16 @@ ErrCode OsAccountInterface::SendToStorageAccountStop(OsAccountInfo &osAccountInf
|
||||
auto systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (!systemAbilityManager) {
|
||||
ACCOUNT_LOGE("failed to get system ability mgr.");
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(),
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_STOP,
|
||||
ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_STOP_ERROR,
|
||||
"stop",
|
||||
"GetSystemAbilityManager for storage failed!");
|
||||
return ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_STOP_ERROR;
|
||||
}
|
||||
auto remote = systemAbilityManager->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
|
||||
if (!remote) {
|
||||
ACCOUNT_LOGE("failed to get STORAGE_MANAGER_MANAGER_ID service.");
|
||||
ReportAccountOperationFail(osAccountInfo.GetLocalId(),
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_STOP,
|
||||
ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_STOP_ERROR,
|
||||
"stop",
|
||||
"GetSystemAbility for storage failed!");
|
||||
return ERR_OSACCOUNT_SERVICE_INTERFACE_TO_STORAGE_ACCOUNT_STOP_ERROR;
|
||||
}
|
||||
@ -380,11 +375,13 @@ ErrCode OsAccountInterface::SendToStorageAccountStop(OsAccountInfo &osAccountInf
|
||||
int localId = osAccountInfo.GetLocalId();
|
||||
int err = proxy->StopUser(localId);
|
||||
if (err != 0) {
|
||||
ReportAccountOperationFail(localId, err, "stop", "Storage StopUser failed!");
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_STOP,
|
||||
err, "Storage StopUser failed!");
|
||||
}
|
||||
err = proxy->InactiveUserKey(localId);
|
||||
if (err != 0) {
|
||||
ReportAccountOperationFail(localId, err, "activate", "Storage InactiveUserKey failed!");
|
||||
ReportOsAccountOperationFail(osAccountInfo.GetLocalId(), Constants::OPERATION_STOP,
|
||||
err, "Storage StopUser failed!");
|
||||
}
|
||||
ACCOUNT_LOGI("end, Storage StopUser ret %{public}d", err);
|
||||
FinishTrace(HITRACE_TAG_ACCOUNT_MANAGER);
|
||||
|
Loading…
Reference in New Issue
Block a user