sysevent name change

Signed-off-by: dujingcheng <dujingcheng@huawei.com>
Change-Id: I9e502df9cd925f5a5380615cf5b56ba32c86dc83
This commit is contained in:
dujingcheng 2022-04-27 10:13:37 +08:00
parent 2496274b06
commit 0648d00cda
6 changed files with 20 additions and 12 deletions

View File

@ -102,7 +102,7 @@ PRE_BUNDLE_RECOVER:
VERSION: {type: UINT32, desc: versionCode}
INSTALL_TYPE: {type: STRING, desc: only prebundle}
BUNDLE_COMPONENT_STATE_CHANGE:
BUNDLE_STATE_CHANGE:
__BASE: {type: BEHAVIOR, level: MINOR, desc: bundle or component disable or enable}
USERID: {type: INT32, desc: userId}
BUNDLE_NAME: {type: STRING, desc: bundleName}

View File

@ -39,7 +39,7 @@ enum class BMSEventType {
BUNDLE_UNINSTALL,
BUNDLE_UPDATE,
PRE_BUNDLE_RECOVER,
BUNDLE_COMPONENT_STATE_CHANGE,
BUNDLE_STATE_CHANGE,
BUNDLE_CLEAN_CACHE,
};

View File

@ -37,7 +37,7 @@ private:
static void InnerSendBundleUninstallExceptionEvent(const EventInfo& eventInfo);
static void InnerSendBundleUpdateExceptionEvent(const EventInfo& eventInfo);
static void InnerSendPreBundleRecoverExceptionEvent(const EventInfo& eventInfo);
static void InnerSendBundleComponentChangeExceptionEvent(const EventInfo& eventInfo);
static void InnerSendBundleStateChangeExceptionEvent(const EventInfo& eventInfo);
static void InnerSendBundleCleanCacheExceptionEvent(const EventInfo& eventInfo);
// behavior event
@ -47,7 +47,7 @@ private:
static void InnerSendBundleUninstallEvent(const EventInfo& eventInfo);
static void InnerSendBundleUpdateEvent(const EventInfo& eventInfo);
static void InnerSendPreBundleRecoverEvent(const EventInfo& eventInfo);
static void InnerSendBundleComponentChangeEvent(const EventInfo& eventInfo);
static void InnerSendBundleStateChangeEvent(const EventInfo& eventInfo);
static void InnerSendBundleCleanCacheEvent(const EventInfo& eventInfo);
template<typename... Types>

View File

