mirror of
https://gitee.com/openharmony/account_os_account
synced 2024-11-23 10:10:11 +00:00
adapt sysevent new interface
Signed-off-by: jidong <jidong4@huawei.com> Change-Id: I01773bd09361cb72086dc10cfa268d61ac2b5953
This commit is contained in:
parent
ca4389f262
commit
56b44a14fd
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
@ -22,16 +22,15 @@ namespace OHOS {
|
|||||||
namespace AccountSA {
|
namespace AccountSA {
|
||||||
namespace {
|
namespace {
|
||||||
#ifdef HAS_HISYSEVENT_PART
|
#ifdef HAS_HISYSEVENT_PART
|
||||||
using HiSysEventNameSpace = OHOS::HiviewDFX::HiSysEvent;
|
using namespace OHOS::HiviewDFX;
|
||||||
const std::string DOMAIN_STR = std::string(HiSysEventNameSpace::Domain::ACCOUNT);
|
|
||||||
#endif // HAS_HISYSEVENT_PART
|
#endif // HAS_HISYSEVENT_PART
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportServiceStartFail(int32_t errCode, const std::string& errMsg)
|
void ReportServiceStartFail(int32_t errCode, const std::string& errMsg)
|
||||||
{
|
{
|
||||||
#ifdef HAS_HISYSEVENT_PART
|
#ifdef HAS_HISYSEVENT_PART
|
||||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "SERVICE_START_FAILED",
|
int ret = HiSysEventWrite(HiSysEvent::Domain::ACCOUNT, "SERVICE_START_FAILED",
|
||||||
HiSysEventNameSpace::EventType::FAULT,
|
HiSysEvent::EventType::FAULT,
|
||||||
"ERROR_TYPE", errCode,
|
"ERROR_TYPE", errCode,
|
||||||
"ERROR_MSG", errMsg);
|
"ERROR_MSG", errMsg);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@ -45,8 +44,8 @@ void ReportServiceStartFail(int32_t errCode, const std::string& errMsg)
|
|||||||
void ReportPermissionFail(int32_t callerUid, int32_t callerPid, const std::string& permName)
|
void ReportPermissionFail(int32_t callerUid, int32_t callerPid, const std::string& permName)
|
||||||
{
|
{
|
||||||
#ifdef HAS_HISYSEVENT_PART
|
#ifdef HAS_HISYSEVENT_PART
|
||||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "PERMISSION_EXCEPTION",
|
int ret = HiSysEventWrite(HiSysEvent::Domain::ACCOUNT, "PERMISSION_EXCEPTION",
|
||||||
HiSysEventNameSpace::EventType::SECURITY,
|
HiSysEvent::EventType::SECURITY,
|
||||||
"CALLER_UID", callerUid,
|
"CALLER_UID", callerUid,
|
||||||
"CALLER_PID", callerPid,
|
"CALLER_PID", callerPid,
|
||||||
"PERMISSION_NAME", permName);
|
"PERMISSION_NAME", permName);
|
||||||
@ -65,8 +64,8 @@ void ReportOsAccountOperationFail(
|
|||||||
int32_t id, const std::string& operationStr, int32_t errCode, const std::string& errMsg)
|
int32_t id, const std::string& operationStr, int32_t errCode, const std::string& errMsg)
|
||||||
{
|
{
|
||||||
#ifdef HAS_HISYSEVENT_PART
|
#ifdef HAS_HISYSEVENT_PART
|
||||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "OS_ACCOUNT_FAILED",
|
int ret = HiSysEventWrite(HiSysEvent::Domain::ACCOUNT, "OS_ACCOUNT_FAILED",
|
||||||
HiSysEventNameSpace::EventType::FAULT,
|
HiSysEvent::EventType::FAULT,
|
||||||
"ID", id,
|
"ID", id,
|
||||||
"OPERATE_TYPE", operationStr,
|
"OPERATE_TYPE", operationStr,
|
||||||
"ERROR_TYPE", errCode,
|
"ERROR_TYPE", errCode,
|
||||||
@ -87,8 +86,8 @@ void ReportOhosAccountOperationFail(
|
|||||||
int32_t userId, const std::string& operationStr, int32_t errCode, const std::string& errMsg)
|
int32_t userId, const std::string& operationStr, int32_t errCode, const std::string& errMsg)
|
||||||
{
|
{
|
||||||
#ifdef HAS_HISYSEVENT_PART
|
#ifdef HAS_HISYSEVENT_PART
|
||||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "DISTRIBUTED_ACCOUNT_FAILED",
|
int ret = HiSysEventWrite(HiSysEvent::Domain::ACCOUNT, "DISTRIBUTED_ACCOUNT_FAILED",
|
||||||
HiSysEventNameSpace::EventType::FAULT,
|
HiSysEvent::EventType::FAULT,
|
||||||
"USER_ID", userId,
|
"USER_ID", userId,
|
||||||
"OPERATE_TYPE", operationStr,
|
"OPERATE_TYPE", operationStr,
|
||||||
"ERROR_TYPE", errCode,
|
"ERROR_TYPE", errCode,
|
||||||
@ -109,8 +108,8 @@ void ReportAppAccountOperationFail(const std::string &name, const std::string &o
|
|||||||
int32_t errCode, const std::string& errMsg)
|
int32_t errCode, const std::string& errMsg)
|
||||||
{
|
{
|
||||||
#ifdef HAS_HISYSEVENT_PART
|
#ifdef HAS_HISYSEVENT_PART
|
||||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "APP_ACCOUNT_FAILED",
|
int ret = HiSysEventWrite(HiSysEvent::Domain::ACCOUNT, "APP_ACCOUNT_FAILED",
|
||||||
HiSysEventNameSpace::EventType::FAULT,
|
HiSysEvent::EventType::FAULT,
|
||||||
"NAME", name,
|
"NAME", name,
|
||||||
"OWNER", owner,
|
"OWNER", owner,
|
||||||
"OPERATE_TYPE", operationStr,
|
"OPERATE_TYPE", operationStr,
|
||||||
@ -134,8 +133,8 @@ void ReportAppAccountOperationFail(const std::string &name, const std::string &o
|
|||||||
void ReportOsAccountLifeCycle(int32_t id, const std::string& operationStr)
|
void ReportOsAccountLifeCycle(int32_t id, const std::string& operationStr)
|
||||||
{
|
{
|
||||||
#ifdef HAS_HISYSEVENT_PART
|
#ifdef HAS_HISYSEVENT_PART
|
||||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "OS_ACCOUNT_LIFE_CYCLE",
|
int ret = HiSysEventWrite(HiSysEvent::Domain::ACCOUNT, "OS_ACCOUNT_LIFE_CYCLE",
|
||||||
HiSysEventNameSpace::EventType::BEHAVIOR,
|
HiSysEvent::EventType::BEHAVIOR,
|
||||||
"ACCOUNT_ID", id,
|
"ACCOUNT_ID", id,
|
||||||
"OPERATE_TYPE", operationStr);
|
"OPERATE_TYPE", operationStr);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@ -151,8 +150,8 @@ void ReportOsAccountLifeCycle(int32_t id, const std::string& operationStr)
|
|||||||
void ReportOsAccountSwitch(int32_t currentId, int32_t oldId)
|
void ReportOsAccountSwitch(int32_t currentId, int32_t oldId)
|
||||||
{
|
{
|
||||||
#ifdef HAS_HISYSEVENT_PART
|
#ifdef HAS_HISYSEVENT_PART
|
||||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "OS_ACCOUNT_SWITCH",
|
int ret = HiSysEventWrite(HiSysEvent::Domain::ACCOUNT, "OS_ACCOUNT_SWITCH",
|
||||||
HiSysEventNameSpace::EventType::BEHAVIOR,
|
HiSysEvent::EventType::BEHAVIOR,
|
||||||
"CURRENT_ID", currentId,
|
"CURRENT_ID", currentId,
|
||||||
"OLD_ID", oldId);
|
"OLD_ID", oldId);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@ -168,8 +167,8 @@ void ReportOsAccountSwitch(int32_t currentId, int32_t oldId)
|
|||||||
void ReportOhosAccountStateChange(int32_t userId, int32_t operateType, int32_t oldStat, int32_t newStat)
|
void ReportOhosAccountStateChange(int32_t userId, int32_t operateType, int32_t oldStat, int32_t newStat)
|
||||||
{
|
{
|
||||||
#ifdef HAS_HISYSEVENT_PART
|
#ifdef HAS_HISYSEVENT_PART
|
||||||
int ret = HiSysEventNameSpace::Write(DOMAIN_STR, "DISTRIBUTED_ACCOUNT_CHANGE",
|
int ret = HiSysEventWrite(HiSysEvent::Domain::ACCOUNT, "DISTRIBUTED_ACCOUNT_CHANGE",
|
||||||
HiSysEventNameSpace::EventType::BEHAVIOR,
|
HiSysEvent::EventType::BEHAVIOR,
|
||||||
"USER_ID", userId,
|
"USER_ID", userId,
|
||||||
"OPERATION_TYPE", operateType,
|
"OPERATION_TYPE", operateType,
|
||||||
"OLD_STATE", oldStat,
|
"OLD_STATE", oldStat,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
@ -14,32 +14,32 @@
|
|||||||
domain: ACCOUNT
|
domain: ACCOUNT
|
||||||
|
|
||||||
PERMISSION_EXCEPTION:
|
PERMISSION_EXCEPTION:
|
||||||
__BASE: {type: SECURITY, level: CRITICAL, tag: security, desc: permission verification errors}
|
__BASE: {type: SECURITY, level: CRITICAL, desc: permission verification errors}
|
||||||
CALLER_UID: {type: INT32, desc: caller uid}
|
CALLER_UID: {type: INT32, desc: caller uid}
|
||||||
CALLER_PID: {type: INT32, desc: caller pid}
|
CALLER_PID: {type: INT32, desc: caller pid}
|
||||||
PERMISSION_NAME: {type: STRING, desc: permission name}
|
PERMISSION_NAME: {type: STRING, desc: permission name}
|
||||||
|
|
||||||
SERVICE_START_FAILED:
|
SERVICE_START_FAILED:
|
||||||
__BASE: {type: FAULT, level: CRITICAL, tag: usability, desc: service start errors}
|
__BASE: {type: FAULT, level: CRITICAL, desc: service start errors}
|
||||||
ERROR_TYPE: {type: INT32, desc: error code}
|
ERROR_TYPE: {type: INT32, desc: error code}
|
||||||
ERROR_MSG: {type: STRING, desc: error message}
|
ERROR_MSG: {type: STRING, desc: error message}
|
||||||
|
|
||||||
OS_ACCOUNT_FAILED:
|
OS_ACCOUNT_FAILED:
|
||||||
__BASE: {type: FAULT, level: CRITICAL, tag: usability, desc: osaccount operation errors}
|
__BASE: {type: FAULT, level: CRITICAL, desc: osaccount operation errors}
|
||||||
ID: {type: INT32, desc: the id of an os account}
|
ID: {type: INT32, desc: the id of an os account}
|
||||||
OPERATE_TYPE: {type: STRING, desc: operation type on an os account}
|
OPERATE_TYPE: {type: STRING, desc: operation type on an os account}
|
||||||
ERROR_TYPE: {type: INT32, desc: error code}
|
ERROR_TYPE: {type: INT32, desc: error code}
|
||||||
ERROR_MSG: {type: STRING, desc: error message}
|
ERROR_MSG: {type: STRING, desc: error message}
|
||||||
|
|
||||||
DISTRIBUTED_ACCOUNT_FAILED:
|
DISTRIBUTED_ACCOUNT_FAILED:
|
||||||
__BASE: {type: FAULT, level: MINOR, tag: usability, desc: kvstore related errors}
|
__BASE: {type: FAULT, level: MINOR, desc: kvstore related errors}
|
||||||
USER_ID: {type: INT32, desc: the user id bound to a distributed account}
|
USER_ID: {type: INT32, desc: the user id bound to a distributed account}
|
||||||
OPERATE_TYPE: {type: STRING, desc: operation type on a distributed account}
|
OPERATE_TYPE: {type: STRING, desc: operation type on a distributed account}
|
||||||
ERROR_TYPE: {type: INT32, desc: error code}
|
ERROR_TYPE: {type: INT32, desc: error code}
|
||||||
ERROR_MSG: {type: STRING, desc: error message}
|
ERROR_MSG: {type: STRING, desc: error message}
|
||||||
|
|
||||||
APP_ACCOUNT_FAILED:
|
APP_ACCOUNT_FAILED:
|
||||||
__BASE: {type: SECURITY, level: CRITICAL, tag: security, desc: permission verification errors}
|
__BASE: {type: SECURITY, level: CRITICAL, desc: permission verification errors}
|
||||||
NAME: {type: STRING, desc: the name of an app account}
|
NAME: {type: STRING, desc: the name of an app account}
|
||||||
OWNER: {type: STRING, desc: the owner 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}
|
OPERATE_TYPE: {type: STRING, desc: operation type on an app account}
|
||||||
@ -47,12 +47,12 @@ APP_ACCOUNT_FAILED:
|
|||||||
ERROR_MSG: {type: STRING, desc: error message}
|
ERROR_MSG: {type: STRING, desc: error message}
|
||||||
|
|
||||||
OS_ACCOUNT_LIFE_CYCLE:
|
OS_ACCOUNT_LIFE_CYCLE:
|
||||||
__BASE: {type: BEHAVIOR, level: MINOR, tag: usability, desc: osaccount create or delete event}
|
__BASE: {type: BEHAVIOR, level: MINOR, desc: osaccount create or delete event}
|
||||||
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}
|
OPERATE_TYPE: {type: STRING, desc: operation type on an os account create or delete}
|
||||||
|
|
||||||
OS_ACCOUNT_SWITCH:
|
OS_ACCOUNT_SWITCH:
|
||||||
__BASE: {type: BEHAVIOR, level: MINOR, tag: usability, desc: osaccount switch event}
|
__BASE: {type: BEHAVIOR, level: MINOR, desc: osaccount switch event}
|
||||||
CURRENT_ID: {type: INT32, desc: the id of os account after switch}
|
CURRENT_ID: {type: INT32, desc: the id of os account after switch}
|
||||||
OLD_ID: {type: INT32, desc: the id of os account before switch}
|
OLD_ID: {type: INT32, desc: the id of os account before switch}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user