mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-23 14:30:21 +00:00
add hisysevent
Signed-off-by: qianli <qianli16@huawei.com> Change-Id: If4e45cd1d34a89638579d67df1d8fe6bb77d69b5
This commit is contained in:
parent
9fe9e2c411
commit
312ada87c5
@ -56,6 +56,8 @@ struct BehaviorEventParam {
|
||||
std::string bundleName = "";
|
||||
std::string abilityName = "";
|
||||
int32_t callingAppUid = -1;
|
||||
std::string srcBundleName = "";
|
||||
std::string version ="";
|
||||
};
|
||||
|
||||
class DmsHiSysEventReport {
|
||||
|
@ -68,6 +68,7 @@ private:
|
||||
#endif
|
||||
int32_t NotifyStateChangedFromRemoteInner(MessageParcel& data, MessageParcel& reply);
|
||||
int32_t GetDistributedComponentListInner(MessageParcel& data, MessageParcel& reply);
|
||||
int32_t ReportEvent(const OHOS::AAFwk::Want& want, const std::string& eventName, int32_t result, int32_t callerUid);
|
||||
bool CheckDmsRequestPermission();
|
||||
bool CheckCallingUid();
|
||||
bool EnforceInterfaceToken(MessageParcel& data);
|
||||
|
@ -36,8 +36,10 @@ constexpr const char* KEY_CALLING_UID = "CALLING_UID";
|
||||
constexpr const char* KEY_ERROR_TYPE = "ERROR_TYPE";
|
||||
|
||||
constexpr const char* KEY_RESULT = "RESULT";
|
||||
constexpr const char* KEY_TARGET_ABILITY = "TARGET_ABILITY";
|
||||
constexpr const char* KEY_TARGET_BUNDLE = "TARGET_BUNDLE";
|
||||
constexpr const char* KEY_CALLEE_ABILITY = "CALLEE_ABILITY";
|
||||
constexpr const char* KEY_CALLEE_BUNDLE = "CALLEE_BUNDLE";
|
||||
constexpr const char* KEY_CALLER_BUNDLE = "CALLER_BUNDLE";
|
||||
constexpr const char* KEY_VERSION = "VERSION";
|
||||
}
|
||||
|
||||
int DmsHiSysEventReport::ReportBehaviorEvent(const BehaviorEventParam& param)
|
||||
@ -47,9 +49,11 @@ int DmsHiSysEventReport::ReportBehaviorEvent(const BehaviorEventParam& param)
|
||||
KEY_CALLING_UID, IPCSkeleton::GetCallingUid(),
|
||||
KEY_CALLING_PID, IPCSkeleton::GetCallingPid(),
|
||||
KEY_CALLING_APP_UID, param.callingAppUid,
|
||||
KEY_TARGET_BUNDLE, param.bundleName,
|
||||
KEY_TARGET_ABILITY, param.abilityName,
|
||||
KEY_RESULT, param.eventResult);
|
||||
KEY_CALLEE_BUNDLE, param.bundleName,
|
||||
KEY_CALLEE_ABILITY, param.abilityName,
|
||||
KEY_RESULT, param.eventResult,
|
||||
KEY_CALLER_BUNDLE, param.srcBundleName,
|
||||
KEY_VERSION, param.version);
|
||||
if (result != 0) {
|
||||
HILOGE("hisysevent report failed! ret %{public}d.", result);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "ability_info.h"
|
||||
#include "adapter/dnetwork_adapter.h"
|
||||
#include "bundle/bundle_manager_internal.h"
|
||||
#include "caller_info.h"
|
||||
#include "datetime_ex.h"
|
||||
#include "dfx/dms_hisysevent_report.h"
|
||||
@ -33,7 +34,6 @@
|
||||
#endif
|
||||
#include "ipc_skeleton.h"
|
||||
#include "message_parcel.h"
|
||||
|
||||
#include "parcel_helper.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -178,13 +178,34 @@ int32_t DistributedSchedStub::StartRemoteAbilityInner(MessageParcel& data, Messa
|
||||
}
|
||||
DistributedSchedPermission::GetInstance().MarkUriPermission(*want, accessToken);
|
||||
int32_t result = StartRemoteAbility(*want, callerUid, requestCode, accessToken);
|
||||
BehaviorEventParam eventParam = { EventCallingType::LOCAL, BehaviorEvent::START_REMOTE_ABILITY, result,
|
||||
want->GetElement().GetBundleName(), want->GetElement().GetAbilityName(), callerUid };
|
||||
DmsHiSysEventReport::ReportBehaviorEvent(eventParam);
|
||||
ReportEvent(*want, BehaviorEvent::START_REMOTE_ABILITY, result, callerUid);
|
||||
HILOGI("StartRemoteAbilityInner result = %{public}d", result);
|
||||
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
|
||||
}
|
||||
|
||||
int32_t DistributedSchedStub::ReportEvent(const OHOS::AAFwk::Want& want, const std::string& eventName, int32_t result,
|
||||
int32_t callerUid)
|
||||
{
|
||||
std::vector<std::string> bundleNames;
|
||||
if (!BundleManagerInternal::GetBundleNameListFromBms(callerUid, bundleNames)) {
|
||||
HILOGE("GetBundleNameListFromBms failed");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
std::string srcBundleName = bundleNames.empty() ? std::string() : bundleNames.front();
|
||||
HILOGD("srcBundleName %{public}s", srcBundleName.c_str());
|
||||
AppExecFwk::BundleInfo localBundleInfo;
|
||||
if (BundleManagerInternal::GetLocalBundleInfo(srcBundleName, localBundleInfo) != ERR_OK) {
|
||||
HILOGE("get local bundle info failed");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
HILOGD("version %{public}s", localBundleInfo.versionName.c_str());
|
||||
|
||||
BehaviorEventParam eventParam = { EventCallingType::LOCAL, eventName, result, want.GetElement().GetBundleName(),
|
||||
want.GetElement().GetAbilityName(), callerUid, srcBundleName, localBundleInfo.versionName };
|
||||
DmsHiSysEventReport::ReportBehaviorEvent(eventParam);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t DistributedSchedStub::StartAbilityFromRemoteInner(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
if (!CheckCallingUid()) {
|
||||
@ -343,9 +364,7 @@ int32_t DistributedSchedStub::StartContinuationInner(MessageParcel& data, Messag
|
||||
}
|
||||
DistributedSchedPermission::GetInstance().MarkUriPermission(*want, accessToken);
|
||||
int32_t result = StartContinuation(*want, missionId, callerUid, status, accessToken);
|
||||
BehaviorEventParam eventParam = { EventCallingType::LOCAL, BehaviorEvent::START_CONTINUATION, result,
|
||||
want->GetElement().GetBundleName(), want->GetElement().GetAbilityName(), callerUid };
|
||||
DmsHiSysEventReport::ReportBehaviorEvent(eventParam);
|
||||
ReportEvent(*want, BehaviorEvent::START_CONTINUATION, result, callerUid);
|
||||
HILOGI("result = %{public}d", result);
|
||||
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
|
||||
}
|
||||
@ -413,9 +432,7 @@ int32_t DistributedSchedStub::ConnectRemoteAbilityInner(MessageParcel& data, Mes
|
||||
return DMS_PERMISSION_DENIED;
|
||||
}
|
||||
int32_t result = ConnectRemoteAbility(*want, connect, callerUid, callerPid, accessToken);
|
||||
BehaviorEventParam eventParam = { EventCallingType::LOCAL, BehaviorEvent::CONNECT_REMOTE_ABILITY, result,
|
||||
want->GetElement().GetBundleName(), want->GetElement().GetAbilityName(), callerUid };
|
||||
DmsHiSysEventReport::ReportBehaviorEvent(eventParam);
|
||||
ReportEvent(*want, BehaviorEvent::CONNECT_REMOTE_ABILITY, result, callerUid);
|
||||
HILOGI("result = %{public}d", result);
|
||||
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
|
||||
}
|
||||
@ -798,9 +815,7 @@ int32_t DistributedSchedStub::StartRemoteAbilityByCallInner(MessageParcel& data,
|
||||
return DMS_PERMISSION_DENIED;
|
||||
}
|
||||
int32_t result = StartRemoteAbilityByCall(*want, connect, callerUid, callerPid, accessToken);
|
||||
BehaviorEventParam eventParam = { EventCallingType::LOCAL, BehaviorEvent::START_REMOTE_ABILITY_BYCALL, result,
|
||||
want->GetElement().GetBundleName(), want->GetElement().GetAbilityName(), callerUid };
|
||||
DmsHiSysEventReport::ReportBehaviorEvent(eventParam);
|
||||
ReportEvent(*want, BehaviorEvent::START_REMOTE_ABILITY_BYCALL, result, callerUid);
|
||||
HILOGI("result = %{public}d", result);
|
||||
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user