@ -964,6 +964,10 @@ bool BundleMgrHostImpl::SetModuleUpgradeFlag(const std::string &bundleName,
bool BundleMgrHostImpl::SetApplicationEnabled(const std::string &bundleName, bool isEnable, int32_t userId)
{
APP_LOGD("SetApplicationEnabled begin");
if (userId == Constants::UNSPECIFIED_USERID) {
userId = BundleUtil::GetUserIdByCallingUid();
}
if (!BundlePermissionMgr::VerifyCallingPermission(Constants::PERMISSION_CHANGE_ABILITY_ENABLED_STATE)) {
APP_LOGE("verify permission failed");
EventReport::SendComponentStateSysEvent(bundleName, "", userId, isEnable, true);
@ -1014,6 +1018,10 @@ bool BundleMgrHostImpl::IsAbilityEnabled(const AbilityInfo &abilityInfo)
bool BundleMgrHostImpl::SetAbilityEnabled(const AbilityInfo &abilityInfo, bool isEnabled, int32_t userId)
{
APP_LOGD("start SetAbilityEnabled");
if (userId == Constants::UNSPECIFIED_USERID) {
userId = BundleUtil::GetUserIdByCallingUid();
}
if (!BundlePermissionMgr::VerifyCallingPermission(Constants::PERMISSION_CHANGE_ABILITY_ENABLED_STATE)) {
APP_LOGE("verify permission failed");
EventReport::SendComponentStateSysEvent(

View File

@ -82,7 +82,7 @@ void EventReport::SendComponentStateSysEvent(const std::string &bundleName,
if (exception) {
bmsEventType = BMSEventType::BUNDLE_STATE_CHANGE_EXCEPTION;
} else {
bmsEventType = BMSEventType::BUNDLE_COMPONENT_STATE_CHANGE;
bmsEventType = BMSEventType::BUNDLE_STATE_CHANGE;
}
EventReport::SendSystemEvent(bmsEventType, eventInfo);

View File

@ -35,7 +35,7 @@ const std::string BUNDLE_INSTALL = "BUNDLE_INSTALL";
const std::string BUNDLE_UNINSTALL = "BUNDLE_UNINSTALL";
const std::string BUNDLE_UPDATE = "BUNDLE_UPDATE";
const std::string PRE_BUNDLE_RECOVER = "PRE_BUNDLE_RECOVER";
const std::string BUNDLE_COMPONENT_STATE_CHANGE = "BUNDLE_COMPONENT_STATE_CHANGE";
const std::string BUNDLE_STATE_CHANGE = "BUNDLE_STATE_CHANGE";
const std::string BUNDLE_CLEAN_CACHE = "BUNDLE_CLEAN_CACHE";
// event params
@ -119,7 +119,7 @@ std::unordered_map<BMSEventType, void (*)(const EventInfo& eventInfo)>
} },
{ BMSEventType::BUNDLE_STATE_CHANGE_EXCEPTION,
[](const EventInfo& eventInfo) {
InnerSendBundleComponentChangeExceptionEvent(eventInfo);
InnerSendBundleStateChangeExceptionEvent(eventInfo);
} },
{ BMSEventType::BUNDLE_CLEAN_CACHE_EXCEPTION,
[](const EventInfo& eventInfo) {
@ -149,9 +149,9 @@ std::unordered_map<BMSEventType, void (*)(const EventInfo& eventInfo)>
[](const EventInfo& eventInfo) {
InnerSendPreBundleRecoverEvent(eventInfo);
} },
{ BMSEventType::BUNDLE_COMPONENT_STATE_CHANGE,
{ BMSEventType::BUNDLE_STATE_CHANGE,
[](const EventInfo& eventInfo) {
InnerSendBundleComponentChangeEvent(eventInfo);
InnerSendBundleStateChangeEvent(eventInfo);
} },
{ BMSEventType::BUNDLE_CLEAN_CACHE,
[](const EventInfo& eventInfo) {
@ -218,7 +218,7 @@ void InnerEventReport::InnerSendPreBundleRecoverExceptionEvent(const EventInfo&
EVENT_PARAM_ERROR_CODE, eventInfo.errCode);
}
void InnerEventReport::InnerSendBundleComponentChangeExceptionEvent(const EventInfo& eventInfo)
void InnerEventReport::InnerSendBundleStateChangeExceptionEvent(const EventInfo& eventInfo)
{
std::string type = eventInfo.abilityName.empty() ? APPLICATION : ABILITY;
InnerEventWrite(
@ -302,12 +302,12 @@ void InnerEventReport::InnerSendPreBundleRecoverEvent(const EventInfo& eventInfo
EVENT_PARAM_INSTALL_TYPE, PRE_BUNDLE_INSTALL_TYPE);
}
void InnerEventReport::InnerSendBundleComponentChangeEvent(const EventInfo& eventInfo)
void InnerEventReport::InnerSendBundleStateChangeEvent(const EventInfo& eventInfo)
{
std::string type = eventInfo.abilityName.empty() ? APPLICATION : ABILITY;
std::string state = eventInfo.isEnable ? ENABLE : DISABLE;
InnerEventWrite(
BUNDLE_COMPONENT_STATE_CHANGE,
BUNDLE_STATE_CHANGE,
HiSysEventType::BEHAVIOR,
EVENT_PARAM_USERID, eventInfo.userId,
EVENT_PARAM_BUNDLE_NAME, eventInfo.bundleName,