Signed-off-by: zhoushicheng2@huawei.com <zhoushicheng2@huawei.com>
Change-Id: Ifebac8e6fa927acbc5b9db6ee84d761039047240
This commit is contained in:
zhoushicheng2@huawei.com
2022-05-26 16:25:04 +08:00
parent b5ed67e21f
commit bf95c1d681
7 changed files with 55 additions and 115 deletions
+2 -2
View File
@@ -117,7 +117,7 @@ TERMINATE_ABILITY:
# serviceExtensionAbility behavior event
START_SERVICE_EXTENSION:
START_SERVICE:
__BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: start serviceExtensionAbility}
USER_ID: {type: INT32, desc: userId}
BUNDLE_NAME: {type: STRING, desc: bundle name}
@@ -125,7 +125,7 @@ START_SERVICE_EXTENSION:
ABILITY_NAME: {type: STRING, desc: ability name}
EXTENSION_TYPE: {type: STRING, desc: extension type}
STOP_SERVICE_EXTENSION:
STOP_SERVICE:
__BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: stop serviceExtensionAbility}
USER_ID: {type: INT32, desc: userId}
BUNDLE_NAME: {type: STRING, desc: bundle name}
@@ -1016,7 +1016,6 @@ private:
const sptr<IRemoteObject> &callerToken, int32_t userId);
int CheckOptExtensionAbility(const Want &want, AbilityRequest &abilityRequest,
int32_t validUserId, AppExecFwk::ExtensionAbilityType extensionType);
std::string GetExtensionType(AppExecFwk::ExtensionAbilityType extensionType);
constexpr static int REPOLL_TIME_MICRO_SECONDS = 1000000;
constexpr static int WAITING_BOOT_ANIMATION_TIMER = 5;
@@ -632,7 +632,7 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st
abilityRequest.want.SetParam(Want::PARAM_RESV_WINDOW_MODE, startOptions.GetWindowMode());
auto missionListManager = GetListManagerByUserId(oriValidUserId);
if (missionListManager == nullptr) {
HILOG_ERROR("missionListManager is Null. userId=%{public}d", validUserId);
HILOG_ERROR("missionListManager is Null. userId=%{public}d", oriValidUserId);
eventInfo.errCode = ERR_INVALID_VALUE;
AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR,
HiSysEventType::FAULT, eventInfo);
@@ -690,13 +690,13 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptr<IR
eventInfo.bundleName = want.GetElement().GetBundleName();
eventInfo.moduleName = want.GetElement().GetModuleName();
eventInfo.abilityName = want.GetElement().GetAbilityName();
eventInfo.extensionType = GetExtensionType(extensionType);
AAFWK::EventReport::SendExtensionEvent(AAFWK::START_SERVICE_EXTENSION,
eventInfo.extensionType = extensionType;
AAFWK::EventReport::SendExtensionEvent(AAFWK::START_SERVICE,
HiSysEventType::BEHAVIOR, eventInfo);
if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) {
HILOG_ERROR("%{public}s: Permission verification failed.", __func__);
eventInfo.errCode = CHECK_PERMISSION_FAILED;
AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::START_EXTENSION_ERROR,
HiSysEventType::FAULT, eventInfo);
return CHECK_PERMISSION_FAILED;
}
@@ -704,7 +704,7 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptr<IR
if (callerToken != nullptr && !VerificationAllToken(callerToken)) {
HILOG_ERROR("%{public}s VerificationAllToken failed.", __func__);
eventInfo.errCode = ERR_INVALID_VALUE;
AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::START_EXTENSION_ERROR,
HiSysEventType::FAULT, eventInfo);
return ERR_INVALID_VALUE;
}
@@ -712,7 +712,7 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptr<IR
if (!JudgeMultiUserConcurrency(validUserId)) {
HILOG_ERROR("Multi-user non-concurrent mode is not satisfied.");
eventInfo.errCode = ERR_INVALID_VALUE;
AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::START_EXTENSION_ERROR,
HiSysEventType::FAULT, eventInfo);
return ERR_INVALID_VALUE;
}
@@ -722,7 +722,7 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptr<IR
if (result != ERR_OK) {
HILOG_ERROR("Generate ability request local error.");
eventInfo.errCode = result;
AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::START_EXTENSION_ERROR,
HiSysEventType::FAULT, eventInfo);
return result;
}
@@ -736,7 +736,7 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptr<IR
if (result != ERR_OK) {
HILOG_ERROR("CheckOptExtensionAbility error.");
eventInfo.errCode = result;
AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::START_EXTENSION_ERROR,
HiSysEventType::FAULT, eventInfo);
return result;
}
@@ -745,14 +745,14 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptr<IR
if (!connectManager) {
HILOG_ERROR("connectManager is nullptr. userId=%{public}d", validUserId);
eventInfo.errCode = ERR_INVALID_VALUE;
AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::START_EXTENSION_ERROR,
HiSysEventType::FAULT, eventInfo);
return ERR_INVALID_VALUE;
}
HILOG_INFO("Start extension begin, name is %{public}s.", abilityInfo.name.c_str());
eventInfo.errCode = connectManager->StartAbility(abilityRequest);
if (eventInfo.errCode != ERR_OK) {
AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::START_EXTENSION_ERROR,
HiSysEventType::FAULT, eventInfo);
}
return eventInfo.errCode;
@@ -768,13 +768,13 @@ int AbilityManagerService::StopExtensionAbility(const Want &want, const sptr<IRe
eventInfo.bundleName = want.GetElement().GetBundleName();
eventInfo.moduleName = want.GetElement().GetModuleName();
eventInfo.abilityName = want.GetElement().GetAbilityName();
eventInfo.extensionType = GetExtensionType(extensionType);
AAFWK::EventReport::SendExtensionEvent(AAFWK::STOP_SERVICE_EXTENSION,
eventInfo.extensionType = extensionType;
AAFWK::EventReport::SendExtensionEvent(AAFWK::STOP_SERVICE,
HiSysEventType::BEHAVIOR, eventInfo);
if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) {
HILOG_ERROR("%{public}s: Permission verification failed.", __func__);
eventInfo.errCode = CHECK_PERMISSION_FAILED;
AAFWK::EventReport::SendAbilityEvent(AAFWK::STOP_EXTENSION_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::STOP_EXTENSION_ERROR,
HiSysEventType::FAULT,
eventInfo);
return CHECK_PERMISSION_FAILED;
@@ -783,7 +783,7 @@ int AbilityManagerService::StopExtensionAbility(const Want &want, const sptr<IRe
if (callerToken != nullptr && !VerificationAllToken(callerToken)) {
HILOG_ERROR("%{public}s VerificationAllToken failed.", __func__);
eventInfo.errCode = ERR_INVALID_VALUE;
AAFWK::EventReport::SendAbilityEvent(AAFWK::STOP_EXTENSION_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::STOP_EXTENSION_ERROR,
HiSysEventType::FAULT,
eventInfo);
return ERR_INVALID_VALUE;
@@ -792,7 +792,7 @@ int AbilityManagerService::StopExtensionAbility(const Want &want, const sptr<IRe
if (!JudgeMultiUserConcurrency(validUserId)) {
HILOG_ERROR("Multi-user non-concurrent mode is not satisfied.");
eventInfo.errCode = ERR_INVALID_VALUE;
AAFWK::EventReport::SendAbilityEvent(AAFWK::STOP_EXTENSION_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::STOP_EXTENSION_ERROR,
HiSysEventType::FAULT,
eventInfo);
return ERR_INVALID_VALUE;
@@ -803,7 +803,7 @@ int AbilityManagerService::StopExtensionAbility(const Want &want, const sptr<IRe
if (result != ERR_OK) {
HILOG_ERROR("Generate ability request local error.");
eventInfo.errCode = result;
AAFWK::EventReport::SendAbilityEvent(AAFWK::STOP_EXTENSION_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::STOP_EXTENSION_ERROR,
HiSysEventType::FAULT,
eventInfo);
return result;
@@ -828,14 +828,14 @@ int AbilityManagerService::StopExtensionAbility(const Want &want, const sptr<IRe
if (!connectManager) {
HILOG_ERROR("connectManager is nullptr. userId=%{public}d", validUserId);
eventInfo.errCode = ERR_INVALID_VALUE;
AAFWK::EventReport::SendAbilityEvent(AAFWK::STOP_EXTENSION_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::STOP_EXTENSION_ERROR,
HiSysEventType::FAULT,
eventInfo);
return ERR_INVALID_VALUE;
}
HILOG_INFO("Stop extension begin, name is %{public}s.", abilityInfo.name.c_str());
eventInfo.errCode = connectManager->StopServiceAbility(abilityRequest);
AAFWK::EventReport::SendAbilityEvent(AAFWK::STOP_EXTENSION_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::STOP_EXTENSION_ERROR,
HiSysEventType::FAULT,
eventInfo);
return eventInfo.errCode;
@@ -898,19 +898,13 @@ void AbilityManagerService::GrantUriPermission(const Want &want, int32_t validUs
int AbilityManagerService::TerminateAbility(const sptr<IRemoteObject> &token, int resultCode, const Want *resultWant)
{
AAFWK::EventInfo eventInfo;
auto abilityRecord = Token::GetAbilityRecordByToken(token);
eventInfo.userId = abilityRecord->GetApplicationInfo().uid / BASE_USER_RANGE;
eventInfo.bundleName = resultWant->GetElement().GetBundleName();
eventInfo.moduleName = resultWant->GetElement().GetModuleName();
eventInfo.abilityName = resultWant->GetElement().GetAbilityName();
eventInfo.errCode = TerminateAbilityWithFlag(token, resultCode, resultWant, true);
AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY,
HiSysEventType::BEHAVIOR, eventInfo);
if (eventInfo.errCode != ERR_OK) {
AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR,
HiSysEventType::FAULT, eventInfo);
}
return eventInfo.errCode;
return TerminateAbilityWithFlag(token, resultCode, resultWant, true);
}
int AbilityManagerService::CloseAbility(const sptr<IRemoteObject> &token, int resultCode, const Want *resultWant)
@@ -1171,7 +1165,7 @@ int AbilityManagerService::ConnectAbility(
if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) {
HILOG_ERROR("%{public}s: Permission verification failed", __func__);
eventInfo.errCode = CHECK_PERMISSION_FAILED;
AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR,
HiSysEventType::FAULT, eventInfo);
return CHECK_PERMISSION_FAILED;
}
@@ -1180,7 +1174,7 @@ int AbilityManagerService::ConnectAbility(
if (!GetLocalDeviceId(localDeviceId)) {
HILOG_ERROR("%{public}s: Get Local DeviceId failed", __func__);
eventInfo.errCode = ERR_INVALID_VALUE;
AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR,
HiSysEventType::FAULT, eventInfo);
return ERR_INVALID_VALUE;
}
@@ -1188,7 +1182,7 @@ int AbilityManagerService::ConnectAbility(
int result = manager->IsConnectFreeInstall(want, validUserId, callerToken, localDeviceId);
if (result != ERR_OK) {
eventInfo.errCode = result;
AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR,
HiSysEventType::FAULT, eventInfo);
return result;
}
@@ -1205,7 +1199,7 @@ int AbilityManagerService::ConnectAbility(
if (!queryResult || extensionInfo.name.empty() || extensionInfo.bundleName.empty()) {
HILOG_ERROR("Invalid extension ability info.");
eventInfo.errCode = ERR_INVALID_VALUE;
AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR,
HiSysEventType::FAULT, eventInfo);
return ERR_INVALID_VALUE;
}
@@ -1215,7 +1209,7 @@ int AbilityManagerService::ConnectAbility(
if (CheckIfOperateRemote(abilityWant)) {
HILOG_INFO("AbilityManagerService::ConnectAbility. try to ConnectRemoteAbility");
eventInfo.errCode = ConnectRemoteAbility(abilityWant, connect->AsObject());
AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR,
HiSysEventType::FAULT, eventInfo);
return eventInfo.errCode;
}
@@ -1223,13 +1217,13 @@ int AbilityManagerService::ConnectAbility(
if (callerToken != nullptr && callerToken->GetObjectDescriptor() != u"ohos.aafwk.AbilityToken") {
HILOG_INFO("%{public}s invalid Token.", __func__);
eventInfo.errCode = ConnectLocalAbility(abilityWant, validUserId, connect, nullptr);
AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR,
HiSysEventType::FAULT, eventInfo);
return eventInfo.errCode;
}
eventInfo.errCode = ConnectLocalAbility(abilityWant, validUserId, connect, callerToken);
if (eventInfo.errCode != ERR_OK) {
AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR,
HiSysEventType::FAULT, eventInfo);
}
return eventInfo.errCode;
@@ -1248,7 +1242,7 @@ int AbilityManagerService::DisconnectAbility(const sptr<IAbilityConnection> &con
eventInfo.errCode = DisconnectLocalAbility(connect);
eventInfo.errCode |= DisconnectRemoteAbility(connect->AsObject());
if (eventInfo.errCode != ERR_OK) {
AAFWK::EventReport::SendAbilityEvent(AAFWK::DISCONNECT_SERVICE_ERROR,
AAFWK::EventReport::SendExtensionEvent(AAFWK::DISCONNECT_SERVICE_ERROR,
HiSysEventType::FAULT, eventInfo);
}
return eventInfo.errCode;
@@ -4719,50 +4713,6 @@ int AbilityManagerService::DumpAbilityInfoDone(std::vector<std::string> &infos,
return ERR_OK;
}
std::string AbilityManagerService::GetExtensionType(AppExecFwk::ExtensionAbilityType extensionType)
{
std::string extensionTypeStr;
switch (extensionType) {
case AppExecFwk::ExtensionAbilityType::FORM:
extensionTypeStr = "FOMR";
break;
case AppExecFwk::ExtensionAbilityType::WORK_SCHEDULER:
extensionTypeStr = "WORK_SCHEDULER";
break;
case AppExecFwk::ExtensionAbilityType::INPUTMETHOD:
extensionTypeStr = "INPUTMETHOD";
break;
case AppExecFwk::ExtensionAbilityType::SERVICE:
extensionTypeStr = "SERVICE";
break;
case AppExecFwk::ExtensionAbilityType::ACCESSIBILITY:
extensionTypeStr = "ACCESSIBILITY";
break;
case AppExecFwk::ExtensionAbilityType::DATASHARE:
extensionTypeStr = "DATASHARE";
break;
case AppExecFwk::ExtensionAbilityType::FILESHARE:
extensionTypeStr = "FILESHARE";
break;
case AppExecFwk::ExtensionAbilityType::STATICSUBSCRIBER:
extensionTypeStr = "STATICSUBSCRIBER";
break;
case AppExecFwk::ExtensionAbilityType::WALLPAPER:
extensionTypeStr = "WALLPAPER";
break;
case AppExecFwk::ExtensionAbilityType::BACKUP:
extensionTypeStr = "BACKUP";
break;
case AppExecFwk::ExtensionAbilityType::WINDOW:
extensionTypeStr = "WINDOW";
break;
default:
extensionTypeStr = "UNSPECIFIED";
break;
}
return extensionTypeStr;
}
#ifdef SUPPORT_GRAPHICS
int AbilityManagerService::SetMissionLabel(const sptr<IRemoteObject> &token, const std::string &label)
{
+10 -20
View File
@@ -273,13 +273,11 @@ void AppMgrServiceInner::AttachApplication(const pid_t pid, const sptr<IAppSched
appRecord->RegisterAppDeathRecipient();
AAFWK::EventInfo eventInfo;
auto applicationInfo = appRecord->GetApplicationInfo();
eventInfo.pid = appRecord->GetPriorityObject()->GetPid();
eventInfo.abilityName = appRecord->GetAbilityInfo()->name;
eventInfo.bundleName = applicationInfo->name;
eventInfo.versionName = applicationInfo->versionName;
eventInfo.versionCode = applicationInfo->versionCode;
eventInfo.timeStamp =
std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch())
.count();
eventInfo.processName = applicationInfo->process;
AAFWK::EventReport::SendAppEvent(AAFWK::APP_ATTACH, HiSysEventType::BEHAVIOR, eventInfo);
}
@@ -318,13 +316,11 @@ void AppMgrServiceInner::LaunchApplication(const std::shared_ptr<AppRunningRecor
appRecord->LaunchPendingAbilities();
AAFWK::EventInfo eventInfo;
auto applicationInfo = appRecord->GetApplicationInfo();
eventInfo.pid = appRecord->GetPriorityObject()->GetPid();
eventInfo.abilityName = appRecord->GetAbilityInfo()->name;
eventInfo.bundleName = applicationInfo->name;
eventInfo.versionName = applicationInfo->versionName;
eventInfo.versionCode = applicationInfo->versionCode;
eventInfo.timeStamp =
std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch())
.count();
eventInfo.processName = applicationInfo->process;
AAFWK::EventReport::SendAppEvent(AAFWK::APP_LAUNCH, HiSysEventType::BEHAVIOR, eventInfo);
}
@@ -362,13 +358,11 @@ void AppMgrServiceInner::ApplicationForegrounded(const int32_t recordId)
HILOG_INFO("application is foregrounded");
AAFWK::EventInfo eventInfo;
auto applicationInfo = appRecord->GetApplicationInfo();
eventInfo.pid = appRecord->GetPriorityObject()->GetPid();
eventInfo.abilityName = appRecord->GetAbilityInfo()->name;
eventInfo.bundleName = applicationInfo->name;
eventInfo.versionName = applicationInfo->versionName;
eventInfo.versionCode = applicationInfo->versionCode;
eventInfo.timeStamp =
std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch())
.count();
eventInfo.processName = applicationInfo->process;
AAFWK::EventReport::SendAppEvent(AAFWK::APP_FOREGROUND,
HiSysEventType::BEHAVIOR, eventInfo);
}
@@ -393,13 +387,11 @@ void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId)
HILOG_INFO("application is backgrounded");
AAFWK::EventInfo eventInfo;
auto applicationInfo = appRecord->GetApplicationInfo();
eventInfo.pid = appRecord->GetPriorityObject()->GetPid();
eventInfo.abilityName = appRecord->GetAbilityInfo()->name;
eventInfo.bundleName = applicationInfo->name;
eventInfo.versionName = applicationInfo->versionName;
eventInfo.versionCode = applicationInfo->versionCode;
eventInfo.timeStamp =
std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch())
.count();
eventInfo.processName = applicationInfo->process;
AAFWK::EventReport::SendAppEvent(AAFWK::APP_BACKGROUND,
HiSysEventType::BEHAVIOR, eventInfo);
}
@@ -433,13 +425,11 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId)
RemoveAppFromRecentListById(recordId);
AAFWK::EventInfo eventInfo;
auto applicationInfo = appRecord->GetApplicationInfo();
eventInfo.pid = appRecord->GetPriorityObject()->GetPid();
eventInfo.abilityName = appRecord->GetAbilityInfo()->name;
eventInfo.bundleName = applicationInfo->name;
eventInfo.versionName = applicationInfo->versionName;
eventInfo.versionCode = applicationInfo->versionCode;
eventInfo.timeStamp =
std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch())
.count();
eventInfo.processName = applicationInfo->process;
AAFWK::EventReport::SendAppEvent(AAFWK::APP_TERMINATE, HiSysEventType::BEHAVIOR, eventInfo);
DelayedSingleton<AppStateObserverManager>::GetInstance()->OnProcessDied(appRecord);
+4 -1
View File
@@ -35,7 +35,10 @@ ohos_source_set("abilitymgr_common") {
config("perm_verification_config") {
visibility = [ ":*" ]
include_dirs = [ "include" ]
include_dirs = [
"include",
"${bundlefwk_inner_api_path}/appexecfwk_base/include",
]
cflags = []
if (target_cpu == "arm") {
cflags += [ "-DBINDER_IPC_32BIT" ]
+7 -8
View File
@@ -21,6 +21,7 @@
#include "errors.h"
#include "hisysevent.h"
#include "extension_ability_info.h"
using HiSysEventType = OHOS::HiviewDFX::HiSysEvent::EventType;
using HiSysEvent = OHOS::HiviewDFX::HiSysEvent;
@@ -42,8 +43,8 @@ const std::string CLOSE_ABILITY = "CLOSE_ABILITY";
const std::string DO_FOREGROUND_ABILITY = "DO_FOREGROUND_ABILITY";
const std::string DO_BACKGROUND_ABILITY = "DO_BACKGROUND_ABILITY";
// serviceExtensionAbility behavior event
const std::string START_SERVICE_EXTENSION = "START_SERVICE_EXTENSION";
const std::string STOP_SERVICE_EXTENSION = "STOP_SERVICE_EXTENSION";
const std::string START_SERVICE = "START_SERVICE";
const std::string STOP_SERVICE = "STOP_SERVICE";
const std::string CONNECT_SERVICE = "CONNECT_SERVICE";
const std::string DISCONNECT_SERVICE = "DISCONNECT_SERVICE";
// form behavior event
@@ -66,9 +67,7 @@ const std::string APP_TERMINATE = "APP_TERMINATE";
}
struct EventInfo {
int32_t pid = -1;
int32_t userId = -1;
int64_t timeStamp = 0;
int64_t formId = -1;
uint32_t versionCode = 0;
uint32_t sceneFlag = -1;
@@ -76,16 +75,15 @@ struct EventInfo {
std::string bundleName;
std::string moduleName;
std::string abilityName;
std::string extensionType;
std::string processName;
AppExecFwk::ExtensionAbilityType extensionType;
// olny used in fault event
ErrCode errCode = ERR_OK;
void Reset()
{
pid =-1;
userId = -1;
timeStamp = 0;
formId =-1;
versionCode = 0;
sceneFlag = -1;
@@ -93,7 +91,8 @@ struct EventInfo {
bundleName.clear();
moduleName.clear();
abilityName.clear();
extensionType.clear();
processName.clear();
extensionType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED;
errCode = ERR_OK;
}
};
+5 -6
View File
@@ -14,7 +14,6 @@
*/
#include "event_report.h"
#include "hisysevent.h"
#include "hilog_wrapper.h"
#include <chrono>
@@ -27,7 +26,6 @@ const std::string TYPE = "TYPE";
const std::string EVENT_KEY_PID = "PID";
const std::string EVENT_KEY_USERID = "USERID";
const std::string EVENT_KEY_FORM_ID = "FORM_ID";
const std::string EVENT_KEY_TIME_STAMP = "TIME_STAMP";
const std::string EVENT_KEY_ERROR_CODE = "ERROR_CODE";
const std::string EVENT_KEY_SCENE_FLAG = "SCENE_FLAG";
const std::string EVENT_KEY_BUNDLE_NAME = "BUNDLE_NAME";
@@ -35,6 +33,7 @@ const std::string EVENT_KEY_MODULE_NAME = "MODULE_NAME";
const std::string EVENT_KEY_ABILITY_NAME = "ABILITY_NAME";
const std::string EVENT_KEY_VERSION_NAME = "VERSION_NAME";
const std::string EVENT_KEY_VERSION_CODE = "VERSION_CODE";
const std::string EVENT_KEY_PROCESS_NAME = "PROCESS_NAME";
const std::string EVENT_KEY_EXTENSION_TYPE = "EXTENSION_TYPE";
}
@@ -48,8 +47,8 @@ void EventReport::SendAppEvent(const std::string &eventName, HiSysEventType type
EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName,
EVENT_KEY_VERSION_NAME, eventInfo.versionName,
EVENT_KEY_VERSION_CODE, eventInfo.versionCode,
EVENT_KEY_PID, eventInfo.pid,
EVENT_KEY_TIME_STAMP, eventInfo.timeStamp);
EVENT_KEY_ABILITY_NAME, eventInfo.abilityName,
EVENT_KEY_PROCESS_NAME, eventInfo.processName);
}
void EventReport::SendAbilityEvent(const std::string &eventName, HiSysEventType type,
@@ -96,7 +95,7 @@ void EventReport::SendExtensionEvent(const std::string &eventName, HiSysEventTyp
HiSysEvent::Domain::AAFWK,
eventName,
type);
} else if (eventName ==CONNECT_SERVICE) {
} else if (eventName == CONNECT_SERVICE) {
HiSysEvent::Write(
HiSysEvent::Domain::AAFWK,
eventName,
@@ -105,7 +104,7 @@ void EventReport::SendExtensionEvent(const std::string &eventName, HiSysEventTyp
EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName,
EVENT_KEY_MODULE_NAME, eventInfo.moduleName,
EVENT_KEY_ABILITY_NAME, eventInfo.abilityName);
} else if (eventName == START_SERVICE_EXTENSION || eventName == STOP_SERVICE_EXTENSION) {
} else if (eventName == START_SERVICE || eventName == STOP_SERVICE) {
HiSysEvent::Write(
HiSysEvent::Domain::AAFWK,
eventName,