10 Star 0 Fork 11

src-openEuler/hiviewdfx_hisysevent

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0006-remove-dependency-and-adapt-for-build-samgr.patch 9.04 KB
一键复制 编辑 原始数据 按行查看 历史
From b83a54f6670d1fecc941ac6601cf714efbf89a2a Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 20 Jun 2023 17:26:10 +0800
Subject: [PATCH] remove dependency and adapt for build
---
interfaces/innerkits/common/BUILD.gn | 4 +-
services/common/src/parse_util.cpp | 7 ++--
services/dfx/source/hisysevent_adapter.cpp | 42 ++++++++++---------
services/samgr/native/BUILD.gn | 6 +--
.../native/source/system_ability_manager.cpp | 2 +-
.../source/system_ability_manager_stub.cpp | 27 ++++++------
6 files changed, 46 insertions(+), 42 deletions(-)
diff --git a/interfaces/innerkits/common/BUILD.gn b/interfaces/innerkits/common/BUILD.gn
index ffbf5a9..368eece 100644
--- a/interfaces/innerkits/common/BUILD.gn
+++ b/interfaces/innerkits/common/BUILD.gn
@@ -49,8 +49,8 @@ ohos_shared_library("samgr_common") {
if (is_standard_system) {
external_deps = [
"c_utils:utils",
- "hisysevent_native:libhisysevent",
- "hitrace_native:hitrace_meter",
+ # "hisysevent_native:libhisysevent",
+ # "hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
]
part_name = "samgr"
diff --git a/services/common/src/parse_util.cpp b/services/common/src/parse_util.cpp
index af7aecc..66ad8e6 100644
--- a/services/common/src/parse_util.cpp
+++ b/services/common/src/parse_util.cpp
@@ -21,10 +21,11 @@
#include <memory>
#include <sstream>
#include <vector>
+#include <algorithm>
#include "datetime_ex.h"
#include "hisysevent_adapter.h"
-#include "hitrace_meter.h"
+// #include "hitrace_meter.h"
#include "libxml/globals.h"
#include "libxml/tree.h"
#include "libxml/xmlstring.h"
@@ -105,7 +106,7 @@ void ParseUtil::OpenSo(SaProfile& saProfile)
{
if (saProfile.handle == nullptr) {
std::string dlopenTag = ToString(saProfile.saId) + "_DLOPEN";
- HITRACE_METER_NAME(HITRACE_TAG_SAMGR, dlopenTag);
+ // HITRACE_METER_NAME(HITRACE_TAG_SAMGR, dlopenTag);
int64_t begin = GetTickCount();
DlHandle handle = dlopen(Str16ToStr8(saProfile.libPath).c_str(), RTLD_NOW);
HILOGI("[PerformanceTest] SA:%{public}d OpenSo spend %{public}" PRId64 " ms",
@@ -117,7 +118,7 @@ void ParseUtil::OpenSo(SaProfile& saProfile)
if ((libPathVec.size() > 0)) {
fileName = libPathVec[libPathVec.size() - 1];
}
- ReportAddSystemAbilityFailed(saProfile.saId, fileName);
+ // ReportAddSystemAbilityFailed(saProfile.saId, fileName);
HILOGE("dlopen %{public}s failed with errno:%s!", fileName.c_str(), dlerror());
return;
}
diff --git a/services/dfx/source/hisysevent_adapter.cpp b/services/dfx/source/hisysevent_adapter.cpp
index 608011e..5da4ad1 100644
--- a/services/dfx/source/hisysevent_adapter.cpp
+++ b/services/dfx/source/hisysevent_adapter.cpp
@@ -16,14 +16,14 @@
#include <string>
-#include "def.h"
-#include "hisysevent.h"
+// #include "def.h"
+// #include "hisysevent.h"
#include "sam_log.h"
namespace OHOS {
using namespace OHOS::HiviewDFX;
namespace {
-const std::string DOMAIN_NAME = std::string(HiSysEvent::Domain::SAMGR);
+// const std::string DOMAIN_NAME = std::string(HiSysEvent::Domain::SAMGR);
const std::string ADD_SYSTEMABILITY_FAIL = "SAMGR_ADD_SYSTEMABILITY_FAIL";
const std::string CALLER_PID = "CALLER_PID";
const std::string SAID = "SAID";
@@ -34,26 +34,28 @@ const std::string GETSA__TAG = "SAMGR_GETSA_FREQUENCY";
void ReportAddSystemAbilityFailed(int32_t said, const std::string& filaName)
{
- int ret = HiSysEvent::Write(DOMAIN_NAME,
- ADD_SYSTEMABILITY_FAIL,
- HiSysEvent::EventType::FAULT,
- SAID, said,
- FILE_NAME, filaName);
- if (ret != 0) {
- HILOGE("hisysevent report add system ability event failed! ret %{public}d.", ret);
- }
+ HILOGE("Skip this method");
+ // int ret = HiSysEvent::Write(DOMAIN_NAME,
+ // ADD_SYSTEMABILITY_FAIL,
+ // HiSysEvent::EventType::FAULT,
+ // SAID, said,
+ // FILE_NAME, filaName);
+ // if (ret != 0) {
+ // HILOGE("hisysevent report add system ability event failed! ret %{public}d.", ret);
+ // }
}
void ReportGetSAFrequency(uint32_t callerPid, uint32_t said, int32_t count)
{
- int ret = HiSysEvent::Write(DOMAIN_NAME,
- GETSA__TAG,
- HiSysEvent::EventType::STATISTIC,
- CALLER_PID, callerPid,
- SAID, said,
- COUNT, count);
- if (ret != 0) {
- HILOGE("hisysevent report get sa frequency failed! ret %{public}d.", ret);
- }
+ HILOGE("Skip this method");
+ // int ret = HiSysEvent::Write(DOMAIN_NAME,
+ // GETSA__TAG,
+ // HiSysEvent::EventType::STATISTIC,
+ // CALLER_PID, callerPid,
+ // SAID, said,
+ // COUNT, count);
+ // if (ret != 0) {
+ // HILOGE("hisysevent report get sa frequency failed! ret %{public}d.", ret);
+ // }
}
} // OHOS
diff --git a/services/samgr/native/BUILD.gn b/services/samgr/native/BUILD.gn
index 8ec85e5..2e99473 100644
--- a/services/samgr/native/BUILD.gn
+++ b/services/samgr/native/BUILD.gn
@@ -59,11 +59,11 @@ ohos_executable("samgr") {
if (is_standard_system) {
external_deps = [
- "access_token:libaccesstoken_sdk",
+ # "access_token:libaccesstoken_sdk",
"c_utils:utils",
"eventhandler:libeventhandler",
- "hisysevent_native:libhisysevent",
- "hitrace_native:hitrace_meter",
+ # "hisysevent_native:libhisysevent",
+ # "hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"init:libbeget_proxy",
"init:libbegetutil",
diff --git a/services/samgr/native/source/system_ability_manager.cpp b/services/samgr/native/source/system_ability_manager.cpp
index e43c103..95c894e 100644
--- a/services/samgr/native/source/system_ability_manager.cpp
+++ b/services/samgr/native/source/system_ability_manager.cpp
@@ -23,7 +23,7 @@
#include "directory_ex.h"
#include "errors.h"
#include "hisysevent_adapter.h"
-#include "hitrace_meter.h"
+// #include "hitrace_meter.h"
#include "if_local_ability_manager.h"
#include "ipc_skeleton.h"
#include "local_ability_manager_proxy.h"
diff --git a/services/samgr/native/source/system_ability_manager_stub.cpp b/services/samgr/native/source/system_ability_manager_stub.cpp
index 5b168dc..89fe52d 100644
--- a/services/samgr/native/source/system_ability_manager_stub.cpp
+++ b/services/samgr/native/source/system_ability_manager_stub.cpp
@@ -18,10 +18,10 @@
#include <unistd.h>
#include <cinttypes>
-#include "accesstoken_kit.h"
+// #include "accesstoken_kit.h"
#include "datetime_ex.h"
#include "errors.h"
-#include "hitrace_meter.h"
+// #include "hitrace_meter.h"
#include "ipc_skeleton.h"
#include "ipc_types.h"
#include "sam_log.h"
@@ -97,7 +97,7 @@ namespace {
}
}
-using namespace OHOS::Security;
+// using namespace OHOS::Security;
namespace OHOS {
SystemAbilityManagerStub::SystemAbilityManagerStub()
{
@@ -489,10 +489,10 @@ int32_t SystemAbilityManagerStub::RemoveSystemAbilityInner(MessageParcel& data,
int32_t SystemAbilityManagerStub::AddSystemProcessInner(MessageParcel& data, MessageParcel& reply)
{
- if (!CanRequest()) {
- HILOGE("AddSystemProcessInner PERMISSION DENIED!");
- return ERR_PERMISSION_DENIED;
- }
+ // if (!CanRequest()) {
+ // HILOGE("AddSystemProcessInner PERMISSION DENIED!");
+ // return ERR_PERMISSION_DENIED;
+ // }
std::u16string procName = data.ReadString16();
if (procName.empty()) {
HILOGW("SystemAbilityManagerStub::AddSystemProcessInner read process name failed!");
@@ -518,7 +518,7 @@ int32_t SystemAbilityManagerStub::LoadSystemAbilityInner(MessageParcel& data, Me
{
int32_t systemAbilityId = data.ReadInt32();
std::string loadSystemAbilityTag = ToString(systemAbilityId) + "_LoadSystemAbility";
- HITRACE_METER_NAME(HITRACE_TAG_SAMGR, loadSystemAbilityTag);
+ // HITRACE_METER_NAME(HITRACE_TAG_SAMGR, loadSystemAbilityTag);
if (!CheckInputSysAbilityId(systemAbilityId)) {
HILOGW("SystemAbilityManagerStub::LoadSystemAbilityInner read systemAbilityId failed!");
return ERR_INVALID_VALUE;
@@ -589,10 +589,11 @@ int32_t SystemAbilityManagerStub::LoadRemoteSystemAbilityInner(MessageParcel& da
bool SystemAbilityManagerStub::CanRequest()
{
- auto accessTokenId = IPCSkeleton::GetCallingTokenID();
- AccessToken::ATokenTypeEnum tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(accessTokenId);
- HILOGD("SystemAbilityManagerStub::CanRequest tokenId:%{private}u, tokenType:%{public}d",
- accessTokenId, tokenType);
- return (tokenType == AccessToken::ATokenTypeEnum::TOKEN_NATIVE);
+ return true;
+ // auto accessTokenId = IPCSkeleton::GetCallingTokenID();
+ // AccessToken::ATokenTypeEnum tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(accessTokenId);
+ // HILOGD("SystemAbilityManagerStub::CanRequest tokenId:%{private}u, tokenType:%{public}d",
+ // accessTokenId, tokenType);
+ // return (tokenType == AccessToken::ATokenTypeEnum::TOKEN_NATIVE);
}
} // namespace OHOS
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/hiviewdfx_hisysevent.git
git@gitee.com:src-openeuler/hiviewdfx_hisysevent.git
src-openeuler
hiviewdfx_hisysevent
hiviewdfx_hisysevent
master

搜索帮助