!11 同步sp2 到 22.03 next 分支

From: @yanansong 
Reviewed-by: @chrisshangguan 
Signed-off-by: @chrisshangguan
This commit is contained in:
openeuler-ci-bot 2023-10-26 09:16:28 +00:00 committed by Gitee
commit be6d10f243
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
32 changed files with 5094 additions and 0 deletions

View File

@ -0,0 +1,138 @@
From 80f5c4618a582ac2735a770e5b6e2fc172a17f8e Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 20 Jun 2023 16:45:15 +0800
Subject: [PATCH] adapt for build
---
base/include/linux/ashmem.h | 44 +++++++++++++++++++++++++++++++++++++
base/src/event_reactor.h | 1 +
base/src/file_ex.cpp | 3 ++-
base/src/parcel.cpp | 1 +
base/src/string_ex.cpp | 2 ++
base/src/thread_pool.cpp | 1 +
6 files changed, 51 insertions(+), 1 deletion(-)
create mode 100644 base/include/linux/ashmem.h
diff --git a/base/include/linux/ashmem.h b/base/include/linux/ashmem.h
new file mode 100644
index 0000000..174667f
--- /dev/null
+++ b/base/include/linux/ashmem.h
@@ -0,0 +1,44 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_LINUX_ASHMEM_H
+#define _UAPI_LINUX_ASHMEM_H
+#include <linux/ioctl.h>
+#include <linux/types.h>
+#define ASHMEM_NAME_LEN 256
+#define ASHMEM_NAME_DEF "dev/ashmem"
+#define ASHMEM_NOT_PURGED 0
+#define ASHMEM_WAS_PURGED 1
+#define ASHMEM_IS_UNPINNED 0
+#define ASHMEM_IS_PINNED 1
+struct ashmem_pin {
+ __u32 offset;
+ __u32 len;
+};
+#define __ASHMEMIOC 0x77
+#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN])
+#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN])
+#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t)
+#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4)
+#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long)
+#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6)
+#define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin)
+#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
+#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
+#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
+#endif
diff --git a/base/src/event_reactor.h b/base/src/event_reactor.h
index 794e44a..1a282ec 100644
--- a/base/src/event_reactor.h
+++ b/base/src/event_reactor.h
@@ -21,6 +21,7 @@
#include <memory>
#include <mutex>
#include <list>
+#include <functional>
namespace OHOS {
namespace Utils {
diff --git a/base/src/file_ex.cpp b/base/src/file_ex.cpp
index 578b1be..a9e0572 100644
--- a/base/src/file_ex.cpp
+++ b/base/src/file_ex.cpp
@@ -24,6 +24,7 @@
#include <cstdio>
#include <securec.h>
#include <cstring>
+#include <limits.h>
#include "directory_ex.h"
#include "utils_log.h"
@@ -262,7 +263,7 @@ bool SaveBufferToFile(const string& filePath, const vector<char>& content, bool
}
// if the file is not exist,create it first!
- uint32_t mode = truncated ? (ios::out | ios::binary | ios::trunc) : (ios::out | ios::binary | ios::app);
+ ios_base::openmode mode = truncated ? (ios::out | ios::binary | ios::trunc) : (ios::out | ios::binary | ios::app);
ofstream file;
file.open(filePath.c_str(), mode);
if (!file.is_open()) {
diff --git a/base/src/parcel.cpp b/base/src/parcel.cpp
index 4d62353..b0012bc 100644
--- a/base/src/parcel.cpp
+++ b/base/src/parcel.cpp
@@ -16,6 +16,7 @@
#include "parcel.h"
#include "securec.h"
#include "utils_log.h"
+#include <limits.h>
namespace OHOS {
diff --git a/base/src/string_ex.cpp b/base/src/string_ex.cpp
index 32340ae..782e419 100644
--- a/base/src/string_ex.cpp
+++ b/base/src/string_ex.cpp
@@ -20,6 +20,8 @@
#include <iostream>
#include <iomanip>
#include <sstream>
+#include <algorithm>
+#include <limits.h>
using namespace std;
namespace OHOS {
diff --git a/base/src/thread_pool.cpp b/base/src/thread_pool.cpp
index 9951929..b4e663c 100644
--- a/base/src/thread_pool.cpp
+++ b/base/src/thread_pool.cpp
@@ -19,6 +19,7 @@
#include <memory>
#include <pthread.h>
+#include <cstring>
namespace OHOS {
--
2.33.0

View File

@ -0,0 +1,91 @@
From 998af3dc5949cbfebf9d446b655d8be02f3cce82 Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 20 Jun 2023 16:51:48 +0800
Subject: [PATCH] remove dependency and adpat for build
---
config_policy.gni | 2 +-
.../hisysevent_adapter/hisysevent_adapter.cpp | 29 ++++++++++---------
interfaces/kits/js/BUILD.gn | 3 +-
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/config_policy.gni b/config_policy.gni
index c4a6a69..1d0388e 100644
--- a/config_policy.gni
+++ b/config_policy.gni
@@ -16,5 +16,5 @@ declare_args() {
config_policy_fs_prefix = ""
# Whether support napi so
- support_config_policy_napi = true
+ support_config_policy_napi = false
}
diff --git a/frameworks/dfx/hisysevent_adapter/hisysevent_adapter.cpp b/frameworks/dfx/hisysevent_adapter/hisysevent_adapter.cpp
index f486dd8..bd84ab0 100644
--- a/frameworks/dfx/hisysevent_adapter/hisysevent_adapter.cpp
+++ b/frameworks/dfx/hisysevent_adapter/hisysevent_adapter.cpp
@@ -14,7 +14,7 @@
*/
#include "hisysevent_adapter.h"
-#include "hisysevent.h"
+// #include "hisysevent.h"
#include "hilog/log.h"
namespace OHOS {
@@ -22,23 +22,24 @@ namespace Customization {
namespace ConfigPolicy {
using namespace OHOS::HiviewDFX;
static constexpr HiLogLabel LABEL = { LOG_CORE, 0xD001E00, "ReportConfigPolicyEvent" };
-const std::string DOMAIN_STR = std::string(HiSysEvent::Domain::CUSTOMIZATION_CONFIG);
+// const std::string DOMAIN_STR = std::string(HiSysEvent::Domain::CUSTOMIZATION_CONFIG);
void ReportConfigPolicyEvent(ReportType reportType, const std::string &apiName, const std::string &msgInfo)
{
- int ret;
- if (reportType == ReportType::CONFIG_POLICY_FAILED) {
- ret = HiSysEvent::Write(DOMAIN_STR, "CONFIG_POLICY_FAILED", HiSysEvent::EventType::FAULT, "APINAME", apiName,
- "MSG", msgInfo);
- } else {
- ret =
- HiSysEvent::Write(DOMAIN_STR, "CONFIG_POLICY_EVENT", HiSysEvent::EventType::STATISTIC, "APINAME", apiName);
- }
+ return;
+ // int ret;
+ // if (reportType == ReportType::CONFIG_POLICY_FAILED) {
+ // ret = HiSysEvent::Write(DOMAIN_STR, "CONFIG_POLICY_FAILED", HiSysEvent::EventType::FAULT, "APINAME", apiName,
+ // "MSG", msgInfo);
+ // } else {
+ // ret =
+ // HiSysEvent::Write(DOMAIN_STR, "CONFIG_POLICY_EVENT", HiSysEvent::EventType::STATISTIC, "APINAME", apiName);
+ // }
- if (ret != 0) {
- HiLog::Error(LABEL, "hisysevent write failed! ret %{public}d, apiName %{public}s, errMsg %{public}s", ret,
- apiName.c_str(), msgInfo.c_str());
- }
+ // if (ret != 0) {
+ // HiLog::Error(LABEL, "hisysevent write failed! ret %{public}d, apiName %{public}s, errMsg %{public}s", ret,
+ // apiName.c_str(), msgInfo.c_str());
+ // }
}
} // namespace ConfigPolicy
} // namespace Customization
diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn
index 2640cea..bf4c27f 100644
--- a/interfaces/kits/js/BUILD.gn
+++ b/interfaces/kits/js/BUILD.gn
@@ -28,9 +28,8 @@ ohos_shared_library("configpolicy") {
deps = [ "//base/customization/config_policy/frameworks/config_policy:configpolicy_util" ]
external_deps = [
- "hisysevent_native:libhisysevent",
+ # "hisysevent_native:libhisysevent",
"hiviewdfx_hilog_native:libhilog",
- "napi:ace_napi",
]
relative_install_dir = "module"
subsystem_name = "customization"
--
2.33.0

View File

@ -0,0 +1,934 @@
From ad68a9dc1f289fb63cc4b10613f3bd46b546c225 Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 20 Jun 2023 17:01:51 +0800
Subject: [PATCH] remove dependency and adapt for openeuler
---
adapter/BUILD.gn | 2 +-
.../common/bus_center/bus_center_adapter.gni | 4 +-
.../common/dfx/softbus_adapter_hisysevent.cpp | 263 +++++++++---------
bundle.json | 4 +-
.../bus_center/src/bus_center_adapter.c | 2 +-
core/authentication/include/auth_hichain.h | 2 +
core/authentication/src/auth_hichain.c | 8 +-
core/authentication/src/auth_session_fsm.c | 8 +
.../lane_manager/src/lnn_lane_link_proc.c | 2 +-
.../lane_manager/src/lnn_select_rule.c | 2 +-
.../standard/softbus_permission.cpp | 151 +++++-----
.../common/src/softbus_thread_pool.c | 3 +-
core/frame/BUILD.gn | 6 +-
.../src/permission_status_change_cb.cpp | 18 +-
.../src/softbus_client_info_manager.cpp | 9 +-
.../standard/init/src/softbus_server_stub.cpp | 137 ++++-----
16 files changed, 325 insertions(+), 296 deletions(-)
diff --git a/adapter/BUILD.gn b/adapter/BUILD.gn
index 20f4e606d..2b7fa0fb8 100644
--- a/adapter/BUILD.gn
+++ b/adapter/BUILD.gn
@@ -206,7 +206,7 @@ if (defined(ohos_lite)) {
public_configs = [ ":config_adapter_common" ]
if (is_standard_system) {
external_deps = [
- "hisysevent_native:libhisysevent",
+ # "hisysevent_native:libhisysevent",
"hiviewdfx_hilog_native:libhilog",
]
}
diff --git a/adapter/common/bus_center/bus_center_adapter.gni b/adapter/common/bus_center/bus_center_adapter.gni
index ebd12a0f3..6c8887d8b 100644
--- a/adapter/common/bus_center/bus_center_adapter.gni
+++ b/adapter/common/bus_center/bus_center_adapter.gni
@@ -87,8 +87,8 @@ if (defined(ohos_lite)) {
if (has_ces_part) {
bus_center_adapter_src +=
[ "$adapter_bus_center_path/common_event/lnn_common_event_monitor.cpp" ]
- bus_center_adapter_external_deps +=
- [ "common_event_service:cesfwk_innerkits" ]
+ # bus_center_adapter_external_deps +=
+ # [ "common_event_service:cesfwk_innerkits" ]
} else {
bus_center_adapter_src += [ "$adapter_bus_center_path/common_event/lnn_common_event_monitor_virtual.cpp" ]
}
diff --git a/adapter/common/dfx/softbus_adapter_hisysevent.cpp b/adapter/common/dfx/softbus_adapter_hisysevent.cpp
index 1c6d36352..d04490317 100644
--- a/adapter/common/dfx/softbus_adapter_hisysevent.cpp
+++ b/adapter/common/dfx/softbus_adapter_hisysevent.cpp
@@ -23,127 +23,127 @@
#include "softbus_adapter_mem.h"
#include "softbus_adapter_thread.h"
#include "message_handler.h"
-#include "hisysevent_c.h"
+// #include "hisysevent_c.h"
-static const char *g_domain = "DSOFTBUS";
-static bool g_init_lock = false;
-static SoftBusMutex g_dfx_lock;
-static HiSysEventParam g_dstParam[SOFTBUS_EVT_PARAM_BUTT];
+// static const char *g_domain = "DSOFTBUS";
+// static bool g_init_lock = false;
+// static SoftBusMutex g_dfx_lock;
+// static HiSysEventParam g_dstParam[SOFTBUS_EVT_PARAM_BUTT];
-static int32_t ConvertEventParam(SoftBusEvtParam *srcParam, HiSysEventParam *dstParam)
-{
- switch (srcParam->paramType) {
- case SOFTBUS_EVT_PARAMTYPE_BOOL:
- dstParam->t = HISYSEVENT_BOOL;
- dstParam->v.b = srcParam->paramValue.b;
- break;
- case SOFTBUS_EVT_PARAMTYPE_UINT8:
- dstParam->t = HISYSEVENT_UINT8;
- dstParam->v.ui8 = srcParam->paramValue.u8v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_UINT16:
- dstParam->t = HISYSEVENT_UINT16;
- dstParam->v.ui16 = srcParam->paramValue.u16v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_INT32:
- dstParam->t = HISYSEVENT_INT32;
- dstParam->v.i32 = srcParam->paramValue.i32v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_UINT32:
- dstParam->t = HISYSEVENT_UINT32;
- dstParam->v.ui32 = srcParam->paramValue.u32v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_UINT64:
- dstParam->t = HISYSEVENT_UINT64;
- dstParam->v.ui64 = srcParam->paramValue.u64v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_FLOAT:
- dstParam->t = HISYSEVENT_FLOAT;
- dstParam->v.f = srcParam->paramValue.f;
- break;
- case SOFTBUS_EVT_PARAMTYPE_DOUBLE:
- dstParam->t = HISYSEVENT_DOUBLE;
- dstParam->v.d = srcParam->paramValue.d;
- break;
- case SOFTBUS_EVT_PARAMTYPE_STRING:
- dstParam->t = HISYSEVENT_STRING;
- dstParam->v.s = (char *)SoftBusCalloc(sizeof(char) * SOFTBUS_HISYSEVT_PARAM_LEN);
- if (dstParam->v.s == NULL) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam: SoftBusMalloc fail");
- return SOFTBUS_ERR;
- }
- if (strcpy_s(dstParam->v.s, SOFTBUS_HISYSEVT_PARAM_LEN, srcParam->paramValue.str) != EOK) {
- SoftBusFree(dstParam->v.s);
- HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam:copy string var fail");
- return SOFTBUS_ERR;
- }
- break;
- default:
- break;
- }
- return SOFTBUS_OK;
-}
+// static int32_t ConvertEventParam(SoftBusEvtParam *srcParam, HiSysEventParam *dstParam)
+// {
+ // switch (srcParam->paramType) {
+ // case SOFTBUS_EVT_PARAMTYPE_BOOL:
+ // dstParam->t = HISYSEVENT_BOOL;
+ // dstParam->v.b = srcParam->paramValue.b;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_UINT8:
+ // dstParam->t = HISYSEVENT_UINT8;
+ // dstParam->v.ui8 = srcParam->paramValue.u8v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_UINT16:
+ // dstParam->t = HISYSEVENT_UINT16;
+ // dstParam->v.ui16 = srcParam->paramValue.u16v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_INT32:
+ // dstParam->t = HISYSEVENT_INT32;
+ // dstParam->v.i32 = srcParam->paramValue.i32v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_UINT32:
+ // dstParam->t = HISYSEVENT_UINT32;
+ // dstParam->v.ui32 = srcParam->paramValue.u32v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_UINT64:
+ // dstParam->t = HISYSEVENT_UINT64;
+ // dstParam->v.ui64 = srcParam->paramValue.u64v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_FLOAT:
+ // dstParam->t = HISYSEVENT_FLOAT;
+ // dstParam->v.f = srcParam->paramValue.f;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_DOUBLE:
+ // dstParam->t = HISYSEVENT_DOUBLE;
+ // dstParam->v.d = srcParam->paramValue.d;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_STRING:
+ // dstParam->t = HISYSEVENT_STRING;
+ // dstParam->v.s = (char *)SoftBusCalloc(sizeof(char) * SOFTBUS_HISYSEVT_PARAM_LEN);
+ // if (dstParam->v.s == NULL) {
+ // HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam: SoftBusMalloc fail");
+ // return SOFTBUS_ERR;
+ // }
+ // if (strcpy_s(dstParam->v.s, SOFTBUS_HISYSEVT_PARAM_LEN, srcParam->paramValue.str) != EOK) {
+ // SoftBusFree(dstParam->v.s);
+ // HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam:copy string var fail");
+ // return SOFTBUS_ERR;
+ // }
+ // break;
+ // default:
+ // break;
+ // }
+// return SOFTBUS_OK;
+// }
-static int32_t ConvertMsgToHiSysEvent(SoftBusEvtReportMsg *msg)
-{
- if (memset_s(g_dstParam, sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT, 0,
- sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT) != EOK) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "init g_dstParam fail");
- return SOFTBUS_ERR;
- }
- for (uint32_t i = 0; i < msg->paramNum; i++) {
- if (strcpy_s(g_dstParam[i].name, SOFTBUS_HISYSEVT_NAME_LEN, msg->paramArray[i].paramName) != EOK) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "copy param fail");
- return SOFTBUS_ERR;
- }
- if (ConvertEventParam(&msg->paramArray[i], &g_dstParam[i]) != SOFTBUS_OK) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertMsgToHiSysEvent:convert param fail");
- return SOFTBUS_ERR;
- }
- }
- return SOFTBUS_OK;
-}
+// static int32_t ConvertMsgToHiSysEvent(SoftBusEvtReportMsg *msg)
+// {
+// if (memset_s(g_dstParam, sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT, 0,
+// sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT) != EOK) {
+// HILOG_ERROR(SOFTBUS_HILOG_ID, "init g_dstParam fail");
+// return SOFTBUS_ERR;
+// }
+// for (uint32_t i = 0; i < msg->paramNum; i++) {
+// if (strcpy_s(g_dstParam[i].name, SOFTBUS_HISYSEVT_NAME_LEN, msg->paramArray[i].paramName) != EOK) {
+// HILOG_ERROR(SOFTBUS_HILOG_ID, "copy param fail");
+// return SOFTBUS_ERR;
+// }
+// if (ConvertEventParam(&msg->paramArray[i], &g_dstParam[i]) != SOFTBUS_OK) {
+// HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertMsgToHiSysEvent:convert param fail");
+// return SOFTBUS_ERR;
+// }
+// }
+// return SOFTBUS_OK;
+// }
-static void HiSysEventParamDeInit(uint32_t size)
-{
- for (uint32_t i = 0; i < size; i++) {
- if (g_dstParam[i].t == HISYSEVENT_STRING && g_dstParam[i].v.s != NULL) {
- SoftBusFree(g_dstParam[i].v.s);
- g_dstParam[i].v.s = NULL;
- }
- }
- }
+// static void HiSysEventParamDeInit(uint32_t size)
+// {
+// for (uint32_t i = 0; i < size; i++) {
+// if (g_dstParam[i].t == HISYSEVENT_STRING && g_dstParam[i].v.s != NULL) {
+// SoftBusFree(g_dstParam[i].v.s);
+// g_dstParam[i].v.s = NULL;
+// }
+// }
+// }
-static HiSysEventEventType ConvertMsgType(SoftBusEvtType type)
-{
- HiSysEventEventType hiSysEvtType;
- switch (type) {
- case SOFTBUS_EVT_TYPE_FAULT:
- hiSysEvtType = HISYSEVENT_FAULT;
- break;
- case SOFTBUS_EVT_TYPE_STATISTIC:
- hiSysEvtType = HISYSEVENT_STATISTIC;
- break;
- case SOFTBUS_EVT_TYPE_SECURITY:
- hiSysEvtType = HISYSEVENT_SECURITY;
- break;
- case SOFTBUS_EVT_TYPE_BEHAVIOR:
- hiSysEvtType = HISYSEVENT_BEHAVIOR;
- break;
- default:
- hiSysEvtType = HISYSEVENT_STATISTIC;
- break;
- }
- return hiSysEvtType;
-}
+// static HiSysEventEventType ConvertMsgType(SoftBusEvtType type)
+// {
+// HiSysEventEventType hiSysEvtType;
+// switch (type) {
+// case SOFTBUS_EVT_TYPE_FAULT:
+// hiSysEvtType = HISYSEVENT_FAULT;
+// break;
+// case SOFTBUS_EVT_TYPE_STATISTIC:
+// hiSysEvtType = HISYSEVENT_STATISTIC;
+// break;
+// case SOFTBUS_EVT_TYPE_SECURITY:
+// hiSysEvtType = HISYSEVENT_SECURITY;
+// break;
+// case SOFTBUS_EVT_TYPE_BEHAVIOR:
+// hiSysEvtType = HISYSEVENT_BEHAVIOR;
+// break;
+// default:
+// hiSysEvtType = HISYSEVENT_STATISTIC;
+// break;
+// }
+// return hiSysEvtType;
+// }
-static void InitHisEvtMutexLock()
-{
- if (SoftBusMutexInit(&g_dfx_lock, NULL) != SOFTBUS_OK) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "init HisEvtMutexLock fail");
- return;
- }
-}
+// static void InitHisEvtMutexLock()
+// {
+// if (SoftBusMutexInit(&g_dfx_lock, NULL) != SOFTBUS_OK) {
+// HILOG_ERROR(SOFTBUS_HILOG_ID, "init HisEvtMutexLock fail");
+// return;
+// }
+// }
#ifdef __cplusplus
#if __cplusplus
@@ -153,22 +153,23 @@ extern "C" {
int32_t SoftbusWriteHisEvt(SoftBusEvtReportMsg* reportMsg)
{
- if (reportMsg == nullptr) {
- return SOFTBUS_ERR;
- }
- if (!g_init_lock) {
- InitHisEvtMutexLock();
- g_init_lock = true;
- }
- if (SoftBusMutexLock(&g_dfx_lock) != 0) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "%s:lock failed", __func__);
- return SOFTBUS_LOCK_ERR;
- }
- ConvertMsgToHiSysEvent(reportMsg);
- OH_HiSysEvent_Write(g_domain, reportMsg->evtName, ConvertMsgType(reportMsg->evtType),
- g_dstParam, reportMsg->paramNum);
- HiSysEventParamDeInit(reportMsg->paramNum);
- (void)SoftBusMutexUnlock(&g_dfx_lock);
+ // if (reportMsg == nullptr) {
+ // return SOFTBUS_ERR;
+ // }
+ // if (!g_init_lock) {
+ // InitHisEvtMutexLock();
+ // g_init_lock = true;
+ // }
+ // if (SoftBusMutexLock(&g_dfx_lock) != 0) {
+ // HILOG_ERROR(SOFTBUS_HILOG_ID, "%s:lock failed", __func__);
+ // return SOFTBUS_LOCK_ERR;
+ // }
+ // ConvertMsgToHiSysEvent(reportMsg);
+ // OH_HiSysEvent_Write(g_domain, reportMsg->evtName, ConvertMsgType(reportMsg->evtType),
+ // g_dstParam, reportMsg->paramNum);
+ // HiSysEventParamDeInit(reportMsg->paramNum);
+ // (void)SoftBusMutexUnlock(&g_dfx_lock);
+ (void)reportMsg;
return SOFTBUS_OK;
}
diff --git a/bundle.json b/bundle.json
index fafbe1a58..e6f2752ba 100644
--- a/bundle.json
+++ b/bundle.json
@@ -81,7 +81,9 @@
"bus_center/softbus_bus_center.h",
"common/softbus_common.h",
"discovery/discovery_service.h",
- "transport/session.h"
+ "transport/session.h",
+ "../inner_kits/transport/dfs_session.h",
+ "../inner_kits/transport/inner_session.h"
],
"header_base": "//foundation/communication/dsoftbus/interfaces/kits"
}
diff --git a/core/adapter/bus_center/src/bus_center_adapter.c b/core/adapter/bus_center/src/bus_center_adapter.c
index 70f1d4a87..909a67563 100644
--- a/core/adapter/bus_center/src/bus_center_adapter.c
+++ b/core/adapter/bus_center/src/bus_center_adapter.c
@@ -27,7 +27,7 @@
#include "softbus_errcode.h"
#include "softbus_log.h"
-#define DEFAULT_DEVICE_NAME "OpenHarmony"
+#define DEFAULT_DEVICE_NAME "openEuler"
int32_t GetCommonDevInfo(const CommonDeviceKey key, char *value, uint32_t len)
{
diff --git a/core/authentication/include/auth_hichain.h b/core/authentication/include/auth_hichain.h
index 812541147..dbbff1e1f 100644
--- a/core/authentication/include/auth_hichain.h
+++ b/core/authentication/include/auth_hichain.h
@@ -37,6 +37,8 @@ int32_t HichainProcessData(int64_t authSeq, const uint8_t *data, uint32_t len);
void HichainDestroy(void);
+void OnFinish(int64_t authSeq, int operationCode, const char *returnData);
+
#ifdef __cplusplus
#if __cplusplus
}
diff --git a/core/authentication/src/auth_hichain.c b/core/authentication/src/auth_hichain.c
index f7b362e03..78a5f0783 100644
--- a/core/authentication/src/auth_hichain.c
+++ b/core/authentication/src/auth_hichain.c
@@ -90,7 +90,7 @@ static void OnSessionKeyReturned(int64_t authSeq, const uint8_t *sessionKey, uin
(void)AuthSessionSaveSessionKey(authSeq, sessionKey, sessionKeyLen);
}
-static void OnFinish(int64_t authSeq, int operationCode, const char *returnData)
+void OnFinish(int64_t authSeq, int operationCode, const char *returnData)
{
(void)operationCode;
(void)returnData;
@@ -286,6 +286,12 @@ void UnregTrustDataChangeListener(void)
int32_t HichainStartAuth(int64_t authSeq, const char *udid, const char *uid)
{
+ // bypass auth
+ uint8_t tempKey[32] = {0};
+ memset(tempKey, 1, 32);
+ g_hichainCallback.onSessionKeyReturned(authSeq, tempKey, 32);
+ return SOFTBUS_OK;
+
if (udid == NULL || uid == NULL) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "udid/uid is invalid.");
return SOFTBUS_INVALID_PARAM;
diff --git a/core/authentication/src/auth_session_fsm.c b/core/authentication/src/auth_session_fsm.c
index eaf6844e9..56d9b84fc 100644
--- a/core/authentication/src/auth_session_fsm.c
+++ b/core/authentication/src/auth_session_fsm.c
@@ -264,6 +264,11 @@ static void HandleMsgRecvDeviceId(AuthFsm *authFsm, MessagePara *para)
ret = SOFTBUS_AUTH_SYNC_DEVID_FAIL;
break;
}
+ // bypass auth
+ if (HichainStartAuth(authFsm->authSeq, info->udid, info->connInfo.peerUid) != SOFTBUS_OK) {
+ ret = SOFTBUS_AUTH_HICHAIN_AUTH_FAIL;
+ break;
+ }
} else {
/* just client need start authDevice. */
if (HichainStartAuth(authFsm->authSeq, info->udid, info->connInfo.peerUid) != SOFTBUS_OK) {
@@ -275,6 +280,9 @@ static void HandleMsgRecvDeviceId(AuthFsm *authFsm, MessagePara *para)
ret = SOFTBUS_OK;
} while (false);
+ // by pass auth
+ OnFinish(authFsm->authSeq, 0, NULL);
+
if (ret != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "handle devId msg fail, ret=%d", ret);
CompleteAuthSession(authFsm, ret);
diff --git a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c
index c966df363..b37b90a76 100755
--- a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c
+++ b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c
@@ -34,7 +34,7 @@
#include "softbus_network_utils.h"
#include "softbus_protocol_def.h"
#include "softbus_utils.h"
-#include "wifi_device.h"
+// #include "wifi_device.h"
typedef int32_t (*LaneLinkByType)(uint32_t reqId, const LinkRequest *reqInfo, const LaneLinkCb *callback);
diff --git a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c
index 79712a68f..ec66978ec 100644
--- a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c
+++ b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c
@@ -30,7 +30,7 @@
#include "softbus_network_utils.h"
#include "softbus_utils.h"
#include "softbus_wifi_api_adapter.h"
-#include "wifi_device.h"
+// #include "wifi_device.h"
#define LNN_LINK_DEFAULT_SCORE 60 /* Indicates that scoring is not supported */
diff --git a/core/common/security/permission/standard/softbus_permission.cpp b/core/common/security/permission/standard/softbus_permission.cpp
index e2b3ac720..5016dec1d 100644
--- a/core/common/security/permission/standard/softbus_permission.cpp
+++ b/core/common/security/permission/standard/softbus_permission.cpp
@@ -17,8 +17,9 @@
#include <sys/types.h>
#include <unistd.h>
+#include <string.h>
-#include "accesstoken_kit.h"
+// #include "accesstoken_kit.h"
#include "ipc_skeleton.h"
#include "permission_entry.h"
#include "softbus_adapter_mem.h"
@@ -32,95 +33,100 @@
#endif
namespace {
- using namespace OHOS::Security;
+ // using namespace OHOS::Security;
const std::string PERMISSION_JSON_FILE = PERMISSION_JSON_FILE_PATH;
const std::string DANGER_APP_PERMISSION = "ohos.permission.DISTRIBUTED_DATASYNC";
- const int32_t SYSTEM_UID = 1000;
- const int32_t MULTE_USER_RADIX = 100000;
- const std::string SAMGR_PROCESS_NAME = "samgr";
+ // const int32_t SYSTEM_UID = 1000;
+ // const int32_t MULTE_USER_RADIX = 100000;
+ // const std::string SAMGR_PROCESS_NAME = "samgr";
}
int32_t TransPermissionInit(void)
{
- int32_t ret = LoadPermissionJson(PERMISSION_JSON_FILE.c_str());
- if (ret != SOFTBUS_OK) {
- return ret;
- }
- return InitDynamicPermission();
+ // int32_t ret = LoadPermissionJson(PERMISSION_JSON_FILE.c_str());
+ // if (ret != SOFTBUS_OK) {
+ // return ret;
+ // }
+ // return InitDynamicPermission();
+ return SOFTBUS_OK;
}
void TransPermissionDeinit(void)
{
- DeinitPermissionJson();
+ // DeinitPermissionJson();
}
int32_t CheckTransPermission(pid_t callingUid, pid_t callingPid,
const char *pkgName, const char *sessionName, uint32_t actions)
{
- if (sessionName == nullptr || pkgName == nullptr) {
- return SOFTBUS_PERMISSION_DENIED;
- }
- SoftBusPermissionItem *pItem = CreatePermissionItem(NATIVE_APP, callingUid, callingPid, pkgName, actions);
- if (pItem == nullptr) {
- return SOFTBUS_MALLOC_ERR;
- }
- int32_t ret = CheckPermissionEntry(sessionName, pItem);
- SoftBusFree(pItem);
- if (ret >= SYSTEM_APP) {
- return SOFTBUS_OK;
- }
- return SOFTBUS_PERMISSION_DENIED;
+ // if (sessionName == nullptr || pkgName == nullptr) {
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
+ // SoftBusPermissionItem *pItem = CreatePermissionItem(NATIVE_APP, callingUid, callingPid, pkgName, actions);
+ // if (pItem == nullptr) {
+ // return SOFTBUS_MALLOC_ERR;
+ // }
+ // int32_t ret = CheckPermissionEntry(sessionName, pItem);
+ // SoftBusFree(pItem);
+ // if (ret >= SYSTEM_APP) {
+ // return SOFTBUS_OK;
+ // }
+ // return SOFTBUS_PERMISSION_DENIED;
+ return SOFTBUS_OK;
}
int32_t CheckTransSecLevel(const char *mySessionName, const char *peerSessionName)
{
- if (mySessionName == nullptr || peerSessionName == nullptr) {
- return SOFTBUS_INVALID_PARAM;
- }
- if (strcmp(mySessionName, peerSessionName) == 0) {
- return SOFTBUS_OK;
- }
- if (!PermIsSecLevelPublic(mySessionName)) {
- return SOFTBUS_PERMISSION_DENIED;
- }
- if (!PermIsSecLevelPublic(peerSessionName)) {
- return SOFTBUS_PERMISSION_DENIED;
- }
+ // if (mySessionName == nullptr || peerSessionName == nullptr) {
+ // return SOFTBUS_INVALID_PARAM;
+ // }
+ // if (strcmp(mySessionName, peerSessionName) == 0) {
+ // return SOFTBUS_OK;
+ // }
+ // if (!PermIsSecLevelPublic(mySessionName)) {
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
+ // if (!PermIsSecLevelPublic(peerSessionName)) {
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
return SOFTBUS_OK;
}
bool CheckDiscPermission(pid_t callingUid, const char *pkgName)
{
- std::string pkg = "";
- if (pkgName != nullptr) {
- pkg = std::string(pkgName);
- } else {
- return false;
- }
- if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) {
- return true;
- }
- return false;
+ // std::string pkg = "";
+ // if (pkgName != nullptr) {
+ // pkg = std::string(pkgName);
+ // } else {
+ // return false;
+ // }
+ // if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) {
+ // return true;
+ // }
+ // return false;
+ return 0;
}
bool CheckBusCenterPermission(pid_t callingUid, const char *pkgName)
{
- std::string pkg = "";
- if (pkgName != nullptr) {
- pkg = std::string(pkgName);
- } else {
- return false;
- }
- if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) {
- return true;
- }
- return false;
+ // std::string pkg = "";
+ // if (pkgName != nullptr) {
+ // pkg = std::string(pkgName);
+ // } else {
+ // return false;
+ // }
+ // if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) {
+ // return true;
+ // }
+ // return false;
+ return true;
}
int32_t GrantTransPermission(int32_t callingUid, int32_t callingPid, const char *sessionName)
{
- return AddDynamicPermission(callingUid, callingPid, sessionName);
+ // return AddDynamicPermission(callingUid, callingPid, sessionName);
+ return SOFTBUS_OK;
}
int32_t RemoveTransPermission(const char *sessionName)
@@ -130,19 +136,20 @@ int32_t RemoveTransPermission(const char *sessionName)
int32_t CheckDynamicPermission(void)
{
- uint32_t callingToken = OHOS::IPCSkeleton::GetCallingTokenID();
-
- auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(callingToken);
- if (tokenType != AccessToken::ATokenTypeEnum::TOKEN_NATIVE) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "not native call");
- return SOFTBUS_ERR;
- }
- AccessToken::NativeTokenInfo nativeTokenInfo;
- int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(callingToken, nativeTokenInfo);
- if (result == SOFTBUS_OK && nativeTokenInfo.processName == SAMGR_PROCESS_NAME) {
- return SOFTBUS_OK;
- }
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR,
- "check dynamic permission failed, processName:%{private}s", nativeTokenInfo.processName.c_str());
- return SOFTBUS_ERR;
+ // uint32_t callingToken = OHOS::IPCSkeleton::GetCallingTokenID();
+
+ // auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(callingToken);
+ // if (tokenType != AccessToken::ATokenTypeEnum::TOKEN_NATIVE) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "not native call");
+ // return SOFTBUS_ERR;
+ // }
+ // AccessToken::NativeTokenInfo nativeTokenInfo;
+ // int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(callingToken, nativeTokenInfo);
+ // if (result == SOFTBUS_OK && nativeTokenInfo.processName == SAMGR_PROCESS_NAME) {
+ // return SOFTBUS_OK;
+ // }
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR,
+ // "check dynamic permission failed, processName:%{private}s", nativeTokenInfo.processName.c_str());
+ // return SOFTBUS_ERR;
+ return SOFTBUS_OK;
}
diff --git a/core/connection/common/src/softbus_thread_pool.c b/core/connection/common/src/softbus_thread_pool.c
index 854cfbb6e..71dad9311 100644
--- a/core/connection/common/src/softbus_thread_pool.c
+++ b/core/connection/common/src/softbus_thread_pool.c
@@ -24,7 +24,8 @@
#include "softbus_log.h"
#ifndef MIN_STACK_SIZE
-#define MIN_STACK_SIZE 0x8000
+// #define MIN_STACK_SIZE 0x8000
+#define MIN_STACK_SIZE 0x200000
#endif
#define THREAD_POOL_NAME "SoftBusConnect"
diff --git a/core/frame/BUILD.gn b/core/frame/BUILD.gn
index ec37faeb9..ad2e1cc18 100644
--- a/core/frame/BUILD.gn
+++ b/core/frame/BUILD.gn
@@ -173,7 +173,7 @@ if (defined(ohos_lite)) {
sources = dsoftbus_server_common_src
sources += [
"$dsoftbus_root_path/sdk/frame/$os_type/src/if_softbus_client.cpp",
- "$os_type/client_manager/src/permission_status_change_cb.cpp",
+ # "$os_type/client_manager/src/permission_status_change_cb.cpp",
"$os_type/client_manager/src/softbus_client_info_manager.cpp",
"$os_type/init/src/if_softbus_server.cpp",
"$os_type/init/src/softbus_server.cpp",
@@ -195,8 +195,8 @@ if (defined(ohos_lite)) {
if (is_standard_system) {
external_deps = dsoftbus_server_common_external_deps
external_deps += [
- "access_token:libaccesstoken_sdk",
- "access_token:libprivacy_sdk",
+ # "access_token:libaccesstoken_sdk",
+ # "access_token:libprivacy_sdk",
"device_auth:deviceauth_sdk",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
diff --git a/core/frame/standard/client_manager/src/permission_status_change_cb.cpp b/core/frame/standard/client_manager/src/permission_status_change_cb.cpp
index 391f03f99..8d871c669 100644
--- a/core/frame/standard/client_manager/src/permission_status_change_cb.cpp
+++ b/core/frame/standard/client_manager/src/permission_status_change_cb.cpp
@@ -33,14 +33,14 @@ void PermissionStatusChangeCb::PermStateChangeCallback(PermStateChangeInfo& resu
void RegisterDataSyncPermission(const uint32_t callingTokenId,
const std::string permissionName, const std::string pkgName)
{
- PermStateChangeScope scopeInfo;
- scopeInfo.permList = {permissionName};
- scopeInfo.tokenIDs = {callingTokenId};
- std::shared_ptr<PermissionStatusChangeCb> callbackPtr_ =
- std::make_shared<PermissionStatusChangeCb>(scopeInfo, pkgName);
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "after tokenId:%{public}d register", callingTokenId);
- if (AccessTokenKit::RegisterPermStateChangeCallback(callbackPtr_) != SOFTBUS_OK) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "RegisterPermStateChangeCallback failed.");
- }
+ // PermStateChangeScope scopeInfo;
+ // scopeInfo.permList = {permissionName};
+ // scopeInfo.tokenIDs = {callingTokenId};
+ // std::shared_ptr<PermissionStatusChangeCb> callbackPtr_ =
+ // std::make_shared<PermissionStatusChangeCb>(scopeInfo, pkgName);
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "after tokenId:%{public}d register", callingTokenId);
+ // if (AccessTokenKit::RegisterPermStateChangeCallback(callbackPtr_) != SOFTBUS_OK) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "RegisterPermStateChangeCallback failed.");
+ // }
}
} // namespace OHOS
\ No newline at end of file
diff --git a/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp b/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp
index 6014d0ca8..2a6b07b1b 100644
--- a/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp
+++ b/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp
@@ -14,7 +14,8 @@
*/
#include "softbus_client_info_manager.h"
-#include "permission_status_change_cb.h"
+#include "ipc_skeleton.h"
+// #include "permission_status_change_cb.h"
#include "softbus_server.h"
#include "softbus_errcode.h"
#include "softbus_log.h"
@@ -36,9 +37,9 @@ int32_t SoftbusClientInfoManager::SoftbusAddService(const std::string &pkgName,
std::lock_guard<std::recursive_mutex> autoLock(clientObjectMapLock_);
std::pair<sptr<IRemoteObject>, sptr<IRemoteObject::DeathRecipient>> clientObject(object, abilityDeath);
clientObjectMap_.emplace(pkgName, clientObject);
- uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID();
- std::string permissionName = OHOS_PERMISSION_DISTRIBUTED_DATASYNC;
- RegisterDataSyncPermission(tokenCaller, permissionName, pkgName);
+ // uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID();
+ // std::string permissionName = OHOS_PERMISSION_DISTRIBUTED_DATASYNC;
+ // RegisterDataSyncPermission(tokenCaller, permissionName, pkgName);
return SOFTBUS_OK;
}
diff --git a/core/frame/standard/init/src/softbus_server_stub.cpp b/core/frame/standard/init/src/softbus_server_stub.cpp
index dd8bf9469..fc0058ee9 100644
--- a/core/frame/standard/init/src/softbus_server_stub.cpp
+++ b/core/frame/standard/init/src/softbus_server_stub.cpp
@@ -30,80 +30,81 @@
#include "softbus_server_frame.h"
#include "trans_channel_manager.h"
#include "trans_session_manager.h"
-#include "accesstoken_kit.h"
-#include "access_token.h"
-#include "privacy_kit.h"
+// #include "accesstoken_kit.h"
+// #include "access_token.h"
+// #include "privacy_kit.h"
#include "softbus_hisysevt_transreporter.h"
-using namespace OHOS::Security::AccessToken;
+// using namespace OHOS::Security::AccessToken;
namespace OHOS {
int32_t SoftBusServerStub::CheckOpenSessionPermission(const SessionParam *param)
{
- char pkgName[PKG_NAME_SIZE_MAX] = {0};
- if ((param == NULL) ||
- (TransGetPkgNameBySessionName(param->sessionName, pkgName, PKG_NAME_SIZE_MAX) != SOFTBUS_OK)) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession TransGetPkgNameBySessionName failed");
- return SOFTBUS_INVALID_PARAM;
- }
-
- pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid();
- pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid();
- if (CheckTransPermission(callingUid, callingPid, pkgName, param->sessionName, ACTION_OPEN) != SOFTBUS_OK) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession no permission");
- return SOFTBUS_PERMISSION_DENIED;
- }
-
- if (CheckTransSecLevel(param->sessionName, param->peerSessionName) != SOFTBUS_OK) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession sec level invalid");
- return SOFTBUS_PERMISSION_DENIED;
- }
+ // char pkgName[PKG_NAME_SIZE_MAX] = {0};
+ // if ((param == NULL) ||
+ // (TransGetPkgNameBySessionName(param->sessionName, pkgName, PKG_NAME_SIZE_MAX) != SOFTBUS_OK)) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession TransGetPkgNameBySessionName failed");
+ // return SOFTBUS_INVALID_PARAM;
+ // }
+
+ // pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid();
+ // pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid();
+ // if (CheckTransPermission(callingUid, callingPid, pkgName, param->sessionName, ACTION_OPEN) != SOFTBUS_OK) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession no permission");
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
+
+ // if (CheckTransSecLevel(param->sessionName, param->peerSessionName) != SOFTBUS_OK) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession sec level invalid");
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
return SOFTBUS_OK;
}
int32_t SoftBusServerStub::CheckChannelPermission(int32_t channelId, int32_t channelType)
{
- char pkgName[PKG_NAME_SIZE_MAX] = {0};
- char sessionName[SESSION_NAME_SIZE_MAX] = {0};
- int32_t ret = SOFTBUS_OK;
- TransInfo info;
- info.channelId = channelId;
- info.channelType = channelType;
- ret = TransGetNameByChanId(&info, pkgName, sessionName, PKG_NAME_SIZE_MAX, SESSION_NAME_SIZE_MAX);
- if (ret != SOFTBUS_OK) {
- SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "ServerCloseChannel invalid channel info");
- return ret;
- }
-
- pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid();
- pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid();
- if (CheckTransPermission(callingUid, callingPid, pkgName, sessionName, ACTION_OPEN) != SOFTBUS_OK) {
- return SOFTBUS_PERMISSION_DENIED;
- }
+ // char pkgName[PKG_NAME_SIZE_MAX] = {0};
+ // char sessionName[SESSION_NAME_SIZE_MAX] = {0};
+ // int32_t ret = SOFTBUS_OK;
+ // TransInfo info;
+ // info.channelId = channelId;
+ // info.channelType = channelType;
+ // ret = TransGetNameByChanId(&info, pkgName, sessionName, PKG_NAME_SIZE_MAX, SESSION_NAME_SIZE_MAX);
+ // if (ret != SOFTBUS_OK) {
+ // SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "ServerCloseChannel invalid channel info");
+ // return ret;
+ // }
+
+ // pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid();
+ // pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid();
+ // if (CheckTransPermission(callingUid, callingPid, pkgName, sessionName, ACTION_OPEN) != SOFTBUS_OK) {
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
return SOFTBUS_OK;
}
-static inline int32_t CheckAndRecordAccessToken(const char* permission)
-{
- uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID();
- int32_t ret = AccessTokenKit::VerifyAccessToken(tokenCaller, permission);
-
- ATokenTypeEnum type = AccessTokenKit::GetTokenTypeFlag(tokenCaller);
- int32_t successCnt = (int32_t)(ret == PERMISSION_GRANTED);
- int32_t failCnt = 1 - successCnt;
- if (type == TOKEN_HAP) {
- PrivacyKit::AddPermissionUsedRecord(tokenCaller, permission, successCnt, failCnt);
- }
+// static inline int32_t CheckAndRecordAccessToken(const char* permission)
+// {
+ // uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID();
+ // int32_t ret = AccessTokenKit::VerifyAccessToken(tokenCaller, permission);
+
+ // ATokenTypeEnum type = AccessTokenKit::GetTokenTypeFlag(tokenCaller);
+ // int32_t successCnt = (int32_t)(ret == PERMISSION_GRANTED);
+ // int32_t failCnt = 1 - successCnt;
+ // if (type == TOKEN_HAP) {
+ // PrivacyKit::AddPermissionUsedRecord(tokenCaller, permission, successCnt, failCnt);
+ // }
- return ret;
-}
+ // return ret;
+ // return SOFTBUS_OK;
+// }
-static inline void SoftbusReportPermissionFaultEvt(uint32_t ipcCode)
-{
- if (ipcCode == SERVER_OPEN_SESSION) {
- SoftbusReportTransErrorEvt(SOFTBUS_ACCESS_TOKEN_DENIED);
- }
-}
+// static inline void SoftbusReportPermissionFaultEvt(uint32_t ipcCode)
+// {
+// if (ipcCode == SERVER_OPEN_SESSION) {
+// SoftbusReportTransErrorEvt(SOFTBUS_ACCESS_TOKEN_DENIED);
+// }
+// }
SoftBusServerStub::SoftBusServerStub()
{
@@ -205,16 +206,16 @@ int32_t SoftBusServerStub::OnRemoteRequest(uint32_t code,
return SOFTBUS_ERR;
}
- auto itPerm = memberPermissionMap_.find(code);
- if (itPerm != memberPermissionMap_.end()) {
- const char *permission = itPerm->second;
- if ((permission != nullptr) &&
- (CheckAndRecordAccessToken(permission) != PERMISSION_GRANTED)) {
- SoftbusReportPermissionFaultEvt(code);
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "access token permission %s denied!", permission);
- return SOFTBUS_ACCESS_TOKEN_DENIED;
- }
- }
+ // auto itPerm = memberPermissionMap_.find(code);
+ // if (itPerm != memberPermissionMap_.end()) {
+ // const char *permission = itPerm->second;
+ // if ((permission != nullptr) &&
+ // (CheckAndRecordAccessToken(permission) != PERMISSION_GRANTED)) {
+ // SoftbusReportPermissionFaultEvt(code);
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "access token permission %s denied!", permission);
+ // return SOFTBUS_ACCESS_TOKEN_DENIED;
+ // }
+ // }
auto itFunc = memberFuncMap_.find(code);
if (itFunc != memberFuncMap_.end()) {
--
2.33.0

View File

@ -0,0 +1,280 @@
From 67bd1bcc2fd1570850ec5c5aee18c282712267dc Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 20 Jun 2023 17:05:46 +0800
Subject: [PATCH] remove dependency and adpat for build
---
frameworks/eventhandler/BUILD.gn | 2 +-
.../include/event_handler_utils.h | 38 ++++++++--------
frameworks/eventhandler/src/event_handler.cpp | 44 +++++++++----------
frameworks/eventhandler/src/inner_event.cpp | 44 +++++++++----------
interfaces/inner_api/event_queue.h | 1 +
interfaces/inner_api/inner_event.h | 6 +--
6 files changed, 68 insertions(+), 67 deletions(-)
diff --git a/frameworks/eventhandler/BUILD.gn b/frameworks/eventhandler/BUILD.gn
index ceed950..7342337 100644
--- a/frameworks/eventhandler/BUILD.gn
+++ b/frameworks/eventhandler/BUILD.gn
@@ -37,7 +37,7 @@ ohos_shared_library("libeventhandler") {
public_configs = [ ":public_libeventhandler_config" ]
external_deps = [
- "hitrace_native:libhitracechain",
+ # "hitrace_native:libhitracechain",
"hiviewdfx_hilog_native:libhilog",
]
diff --git a/frameworks/eventhandler/include/event_handler_utils.h b/frameworks/eventhandler/include/event_handler_utils.h
index 72fbdac..37e862f 100644
--- a/frameworks/eventhandler/include/event_handler_utils.h
+++ b/frameworks/eventhandler/include/event_handler_utils.h
@@ -22,7 +22,7 @@
#include <string>
#include "hilog/log.h"
-#include "hitrace/trace.h"
+// #include "hitrace/trace.h"
#include "inner_event.h"
#define DEFINE_HILOG_LABEL(name) \
@@ -66,30 +66,30 @@ static inline int32_t NanosecondsToTimeout(int64_t nanoseconds)
return (milliseconds > INT32_MAX) ? INT32_MAX : static_cast<int32_t>(milliseconds);
}
-using HiTraceChain = OHOS::HiviewDFX::HiTraceChain;
+// using HiTraceChain = OHOS::HiviewDFX::HiTraceChain;
static inline bool AllowHiTraceOutPut(const std::shared_ptr<HiTraceId>& traceId, bool isSyncEvent)
{
- if ((!traceId) || (!traceId->IsValid())) {
- return false;
- }
- if ((!isSyncEvent) && (!traceId->IsFlagEnabled(HITRACE_FLAG_INCLUDE_ASYNC))) {
- return false;
- }
+ // if ((!traceId) || (!traceId->IsValid())) {
+ // return false;
+ // }
+ // if ((!isSyncEvent) && (!traceId->IsFlagEnabled(HITRACE_FLAG_INCLUDE_ASYNC))) {
+ // return false;
+ // }
return true;
}
-static inline void HiTracePointerOutPut(const std::shared_ptr<HiTraceId>& spanId,
- const InnerEvent::Pointer& event, const char* action, HiTraceTracepointType type)
-{
- if (!event->HasTask()) {
- HiTraceChain::Tracepoint(type, *spanId, "%s event, event id: %d", action, event->GetInnerEventId());
- } else if (!event->GetTaskName().empty()) {
- HiTraceChain::Tracepoint(type, *spanId, "%s task with name, name: %s", action, event->GetTaskName().c_str());
- } else {
- HiTraceChain::Tracepoint(type, *spanId, "%s UnNamed Task", action);
- }
-}
+// static inline void HiTracePointerOutPut(const std::shared_ptr<HiTraceId>& spanId,
+// const InnerEvent::Pointer& event, const char* action, HiTraceTracepointType type)
+// {
+// if (!event->HasTask()) {
+// HiTraceChain::Tracepoint(type, *spanId, "%s event, event id: %d", action, event->GetInnerEventId());
+// } else if (!event->GetTaskName().empty()) {
+// HiTraceChain::Tracepoint(type, *spanId, "%s task with name, name: %s", action, event->GetTaskName().c_str());
+// } else {
+// HiTraceChain::Tracepoint(type, *spanId, "%s UnNamed Task", action);
+// }
+// }
static inline void GetLastErr(char *errmsg, size_t size = MAX_ERRORMSG_LEN)
{
diff --git a/frameworks/eventhandler/src/event_handler.cpp b/frameworks/eventhandler/src/event_handler.cpp
index ab6e876..8477424 100644
--- a/frameworks/eventhandler/src/event_handler.cpp
+++ b/frameworks/eventhandler/src/event_handler.cpp
@@ -74,11 +74,11 @@ bool EventHandler::SendEvent(InnerEvent::Pointer &event, int64_t delayTime, Prio
event->SetOwner(shared_from_this());
// get traceId from event, if HiTraceChain::begin has been called, would get a valid trace id.
- auto traceId = event->GetOrCreateTraceId();
+ // auto traceId = event->GetOrCreateTraceId();
// if traceId is valid, out put trace information
- if (AllowHiTraceOutPut(traceId, event->HasWaiter())) {
- HiTracePointerOutPut(traceId, event, "Send", HiTraceTracepointType::HITRACE_TP_CS);
- }
+ // if (AllowHiTraceOutPut(traceId, event->HasWaiter())) {
+ // HiTracePointerOutPut(traceId, event, "Send", HiTraceTracepointType::HITRACE_TP_CS);
+ // }
eventRunner_->GetEventQueue()->Insert(event, priority);
return true;
@@ -117,7 +117,7 @@ bool EventHandler::SendSyncEvent(InnerEvent::Pointer &event, Priority priority)
}
// get traceId from event, if HiTraceChain::begin has been called, would get a valid trace id.
- auto spanId = event->GetOrCreateTraceId();
+ // auto spanId = event->GetOrCreateTraceId();
// Create waiter, used to block.
auto waiter = event->CreateWaiter();
@@ -128,9 +128,9 @@ bool EventHandler::SendSyncEvent(InnerEvent::Pointer &event, Priority priority)
// Wait until event is processed(recycled).
waiter->Wait();
- if ((spanId) && (spanId->IsValid())) {
- HiTraceChain::Tracepoint(HiTraceTracepointType::HITRACE_TP_CR, *spanId, "event is processed");
- }
+ // if ((spanId) && (spanId->IsValid())) {
+ // HiTraceChain::Tracepoint(HiTraceTracepointType::HITRACE_TP_CR, *spanId, "event is processed");
+ // }
return true;
}
@@ -305,13 +305,13 @@ void EventHandler::DistributeEvent(const InnerEvent::Pointer &event)
currentEventHandler = shared_from_this();
- auto spanId = event->GetTraceId();
- auto traceId = HiTraceChain::GetId();
- bool allowTraceOutPut = AllowHiTraceOutPut(spanId, event->HasWaiter());
- if (allowTraceOutPut) {
- HiTraceChain::SetId(*spanId);
- HiTracePointerOutPut(spanId, event, "Receive", HiTraceTracepointType::HITRACE_TP_SR);
- }
+ // auto spanId = event->GetTraceId();
+ // auto traceId = HiTraceChain::GetId();
+ // bool allowTraceOutPut = AllowHiTraceOutPut(spanId, event->HasWaiter());
+ // if (allowTraceOutPut) {
+ // HiTraceChain::SetId(*spanId);
+ // HiTracePointerOutPut(spanId, event, "Receive", HiTraceTracepointType::HITRACE_TP_SR);
+ // }
InnerEvent::TimePoint nowStart = InnerEvent::Clock::now();
DeliveryTimeAction(event, nowStart);
@@ -326,13 +326,13 @@ void EventHandler::DistributeEvent(const InnerEvent::Pointer &event)
DistributeTimeAction(event, nowStart);
- if (allowTraceOutPut) {
- HiTraceChain::Tracepoint(HiTraceTracepointType::HITRACE_TP_SS, *spanId, "Event Distribute over");
- HiTraceChain::ClearId();
- if (traceId.IsValid()) {
- HiTraceChain::SetId(traceId);
- }
- }
+ // if (allowTraceOutPut) {
+ // HiTraceChain::Tracepoint(HiTraceTracepointType::HITRACE_TP_SS, *spanId, "Event Distribute over");
+ // HiTraceChain::ClearId();
+ // if (traceId.IsValid()) {
+ // HiTraceChain::SetId(traceId);
+ // }
+ // }
}
void EventHandler::Dump(Dumper &dumper)
diff --git a/frameworks/eventhandler/src/inner_event.cpp b/frameworks/eventhandler/src/inner_event.cpp
index 654b44e..90e0c49 100644
--- a/frameworks/eventhandler/src/inner_event.cpp
+++ b/frameworks/eventhandler/src/inner_event.cpp
@@ -209,9 +209,9 @@ void InnerEvent::ClearEvent()
}
}
- if (hiTraceId_) {
- hiTraceId_.reset();
- }
+ // if (hiTraceId_) {
+ // hiTraceId_.reset();
+ // }
// Clear owner
owner_.reset();
@@ -233,25 +233,25 @@ bool InnerEvent::HasWaiter() const
return (waiter_ != nullptr);
}
-const std::shared_ptr<HiTraceId> InnerEvent::GetOrCreateTraceId()
-{
- if (hiTraceId_) {
- return hiTraceId_;
- }
-
- auto traceId = HiTraceChain::GetId();
- if (!traceId.IsValid()) {
- return nullptr;
- }
-
- hiTraceId_ = std::make_shared<HiTraceId>(HiTraceChain::CreateSpan());
- return hiTraceId_;
-}
-
-const std::shared_ptr<HiTraceId> InnerEvent::GetTraceId()
-{
- return hiTraceId_;
-}
+// const std::shared_ptr<HiTraceId> InnerEvent::GetOrCreateTraceId()
+// {
+ // if (hiTraceId_) {
+ // return hiTraceId_;
+ // }
+
+ // auto traceId = HiTraceChain::GetId();
+ // if (!traceId.IsValid()) {
+ // return nullptr;
+ // }
+
+ // hiTraceId_ = std::make_shared<HiTraceId>(HiTraceChain::CreateSpan());
+ // return hiTraceId_;
+// }
+
+// const std::shared_ptr<HiTraceId> InnerEvent::GetTraceId()
+// {
+// // return hiTraceId_;
+// }
std::string InnerEvent::Dump()
{
diff --git a/interfaces/inner_api/event_queue.h b/interfaces/inner_api/event_queue.h
index 1b4d82c..e98500d 100644
--- a/interfaces/inner_api/event_queue.h
+++ b/interfaces/inner_api/event_queue.h
@@ -20,6 +20,7 @@
#include <list>
#include <map>
#include <mutex>
+#include <atomic>
#include "inner_event.h"
#include "event_handler_errors.h"
diff --git a/interfaces/inner_api/inner_event.h b/interfaces/inner_api/inner_event.h
index b8fb32c..1bedc46 100644
--- a/interfaces/inner_api/inner_event.h
+++ b/interfaces/inner_api/inner_event.h
@@ -437,14 +437,14 @@ private:
*
* @return return hiTrace Id.
*/
- const std::shared_ptr<HiTraceId> GetOrCreateTraceId();
+ // const std::shared_ptr<HiTraceId> GetOrCreateTraceId();
/**
* return trace id.
*
* @return return hiTrace Id.
*/
- const std::shared_ptr<HiTraceId> GetTraceId();
+ // const std::shared_ptr<HiTraceId> GetTraceId();
/*
* Calculate the type id for different smart pointers.
@@ -522,7 +522,7 @@ private:
std::shared_ptr<Waiter> waiter_;
// use to store hitrace Id
- std::shared_ptr<HiTraceId> hiTraceId_;
+ // std::shared_ptr<HiTraceId> hiTraceId_;
};
} // namespace AppExecFwk
} // namespace OHOS
--
2.33.0

View File

@ -0,0 +1,699 @@
From 69d852f1b2e243188e06d6462343dc0ed06f772d Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 20 Jun 2023 17:19:42 +0800
Subject: [PATCH] remove dependency and adapt for build
---
interfaces/innerkits/ipc_core/BUILD.gn | 4 +-
.../ipc_core/include/iremote_broker.h | 1 +
.../ipc_core/include/message_parcel.h | 1 +
interfaces/innerkits/ipc_single/BUILD.gn | 2 +-
.../access_token/src/access_token_adapter.c | 2 +-
.../src/core/source/ipc_object_proxy.cpp | 2 +-
.../src/core/source/ipc_object_stub.cpp | 76 ++++---
ipc/native/src/core/source/iremote_broker.cpp | 2 +-
.../src/mock/include/dbinder_base_invoker.h | 12 +-
ipc/native/src/mock/include/hitrace_invoker.h | 18 +-
ipc/native/src/mock/include/invoker_factory.h | 1 +
.../src/mock/source/binder_connector.cpp | 2 +-
ipc/native/src/mock/source/binder_invoker.cpp | 12 +-
.../src/mock/source/hitrace_invoker.cpp | 212 +++++++++---------
.../src/mock/source/invoker_factory.cpp | 2 +-
.../src/napi/src/napi_remote_object.cpp | 2 +-
ipc/native/src/napi/src/napi_remote_proxy.cpp | 2 +-
.../unittest/common/ipc_hitrace_unittest.cpp | 2 +-
.../include/dbinder_test_service_skeleton.h | 2 +-
19 files changed, 181 insertions(+), 176 deletions(-)
diff --git a/interfaces/innerkits/ipc_core/BUILD.gn b/interfaces/innerkits/ipc_core/BUILD.gn
index cb35083..3c4d57b 100644
--- a/interfaces/innerkits/ipc_core/BUILD.gn
+++ b/interfaces/innerkits/ipc_core/BUILD.gn
@@ -71,10 +71,10 @@ ohos_shared_library("ipc_core") {
all_dependent_configs = [ ":ipc_all_deps_config" ]
external_deps = [
- "access_token:libaccesstoken_sdk",
+ # "access_token:libaccesstoken_sdk",
"c_utils:utils",
"dsoftbus:softbus_client",
- "hitrace_native:libhitracechain",
+ # "hitrace_native:libhitracechain",
"hiviewdfx_hilog_native:libhilog",
]
diff --git a/interfaces/innerkits/ipc_core/include/iremote_broker.h b/interfaces/innerkits/ipc_core/include/iremote_broker.h
index ed2045c..7105ff7 100644
--- a/interfaces/innerkits/ipc_core/include/iremote_broker.h
+++ b/interfaces/innerkits/ipc_core/include/iremote_broker.h
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <functional>
+#include <mutex>
#include "iremote_object.h"
#include "refbase.h"
diff --git a/interfaces/innerkits/ipc_core/include/message_parcel.h b/interfaces/innerkits/ipc_core/include/message_parcel.h
index 0f3302e..efa57ab 100644
--- a/interfaces/innerkits/ipc_core/include/message_parcel.h
+++ b/interfaces/innerkits/ipc_core/include/message_parcel.h
@@ -20,6 +20,7 @@
#include "parcel.h"
#include "refbase.h"
#include <string>
+#include <memory>
namespace OHOS {
class IRemoteObject;
diff --git a/interfaces/innerkits/ipc_single/BUILD.gn b/interfaces/innerkits/ipc_single/BUILD.gn
index de33cdb..f61f26c 100644
--- a/interfaces/innerkits/ipc_single/BUILD.gn
+++ b/interfaces/innerkits/ipc_single/BUILD.gn
@@ -59,7 +59,7 @@ ohos_shared_library("ipc_single") {
external_deps = [
"c_utils:utils",
- "hitrace_native:libhitracechain",
+ # "hitrace_native:libhitracechain",
"hiviewdfx_hilog_native:libhilog",
]
diff --git a/ipc/native/c/adapter/access_token/src/access_token_adapter.c b/ipc/native/c/adapter/access_token/src/access_token_adapter.c
index c25aa57..396cee4 100644
--- a/ipc/native/c/adapter/access_token/src/access_token_adapter.c
+++ b/ipc/native/c/adapter/access_token/src/access_token_adapter.c
@@ -19,7 +19,7 @@
#include <sys/ioctl.h>
#include <unistd.h>
-#include "bits/ioctl.h"
+// #include "bits/ioctl.h"
#define ACCESS_TOKEN_ID_IOCTL_BASE 'A'
diff --git a/ipc/native/src/core/source/ipc_object_proxy.cpp b/ipc/native/src/core/source/ipc_object_proxy.cpp
index 559c276..23f56a8 100644
--- a/ipc/native/src/core/source/ipc_object_proxy.cpp
+++ b/ipc/native/src/core/source/ipc_object_proxy.cpp
@@ -17,7 +17,7 @@
#include <cstdint>
-#include "__mutex_base"
+// #include "__mutex_base"
#include "algorithm"
#include "errors.h"
#include "hilog/log_c.h"
diff --git a/ipc/native/src/core/source/ipc_object_stub.cpp b/ipc/native/src/core/source/ipc_object_stub.cpp
index 28df2cd..781d600 100644
--- a/ipc/native/src/core/source/ipc_object_stub.cpp
+++ b/ipc/native/src/core/source/ipc_object_stub.cpp
@@ -39,8 +39,8 @@
#include "vector"
#ifndef CONFIG_IPC_SINGLE
-#include "accesstoken_kit.h"
-#include "access_token_adapter.h"
+// #include "accesstoken_kit.h"
+// #include "access_token_adapter.h"
#include "dbinder_databus_invoker.h"
#include "dbinder_error_code.h"
#include "rpc_feature_set.h"
@@ -56,10 +56,10 @@ static constexpr int HIDUMPER_SERVICE_UID = 1212;
using namespace OHOS::HiviewDFX;
static constexpr HiLogLabel LABEL = { LOG_CORE, LOG_ID_IPC, "IPCObjectStub" };
#ifndef CONFIG_IPC_SINGLE
-using namespace OHOS::Security;
+// using namespace OHOS::Security;
// Authentication information can be added only for processes with system permission.
static constexpr pid_t ALLOWED_UID = 10000;
-static constexpr int APL_BASIC = 2;
+// static constexpr int APL_BASIC = 2;
// Only the samgr can obtain the UID and PID.
static const std::string SAMGR_PROCESS_NAME = "samgr";
#endif
@@ -259,7 +259,7 @@ int IPCObjectStub::SendRequest(uint32_t code, MessageParcel &data, MessageParcel
break;
}
case GRANT_DATABUS_NAME: {
- if (!IPCSkeleton::IsLocalCalling() || !IsSamgrCall((uint32_t)RpcGetSelfTokenID())) {
+ if (!IPCSkeleton::IsLocalCalling() || !IsSamgrCall((uint32_t)0)) {
ZLOGE(LABEL, "GRANT_DATABUS_NAME message is excluded in sa manager");
result = IPC_STUB_INVALID_DATA_ERR;
break;
@@ -268,7 +268,7 @@ int IPCObjectStub::SendRequest(uint32_t code, MessageParcel &data, MessageParcel
break;
}
case TRANS_DATABUS_NAME: {
- if (!IPCSkeleton::IsLocalCalling() || !IsSamgrCall((uint32_t)RpcGetSelfTokenID())) {
+ if (!IPCSkeleton::IsLocalCalling() || !IsSamgrCall((uint32_t)0)) {
ZLOGE(LABEL, "TRANS_DATABUS_NAME message is excluded in sa manager");
result = IPC_STUB_INVALID_DATA_ERR;
break;
@@ -611,41 +611,43 @@ std::string IPCObjectStub::CreateDatabusName(int uid, int pid, int systemAbility
bool IPCObjectStub::IsSamgrCall(uint32_t accessToken)
{
- auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(accessToken);
- if (tokenType != AccessToken::ATokenTypeEnum::TOKEN_NATIVE) {
- ZLOGE(LABEL, "not native call");
- return false;
- }
- AccessToken::NativeTokenInfo nativeTokenInfo;
- int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(accessToken, nativeTokenInfo);
- if (result == ERR_NONE && nativeTokenInfo.processName == SAMGR_PROCESS_NAME) {
- return true;
- }
- ZLOGE(LABEL, "not samgr called, processName:%{private}s", nativeTokenInfo.processName.c_str());
- return false;
+ // auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(accessToken);
+ // if (tokenType != AccessToken::ATokenTypeEnum::TOKEN_NATIVE) {
+ // ZLOGE(LABEL, "not native call");
+ // return false;
+ // }
+ // AccessToken::NativeTokenInfo nativeTokenInfo;
+ // int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(accessToken, nativeTokenInfo);
+ // if (result == ERR_NONE && nativeTokenInfo.processName == SAMGR_PROCESS_NAME) {
+ // return true;
+ // }
+ // ZLOGE(LABEL, "not samgr called, processName:%{private}s", nativeTokenInfo.processName.c_str());
+ // return false;
+ return true;
}
bool IPCObjectStub::HasDumpPermission(uint32_t accessToken) const
{
- int res = AccessToken::AccessTokenKit::VerifyAccessToken(accessToken, "ohos.permission.DUMP");
- if (res == AccessToken::PermissionState::PERMISSION_GRANTED) {
- return true;
- }
- bool ret = false;
- auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(accessToken);
- if (tokenType == AccessToken::ATokenTypeEnum::TOKEN_NATIVE) {
- AccessToken::NativeTokenInfo nativeTokenInfo;
- int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(accessToken, nativeTokenInfo);
- ret = (result == ERR_NONE && nativeTokenInfo.apl >= APL_BASIC);
- } else if (tokenType == AccessToken::ATokenTypeEnum::TOKEN_HAP) {
- AccessToken::HapTokenInfo hapTokenInfo;
- int32_t result = AccessToken::AccessTokenKit::GetHapTokenInfo(accessToken, hapTokenInfo);
- ret = (result == ERR_NONE && hapTokenInfo.apl >= APL_BASIC);
- }
- if (!ret) {
- ZLOGD(LABEL, "No dump permission, please check!");
- }
- return ret;
+ // int res = AccessToken::AccessTokenKit::VerifyAccessToken(accessToken, "ohos.permission.DUMP");
+ // if (res == AccessToken::PermissionState::PERMISSION_GRANTED) {
+ // return true;
+ // }
+ // bool ret = false;
+ // auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(accessToken);
+ // if (tokenType == AccessToken::ATokenTypeEnum::TOKEN_NATIVE) {
+ // AccessToken::NativeTokenInfo nativeTokenInfo;
+ // int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(accessToken, nativeTokenInfo);
+ // ret = (result == ERR_NONE && nativeTokenInfo.apl >= APL_BASIC);
+ // } else if (tokenType == AccessToken::ATokenTypeEnum::TOKEN_HAP) {
+ // AccessToken::HapTokenInfo hapTokenInfo;
+ // int32_t result = AccessToken::AccessTokenKit::GetHapTokenInfo(accessToken, hapTokenInfo);
+ // ret = (result == ERR_NONE && hapTokenInfo.apl >= APL_BASIC);
+ // }
+ // if (!ret) {
+ // ZLOGD(LABEL, "No dump permission, please check!");
+ // }
+ // return ret;
+ return true;
}
#endif
} // namespace OHOS
diff --git a/ipc/native/src/core/source/iremote_broker.cpp b/ipc/native/src/core/source/iremote_broker.cpp
index dcbb59c..12f498e 100644
--- a/ipc/native/src/core/source/iremote_broker.cpp
+++ b/ipc/native/src/core/source/iremote_broker.cpp
@@ -17,7 +17,7 @@
#include <utility>
-#include "__mutex_base"
+// #include "__mutex_base"
#include "functional"
#include "hilog/log_c.h"
#include "hilog/log_cpp.h"
diff --git a/ipc/native/src/mock/include/dbinder_base_invoker.h b/ipc/native/src/mock/include/dbinder_base_invoker.h
index ca7fd8e..7d40e7d 100644
--- a/ipc/native/src/mock/include/dbinder_base_invoker.h
+++ b/ipc/native/src/mock/include/dbinder_base_invoker.h
@@ -701,9 +701,9 @@ int DBinderBaseInvoker<T>::SendRequest(int32_t handle, uint32_t code, MessagePar
int userWaitTime = option.GetWaitTime();
MessageParcel &newData = const_cast<MessageParcel &>(data);
size_t oldWritePosition = newData.GetWritePosition();
- HiTraceId traceId = HiTraceChain::GetId();
+ // HiTraceId traceId = HiTraceChain::GetId();
// set client send trace point if trace is enabled
- HiTraceId childId = HitraceInvoker::TraceClientSend(handle, code, newData, flags, traceId);
+ // HiTraceId childId = HitraceInvoker::TraceClientSend(handle, code, newData, flags, traceId);
std::shared_ptr<T> session = WriteTransaction(BC_TRANSACTION, flags, handle, 0, code, data, seqNumber, 0);
if (session == nullptr) {
newData.RewindWrite(oldWritePosition);
@@ -720,7 +720,7 @@ int DBinderBaseInvoker<T>::SendRequest(int32_t handle, uint32_t code, MessagePar
} else {
ret = SendOrWaitForCompletion(userWaitTime, seqNumber, session, &reply);
}
- HitraceInvoker::TraceClientReceieve(handle, code, flags, traceId, childId);
+ // HitraceInvoker::TraceClientReceieve(handle, code, flags, traceId, childId);
// restore Parcel data
newData.RewindWrite(oldWritePosition);
return ret;
@@ -865,8 +865,8 @@ template <class T> void DBinderBaseInvoker<T>::ProcessTransaction(dbinder_transa
data.InjectOffsets(reinterpret_cast<binder_uintptr_t>(reinterpret_cast<char *>(tr->buffer) + tr->offsets),
tr->offsets_size / sizeof(binder_size_t));
}
- uint32_t &newflags = const_cast<uint32_t &>(tr->flags);
- int isServerTraced = HitraceInvoker::TraceServerReceieve(tr->cookie, tr->code, data, newflags);
+ // uint32_t &newflags = const_cast<uint32_t &>(tr->flags);
+ // int isServerTraced = HitraceInvoker::TraceServerReceieve(tr->cookie, tr->code, data, newflags);
const pid_t oldPid = GetCallerPid();
const auto oldUid = static_cast<const uid_t>(GetCallerUid());
@@ -918,7 +918,7 @@ template <class T> void DBinderBaseInvoker<T>::ProcessTransaction(dbinder_transa
ZLOGE(LOG_LABEL, "delete raw data in process skeleton");
current->DetachRawData(listenFd);
}
- HitraceInvoker::TraceServerSend(tr->cookie, tr->code, isServerTraced, newflags);
+ // HitraceInvoker::TraceServerSend(tr->cookie, tr->code, isServerTraced, newflags);
if (!(flags & MessageOption::TF_ASYNC)) {
SetClientFd(listenFd);
SetSeqNum(senderSeqNumber);
diff --git a/ipc/native/src/mock/include/hitrace_invoker.h b/ipc/native/src/mock/include/hitrace_invoker.h
index 7da8029..785a1d2 100644
--- a/ipc/native/src/mock/include/hitrace_invoker.h
+++ b/ipc/native/src/mock/include/hitrace_invoker.h
@@ -16,24 +16,24 @@
#ifndef OHOS_IPC_HITRACE_INVOKER_H
#define OHOS_IPC_HITRACE_INVOKER_H
-#include "hitrace/trace.h"
+// #include "hitrace/trace.h"
#include "iremote_object.h"
namespace OHOS {
class HitraceInvoker {
public:
- static bool IsClientTraced(int32_t handle, uint32_t flags, const HiviewDFX::HiTraceId &traceId);
+ // static bool IsClientTraced(int32_t handle, uint32_t flags, const HiviewDFX::HiTraceId &traceId);
- static HiviewDFX::HiTraceId TraceClientSend(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags,
- const HiviewDFX::HiTraceId &traceId);
+ // static HiviewDFX::HiTraceId TraceClientSend(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags,
+ // const HiviewDFX::HiTraceId &traceId);
- static void TraceClientReceieve(int32_t handle, uint32_t code, uint32_t flags, const HiviewDFX::HiTraceId &traceId,
- const HiviewDFX::HiTraceId &childId);
+ // static void TraceClientReceieve(int32_t handle, uint32_t code, uint32_t flags, const HiviewDFX::HiTraceId &traceId,
+ // const HiviewDFX::HiTraceId &childId);
- static void RecoveryDataAndFlag(Parcel &data, uint32_t &flags, size_t oldReadPosition, uint8_t idLen);
+ // static void RecoveryDataAndFlag(Parcel &data, uint32_t &flags, size_t oldReadPosition, uint8_t idLen);
- static bool TraceServerReceieve(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags);
+ // static bool TraceServerReceieve(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags);
- static void TraceServerSend(int32_t handle, uint32_t code, bool isServerTraced, uint32_t flags);
+ // static void TraceServerSend(int32_t handle, uint32_t code, bool isServerTraced, uint32_t flags);
private:
static const int PADDED_SIZE_OF_PARCEL = 4;
diff --git a/ipc/native/src/mock/include/invoker_factory.h b/ipc/native/src/mock/include/invoker_factory.h
index 14bd25f..83086c5 100644
--- a/ipc/native/src/mock/include/invoker_factory.h
+++ b/ipc/native/src/mock/include/invoker_factory.h
@@ -17,6 +17,7 @@
#define OHOS_IPC_INVOKER_FACTORY_H
#include <functional>
+#include <mutex>
#include <unordered_map>
#include "iremote_invoker.h"
diff --git a/ipc/native/src/mock/source/binder_connector.cpp b/ipc/native/src/mock/source/binder_connector.cpp
index a262de6..733769d 100644
--- a/ipc/native/src/mock/source/binder_connector.cpp
+++ b/ipc/native/src/mock/source/binder_connector.cpp
@@ -21,7 +21,7 @@
#include <sys/mman.h>
#include <unistd.h>
-#include "__mutex_base"
+// #include "__mutex_base"
#include "cerrno"
#include "hilog/log_c.h"
#include "hilog/log_cpp.h"
diff --git a/ipc/native/src/mock/source/binder_invoker.cpp b/ipc/native/src/mock/source/binder_invoker.cpp
index 9ce6b59..946940c 100644
--- a/ipc/native/src/mock/source/binder_invoker.cpp
+++ b/ipc/native/src/mock/source/binder_invoker.cpp
@@ -96,9 +96,9 @@ int BinderInvoker::SendRequest(int handle, uint32_t code, MessageParcel &data, M
uint32_t flags = (uint32_t)option.GetFlags();
MessageParcel &newData = const_cast<MessageParcel &>(data);
size_t oldWritePosition = newData.GetWritePosition();
- HiTraceId traceId = HiTraceChain::GetId();
+ // HiTraceId traceId = HiTraceChain::GetId();
// set client send trace point if trace is enabled
- HiTraceId childId = HitraceInvoker::TraceClientSend(handle, code, newData, flags, traceId);
+ // HiTraceId childId = HitraceInvoker::TraceClientSend(handle, code, newData, flags, traceId);
if (!WriteTransaction(BC_TRANSACTION, flags, handle, code, data, nullptr)) {
newData.RewindWrite(oldWritePosition);
ZLOGE(LABEL, "WriteTransaction ERROR");
@@ -114,7 +114,7 @@ int BinderInvoker::SendRequest(int handle, uint32_t code, MessageParcel &data, M
} else {
error = WaitForCompletion(&reply);
}
- HitraceInvoker::TraceClientReceieve(handle, code, flags, traceId, childId);
+ // HitraceInvoker::TraceClientReceieve(handle, code, flags, traceId, childId);
// restore Parcel data
newData.RewindWrite(oldWritePosition);
if (error != ERR_NONE) {
@@ -413,8 +413,8 @@ void BinderInvoker::OnTransaction(const uint8_t *buffer)
if (tr->offsets_size > 0) {
data->InjectOffsets(tr->data.ptr.offsets, tr->offsets_size / sizeof(binder_size_t));
}
- uint32_t &newflags = const_cast<uint32_t &>(tr->flags);
- int isServerTraced = HitraceInvoker::TraceServerReceieve(tr->target.handle, tr->code, *data, newflags);
+ // uint32_t &newflags = const_cast<uint32_t &>(tr->flags);
+ // int isServerTraced = HitraceInvoker::TraceServerReceieve(tr->target.handle, tr->code, *data, newflags);
const pid_t oldPid = callerPid_;
const auto oldUid = static_cast<const uid_t>(callerUid_);
const uint32_t oldToken = callerTokenID_;
@@ -469,7 +469,7 @@ void BinderInvoker::OnTransaction(const uint8_t *buffer)
Str16ToStr8(targetObject->descriptor_).c_str(), tr->code, duration);
}
}
- HitraceInvoker::TraceServerSend(tr->target.handle, tr->code, isServerTraced, newflags);
+ // HitraceInvoker::TraceServerSend(tr->target.handle, tr->code, isServerTraced, newflags);
if (!(flagValue & TF_ONE_WAY)) {
SendReply(reply, 0, error);
}
diff --git a/ipc/native/src/mock/source/hitrace_invoker.cpp b/ipc/native/src/mock/source/hitrace_invoker.cpp
index 4f7f7c3..bc55772 100644
--- a/ipc/native/src/mock/source/hitrace_invoker.cpp
+++ b/ipc/native/src/mock/source/hitrace_invoker.cpp
@@ -20,7 +20,7 @@
#include "hilog/log_c.h"
#include "hilog/log_cpp.h"
-#include "hitrace/trace.h"
+// #include "hitrace/trace.h"
#include "ipc_debug.h"
#include "log_tags.h"
#include "parcel.h"
@@ -29,118 +29,118 @@
namespace OHOS {
// the value should be equal to the set of parcel
using namespace OHOS::HiviewDFX;
-static const HiLogLabel TRACE_LABEL = { LOG_CORE, LOG_ID_IPC, "BinderHiTrace" };
+// static const HiLogLabel TRACE_LABEL = { LOG_CORE, LOG_ID_IPC, "BinderHiTrace" };
-bool HitraceInvoker::IsClientTraced(int32_t handle, uint32_t flags, const HiTraceId &traceId)
-{
- return (traceId.IsValid() && (handle != 0) &&
- ((flags & TF_ONE_WAY) ? traceId.IsFlagEnabled(HITRACE_FLAG_INCLUDE_ASYNC) : true));
-}
+// bool HitraceInvoker::IsClientTraced(int32_t handle, uint32_t flags, const HiTraceId &traceId)
+// {
+// return (traceId.IsValid() && (handle != 0) &&
+// ((flags & TF_ONE_WAY) ? traceId.IsFlagEnabled(HITRACE_FLAG_INCLUDE_ASYNC) : true));
+// }
-HiTraceId HitraceInvoker::TraceClientSend(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags,
- const HiTraceId &traceId)
-{
- HiTraceId childId = traceId;
- bool isClientTraced = IsClientTraced(handle, flags, traceId);
- if (isClientTraced) {
- childId = HiTraceChain::CreateSpan();
- // add childid to parcel data
- uint8_t idBytes[HITRACE_ID_LEN];
- size_t idLen = (size_t)(childId.ToBytes(idBytes, HITRACE_ID_LEN));
- if (idLen != HITRACE_ID_LEN) {
- ZLOGE(TRACE_LABEL, "%{public}s:idLen not correct", __func__);
- return childId;
- }
+// HiTraceId HitraceInvoker::TraceClientSend(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags,
+// const HiTraceId &traceId)
+// {
+// HiTraceId childId = traceId;
+// bool isClientTraced = IsClientTraced(handle, flags, traceId);
+// if (isClientTraced) {
+// childId = HiTraceChain::CreateSpan();
+// // add childid to parcel data
+// uint8_t idBytes[HITRACE_ID_LEN];
+// size_t idLen = (size_t)(childId.ToBytes(idBytes, HITRACE_ID_LEN));
+// if (idLen != HITRACE_ID_LEN) {
+// ZLOGE(TRACE_LABEL, "%{public}s:idLen not correct", __func__);
+// return childId;
+// }
- size_t oldWritePosition = data.GetWritePosition();
- if (!data.WriteBuffer(idBytes, idLen)) {
- ZLOGE(TRACE_LABEL, "%{public}s:Write idBytes fail", __func__);
- // restore Parcel data
- data.RewindWrite(oldWritePosition);
- return childId;
- }
+// size_t oldWritePosition = data.GetWritePosition();
+// if (!data.WriteBuffer(idBytes, idLen)) {
+// ZLOGE(TRACE_LABEL, "%{public}s:Write idBytes fail", __func__);
+// // restore Parcel data
+// data.RewindWrite(oldWritePosition);
+// return childId;
+// }
- // padded size of traceid
- if (!data.WriteUint8(data.GetWritePosition() - oldWritePosition)) {
- ZLOGE(TRACE_LABEL, "%{public}s:Write idLen fail", __func__);
- // restore Parcel data
- data.RewindWrite(oldWritePosition);
- return childId;
- }
- // tracepoint: CS(Client Send)
- HiTraceChain::Tracepoint(HITRACE_TP_CS, childId, "%s handle=%d,code=%u",
- (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC",
- handle, code);
- flags |= TF_HITRACE;
- }
- return childId;
-}
+// // padded size of traceid
+// if (!data.WriteUint8(data.GetWritePosition() - oldWritePosition)) {
+// ZLOGE(TRACE_LABEL, "%{public}s:Write idLen fail", __func__);
+// // restore Parcel data
+// data.RewindWrite(oldWritePosition);
+// return childId;
+// }
+// // tracepoint: CS(Client Send)
+// HiTraceChain::Tracepoint(HITRACE_TP_CS, childId, "%s handle=%d,code=%u",
+// (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC",
+// handle, code);
+// flags |= TF_HITRACE;
+// }
+// return childId;
+// }
-void HitraceInvoker::TraceClientReceieve(int32_t handle, uint32_t code, uint32_t flags, const HiTraceId &traceId,
- const HiTraceId &childId)
-{
- if (!(flags & TF_HITRACE)) {
- return;
- }
- bool isClientTraced = IsClientTraced(handle, flags, traceId);
- if (isClientTraced) {
- if (!(flags & TF_ONE_WAY)) {
- // restore thread trace id
- HiTraceChain::SetId(traceId);
- // tracepoint: CR(Client Receive)
- HiTraceChain::Tracepoint(HITRACE_TP_CR, childId, "%s handle=%d,code=%u", "SYNC", handle, code);
- }
- }
-}
+// void HitraceInvoker::TraceClientReceieve(int32_t handle, uint32_t code, uint32_t flags, const HiTraceId &traceId,
+// const HiTraceId &childId)
+// {
+// if (!(flags & TF_HITRACE)) {
+// return;
+// }
+// bool isClientTraced = IsClientTraced(handle, flags, traceId);
+// if (isClientTraced) {
+// if (!(flags & TF_ONE_WAY)) {
+// // restore thread trace id
+// HiTraceChain::SetId(traceId);
+// // tracepoint: CR(Client Receive)
+// HiTraceChain::Tracepoint(HITRACE_TP_CR, childId, "%s handle=%d,code=%u", "SYNC", handle, code);
+// }
+// }
+// }
-void HitraceInvoker::RecoveryDataAndFlag(Parcel &data, uint32_t &flags, size_t oldReadPosition, uint8_t idLen)
-{
- // restore data
- data.RewindRead(oldReadPosition);
- // padded size(4 bytes) of uint8_t
- data.SetDataSize(data.GetDataSize() - PADDED_SIZE_OF_PARCEL - idLen);
- flags &= ~(uint32_t)TF_HITRACE;
-}
+// void HitraceInvoker::RecoveryDataAndFlag(Parcel &data, uint32_t &flags, size_t oldReadPosition, uint8_t idLen)
+// {
+// // restore data
+// data.RewindRead(oldReadPosition);
+// // padded size(4 bytes) of uint8_t
+// data.SetDataSize(data.GetDataSize() - PADDED_SIZE_OF_PARCEL - idLen);
+// flags &= ~(uint32_t)TF_HITRACE;
+// }
-bool HitraceInvoker::TraceServerReceieve(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags)
-{
- bool isServerTraced = (flags & TF_HITRACE) != 0;
- if (isServerTraced) {
- size_t oldReadPosition = data.GetReadPosition();
- // padded size(4 bytes) of uint8_t
- data.RewindRead(data.GetDataSize() - PADDED_SIZE_OF_PARCEL);
- // the padded size of traceid
- uint8_t idLen = data.ReadUint8();
- if (idLen >= sizeof(HiTraceIdStruct)) {
- // padded size(4 bytes) of uint8_t
- data.RewindRead(data.GetDataSize() - PADDED_SIZE_OF_PARCEL - idLen);
- const uint8_t *idBytes = data.ReadUnpadBuffer(sizeof(HiTraceIdStruct));
- if (idBytes == nullptr) {
- ZLOGE(TRACE_LABEL, "%{public}s:idBytes is null", __func__);
- isServerTraced = 0;
- RecoveryDataAndFlag(data, flags, oldReadPosition, idLen);
- return isServerTraced;
- }
- HiTraceId traceId(idBytes, sizeof(HiTraceIdStruct));
- HiTraceChain::SetId(traceId);
- // tracepoint: SR(Server Receive)
- HiTraceChain::Tracepoint(HITRACE_TP_SR, traceId,
- "%s handle=%d,code=%u", (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC",
- handle, code);
- }
+// bool HitraceInvoker::TraceServerReceieve(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags)
+// {
+// bool isServerTraced = (flags & TF_HITRACE) != 0;
+// if (isServerTraced) {
+// size_t oldReadPosition = data.GetReadPosition();
+// // padded size(4 bytes) of uint8_t
+// data.RewindRead(data.GetDataSize() - PADDED_SIZE_OF_PARCEL);
+// // the padded size of traceid
+// uint8_t idLen = data.ReadUint8();
+// if (idLen >= sizeof(HiTraceIdStruct)) {
+// // padded size(4 bytes) of uint8_t
+// data.RewindRead(data.GetDataSize() - PADDED_SIZE_OF_PARCEL - idLen);
+// const uint8_t *idBytes = data.ReadUnpadBuffer(sizeof(HiTraceIdStruct));
+// if (idBytes == nullptr) {
+// ZLOGE(TRACE_LABEL, "%{public}s:idBytes is null", __func__);
+// isServerTraced = 0;
+// RecoveryDataAndFlag(data, flags, oldReadPosition, idLen);
+// return isServerTraced;
+// }
+// HiTraceId traceId(idBytes, sizeof(HiTraceIdStruct));
+// HiTraceChain::SetId(traceId);
+// // tracepoint: SR(Server Receive)
+// HiTraceChain::Tracepoint(HITRACE_TP_SR, traceId,
+// "%s handle=%d,code=%u", (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC",
+// handle, code);
+// }
- RecoveryDataAndFlag(data, flags, oldReadPosition, idLen);
- }
- return isServerTraced;
-}
+// RecoveryDataAndFlag(data, flags, oldReadPosition, idLen);
+// }
+// return isServerTraced;
+// }
-void HitraceInvoker::TraceServerSend(int32_t handle, uint32_t code, bool isServerTraced, uint32_t flags)
-{
- if (isServerTraced) {
- // tracepoint: SS(Server Send)
- HiTraceChain::Tracepoint(HITRACE_TP_SS, HiTraceChain::GetId(), "%s handle=%d,code=%u",
- (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", handle, code);
- }
- HiTraceChain::ClearId();
-}
+// void HitraceInvoker::TraceServerSend(int32_t handle, uint32_t code, bool isServerTraced, uint32_t flags)
+// {
+// if (isServerTraced) {
+// // tracepoint: SS(Server Send)
+// HiTraceChain::Tracepoint(HITRACE_TP_SS, HiTraceChain::GetId(), "%s handle=%d,code=%u",
+// (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", handle, code);
+// }
+// HiTraceChain::ClearId();
+// }
} // namespace OHOS
diff --git a/ipc/native/src/mock/source/invoker_factory.cpp b/ipc/native/src/mock/source/invoker_factory.cpp
index 5b2946b..e539639 100644
--- a/ipc/native/src/mock/source/invoker_factory.cpp
+++ b/ipc/native/src/mock/source/invoker_factory.cpp
@@ -18,7 +18,7 @@
#include <memory>
#include <utility>
-#include "__mutex_base"
+// #include "__mutex_base"
#include "functional"
#include "iremote_invoker.h"
#include "unordered_map"
diff --git a/ipc/native/src/napi/src/napi_remote_object.cpp b/ipc/native/src/napi/src/napi_remote_object.cpp
index 1275bb3..4ff5260 100644
--- a/ipc/native/src/napi/src/napi_remote_object.cpp
+++ b/ipc/native/src/napi/src/napi_remote_object.cpp
@@ -22,7 +22,7 @@
#include <uv.h>
#include "access_token_adapter.h"
#include "hilog/log.h"
-#include "hitrace_meter.h"
+// #include "hitrace_meter.h"
#include "ipc_object_proxy.h"
#include "ipc_object_stub.h"
#include "ipc_skeleton.h"
diff --git a/ipc/native/src/napi/src/napi_remote_proxy.cpp b/ipc/native/src/napi/src/napi_remote_proxy.cpp
index 0239944..9b4c6d9 100644
--- a/ipc/native/src/napi/src/napi_remote_proxy.cpp
+++ b/ipc/native/src/napi/src/napi_remote_proxy.cpp
@@ -21,7 +21,7 @@
#include <uv.h>
#include "access_token_adapter.h"
#include "hilog/log.h"
-#include "hitrace_meter.h"
+// #include "hitrace_meter.h"
#include "ipc_object_proxy.h"
#include "ipc_object_stub.h"
#include "ipc_skeleton.h"
diff --git a/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp b/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp
index 8b008f5..77649f0 100644
--- a/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp
+++ b/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp
@@ -23,7 +23,7 @@
#include <securec.h>
#include <gtest/gtest.h>
#include "ipc_debug.h"
-#include "hitrace/trace.h"
+// #include "hitrace/trace.h"
#include "ipc_skeleton.h"
#include "ipc_object_proxy.h"
#include "test_service_skeleton.h"
diff --git a/services/dbinder/test/distributedtest/include/dbinder_test_service_skeleton.h b/services/dbinder/test/distributedtest/include/dbinder_test_service_skeleton.h
index 41fe229..40d5177 100644
--- a/services/dbinder/test/distributedtest/include/dbinder_test_service_skeleton.h
+++ b/services/dbinder/test/distributedtest/include/dbinder_test_service_skeleton.h
@@ -23,7 +23,7 @@
#include "iremote_proxy.h"
#include "hilog/log.h"
#include "log_tags.h"
-#include "hitrace/trace.h"
+// #include "hitrace/trace.h"
namespace OHOS {
class IDBinderTestService : public IRemoteBroker {
--
2.33.0

View File

@ -0,0 +1,71 @@
From e0aace24cbc8d0943bb79589d1a236fb8ff5afdb Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 20 Jun 2023 17:23:24 +0800
Subject: [PATCH] remove dependency on hitrace
---
interfaces/innerkits/safwk/BUILD.gn | 2 +-
services/safwk/src/local_ability_manager.cpp | 4 ++--
services/safwk/src/system_ability.cpp | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/interfaces/innerkits/safwk/BUILD.gn b/interfaces/innerkits/safwk/BUILD.gn
index 5509789..3dd18cb 100644
--- a/interfaces/innerkits/safwk/BUILD.gn
+++ b/interfaces/innerkits/safwk/BUILD.gn
@@ -51,7 +51,7 @@ ohos_shared_library("system_ability_fwk") {
if (is_standard_system) {
external_deps = [
"c_utils:utils",
- "hitrace_native:hitrace_meter",
+ # "hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"samgr:samgr_common",
diff --git a/services/safwk/src/local_ability_manager.cpp b/services/safwk/src/local_ability_manager.cpp
index 11f7a06..0af6af9 100644
--- a/services/safwk/src/local_ability_manager.cpp
+++ b/services/safwk/src/local_ability_manager.cpp
@@ -22,7 +22,7 @@
#include "datetime_ex.h"
#include "errors.h"
-#include "hitrace_meter.h"
+// #include "hitrace_meter.h"
#include "ipc_skeleton.h"
#include "iservice_registry.h"
#include "safwk_log.h"
@@ -88,7 +88,7 @@ void LocalAbilityManager::DoStartSAProcess(const std::string& profilePath, int32
}
{
std::string traceTag = GetTraceTag(realProfilePath);
- HITRACE_METER_NAME(HITRACE_TAG_SAMGR, traceTag);
+ // HITRACE_METER_NAME(HITRACE_TAG_SAMGR, traceTag);
bool ret = InitSystemAbilityProfiles(realProfilePath, saId);
if (!ret) {
HILOGE(TAG, "InitSystemAbilityProfiles no right profile, will exit");
diff --git a/services/safwk/src/system_ability.cpp b/services/safwk/src/system_ability.cpp
index 84911e0..e618560 100644
--- a/services/safwk/src/system_ability.cpp
+++ b/services/safwk/src/system_ability.cpp
@@ -19,7 +19,7 @@
#include "datetime_ex.h"
#include "errors.h"
-#include "hitrace_meter.h"
+// #include "hitrace_meter.h"
#include "if_system_ability_manager.h"
#include "iservice_registry.h"
#include "local_ability_manager.h"
@@ -114,7 +114,7 @@ void SystemAbility::Start()
}
HILOGD(TAG, "[PerformanceTest] SAFWK OnStart systemAbilityId:%{public}d", saId_);
int64_t begin = GetTickCount();
- HITRACE_METER_NAME(HITRACE_TAG_SAMGR, ToString(saId_) + "_OnStart");
+ // HITRACE_METER_NAME(HITRACE_TAG_SAMGR, ToString(saId_) + "_OnStart");
OnStart();
isRunning_ = true;
HILOGI(TAG, "[PerformanceTest] SAFWK OnStart systemAbilityId:%{public}d finished, spend:%{public}" PRId64 " ms",
--
2.33.0

View File

@ -0,0 +1,234 @@
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

View File

@ -0,0 +1,24 @@
From c85aa929e7f0428509ab05a9991d9ec6bfcbe406 Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 20 Jun 2023 17:29:23 +0800
Subject: [PATCH] adapt for build
---
BUILD.gn | 1 +
1 file changed, 1 insertion(+)
diff --git a/BUILD.gn b/BUILD.gn
index af76d78..516dcaf 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -19,6 +19,7 @@ config("sqlite_config") {
"include",
"//commonlibrary/c_utils/base/include",
]
+ cflags_c = [ "-Wno-unused-but-set-variable" ]
}
# This is the configuration used to build sqlite itself.
--
2.33.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,210 @@
From 7b37fc1df4da5befa175ff6687238c0012d2bb5e Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 20 Jun 2023 17:37:06 +0800
Subject: [PATCH] remove dependency and adapt for build
---
services/BUILD.gn | 16 +++----
.../src/hiview_adapter/hisysevent_adapter.cpp | 33 +++++++-------
.../src/hiview_adapter/hitrace_adapter.cpp | 10 +++--
.../permission_adapter/permission_adapter.cpp | 43 ++++++++++---------
4 files changed, 53 insertions(+), 49 deletions(-)
diff --git a/services/BUILD.gn b/services/BUILD.gn
index 655f169..967d958 100644
--- a/services/BUILD.gn
+++ b/services/BUILD.gn
@@ -176,8 +176,8 @@ if (os_level == "mini" || os_level == "small") {
external_deps = [
"c_utils:utils",
"dsoftbus:softbus_client",
- "hisysevent_native:libhisysevent",
- "hitrace_native:hitrace_meter",
+ # "hisysevent_native:libhisysevent",
+ # "hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
]
if (support_jsapi) {
@@ -225,10 +225,10 @@ if (os_level == "mini" || os_level == "small") {
]
external_deps = [
- "access_token:libaccesstoken_sdk",
+ # "access_token:libaccesstoken_sdk",
"c_utils:utils",
- "hisysevent_native:libhisysevent",
- "hitrace_native:hitrace_meter",
+ # "hisysevent_native:libhisysevent",
+ # "hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"init:libbegetutil",
"ipc:ipc_core",
@@ -269,10 +269,10 @@ if (os_level == "mini" || os_level == "small") {
]
external_deps = [
- "access_token:libaccesstoken_sdk",
+ # "access_token:libaccesstoken_sdk",
"c_utils:utils",
- "hisysevent_native:libhisysevent",
- "hitrace_native:hitrace_meter",
+ # "hisysevent_native:libhisysevent",
+ # "hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"init:libbegetutil",
"ipc:ipc_core",
diff --git a/services/frameworks/src/hiview_adapter/hisysevent_adapter.cpp b/services/frameworks/src/hiview_adapter/hisysevent_adapter.cpp
index 3954919..f5b3380 100644
--- a/services/frameworks/src/hiview_adapter/hisysevent_adapter.cpp
+++ b/services/frameworks/src/hiview_adapter/hisysevent_adapter.cpp
@@ -14,33 +14,34 @@
*/
#include "hisysevent_adapter.h"
-#include "hisysevent.h"
+// #include "hisysevent.h"
#ifdef __cplusplus
extern "C" {
#endif
-constexpr char STR_EVENT_CORE_FUNCTION[] = "CORE_FUNCTION";
-constexpr char STR_EVENT[] = "EVENT";
-constexpr char STR_APP_ID[] = "APP_ID";
-constexpr char STR_BATCH_NUMBER[] = "BATCH_NUMBER";
-constexpr char STR_RESULT[] = "RESULT";
-constexpr char STR_OS_ACCOUNT_ID[] = "OS_ACCOUNT_ID";
+// constexpr char STR_EVENT_CORE_FUNCTION[] = "CORE_FUNCTION";
+// constexpr char STR_EVENT[] = "EVENT";
+// constexpr char STR_APP_ID[] = "APP_ID";
+// constexpr char STR_BATCH_NUMBER[] = "BATCH_NUMBER";
+// constexpr char STR_RESULT[] = "RESULT";
+// constexpr char STR_OS_ACCOUNT_ID[] = "OS_ACCOUNT_ID";
void ReportCoreFuncInvokeEvent(const InvokeEvent *event)
{
+ return;
if (event == nullptr) {
return;
}
- OHOS::HiviewDFX::HiSysEvent::Write(
- OHOS::HiviewDFX::HiSysEvent::Domain::DEVICE_AUTH,
- STR_EVENT_CORE_FUNCTION,
- OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC,
- STR_EVENT, event->eventId,
- STR_APP_ID, event->appId,
- STR_BATCH_NUMBER, event->batchNumber,
- STR_RESULT, event->result,
- STR_OS_ACCOUNT_ID, event->osAccountId);
+ // OHOS::HiviewDFX::HiSysEvent::Write(
+ // OHOS::HiviewDFX::HiSysEvent::Domain::DEVICE_AUTH,
+ // STR_EVENT_CORE_FUNCTION,
+ // OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC,
+ // STR_EVENT, event->eventId,
+ // STR_APP_ID, event->appId,
+ // STR_BATCH_NUMBER, event->batchNumber,
+ // STR_RESULT, event->result,
+ // STR_OS_ACCOUNT_ID, event->osAccountId);
}
#ifdef __cplusplus
diff --git a/services/frameworks/src/hiview_adapter/hitrace_adapter.cpp b/services/frameworks/src/hiview_adapter/hitrace_adapter.cpp
index 57eca82..0beea45 100644
--- a/services/frameworks/src/hiview_adapter/hitrace_adapter.cpp
+++ b/services/frameworks/src/hiview_adapter/hitrace_adapter.cpp
@@ -15,24 +15,26 @@
#include "hitrace_adapter.h"
-#include "hitrace_meter.h"
+// #include "hitrace_meter.h"
#ifdef __cplusplus
extern "C" {
#endif
void DevAuthStartTrace(const char *value)
-{
+{
+ return;
if (value == nullptr) {
return;
}
- StartTrace(HITRACE_TAG_APP, value);
+ // StartTrace(HITRACE_TAG_APP, value);
}
void DevAuthFinishTrace(void)
{
- FinishTrace(HITRACE_TAG_APP);
+ return;
+ // FinishTrace(HITRACE_TAG_APP);
}
#ifdef __cplusplus
diff --git a/services/frameworks/src/permission_adapter/permission_adapter.cpp b/services/frameworks/src/permission_adapter/permission_adapter.cpp
index b4b1eb2..74f1d92 100644
--- a/services/frameworks/src/permission_adapter/permission_adapter.cpp
+++ b/services/frameworks/src/permission_adapter/permission_adapter.cpp
@@ -15,34 +15,35 @@
#include "permission_adapter.h"
-#include "accesstoken_kit.h"
+// #include "accesstoken_kit.h"
#include "ipc_skeleton.h"
#include "device_auth_defines.h"
#include "hc_log.h"
using namespace OHOS;
-using namespace OHOS::Security::AccessToken;
+// using namespace OHOS::Security::AccessToken;
int32_t CheckPermission(void)
{
- AccessTokenID tokenId = IPCSkeleton::GetCallingTokenID();
- ATokenTypeEnum tokenType = AccessTokenKit::GetTokenTypeFlag(tokenId);
- if (tokenType == TOKEN_NATIVE) {
- NativeTokenInfo findInfo;
- if (AccessTokenKit::GetNativeTokenInfo(tokenId, findInfo) != 0) {
- LOGE("GetNativeTokenInfo failed!");
- return HC_ERROR;
- }
- if ((findInfo.apl == APL_SYSTEM_CORE) || (findInfo.apl == APL_SYSTEM_BASIC)) {
- LOGI("Check permission(APL3=SYSTEM_CORE or APL2=SYSTEM_BASIC) success!");
- return HC_SUCCESS;
- } else {
- LOGE("Check permission(APL3=SYSTEM_CORE or APL2=SYSTEM_BASIC) failed! APL: %d", findInfo.apl);
- return HC_ERROR;
- }
- } else {
- LOGE("Invalid token type: %d", tokenType);
- return HC_ERROR;
- }
+ // AccessTokenID tokenId = IPCSkeleton::GetCallingTokenID();
+ // ATokenTypeEnum tokenType = AccessTokenKit::GetTokenTypeFlag(tokenId);
+ // if (tokenType == TOKEN_NATIVE) {
+ // NativeTokenInfo findInfo;
+ // if (AccessTokenKit::GetNativeTokenInfo(tokenId, findInfo) != 0) {
+ // LOGE("GetNativeTokenInfo failed!");
+ // return HC_ERROR;
+ // }
+ // if ((findInfo.apl == APL_SYSTEM_CORE) || (findInfo.apl == APL_SYSTEM_BASIC)) {
+ // LOGI("Check permission(APL3=SYSTEM_CORE or APL2=SYSTEM_BASIC) success!");
+ // return HC_SUCCESS;
+ // } else {
+ // LOGE("Check permission(APL3=SYSTEM_CORE or APL2=SYSTEM_BASIC) failed! APL: %d", findInfo.apl);
+ // return HC_ERROR;
+ // }
+ // } else {
+ // LOGE("Invalid token type: %d", tokenType);
+ // return HC_ERROR;
+ // }
+ return HC_SUCCESS;
}
\ No newline at end of file
--
2.33.0

View File

@ -0,0 +1,33 @@
From 0cc0151dcf4507479a2db8912a67d68a8946e70d Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 20 Jun 2023 17:40:56 +0800
Subject: [PATCH] adapt for build
---
BUILD.gn | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/BUILD.gn b/BUILD.gn
index 2c77990..ec05d65 100755
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
+#
import("//third_party/mbedtls/mbedtls.gni")
@@ -115,6 +115,7 @@ if (defined(ohos_lite)) {
ohos_shared_library("mbedtls_shared") {
public_configs = [ ":mbedtls_config" ]
+ cflags_c = [ "-Wno-unused-but-set-variable" ]
output_name = "mbedtls"
subsystem_name = "common"
part_name = "dsoftbus"
--
2.33.0

View File

@ -0,0 +1,813 @@
From 3ecd44499a662c42887d6349b17e5d06f49cc799 Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Sun, 25 Jun 2023 11:17:44 +0800
Subject: [PATCH] remove dependency
---
bundle.json | 3 +-
common/include/dm_constants.h | 6 ++--
common/src/dfx/standard/dm_hisysevent.cpp | 4 ++-
common/src/dfx/standard/dm_hitrace.cpp | 6 ++--
ext/BUILD.gn | 4 +--
ext/no_interaction_auth/BUILD.gn | 10 +++----
ext/pin_auth/BUILD.gn | 8 ++---
.../include/ability/dm_ability_manager.h | 4 +--
ext/pin_auth/include/standard/pin_auth_ui.h | 4 +--
ext/pin_auth/src/standard/pin_auth_ui.cpp | 15 ++++++++--
interfaces/inner_kits/native_cpp/BUILD.gn | 4 +--
.../native_cpp/include/dm_subscribe_info.h | 2 ++
services/implementation/BUILD.gn | 22 +++++++-------
.../include/config/json_config.h | 12 ++++----
.../include/device_manager_service_impl.h | 4 +--
.../src/authentication/dm_auth_manager.cpp | 3 +-
.../showconfirm/standard/show_confirm.cpp | 7 +++--
.../src/device_manager_service_impl.cpp | 30 +++++++++++++++----
.../devicestate/dm_device_state_manager.cpp | 8 ++---
services/service/BUILD.gn | 16 +++++-----
.../ipc/standard/ipc_server_listener.h | 4 ++-
.../src/device_manager_service_listener.cpp | 2 +-
.../src/ipc/standard/ipc_server_listener.cpp | 2 +-
utils/BUILD.gn | 6 ++--
24 files changed, 112 insertions(+), 74 deletions(-)
diff --git a/bundle.json b/bundle.json
index 5d6b784..bee412c 100644
--- a/bundle.json
+++ b/bundle.json
@@ -72,7 +72,8 @@
"device_manager_callback.h",
"dm_device_info.h",
"dm_publish_info.h",
- "dm_subscribe_info.h"
+ "dm_subscribe_info.h",
+ "dm_app_image_info.h"
],
"header_base": "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include"
}
diff --git a/common/include/dm_constants.h b/common/include/dm_constants.h
index 263d6aa..8104c65 100755
--- a/common/include/dm_constants.h
+++ b/common/include/dm_constants.h
@@ -19,9 +19,9 @@
#include <string>
#ifdef __LP64__
-constexpr const char* LIB_LOAD_PATH = "/system/lib64/";
+constexpr const char* LIB_LOAD_PATH = "/usr/lib64/";
#else
-constexpr const char* LIB_LOAD_PATH = "/system/lib/";
+constexpr const char* LIB_LOAD_PATH = "/usr/lib/";
#endif
namespace OHOS {
@@ -120,4 +120,4 @@ constexpr const char* EVENT_INIT_CODE = "2";
constexpr uint32_t MAX_MESSAGE_LEN = 40 * 1024 * 1024;
} // namespace DistributedHardware
} // namespace OHOS
-#endif // OHOS_DM_CONSTANTS_H
\ No newline at end of file
+#endif // OHOS_DM_CONSTANTS_H
diff --git a/common/src/dfx/standard/dm_hisysevent.cpp b/common/src/dfx/standard/dm_hisysevent.cpp
index 4e9b297..9aba660 100644
--- a/common/src/dfx/standard/dm_hisysevent.cpp
+++ b/common/src/dfx/standard/dm_hisysevent.cpp
@@ -17,13 +17,14 @@
#include "dm_constants.h" // for DM_OK
#include "dm_log.h" // for LOGE
-#include "hisysevent.h" // for HiSysEvent, HiSysEvent::Domain, HiSysEvent...
+//#include "hisysevent.h" // for HiSysEvent, HiSysEvent::Domain, HiSysEvent...
#include "unistd.h" // for getpid, getuid
namespace OHOS {
namespace DistributedHardware {
void SysEventWrite(const std::string &status, int32_t eventType, const std::string &msg)
{
+/*
int32_t res = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_DEVICE_MANAGER,
status.c_str(),
@@ -34,6 +35,7 @@ void SysEventWrite(const std::string &status, int32_t eventType, const std::stri
if (res != DM_OK) {
LOGE("%s Write HiSysEvent error, res:%d", status.c_str(), res);
}
+*/
}
} // namespace DistributedHardware
} // namespace OHOS
diff --git a/common/src/dfx/standard/dm_hitrace.cpp b/common/src/dfx/standard/dm_hitrace.cpp
index 1bbe65f..50fa4c5 100644
--- a/common/src/dfx/standard/dm_hitrace.cpp
+++ b/common/src/dfx/standard/dm_hitrace.cpp
@@ -13,18 +13,18 @@
* limitations under the License.
*/
#include "dm_hitrace.h"
-#include "hitrace_meter.h"
+//#include "hitrace_meter.h"
namespace OHOS {
namespace DistributedHardware {
void DmTraceStart(const std::string &msg)
{
- StartTrace(HITRACE_TAG_DEVICE_MANAGER, msg);
+ //StartTrace(HITRACE_TAG_DEVICE_MANAGER, msg);
}
void DmTraceEnd()
{
- FinishTrace(HITRACE_TAG_DEVICE_MANAGER);
+ //FinishTrace(HITRACE_TAG_DEVICE_MANAGER);
}
} // namespace DistributedHardware
} // namespace OHOS
diff --git a/ext/BUILD.gn b/ext/BUILD.gn
index 03033ec..23b3c97 100644
--- a/ext/BUILD.gn
+++ b/ext/BUILD.gn
@@ -16,11 +16,11 @@ import("//foundation/distributedhardware/device_manager/device_manager.gni")
group("ext_modules") {
deps = []
- if (support_jsapi) {
+ #if (support_jsapi) {
if (device_manager_no_interaction_auth) {
deps += [ "./no_interaction_auth:devicemanagerext_no_interaction_auth" ]
} else {
deps += [ "./pin_auth:devicemanagerext_pin_auth" ]
}
- }
+ #}
}
diff --git a/ext/no_interaction_auth/BUILD.gn b/ext/no_interaction_auth/BUILD.gn
index 231e60e..5d75aa4 100644
--- a/ext/no_interaction_auth/BUILD.gn
+++ b/ext/no_interaction_auth/BUILD.gn
@@ -57,12 +57,12 @@ if (defined(ohos_lite)) {
]
sources = [
- "src/ability/standard/dm_ability_manager.cpp",
+ #"src/ability/standard/dm_ability_manager.cpp",
"src/no_interaction_auth.cpp",
]
deps = [
- "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
+ #"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_services_path}/abilitymgr:abilityms",
"${innerkits_path}/native_cpp:devicemanagersdk",
"${utils_path}:devicemanagerutils",
@@ -72,12 +72,12 @@ if (defined(ohos_lite)) {
]
external_deps = [
- "ability_base:want",
+ #"ability_base:want",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
- "common_event_service:cesfwk_core",
- "common_event_service:cesfwk_innerkits",
+ #"common_event_service:cesfwk_core",
+ #"common_event_service:cesfwk_innerkits",
"dsoftbus:softbus_client",
"hiviewdfx_hilog_native:libhilog",
"init:libbeget_proxy",
diff --git a/ext/pin_auth/BUILD.gn b/ext/pin_auth/BUILD.gn
index d49e4f4..a5ab558 100644
--- a/ext/pin_auth/BUILD.gn
+++ b/ext/pin_auth/BUILD.gn
@@ -57,7 +57,7 @@ if (defined(ohos_lite)) {
]
sources = [
- "src/ability/lite/dm_ability_manager.cpp",
+ #"src/ability/lite/dm_ability_manager.cpp",
"src/lite/pin_auth_ui.cpp",
"src/pin_auth.cpp",
]
@@ -128,19 +128,19 @@ if (defined(ohos_lite)) {
]
sources = [
- "src/ability/standard/dm_ability_manager.cpp",
+ #"src/ability/standard/dm_ability_manager.cpp",
"src/pin_auth.cpp",
"src/standard/pin_auth_ui.cpp",
]
deps = [
- "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
+ #"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${innerkits_path}/native_cpp:devicemanagersdk",
"//foundation/distributedhardware/device_manager/services/implementation:devicemanagerserviceimpl",
]
external_deps = [
- "ability_base:want",
+ #"ability_base:want",
"init:libbegetutil",
]
diff --git a/ext/pin_auth/include/ability/dm_ability_manager.h b/ext/pin_auth/include/ability/dm_ability_manager.h
index 83a62f2..34c8382 100644
--- a/ext/pin_auth/include/ability/dm_ability_manager.h
+++ b/ext/pin_auth/include/ability/dm_ability_manager.h
@@ -18,7 +18,7 @@
#include <string>
#include <vector>
-#include "want.h"
+//#include "want.h"
namespace OHOS {
namespace DistributedHardware {
@@ -37,7 +37,7 @@ enum UiAction {
class DmAbilityManager {
public:
- AbilityStatus StartAbility(AAFwk::Want &want);
+ //AbilityStatus StartAbility(AAFwk::Want &want);
};
} // namespace DistributedHardware
} // namespace OHOS
diff --git a/ext/pin_auth/include/standard/pin_auth_ui.h b/ext/pin_auth/include/standard/pin_auth_ui.h
index aa33b20..c8e219f 100644
--- a/ext/pin_auth/include/standard/pin_auth_ui.h
+++ b/ext/pin_auth/include/standard/pin_auth_ui.h
@@ -20,7 +20,7 @@
#include "dm_auth_manager.h"
#include "dm_ability_manager.h"
-#include "want.h"
+//#include "want.h"
namespace OHOS {
namespace DistributedHardware {
@@ -32,4 +32,4 @@ public:
};
} // namespace DistributedHardware
} // namespace OHOS
-#endif // OHOS_DM_PIN_AUTH_UI_H
\ No newline at end of file
+#endif // OHOS_DM_PIN_AUTH_UI_H
diff --git a/ext/pin_auth/src/standard/pin_auth_ui.cpp b/ext/pin_auth/src/standard/pin_auth_ui.cpp
index 65af67a..365ae7e 100644
--- a/ext/pin_auth/src/standard/pin_auth_ui.cpp
+++ b/ext/pin_auth/src/standard/pin_auth_ui.cpp
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+#include <iostream>
#include "pin_auth_ui.h"
#include "dm_ability_manager.h"
@@ -36,6 +36,8 @@ int32_t PinAuthUi::ShowPinDialog(int32_t code, std::shared_ptr<DmAuthManager> au
LOGE("authManager is null");
return ERR_DM_FAILED;
}
+ std::cout << "PinCode:%d" << std::to_string(code) << std::endl;
+ /*
std::shared_ptr<DmAbilityManager> dmAbilityMgr = std::make_shared<DmAbilityManager>();
AAFwk::Want want;
want.SetParam("PinCode", std::to_string(code));
@@ -50,7 +52,7 @@ int32_t PinAuthUi::ShowPinDialog(int32_t code, std::shared_ptr<DmAuthManager> au
if (status != AbilityStatus::ABILITY_STATUS_SUCCESS) {
LOGE("ShowConfirm::start ui service fail");
return ERR_DM_FAILED;
- }
+ }*/
LOGI("ShowPinDialog end");
return DM_OK;
}
@@ -62,6 +64,13 @@ int32_t PinAuthUi::InputPinDialog(std::shared_ptr<DmAuthManager> authManager)
LOGE("authManager is null");
return ERR_DM_FAILED;
}
+
+ int code;
+ std::cout << "Input PinCode:" << std::endl;
+ std::cin >> code ;
+ authManager->OnUserOperation(5,std::to_string(code));
+
+ /*
std::shared_ptr<DmAbilityManager> dmAbilityMgr = std::make_shared<DmAbilityManager>();
AAFwk::Want want;
@@ -77,7 +86,7 @@ int32_t PinAuthUi::InputPinDialog(std::shared_ptr<DmAuthManager> authManager)
if (status != AbilityStatus::ABILITY_STATUS_SUCCESS) {
LOGE("ShowConfirm::start ui service success");
return ERR_DM_FAILED;
- }
+ }*/
LOGI("InputPinDialog end");
return DM_OK;
}
diff --git a/interfaces/inner_kits/native_cpp/BUILD.gn b/interfaces/inner_kits/native_cpp/BUILD.gn
index d572656..a8788e9 100644
--- a/interfaces/inner_kits/native_cpp/BUILD.gn
+++ b/interfaces/inner_kits/native_cpp/BUILD.gn
@@ -149,8 +149,8 @@ if (defined(ohos_lite)) {
external_deps = [
"c_utils:utils",
- "hisysevent_native:libhisysevent",
- "hitrace_native:hitrace_meter",
+ #"hisysevent_native:libhisysevent",
+ #"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"samgr:samgr_proxy",
diff --git a/interfaces/inner_kits/native_cpp/include/dm_subscribe_info.h b/interfaces/inner_kits/native_cpp/include/dm_subscribe_info.h
index 603e242..054bfd3 100644
--- a/interfaces/inner_kits/native_cpp/include/dm_subscribe_info.h
+++ b/interfaces/inner_kits/native_cpp/include/dm_subscribe_info.h
@@ -17,6 +17,8 @@
#define OHOS_DM_SUBSCRIBE_INFO_H
#include <stdbool.h>
+#include <stdlib.h>
+#include <stdint.h>
#define DM_MAX_DEVICE_CAPABILITY_LEN 65
diff --git a/services/implementation/BUILD.gn b/services/implementation/BUILD.gn
index 126232e..faf0951 100644
--- a/services/implementation/BUILD.gn
+++ b/services/implementation/BUILD.gn
@@ -76,7 +76,7 @@ if (defined(ohos_lite)) {
]
sources = [
- "${servicesimpl_path}/src/ability/lite/dm_ability_manager.cpp",
+ #"${servicesimpl_path}/src/ability/lite/dm_ability_manager.cpp",
"${servicesimpl_path}/src/adapter/standard/dm_adapter_manager.cpp",
"${servicesimpl_path}/src/authentication/auth_message_processor.cpp",
"${servicesimpl_path}/src/authentication/auth_request_state.cpp",
@@ -127,10 +127,10 @@ if (defined(ohos_lite)) {
]
}
}
-} else if (!support_jsapi) {
- group("devicemanagerserviceimpl") {
- deps = []
- }
+#} else if (!support_jsapi) {
+# group("devicemanagerserviceimpl") {
+# deps = []
+# }
} else {
config("devicemanagerserviceimpl_config") {
include_dirs = [
@@ -174,7 +174,7 @@ if (defined(ohos_lite)) {
ohos_shared_library("devicemanagerserviceimpl") {
sources = [
- "src/ability/standard/dm_ability_manager.cpp",
+ #"src/ability/standard/dm_ability_manager.cpp",
"src/adapter/standard/dm_adapter_manager.cpp",
"src/authentication/auth_message_processor.cpp",
"src/authentication/auth_request_state.cpp",
@@ -183,7 +183,7 @@ if (defined(ohos_lite)) {
"src/authentication/showconfirm/standard/show_confirm.cpp",
"src/config/dm_config_manager.cpp",
"src/credential/dm_credential_manager.cpp",
- "src/dependency/commonevent/dm_common_event_manager.cpp",
+ #"src/dependency/commonevent/dm_common_event_manager.cpp",
"src/dependency/hichain/hichain_connector.cpp",
"src/dependency/multipleuser/multiple_user_connector.cpp",
"src/dependency/softbus/softbus_connector.cpp",
@@ -205,7 +205,7 @@ if (defined(ohos_lite)) {
]
deps = [
- "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
+ #"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${innerkits_path}/native_cpp:devicemanagersdk",
"${utils_path}:devicemanagerutils",
"//base/security/device_auth/services:deviceauth_sdk",
@@ -220,10 +220,10 @@ if (defined(ohos_lite)) {
}
external_deps = [
- "ability_base:want",
+ #"ability_base:want",
"c_utils:utils",
- "common_event_service:cesfwk_core",
- "common_event_service:cesfwk_innerkits",
+ #"common_event_service:cesfwk_core",
+ #"common_event_service:cesfwk_innerkits",
"dsoftbus:softbus_client",
"init:libbegetutil",
"ipc:ipc_core",
diff --git a/services/implementation/include/config/json_config.h b/services/implementation/include/config/json_config.h
index f9598fa..59d061d 100644
--- a/services/implementation/include/config/json_config.h
+++ b/services/implementation/include/config/json_config.h
@@ -29,7 +29,7 @@ const std::string adapterJsonConfigString =
"version": "1.0",
"funcName": "CreateCryptoAdapterObject",
"soName": "libdevicemanager_crypto_adapter.z.so",
- "soPath": "/system/lib/"
+ "soPath": "/usr/lib64/"
},
{
"name": "device_decision",
@@ -37,7 +37,7 @@ const std::string adapterJsonConfigString =
"version": "1.0",
"funcName": "CreateDeviceDecisionObject",
"soName": "libdevicemanagerext_decision.z.so",
- "soPath": "/system/lib/"
+ "soPath": "/usr/lib64/"
}
]
})";
@@ -52,7 +52,7 @@ const std::string authJsonConfigString =
"authType": 1,
"funcName": "CreatePinAuthObject",
"soName": "libdevicemanagerext_pin_auth.z.so",
- "soPath": "/system/lib/"
+ "soPath": "/usr/lib64/"
},
{
"name": "QRcode_auth",
@@ -61,7 +61,7 @@ const std::string authJsonConfigString =
"authType": 2,
"funcName": "CreateQRcodeAuthObject",
"soName": "libdevicemanager_qrcodeauth.z.so",
- "soPath": "/system/lib/"
+ "soPath": "/usr/lib64/"
},
{
"name": "nfc_auth",
@@ -70,7 +70,7 @@ const std::string authJsonConfigString =
"authType": 3,
"funcName": "CreateNfcAuthObject",
"soName": "libdevicemanager_nfcauth.z.so",
- "soPath": "/system/lib/"
+ "soPath": "/usr/lib64/"
},
{
"name": "no_interaction_auth",
@@ -79,7 +79,7 @@ const std::string authJsonConfigString =
"authType": 4,
"funcName": "CreatePinAuthObject",
"soName": "libdevicemanagerext_no_interaction_auth.z.so",
- "soPath": "/system/lib/"
+ "soPath": "/usr/lib64/"
}
]
})";
diff --git a/services/implementation/include/device_manager_service_impl.h b/services/implementation/include/device_manager_service_impl.h
index 0eec829..b1064f7 100644
--- a/services/implementation/include/device_manager_service_impl.h
+++ b/services/implementation/include/device_manager_service_impl.h
@@ -21,7 +21,7 @@
#include "dm_ability_manager.h"
#include "dm_auth_manager.h"
-#include "dm_common_event_manager.h"
+//#include "dm_common_event_manager.h"
#include "dm_credential_manager.h"
#include "dm_device_info.h"
#include "dm_device_state_manager.h"
@@ -100,7 +100,7 @@ private:
std::shared_ptr<DmAbilityManager> abilityMgr_;
std::shared_ptr<HiChainConnector> hiChainConnector_;
std::shared_ptr<DmCredentialManager> credentialMgr_;
- std::shared_ptr<DmCommonEventManager> commonEventManager_;
+ //std::shared_ptr<DmCommonEventManager> commonEventManager_;
};
using CreateDMServiceFuncPtr = IDeviceManagerServiceImpl *(*)(void);
diff --git a/services/implementation/src/authentication/dm_auth_manager.cpp b/services/implementation/src/authentication/dm_auth_manager.cpp
index 4b0fbd9..5a23b4e 100644
--- a/services/implementation/src/authentication/dm_auth_manager.cpp
+++ b/services/implementation/src/authentication/dm_auth_manager.cpp
@@ -443,6 +443,7 @@ void DmAuthManager::StartNegotiate(const int32_t &sessionId)
LOGI("DmAuthManager::StartNegotiate session id is %d", sessionId);
char localDeviceId[DEVICE_UUID_LENGTH] = {0};
GetDevUdid(localDeviceId, DEVICE_UUID_LENGTH);
+
authRequestContext_->localDeviceId = localDeviceId;
authResponseContext_->localDeviceId = localDeviceId;
authResponseContext_->reply = ERR_DM_AUTH_REJECT;
@@ -940,4 +941,4 @@ bool DmAuthManager::IsIdenticalAccount()
return true;
}
} // namespace DistributedHardware
-} // namespace OHOS
\ No newline at end of file
+} // namespace OHOS
diff --git a/services/implementation/src/authentication/showconfirm/standard/show_confirm.cpp b/services/implementation/src/authentication/showconfirm/standard/show_confirm.cpp
index 37ec3b5..68d6e77 100644
--- a/services/implementation/src/authentication/showconfirm/standard/show_confirm.cpp
+++ b/services/implementation/src/authentication/showconfirm/standard/show_confirm.cpp
@@ -34,6 +34,9 @@ void ShowConfirm::ShowConfirmDialog(const std::string &params, std::shared_ptr<D
std::shared_ptr<DmAbilityManager> dmAbilityMgr)
{
LOGI("ShowConfirm hap start");
+ LOGI("TEST CONFIRM OK..");
+ authManager->OnUserOperation(0,params);
+ /*
if (dmAbilityMgr == nullptr) {
LOGE("ShowConfirm::dmAbilityManager is null");
return;
@@ -42,8 +45,8 @@ void ShowConfirm::ShowConfirmDialog(const std::string &params, std::shared_ptr<D
if (status != AbilityStatus::ABILITY_STATUS_SUCCESS) {
LOGE("ShowConfirm::start ui service fail");
return;
- }
+ }*/
LOGI("ShowConfirm hap end");
}
} // namespace DistributedHardware
-} // namespace OHOS
\ No newline at end of file
+} // namespace OHOS
diff --git a/services/implementation/src/device_manager_service_impl.cpp b/services/implementation/src/device_manager_service_impl.cpp
index a78109c..c3a29a0 100644
--- a/services/implementation/src/device_manager_service_impl.cpp
+++ b/services/implementation/src/device_manager_service_impl.cpp
@@ -23,11 +23,11 @@
#include "dm_log.h"
#include "multiple_user_connector.h"
#include "permission_manager.h"
-#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
-#include "dm_common_event_manager.h"
-#include "common_event_support.h"
-using namespace OHOS::EventFwk;
-#endif
+//#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
+//#include "dm_common_event_manager.h"
+//#include "common_event_support.h"
+//using namespace OHOS::EventFwk;
+//#endif
namespace OHOS {
namespace DistributedHardware {
@@ -74,6 +74,7 @@ int32_t DeviceManagerServiceImpl::Initialize(const std::shared_ptr<IDeviceManage
LOGI("get current account user id success");
MultipleUserConnector::SetSwitchOldUserId(userId);
}
+/*
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
if (commonEventManager_ == nullptr) {
commonEventManager_ = std::make_shared<DmCommonEventManager>();
@@ -84,6 +85,7 @@ int32_t DeviceManagerServiceImpl::Initialize(const std::shared_ptr<IDeviceManage
LOGI("subscribe service user switch common event success");
}
#endif
+*/
LOGI("Init success, singleton initialized");
return DM_OK;
}
@@ -91,9 +93,11 @@ int32_t DeviceManagerServiceImpl::Initialize(const std::shared_ptr<IDeviceManage
void DeviceManagerServiceImpl::Release()
{
LOGI("DeviceManagerServiceImpl Release");
+/*
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
commonEventManager_ = nullptr;
#endif
+*/
softbusConnector_->GetSoftbusSession()->UnRegisterSessionCallback();
hiChainConnector_->UnRegisterHiChainCallback();
authMgr_ = nullptr;
@@ -108,10 +112,12 @@ void DeviceManagerServiceImpl::Release()
int32_t DeviceManagerServiceImpl::StartDeviceDiscovery(const std::string &pkgName, const DmSubscribeInfo &subscribeInfo,
const std::string &extra)
{
+/*
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return ERR_DM_NO_PERMISSION;
}
+*/
if (pkgName.empty()) {
LOGE("StartDeviceDiscovery failed, pkgName is empty");
return ERR_DM_INPUT_PARA_INVALID;
@@ -121,10 +127,12 @@ int32_t DeviceManagerServiceImpl::StartDeviceDiscovery(const std::string &pkgNam
int32_t DeviceManagerServiceImpl::StopDeviceDiscovery(const std::string &pkgName, uint16_t subscribeId)
{
+/*
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return ERR_DM_NO_PERMISSION;
}
+*/
if (pkgName.empty()) {
LOGE("StopDeviceDiscovery failed, pkgName is empty");
return ERR_DM_INPUT_PARA_INVALID;
@@ -134,10 +142,12 @@ int32_t DeviceManagerServiceImpl::StopDeviceDiscovery(const std::string &pkgName
int32_t DeviceManagerServiceImpl::PublishDeviceDiscovery(const std::string &pkgName, const DmPublishInfo &publishInfo)
{
+/*
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return ERR_DM_NO_PERMISSION;
}
+*/
if (pkgName.empty()) {
LOGE("PublishDeviceDiscovery failed, pkgName is empty");
return ERR_DM_INPUT_PARA_INVALID;
@@ -147,10 +157,12 @@ int32_t DeviceManagerServiceImpl::PublishDeviceDiscovery(const std::string &pkgN
int32_t DeviceManagerServiceImpl::UnPublishDeviceDiscovery(const std::string &pkgName, int32_t publishId)
{
+/*
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return ERR_DM_NO_PERMISSION;
}
+*/
if (pkgName.empty()) {
LOGE("UnPublishDeviceDiscovery failed, pkgName is empty");
return ERR_DM_INPUT_PARA_INVALID;
@@ -161,10 +173,12 @@ int32_t DeviceManagerServiceImpl::UnPublishDeviceDiscovery(const std::string &pk
int32_t DeviceManagerServiceImpl::AuthenticateDevice(const std::string &pkgName, int32_t authType,
const std::string &deviceId, const std::string &extra)
{
+/*
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return ERR_DM_NO_PERMISSION;
}
+*/
if (pkgName.empty() || deviceId.empty()) {
LOGE("DeviceManagerServiceImpl::AuthenticateDevice failed, pkgName is %s, deviceId is %s, extra is %s",
pkgName.c_str(), GetAnonyString(deviceId).c_str(), extra.c_str());
@@ -175,10 +189,12 @@ int32_t DeviceManagerServiceImpl::AuthenticateDevice(const std::string &pkgName,
int32_t DeviceManagerServiceImpl::UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId)
{
+/*
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return ERR_DM_NO_PERMISSION;
}
+*/
if (pkgName.empty() || deviceId.empty()) {
LOGE("DeviceManagerServiceImpl::AuthenticateDevice failed, pkgName is %s, deviceId is %s",
pkgName.c_str(), GetAnonyString(deviceId).c_str());
@@ -189,10 +205,12 @@ int32_t DeviceManagerServiceImpl::UnAuthenticateDevice(const std::string &pkgNam
int32_t DeviceManagerServiceImpl::VerifyAuthentication(const std::string &authParam)
{
+/*
if (!PermissionManager::GetInstance().CheckPermission()) {
LOGI("The caller does not have permission to call");
return ERR_DM_NO_PERMISSION;
}
+*/
return authMgr_->VerifyAuthentication(authParam);
}
@@ -391,7 +409,7 @@ int32_t DeviceManagerServiceImpl::NotifyEvent(const std::string &pkgName, const
void DeviceManagerServiceImpl::LoadHardwareFwkService()
{
- DmDistributedHardwareLoad::GetInstance().LoadDistributedHardwareFwk();
+ //DmDistributedHardwareLoad::GetInstance().LoadDistributedHardwareFwk();
}
extern "C" IDeviceManagerServiceImpl *CreateDMServiceObject(void)
diff --git a/services/implementation/src/devicestate/dm_device_state_manager.cpp b/services/implementation/src/devicestate/dm_device_state_manager.cpp
index 26f72db..b9571e1 100644
--- a/services/implementation/src/devicestate/dm_device_state_manager.cpp
+++ b/services/implementation/src/devicestate/dm_device_state_manager.cpp
@@ -18,7 +18,7 @@
#include "dm_adapter_manager.h"
#include "dm_anonymous.h"
#include "dm_constants.h"
-#include "dm_distributed_hardware_load.h"
+//#include "dm_distributed_hardware_load.h"
#include "dm_log.h"
namespace OHOS {
@@ -29,7 +29,7 @@ DmDeviceStateManager::DmDeviceStateManager(std::shared_ptr<SoftbusConnector> sof
std::shared_ptr<IDeviceManagerServiceListener> listener, std::shared_ptr<HiChainConnector> hiChainConnector)
: softbusConnector_(softbusConnector), listener_(listener), hiChainConnector_(hiChainConnector)
{
- decisionSoName_ = "libdevicemanagerext_decision.z.so";
+ decisionSoName_ = "libdevicemanagerext_decision.so";
StartEventThread();
LOGI("DmDeviceStateManager constructor");
}
@@ -192,7 +192,7 @@ void DmDeviceStateManager::OnDbReady(const std::string &pkgName, const std::stri
}
saveInfo = iter->second;
}
- DmDistributedHardwareLoad::GetInstance().LoadDistributedHardwareFwk();
+ //DmDistributedHardwareLoad::GetInstance().LoadDistributedHardwareFwk();
if (listener_ != nullptr) {
DmDeviceState state = DEVICE_INFO_READY;
listener_->OnDeviceStateChange(pkgName, state, saveInfo);
@@ -380,4 +380,4 @@ int32_t DmDeviceStateManager::ProcNotifyEvent(const std::string &pkgName, const
return AddTask(std::make_shared<NotifyEvent>(eventId, deviceId));
}
} // namespace DistributedHardware
-} // namespace OHOS
\ No newline at end of file
+} // namespace OHOS
diff --git a/services/service/BUILD.gn b/services/service/BUILD.gn
index bb353c1..3714eab 100644
--- a/services/service/BUILD.gn
+++ b/services/service/BUILD.gn
@@ -112,10 +112,10 @@ if (defined(ohos_lite)) {
"//third_party/mbedtls",
]
- external_deps = [
- "hisysevent_native:libhisysevent",
- "hitrace_native:hitrace_meter",
- ]
+ #external_deps = [
+ # "hisysevent_native:libhisysevent",
+ # "hitrace_native:hitrace_meter",
+ #]
}
} else {
executable("devicemanagerservice") {
@@ -180,10 +180,10 @@ if (defined(ohos_lite)) {
]
}
}
-} else if (!support_jsapi) {
- group("devicemanagerservice") {
- deps = []
- }
+#} else if (!support_jsapi) {
+# group("devicemanagerservice") {
+# deps = []
+# }
} else {
config("devicemanagerservice_config") {
include_dirs = [
diff --git a/services/service/include/ipc/standard/ipc_server_listener.h b/services/service/include/ipc/standard/ipc_server_listener.h
index 0ff7bb8..abfa0fc 100644
--- a/services/service/include/ipc/standard/ipc_server_listener.h
+++ b/services/service/include/ipc/standard/ipc_server_listener.h
@@ -17,7 +17,9 @@
#define OHOS_DM_IPC_SERVER_LISTENER_H
#include <cstdint>
-
+#include <stdlib.h>
+#include <stdint.h>
+#include <memory>
#include "ipc_req.h"
#include "ipc_rsp.h"
diff --git a/services/service/src/device_manager_service_listener.cpp b/services/service/src/device_manager_service_listener.cpp
index 567b427..993b820 100644
--- a/services/service/src/device_manager_service_listener.cpp
+++ b/services/service/src/device_manager_service_listener.cpp
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+#include <memory>
#include "device_manager_service_listener.h"
#include "dm_constants.h"
diff --git a/services/service/src/ipc/standard/ipc_server_listener.cpp b/services/service/src/ipc/standard/ipc_server_listener.cpp
index 513b1fd..74137d0 100644
--- a/services/service/src/ipc/standard/ipc_server_listener.cpp
+++ b/services/service/src/ipc/standard/ipc_server_listener.cpp
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+#include <memory>
#include "ipc_server_listener.h"
#include "dm_constants.h"
diff --git a/utils/BUILD.gn b/utils/BUILD.gn
index 0d231c7..acd5697 100644
--- a/utils/BUILD.gn
+++ b/utils/BUILD.gn
@@ -181,10 +181,10 @@ if (defined(ohos_lite)) {
deps = [ "//third_party/mbedtls:mbedtls_shared" ]
external_deps = [
- "access_token:libaccesstoken_sdk",
+ #"access_token:libaccesstoken_sdk",
"c_utils:utils",
- "hisysevent_native:libhisysevent",
- "hitrace_native:hitrace_meter",
+ #"hisysevent_native:libhisysevent",
+ #"hitrace_native:hitrace_meter",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"samgr:samgr_proxy",
--
2.33.0

View File

@ -0,0 +1,215 @@
From 4c65e5a05c65fab987ca8669678d701e284138c8 Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 20 Jun 2023 18:43:58 +0800
Subject: [PATCH] remove dependency and adapt for build
---
.../messenger_device_status_manager.cpp | 1 +
services/dfx/BUILD.gn | 4 +-
services/dfx/dslm_bigdata.cpp | 71 ++++++++++---------
services/dfx/dslm_hitrace.cpp | 28 +++++---
4 files changed, 57 insertions(+), 47 deletions(-)
diff --git a/baselib/msglib/src/standard/messenger_device_status_manager.cpp b/baselib/msglib/src/standard/messenger_device_status_manager.cpp
index 955f9ca..fdb2bc9 100644
--- a/baselib/msglib/src/standard/messenger_device_status_manager.cpp
+++ b/baselib/msglib/src/standard/messenger_device_status_manager.cpp
@@ -19,6 +19,7 @@
#include <memory>
#include <mutex>
#include <string>
+#include <functional>
#include "device_manager.h"
#include "securec.h"
diff --git a/services/dfx/BUILD.gn b/services/dfx/BUILD.gn
index cea9105..bccaea7 100644
--- a/services/dfx/BUILD.gn
+++ b/services/dfx/BUILD.gn
@@ -33,8 +33,8 @@ ohos_source_set("dslm_extension_dfx") {
external_deps = [
"c_utils:utils",
"hilog_native:libhilog",
- "hisysevent_native:libhisysevent",
- "hitrace_native:hitrace_meter",
+ # "hisysevent_native:libhisysevent",
+ # "hitrace_native:hitrace_meter",
]
configs = [ "//base/security/device_security_level/common:common_configs" ]
diff --git a/services/dfx/dslm_bigdata.cpp b/services/dfx/dslm_bigdata.cpp
index 9965fe1..caead97 100644
--- a/services/dfx/dslm_bigdata.cpp
+++ b/services/dfx/dslm_bigdata.cpp
@@ -14,40 +14,42 @@
*/
#include "dslm_bigdata.h"
-#include "hisysevent.h"
+// #include "hisysevent.h"
#ifdef __cplusplus
extern "C" {
#endif
-namespace {
-constexpr char STR_EVENT_START_FAILED[] = "SERVICE_START_FAILED";
-constexpr char STR_EVENT_INIT_SELF_LEVEL_FAULT[] = "INIT_SELF_LEVEL_FAULT";
-constexpr char STR_EVENT_CALL_INTERFACE[] = "CALL_INTERFACE";
-constexpr char STR_EVENT_QUERY_INFO[] = "QUERY_INFO";
-constexpr char STR_ERROR_TYPE[] = "ERROR_TYPE";
-constexpr char STR_ERROR_STR[] = "ERROR_STR";
-constexpr char STR_USER_ID[] = "USER_ID";
-constexpr char STR_COST_TIME[] = "COST_TIME";
-constexpr char STR_RET_CODE[] = "RET_CODE";
-constexpr char STR_SEC_LEVEL[] = "SEC_LEVEL";
-constexpr char STR_RET_MODE[] = "RET_MODE";
-constexpr char STR_LOCAL_MODEL[] = "LOCAL_MODEL";
-constexpr char STR_TARGET_MODEL[] = "TARGET_MODEL";
-constexpr char STR_PKG_NAME[] = "PKG_NAME";
-constexpr char STR_LOCAL_VERSION[] = "LOCAL_VERSION";
-constexpr char STR_TARGET_VERSION[] = "TARGET_VERSION";
-constexpr char STR_CRED_TYPE[] = "CRED_TYPE";
-} // namespace
+// namespace {
+// constexpr char STR_EVENT_START_FAILED[] = "SERVICE_START_FAILED";
+// constexpr char STR_EVENT_INIT_SELF_LEVEL_FAULT[] = "INIT_SELF_LEVEL_FAULT";
+// constexpr char STR_EVENT_CALL_INTERFACE[] = "CALL_INTERFACE";
+// constexpr char STR_EVENT_QUERY_INFO[] = "QUERY_INFO";
+// constexpr char STR_ERROR_TYPE[] = "ERROR_TYPE";
+// constexpr char STR_ERROR_STR[] = "ERROR_STR";
+// constexpr char STR_USER_ID[] = "USER_ID";
+// constexpr char STR_COST_TIME[] = "COST_TIME";
+// constexpr char STR_RET_CODE[] = "RET_CODE";
+// constexpr char STR_SEC_LEVEL[] = "SEC_LEVEL";
+// constexpr char STR_RET_MODE[] = "RET_MODE";
+// constexpr char STR_LOCAL_MODEL[] = "LOCAL_MODEL";
+// constexpr char STR_TARGET_MODEL[] = "TARGET_MODEL";
+// constexpr char STR_PKG_NAME[] = "PKG_NAME";
+// constexpr char STR_LOCAL_VERSION[] = "LOCAL_VERSION";
+// constexpr char STR_TARGET_VERSION[] = "TARGET_VERSION";
+// constexpr char STR_CRED_TYPE[] = "CRED_TYPE";
+// } // namespace
void ReportServiceStartFailedEvent(const uint32_t errorType)
{
- HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::DSLM, STR_EVENT_START_FAILED,
- OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, STR_ERROR_TYPE, errorType);
+ return;
+ // HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::DSLM, STR_EVENT_START_FAILED,
+ // OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, STR_ERROR_TYPE, errorType);
}
void ReportInitSelfFailedEvent(const char *errorString)
{
- HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::DSLM, STR_EVENT_INIT_SELF_LEVEL_FAULT,
- OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, STR_ERROR_STR, errorString);
+ return;
+ // HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::DSLM, STR_EVENT_INIT_SELF_LEVEL_FAULT,
+ // OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, STR_ERROR_STR, errorString);
}
void ReportAppInvokeEvent(const AppInvokeEvent *event)
@@ -56,10 +58,11 @@ void ReportAppInvokeEvent(const AppInvokeEvent *event)
return;
}
- HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::DSLM, STR_EVENT_CALL_INTERFACE,
- OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, STR_USER_ID, event->uid, STR_COST_TIME, event->costTime,
- STR_RET_CODE, event->retCode, STR_SEC_LEVEL, event->secLevel, STR_RET_MODE, event->retMode, STR_LOCAL_MODEL,
- event->localModel, STR_TARGET_MODEL, event->targetModel, STR_PKG_NAME, event->pkgName);
+ return;
+ // HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::DSLM, STR_EVENT_CALL_INTERFACE,
+ // OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, STR_USER_ID, event->uid, STR_COST_TIME, event->costTime,
+ // STR_RET_CODE, event->retCode, STR_SEC_LEVEL, event->secLevel, STR_RET_MODE, event->retMode, STR_LOCAL_MODEL,
+ // event->localModel, STR_TARGET_MODEL, event->targetModel, STR_PKG_NAME, event->pkgName);
}
void ReportSecurityInfoSyncEvent(const SecurityInfoSyncEvent *event)
@@ -67,12 +70,12 @@ void ReportSecurityInfoSyncEvent(const SecurityInfoSyncEvent *event)
if (event == nullptr) {
return;
}
-
- HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::DSLM, STR_EVENT_QUERY_INFO,
- OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, STR_LOCAL_MODEL, event->localModel, STR_TARGET_MODEL,
- event->targetModel, STR_LOCAL_VERSION, event->localVersion, STR_TARGET_VERSION, event->targetVersion,
- STR_CRED_TYPE, event->credType, STR_RET_CODE, event->retCode, STR_COST_TIME, event->costTime, STR_SEC_LEVEL,
- event->secLevel);
+ return;
+ // HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::DSLM, STR_EVENT_QUERY_INFO,
+ // OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, STR_LOCAL_MODEL, event->localModel, STR_TARGET_MODEL,
+ // event->targetModel, STR_LOCAL_VERSION, event->localVersion, STR_TARGET_VERSION, event->targetVersion,
+ // STR_CRED_TYPE, event->credType, STR_RET_CODE, event->retCode, STR_COST_TIME, event->costTime, STR_SEC_LEVEL,
+ // event->secLevel);
}
#ifdef __cplusplus
diff --git a/services/dfx/dslm_hitrace.cpp b/services/dfx/dslm_hitrace.cpp
index e610db8..727926d 100644
--- a/services/dfx/dslm_hitrace.cpp
+++ b/services/dfx/dslm_hitrace.cpp
@@ -15,7 +15,7 @@
#include "dslm_hitrace.h"
-#include "hitrace_meter.h"
+// #include "hitrace_meter.h"
#ifdef __cplusplus
extern "C" {
@@ -23,37 +23,43 @@ extern "C" {
void DslmStartProcessTrace(const char *value)
{
- StartTrace(HITRACE_TAG_DLSM, std::string(value));
+ return;
+ // StartTrace(HITRACE_TAG_DLSM, std::string(value));
}
void DslmStartStateMachineTrace(uint32_t machineId, uint32_t event)
{
- std::string traceValue =
- std::string("StartStateMachine_") + std::to_string(machineId) + "_" + std::to_string(event);
+ return;
+ // std::string traceValue =
+ // std::string("StartStateMachine_") + std::to_string(machineId) + "_" + std::to_string(event);
- StartTrace(HITRACE_TAG_DLSM, traceValue);
+ // StartTrace(HITRACE_TAG_DLSM, traceValue);
}
void DslmFinishProcessTrace(void)
{
- FinishTrace(HITRACE_TAG_DLSM);
+ return;
+ // FinishTrace(HITRACE_TAG_DLSM);
}
void DslmStartProcessTraceAsync(const char *value, uint32_t owner, uint32_t cookie)
{
- std::string traceValue = std::string(value) + "_" + std::to_string(owner) + "_" + std::to_string(cookie);
- StartAsyncTrace(HITRACE_TAG_DLSM, traceValue, cookie);
+ return;
+ // std::string traceValue = std::string(value) + "_" + std::to_string(owner) + "_" + std::to_string(cookie);
+ // StartAsyncTrace(HITRACE_TAG_DLSM, traceValue, cookie);
}
void DslmFinishProcessTraceAsync(const char *value, uint32_t owner, uint32_t cookie)
{
- std::string traceValue = std::string(value) + "_" + std::to_string(owner) + "_" + std::to_string(cookie);
- FinishAsyncTrace(HITRACE_TAG_DLSM, traceValue, cookie);
+ return;
+ // std::string traceValue = std::string(value) + "_" + std::to_string(owner) + "_" + std::to_string(cookie);
+ // FinishAsyncTrace(HITRACE_TAG_DLSM, traceValue, cookie);
}
void DslmCountTrace(const char *name, int64_t count)
{
- CountTrace(HITRACE_TAG_DLSM, std::string(name), count);
+ return;
+ // CountTrace(HITRACE_TAG_DLSM, std::string(name), count);
}
#ifdef __cplusplus
--
2.33.0

View File

@ -0,0 +1,47 @@
From f22b729a9ea46420fc31fd630e7182120decd721 Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 27 Jun 2023 17:11:34 +0800
Subject: [PATCH] increase the pthread stack size of x86 and other env
---
adapter/common/kernel/posix/softbus_adapter_thread.c | 3 ++-
core/common/message_handler/message_handler.c | 8 --------
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/adapter/common/kernel/posix/softbus_adapter_thread.c b/adapter/common/kernel/posix/softbus_adapter_thread.c
index f6c65e856..33eeaa922 100644
--- a/adapter/common/kernel/posix/softbus_adapter_thread.c
+++ b/adapter/common/kernel/posix/softbus_adapter_thread.c
@@ -273,7 +273,8 @@ static int32_t SoftBusConfTransPthreadAttr(SoftBusThreadAttr *threadAttr, pthrea
if (stackSize != 0) {
ret = pthread_attr_setstacksize(attr, stackSize);
if (ret != 0) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "pthread_attr_setstacksize failed, ret[%{public}d]", ret);
+ HILOG_ERROR(SOFTBUS_HILOG_ID, "pthread_attr_setstacksize failed, stacksize[%{public}lu], ret[%{public}d]",
+ stackSize, ret);
return SOFTBUS_ERR;
}
}
diff --git a/core/common/message_handler/message_handler.c b/core/common/message_handler/message_handler.c
index d83ca3e89..12a2be117 100644
--- a/core/common/message_handler/message_handler.c
+++ b/core/common/message_handler/message_handler.c
@@ -196,15 +196,7 @@ static void *LoopTask(void *arg)
static int StartNewLooperThread(SoftBusLooper *looper)
{
-#ifdef __aarch64__
#define MAINLOOP_STACK_SIZE (2 * 1024 * 1024)
-#else
-#ifdef ASAN_BUILD
-#define MAINLOOP_STACK_SIZE 10240
-#else
-#define MAINLOOP_STACK_SIZE 8192
-#endif
-#endif
int ret;
SoftBusThreadAttr threadAttr;
SoftBusThread tid;
--
2.33.0

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
distributed-beget.tar.gz Normal file

Binary file not shown.

226
distributed-utils.spec Normal file
View File

@ -0,0 +1,226 @@
%define debug_package %{nil}
%global oh_version OpenHarmony-v3.2-Release
%global c_utils_dir %{_builddir}/commonlibrary/c_utils
%global config_policy_dir %{_builddir}/base/customization/config_policy
%global dsoftbus_dir %{_builddir}/foundation/communication/dsoftbus
%global eventhandler_dir %{_builddir}/base/notification/eventhandler
%global init_dir %{_builddir}/base/startup/init
%global ipc_dir %{_builddir}/foundation/communication/ipc
%global safwk_dir %{_builddir}/foundation/systemabilitymgr/safwk
%global samgr_dir %{_builddir}/foundation/systemabilitymgr/samgr
%global sqlite_dir %{_builddir}/third_party/sqlite
%global libcoap_dir %{_builddir}/third_party/libcoap
%global huks_dir %{_builddir}/base/security/huks
%global device_auth_dir %{_builddir}/base/security/device_auth
%global mbedtls_dir %{_builddir}/third_party/mbedtls
%global device_manager_dir %{_builddir}/foundation/distributedhardware/device_manager
%global json_dir %{_builddir}/third_party/json
%global dataclassification_dir %{_builddir}/base/security/dataclassification
%global device_security_level_dir %{_builddir}/base/security/device_security_level
%global build_opt /opt/distributed-middleware-build
Name: distributed-utils
Version: 1.0.0
Release: 4
Summary: Distributed middleware used components.
License: Apache-2.0 and MIT
Url: https://gitee.com/openharmony/
Source0: https://gitee.com/openharmony/commonlibrary_c_utils/repository/archive/openHarmony-v3.2-Release.tar.gz #/commonlibrary_c_utils-OpenHarmony-v3.2-Release.tar.gz
Source1: https://gitee.com/openharmony/customization_config_policy/repository/archive/openHarmony-v3.2-Release.tar.gz #/customization_config_policy-OpenHarmony-v3.2-Release.tar.gz
Source2: https://gitee.com/openharmony/communication_dsoftbus/repository/archive/openHarmony-v3.2-Release.tar.gz #/communication_dsoftbus-OpenHarmony-v3.2-Release.tar.gz
Source3: https://gitee.com/openharmony/notification_eventhandler/repository/archive/openHarmony-v3.2-Release.tar.gz #/notification_eventhandler-OpenHarmony-v3.2-Release.tar.gz
Source4: https://gitee.com/openeuler/distributed-beget/repository/archive/distributed-beget.tar.gz
Source5: https://gitee.com/openharmony/communication_ipc/repository/archive/openHarmony-v3.2-Release.tar.gz #/communication_ipc-OpenHarmony-v3.2-Release.tar.gz
Source6: https://gitee.com/openharmony/systemabilitymgr_safwk/repository/archive/openHarmony-v3.2-Release.tar.gz #/systemabilitymgr_safwk-OpenHarmony-v3.2-Release.tar.gz
Source7: https://gitee.com/openharmony/systemabilitymgr_samgr/repository/archive/openHarmony-v3.2-Release.tar.gz #/systemabilitymgr_samgr-OpenHarmony-v3.2-Release.tar.gz
Source8: https://gitee.com/openharmony/third_party_sqlite/repository/archive/openHarmony-v3.2-Release.tar.gz #/third_party_sqlite-OpenHarmony-v3.2-Release.tar.gz
Source9: https://gitee.com/openharmony/third_party_libcoap/repository/archive/openHarmony-v3.2-Release.tar.gz #/third_party_libcoap-OpenHarmony-v3.2-Release.tar.gz
Source10: https://gitee.com/openharmony/security_huks/repository/archive/openHarmony-v3.2-Release.tar.gz #/security_huks-OpenHarmony-v3.2-Release.tar.gz
Source11: https://gitee.com/openharmony/security_device_auth/repository/archive/openHarmony-v3.2-Release.tar.gz #/security_device_auth-OpenHarmony-v3.2-Release.tar.gz
Source12: https://gitee.com/openharmony/third_party_mbedtls/repository/archive/openHarmony-v3.2-Release.tar.gz #/third_party_mbedtls-OpenHarmony-v3.2-Release.tar.gz
Source13: https://gitee.com/openharmony/distributedhardware_device_manager/repository/archive/openHarmony-v3.2-Release.tar.gz #/distributedhardware_device_manager-OpenHarmony-v3.2-Release.tar.gz
Source14: https://gitee.com/openharmony/third_party_json/repository/archive/openHarmony-v3.2-Release.tar.gz #/third_party_json-OpenHarmony-v3.2-Release.tar.gz
Source15: https://gitee.com/openharmony/security_dataclassification/repository/archive/openHarmony-v3.2-Release.tar.gz #/security_dataclassification-OpenHarmony-v3.2-Release.tar.gz
Source16: https://gitee.com/openharmony/security_device_security_level/repository/archive/openHarmony-v3.2-Release.tar.gz #/security_device_security_level-OpenHarmony-v3.2-Release.tar.gz
Patch0: 0000-adapt-for-build-c_utils.patch
Patch1: 0001-remove-dependency-and-adpat-for-build-config_policy.patch
Patch2: 0002-remove-dependency-and-adapt-for-openeuler-dsoftbus.patch
Patch3: 0003-remove-dependency-and-adapt-for-build-eventhandler.patch
Patch4: 0004-remove-dependency-and-adapt-for-build-ipc.patch
Patch5: 0005-remove-dependency-on-hitrace-safwk.patch
Patch6: 0006-remove-dependency-and-adapt-for-build-samgr.patch
Patch7: 0007-adapt-for-build-sqlite.patch
Patch8: 0008-remove-dependency-and-adapt-for-build-huks.patch
Patch9: 0009-remove-dependency-and-adapt-for-build-device_auth.patch
Patch10: 0010-adapt-for-build-mbedtls.patch
Patch11: 0011-remove-dependency-and-adapt-for-build-device_manager.patch
Patch12: 0012-remove-dependency-and-adapt-for-build-device_security_level.patch
Patch13: 0013-increase-the-pthread-stack-size-of-x86-and-other-env-dsoftbus.patch
BuildRequires: python3-jinja2 python3-pyyaml cjson cjson-devel
BuildRequires: libatomic libicu-devel libxml2-devel openssl-devel
BuildRequires: distributed-build hilog
Requires: hilog python3-jinja2 python3-pyyaml cjson cjson-devel libatomic libicu-devel libxml2-devel openssl-devel
%description
Tools used by distributed middleware.
# Generate directory structure for build.
%prep
rm -rf %{_builddir}/*
cp -rp %{build_opt} %{_builddir}/build
[ ! -L "%{_builddir}/build.sh" ] && ln -s %{_builddir}/build/build_scripts/build.sh %{_builddir}/build.sh
[ ! -L "%{_builddir}/.gn" ] && ln -s %{_builddir}/build/core/gn/dotfile.gn %{_builddir}/.gn
[ ! -L "%{_builddir}/build.py" ] && ln -s %{_builddir}/build/lite/build.py %{_builddir}/build.py
cp -r %{_builddir}/build/openeuler/vendor %{_builddir}/
cp -r %{_builddir}/build/openeuler/compiler_gn/third_party %{_builddir}/
cp -rf %{_builddir}/build/openeuler/compiler_gn/base %{_builddir}/
rm -rf %{_builddir}/third_party/mbedtls/*
%setup -q -D -T -a 0 -c -n %{c_utils_dir}/..
%setup -q -D -T -a 1 -c -n %{config_policy_dir}/..
%setup -q -D -T -a 2 -c -n %{dsoftbus_dir}/..
%setup -q -D -T -a 3 -c -n %{eventhandler_dir}/..
%setup -q -D -T -a 4 -c -n %{init_dir}/..
%setup -q -D -T -a 5 -c -n %{ipc_dir}/..
%setup -q -D -T -a 6 -c -n %{safwk_dir}/..
%setup -q -D -T -a 7 -c -n %{samgr_dir}/..
%setup -q -D -T -a 8 -c -n %{sqlite_dir}/..
%setup -q -D -T -a 9 -c -n %{libcoap_dir}/..
%setup -q -D -T -a 10 -c -n %{huks_dir}/..
%setup -q -D -T -a 11 -c -n %{device_auth_dir}/..
%setup -q -D -T -a 12 -c -n %{mbedtls_dir}/..
%setup -q -D -T -a 13 -c -n %{device_manager_dir}/..
%setup -q -D -T -a 14 -c -n %{json_dir}/..
%setup -q -D -T -a 15 -c -n %{dataclassification_dir}/..
%setup -q -D -T -a 16 -c -n %{device_security_level_dir}/..
%patch0 -p1 -d %{c_utils_dir}
%patch1 -p1 -d %{config_policy_dir}
%patch2 -p1 -d %{dsoftbus_dir}
%patch3 -p1 -d %{eventhandler_dir}
%patch4 -p1 -d %{ipc_dir}
%patch5 -p1 -d %{safwk_dir}
%patch6 -p1 -d %{samgr_dir}
%patch7 -p1 -d %{sqlite_dir}
%patch8 -p1 -d %{huks_dir}
%patch9 -p1 -d %{device_auth_dir}
%patch10 -p1 -d %{mbedtls_dir}
%patch11 -p1 -d %{device_manager_dir}
%patch12 -p1 -d %{device_security_level_dir}
%patch13 -p1 -d %{dsoftbus_dir}
# build all components with build.sh
%build
cd %{_builddir}
rm -rf %{_builddir}/out
%ifarch x86_64
./build.sh --product-name openeuler --target-cpu x86_64
%endif
%ifarch aarch64
./build.sh --product-name openeuler --target-cpu arm64
%endif
%install
install -d -m 0755 %{buildroot}/system/lib64
install -d -m 0755 %{buildroot}/system/bin
install -d -m 0755 %{buildroot}/usr/lib64
install -d -m 0755 %{buildroot}/usr/bin
install -d -m 0755 %{buildroot}%{_includedir}/c_utils
install -d -m 0755 %{buildroot}%{_includedir}/config_policy
install -d -m 0755 %{buildroot}%{_includedir}/dsoftbus
install -d -m 0755 %{buildroot}%{_includedir}/eventhandler
install -d -m 0755 %{buildroot}%{_includedir}/init
install -d -m 0755 %{buildroot}%{_includedir}/ipc
install -d -m 0755 %{buildroot}%{_includedir}/safwk
install -d -m 0755 %{buildroot}%{_includedir}/samgr
install -d -m 0755 %{buildroot}%{_includedir}/huks
install -d -m 0755 %{buildroot}%{_includedir}/device_auth
install -d -m 0755 %{buildroot}%{_includedir}/device_manager
install -d -m 0755 %{buildroot}%{_includedir}/nlohmann_json
install -d -m 0755 %{buildroot}%{_includedir}/nlohmann_json/single_include
install -d -m 0755 %{buildroot}%{_includedir}/dataclassification
install -d -m 0755 %{buildroot}%{_includedir}/device_security_level
%ifarch aarch64
module_out_path="out/openeuler/linux_clang_arm64"
header_out_path="out/openeuler/innerkits/linux-arm64"
%endif
%ifarch x86_64
module_out_path="out/openeuler/linux_clang_x86_64"
header_out_path="out/openeuler/innerkits/linux-x86_64"
%endif
# copy shared libs and static libs.
pushd %{_builddir}/${module_out_path}
for so_file in $(find . -name *.z.so -type f)
do
cp ${so_file} %{buildroot}/system/lib64
cp ${so_file} %{buildroot}/usr/lib64
done
for a_file in $(find ./ -name *.a -type f)
do
cp ${a_file} %{buildroot}/system/lib64
cp ${a_file} %{buildroot}/usr/lib64
done
rm -rf %{buildroot}/usr/lib64/libhilog_base.a
popd
# copy executable file.
install -m 755 %{_builddir}/out/openeuler/packages/phone/system/bin/* %{buildroot}/system/bin/
install -m 755 %{_builddir}/out/openeuler/packages/phone/system/bin/* %{buildroot}/usr/bin/
# copy header files of component to includedir.
pushd %{_builddir}/${header_out_path}
find c_utils -name *.h -print0 | xargs -0 -i cp -rvf {} %{buildroot}%{_includedir}/c_utils
find config_policy -name *.h -print0 | xargs -0 -i cp -rvf {} %{buildroot}%{_includedir}/config_policy
find dsoftbus -name *.h -print0 | xargs -0 -i cp -rvf {} %{buildroot}%{_includedir}/dsoftbus
cp -f %{dsoftbus_dir}/interfaces/kits/common/softbus_error_code.h %{buildroot}%{_includedir}/dsoftbus/
find eventhandler -name *.h -print0 | xargs -0 -i cp -rvf {} %{buildroot}%{_includedir}/eventhandler
find init -name *.h -print0 | xargs -0 -i cp -rvf {} %{buildroot}%{_includedir}/init
find ipc -name *.h -print0 | xargs -0 -i cp -rvf {} %{buildroot}%{_includedir}/ipc
find safwk -name *.h -print0 | xargs -0 -i cp -rvf {} %{buildroot}%{_includedir}/safwk
find samgr -name *.h -print0 | xargs -0 -i cp -rvf {} %{buildroot}%{_includedir}/samgr
find huks -name *.h -print0 | xargs -0 -i cp -rvf {} %{buildroot}%{_includedir}/huks
find device_auth -name *.h -print0 | xargs -0 -i cp -rvf {} %{buildroot}%{_includedir}/device_auth
find device_manager -name *.h -print0 | xargs -0 -i cp -rvf {} %{buildroot}%{_includedir}/device_manager
find dataclassification -name *.h -print0 | xargs -0 -i cp -rvf {} %{buildroot}%{_includedir}/dataclassification
find device_security_level -name *.h -print0 | xargs -0 -i cp -rvf {} %{buildroot}%{_includedir}/device_security_level
popd
sed -i 's/\"..\/src\/event_reactor.h\"/<c_utils\/event_reactor.h>/g' %{buildroot}%{_includedir}/c_utils/timer.h
cp -f %{c_utils_dir}/base/src/event_reactor.h %{buildroot}%{_includedir}/c_utils
# copy nlohmann_json header file to includedir.
cd %{json_dir}
cp -rvf include/nlohmann %{buildroot}/%{_includedir}/nlohmann_json
cp -rvf single_include/nlohmann %{buildroot}/%{_includedir}/nlohmann_json/single_include
%files
/system/lib64/*
/system/bin/*
/%{_includedir}/*
/usr/lib64/*
/usr/bin/*
%changelog
* Wed Jul 26 2023 Ge Wang <wang__ge@126.com> - 1.0.0-4
- add deficient component.
* Tue Jun 27 2023 Peng He <hepeng68@huawei.com> - 1.0.0-3
- increase the softbus pthread stack size on x86 and other env.
* Sun Jun 25 2023 Peng He <hepeng68@huawei.com> - 1.0.0-2
- add missed libs of device_manager.
* Tue Jun 20 2023 Peng He <hepeng68@huawei.com> - 1.0.0-1
- add components used by distributed middleware.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.