From 6f298398111d76973b6248e0545649cd81bb3f5b Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Mon, 4 Jul 2022 09:52:40 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9dfx=20Signed-off-by:=20?= =?UTF-8?q?wangyb0625=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/implementation/BUILD.gn | 46 +++++++++---------- .../dependency/hichain/hichain_connector.cpp | 1 + services/service/BUILD.gn | 46 +++++++++---------- .../service/src/softbus/softbus_listener.cpp | 1 + test/unittest/BUILD.gn | 20 ++++---- utils/include/dfx/dm_dfx_constants.h | 29 +++++++++++- utils/include/dfx/lite/dm_hitrace.h | 2 + utils/include/dfx/standard/dm_hidumper.h | 1 + utils/include/dfx/standard/dm_hitrace.h | 2 + utils/src/dfx/lite/dm_hitrace.cpp | 10 ++++ utils/src/dfx/standard/dm_hidumper.cpp | 20 ++++++-- utils/src/dfx/standard/dm_hitrace.cpp | 10 ++++ 12 files changed, 126 insertions(+), 62 deletions(-) diff --git a/services/implementation/BUILD.gn b/services/implementation/BUILD.gn index 9497bdb52..4293cc0f5 100644 --- a/services/implementation/BUILD.gn +++ b/services/implementation/BUILD.gn @@ -75,29 +75,29 @@ if (defined(ohos_lite)) { ] sources = [ - "${services_path}/src/ability/lite/dm_ability_manager.cpp", - "${services_path}/src/adapter/standard/dm_adapter_manager.cpp", - "${services_path}/src/authentication/auth_message_processor.cpp", - "${services_path}/src/authentication/auth_request_state.cpp", - "${services_path}/src/authentication/auth_response_state.cpp", - "${services_path}/src/authentication/dm_auth_manager.cpp", - "${services_path}/src/authentication/showconfirm/lite/show_confirm.cpp", - "${services_path}/src/config/mini/dm_config_manager.cpp", - "${services_path}/src/config/mini/pin_auth.cpp", - "${services_path}/src/dependency/hichain/hichain_connector.cpp", - "${services_path}/src/dependency/mini/dm_mutex.cpp", - "${services_path}/src/dependency/mini/dm_thread.cpp", - "${services_path}/src/dependency/multipleuser/multiple_user_connector.cpp", - "${services_path}/src/dependency/softbus/softbus_connector.cpp", - "${services_path}/src/dependency/softbus/softbus_session.cpp", - "${services_path}/src/dependency/timer/mini/dm_timer.cpp", - "${services_path}/src/device_manager_service.cpp", - "${services_path}/src/deviceinfo/dm_device_info_manager.cpp", - "${services_path}/src/devicestate/dm_device_state_manager.cpp", - "${services_path}/src/discovery/dm_discovery_manager.cpp", - "${services_path}/src/dispatch/command_dispatch.cpp", - "${services_path}/src/dispatch/device_manager_service_listener_mini.cpp", - "${services_path}/src/dispatch/server_stub.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", + "${servicesimpl_path}/src/authentication/auth_response_state.cpp", + "${servicesimpl_path}/src/authentication/dm_auth_manager.cpp", + "${servicesimpl_path}/src/authentication/showconfirm/lite/show_confirm.cpp", + "${servicesimpl_path}/src/config/mini/dm_config_manager.cpp", + "${servicesimpl_path}/src/config/mini/pin_auth.cpp", + "${servicesimpl_path}/src/dependency/hichain/hichain_connector.cpp", + "${servicesimpl_path}/src/dependency/mini/dm_mutex.cpp", + "${servicesimpl_path}/src/dependency/mini/dm_thread.cpp", + "${servicesimpl_path}/src/dependency/multipleuser/multiple_user_connector.cpp", + "${servicesimpl_path}/src/dependency/softbus/softbus_connector.cpp", + "${servicesimpl_path}/src/dependency/softbus/softbus_session.cpp", + "${servicesimpl_path}/src/dependency/timer/mini/dm_timer.cpp", + "${servicesimpl_path}/src/device_manager_service.cpp", + "${servicesimpl_path}/src/deviceinfo/dm_device_info_manager.cpp", + "${servicesimpl_path}/src/devicestate/dm_device_state_manager.cpp", + "${servicesimpl_path}/src/discovery/dm_discovery_manager.cpp", + "${servicesimpl_path}/src/dispatch/command_dispatch.cpp", + "${servicesimpl_path}/src/dispatch/device_manager_service_listener_mini.cpp", + "${servicesimpl_path}/src/dispatch/server_stub.cpp", ] defines = [ diff --git a/services/implementation/src/dependency/hichain/hichain_connector.cpp b/services/implementation/src/dependency/hichain/hichain_connector.cpp index 7e5b908d2..a5ad68440 100644 --- a/services/implementation/src/dependency/hichain/hichain_connector.cpp +++ b/services/implementation/src/dependency/hichain/hichain_connector.cpp @@ -271,6 +271,7 @@ void HiChainConnector::onFinish(int64_t requestId, int operationCode, const char LOGI("Create group success"); SysEventWrite(DM_CREATE_GROUP_SUCCESS, DM_HISYEVENT_BEHAVIOR, DM_CREATE_GROUP_SUCCESS_MSG); if (hiChainConnectorCallback_ != nullptr) { + DmStartAsyncTrace(DM_HITRACE_DEVICE_ONLINE); hiChainConnectorCallback_->OnMemberJoin(requestId, DM_OK); hiChainConnectorCallback_->OnGroupCreated(requestId, data); } diff --git a/services/service/BUILD.gn b/services/service/BUILD.gn index ebe2949ac..2fe1b24d0 100644 --- a/services/service/BUILD.gn +++ b/services/service/BUILD.gn @@ -75,29 +75,29 @@ if (defined(ohos_lite)) { ] sources = [ - "${services_path}/src/ability/lite/dm_ability_manager.cpp", - "${services_path}/src/adapter/standard/dm_adapter_manager.cpp", - "${services_path}/src/authentication/auth_message_processor.cpp", - "${services_path}/src/authentication/auth_request_state.cpp", - "${services_path}/src/authentication/auth_response_state.cpp", - "${services_path}/src/authentication/dm_auth_manager.cpp", - "${services_path}/src/authentication/showconfirm/lite/show_confirm.cpp", - "${services_path}/src/config/mini/dm_config_manager.cpp", - "${services_path}/src/config/mini/pin_auth.cpp", - "${services_path}/src/dependency/hichain/hichain_connector.cpp", - "${services_path}/src/dependency/mini/dm_mutex.cpp", - "${services_path}/src/dependency/mini/dm_thread.cpp", - "${services_path}/src/dependency/multipleuser/multiple_user_connector.cpp", - "${services_path}/src/dependency/softbus/softbus_listener.cpp", - "${services_path}/src/dependency/softbus/softbus_session.cpp", - "${services_path}/src/dependency/timer/mini/dm_timer.cpp", - "${services_path}/src/device_manager_service.cpp", - "${services_path}/src/deviceinfo/dm_device_info_manager.cpp", - "${services_path}/src/devicestate/dm_device_state_manager.cpp", - "${services_path}/src/discovery/dm_discovery_manager.cpp", - "${services_path}/src/dispatch/command_dispatch.cpp", - "${services_path}/src/dispatch/device_manager_service_listener_mini.cpp", - "${services_path}/src/dispatch/server_stub.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", + "${servicesimpl_path}/src/authentication/auth_response_state.cpp", + "${servicesimpl_path}/src/authentication/dm_auth_manager.cpp", + "${servicesimpl_path}/src/authentication/showconfirm/lite/show_confirm.cpp", + "${servicesimpl_path}/src/config/mini/dm_config_manager.cpp", + "${servicesimpl_path}/src/config/mini/pin_auth.cpp", + "${servicesimpl_path}/src/dependency/hichain/hichain_connector.cpp", + "${servicesimpl_path}/src/dependency/mini/dm_mutex.cpp", + "${servicesimpl_path}/src/dependency/mini/dm_thread.cpp", + "${servicesimpl_path}/src/dependency/multipleuser/multiple_user_connector.cpp", + "${servicesimpl_path}/src/dependency/softbus/softbus_listener.cpp", + "${servicesimpl_path}/src/dependency/softbus/softbus_session.cpp", + "${servicesimpl_path}/src/dependency/timer/mini/dm_timer.cpp", + "${servicesimpl_path}/src/device_manager_service.cpp", + "${servicesimpl_path}/src/deviceinfo/dm_device_info_manager.cpp", + "${servicesimpl_path}/src/devicestate/dm_device_state_manager.cpp", + "${servicesimpl_path}/src/discovery/dm_discovery_manager.cpp", + "${servicesimpl_path}/src/dispatch/command_dispatch.cpp", + "${servicesimpl_path}/src/dispatch/device_manager_service_listener_mini.cpp", + "${servicesimpl_path}/src/dispatch/server_stub.cpp", ] defines = [ diff --git a/services/service/src/softbus/softbus_listener.cpp b/services/service/src/softbus/softbus_listener.cpp index e4b5c5e1c..63573cced 100644 --- a/services/service/src/softbus/softbus_listener.cpp +++ b/services/service/src/softbus/softbus_listener.cpp @@ -221,6 +221,7 @@ int32_t SoftbusListener::GetUuidByNetworkId(const char *networkId, std::string & void SoftbusListener::OnSoftBusDeviceOnline(NodeBasicInfo *info) { + DmFinishAsyncTrace(DM_HITRACE_DEVICE_ONLINE); LOGI("OnSoftBusDeviceOnline: received device online callback from softbus."); if (info == nullptr) { LOGE("SoftbusListener::OnSoftbusDeviceOffline NodeBasicInfo is nullptr"); diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index 1b2f8ca9f..1438652e4 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -142,9 +142,9 @@ ohos_unittest("UTTest_softbus_connector") { module_out_path = module_out_path sources = [ - "${services_path}/src/device_manager_service.cpp", - "${services_path}/src/device_manager_service_listener.cpp", - "${services_path}/src/softbus/softbus_listener.cpp", + "${servicesimpl_path}/src/device_manager_service.cpp", + "${servicesimpl_path}/src/device_manager_service_listener.cpp", + "${servicesimpl_path}/src/softbus/softbus_listener.cpp", "${servicesimpl_path}/src/adapter/standard/dm_adapter_manager.cpp", "${servicesimpl_path}/src/config/dm_config_manager.cpp", "${servicesimpl_path}/src/dependency/hichain/hichain_connector.cpp", @@ -359,9 +359,9 @@ ohos_unittest("UTTest_dm_device_state_manager") { module_out_path = module_out_path sources = [ - "${services_path}/src/device_manager_service.cpp", - "${services_path}/src/device_manager_service_listener.cpp", - "${services_path}/src/softbus/softbus_listener.cpp", + "${servicesimpl_path}/src/device_manager_service.cpp", + "${servicesimpl_path}/src/device_manager_service_listener.cpp", + "${servicesimpl_path}/src/softbus/softbus_listener.cpp", "${servicesimpl_path}/src/adapter/standard/dm_adapter_manager.cpp", "${servicesimpl_path}/src/config/dm_config_manager.cpp", "${servicesimpl_path}/src/dependency/hichain/hichain_connector.cpp", @@ -391,7 +391,7 @@ ohos_unittest("UTTest_device_manager_service_listener") { module_out_path = module_out_path sources = [ - "${services_path}/src/device_manager_service_listener.cpp", + "${servicesimpl_path}/src/device_manager_service_listener.cpp", "//foundation/distributedhardware/device_manager/test/unittest/mock/ipc_server_listener.cpp", "UTTest_device_manager_service_listener.cpp", ] @@ -460,9 +460,9 @@ ohos_unittest("UTTest_dm_discovery_manager") { module_out_path = module_out_path sources = [ - "${services_path}/src/device_manager_service.cpp", - "${services_path}/src/device_manager_service_listener.cpp", - "${services_path}/src/softbus/softbus_listener.cpp", + "${servicesimpl_path}/src/device_manager_service.cpp", + "${servicesimpl_path}/src/device_manager_service_listener.cpp", + "${servicesimpl_path}/src/softbus/softbus_listener.cpp", "${servicesimpl_path}/src/dependency/softbus/softbus_connector.cpp", "${servicesimpl_path}/src/dependency/softbus/softbus_session.cpp", "${servicesimpl_path}/src/dependency/timer/dm_timer.cpp", diff --git a/utils/include/dfx/dm_dfx_constants.h b/utils/include/dfx/dm_dfx_constants.h index 1605aefdc..69319407e 100644 --- a/utils/include/dfx/dm_dfx_constants.h +++ b/utils/include/dfx/dm_dfx_constants.h @@ -15,6 +15,8 @@ #ifndef OHOS_DM_DFX_CONSTANTS_H #define OHOS_DM_DFX_CONSTANTS_H +#include "dm_device_info.h" + #include #include @@ -26,7 +28,7 @@ const int DM_HISYEVENT_STATISTIC = 2; const int DM_HISYEVENT_SECURITY = 3; const int DM_HISYEVENT_BEHAVIOR = 4; -// state +// HisysEvent state const std::string DM_INIT_DEVICE_MANAGER_SUCCESS = "DM_INIT_DEVICE_MANAGER_SUCCESS"; const std::string DM_INIT_DEVICE_MANAGER_FAILED = "DM_INIT_DEVICE_MANAGER_FAILED"; const std::string START_DEVICE_DISCOVERY_SUCCESS = "START_DEVICE_DISCOVERY_SUCCESS"; @@ -42,7 +44,7 @@ const std::string DM_CREATE_GROUP_FAILED = "DM_CREATE_GROUP_FAILED"; const std::string UNAUTHENTICATE_DEVICE_SUCCESS = "UNAUTHENTICATE_DEVICE_SUCCESS"; const std::string UNAUTHENTICATE_DEVICE_FAILED = "UNAUTHENTICATE_DEVICE_FAILED"; -// msg +// HisysEvent msg const std::string DM_INIT_DEVICE_MANAGER_SUCCESS_MSG = "init devicemanager success."; const std::string DM_INIT_DEVICE_MANAGER_FAILED_MSG = "init devicemanager failed."; const std::string START_DEVICE_DISCOVERY_SUCCESS_MSG = "device manager discovery success."; @@ -66,6 +68,10 @@ const std::string DM_HITRACE_AUTH_TO_OPPEN_SESSION = "DM_HITRACE_AUTH_TO_OPPEN_S const std::string DM_HITRACE_DEVICE_ONLINE = "DM_HITRACE_DEVICE_ONLINE"; const std::string DM_HITRACE_INIT = "DM_HITRACE_INIT"; +enum DeviceManagerTaskId { + DeviceManager_OPEN_CHANNEL_TASKID = 0, +}; + // HiDumper Flag enum class HidumperFlag { HIDUMPER_UNKNOWN = 0, @@ -78,10 +84,29 @@ enum class HidumperFlag { const std::string ARGS_HELP_INFO = "-help"; const std::string HIDUMPER_GET_TRUSTED_LIST_INFO = "-getTrustlist"; +// HiDumper command const std::unordered_map MAP_ARGS = { { ARGS_HELP_INFO, HidumperFlag::HIDUMPER_GET_HELP }, { HIDUMPER_GET_TRUSTED_LIST_INFO, HidumperFlag::HIDUMPER_GET_TRUSTED_LIST }, }; + +typedef struct DumperDeviceTypeId { + DmDeviceType dmDeviceTypeId; + std::string dmDeviceTypeIdString; +} ERROR_INFO; + +static DumperDeviceTypeId dumperDeviceType[] = { + {DEVICE_TYPE_UNKNOWN, "DEVICE_TYPE_UNKNOWN"}, + {DEVICE_TYPE_WIFI_CAMERA, "DEVICE_TYPE_WIFI_CAMERA"}, + {DEVICE_TYPE_AUDIO, "DEVICE_TYPE_AUDIO"}, + {DEVICE_TYPE_PC, "DEVICE_TYPE_PC"}, + {DEVICE_TYPE_PHONE, "DEVICE_TYPE_PHONE"}, + {DEVICE_TYPE_PAD, "DEVICE_TYPE_PAD"}, + {DEVICE_TYPE_WATCH, "DEVICE_TYPE_WATCH"}, + {DEVICE_TYPE_CAR, "DEVICE_TYPE_CAR"}, + {DEVICE_TYPE_TV, "DEVICE_TYPE_TV"}, +}; + } // namespace DistributedHardware } // namespace OHOS #endif // OHOS_DM_DFX_CONSTANTS_H diff --git a/utils/include/dfx/lite/dm_hitrace.h b/utils/include/dfx/lite/dm_hitrace.h index ae1e2e316..3d8d237ac 100644 --- a/utils/include/dfx/lite/dm_hitrace.h +++ b/utils/include/dfx/lite/dm_hitrace.h @@ -25,6 +25,8 @@ namespace OHOS { namespace DistributedHardware { void DmTraceStart(const std::string &msg); void DmTraceEnd(); +void DmStartAsyncTrace(const std::string& msg); +void DmFinishAsyncTrace(const std::string& msg); } // namespace DistributedHardware } // namespace OHOS #endif diff --git a/utils/include/dfx/standard/dm_hidumper.h b/utils/include/dfx/standard/dm_hidumper.h index cf866ef8b..51397d7e6 100644 --- a/utils/include/dfx/standard/dm_hidumper.h +++ b/utils/include/dfx/standard/dm_hidumper.h @@ -41,6 +41,7 @@ private: int32_t ShowAllLoadTrustedList(std::string &result); int32_t ShowHelp(std::string &result); int32_t ShowIllealInfomation(std::string &result); + std::string GetDeviceType(int32_t deviceTypeId); private: std::vector nodeInfos_; diff --git a/utils/include/dfx/standard/dm_hitrace.h b/utils/include/dfx/standard/dm_hitrace.h index a8374deba..ad0ef44f9 100644 --- a/utils/include/dfx/standard/dm_hitrace.h +++ b/utils/include/dfx/standard/dm_hitrace.h @@ -27,6 +27,8 @@ namespace OHOS { namespace DistributedHardware { void DmTraceStart(const std::string &msg); void DmTraceEnd(); +void DmStartAsyncTrace(const std::string& msg); +void DmFinishAsyncTrace(const std::string& msg); } // namespace DistributedHardware } // namespace OHOS #endif diff --git a/utils/src/dfx/lite/dm_hitrace.cpp b/utils/src/dfx/lite/dm_hitrace.cpp index 6030b8577..725199c1e 100644 --- a/utils/src/dfx/lite/dm_hitrace.cpp +++ b/utils/src/dfx/lite/dm_hitrace.cpp @@ -25,5 +25,15 @@ void DmTraceEnd() { return; } + +void DmStartAsyncTrace(const std::string& msg) +{ + return; +} + +void DmFinishAsyncTrace(const std::string& msg) +{ + return; +} } // namespace DistributedHardware } // namespace OHOS diff --git a/utils/src/dfx/standard/dm_hidumper.cpp b/utils/src/dfx/standard/dm_hidumper.cpp index 78b989e19..c441adfe9 100644 --- a/utils/src/dfx/standard/dm_hidumper.cpp +++ b/utils/src/dfx/standard/dm_hidumper.cpp @@ -81,7 +81,8 @@ int32_t HiDumpHelper::ShowAllLoadTrustedList(std::string &result) result.append("\n{\n deviceId : ").append(GetAnonyString(nodeInfos_[i].deviceId).c_str()); result.append("\n{\n deviceName : ").append(nodeInfos_[i].deviceName); result.append("\n{\n networkId : ").append(GetAnonyString(nodeInfos_[i].networkId).c_str()); - result.append("\n{\n deviceTypeId : ").append(std::to_string(nodeInfos_[i].deviceTypeId)); + std::string deviceType = GetDeviceType(nodeInfos_[i].deviceTypeId); + result.append("\n{\n deviceTypeId : ").append(deviceType); } nodeInfos_.clear(); @@ -89,6 +90,18 @@ int32_t HiDumpHelper::ShowAllLoadTrustedList(std::string &result) return ret; } +std::string HiDumpHelper::GetDeviceType(int32_t deviceTypeId) { + + std::string dmDeviceTypeIdString = ""; + for (int32_t i = 0; i < (sizeof(dumperDeviceType) / sizeof(dumperDeviceType[0])); i++) { + if (deviceTypeId == dumperDeviceType[i].dmDeviceTypeId) { + dmDeviceTypeIdString = dumperDeviceType[i].dmDeviceTypeIdString; + break; + } + } + return dmDeviceTypeIdString; +} + int32_t HiDumpHelper::ShowHelp(std::string &result) { LOGI("Show hidumper help"); @@ -96,8 +109,7 @@ int32_t HiDumpHelper::ShowHelp(std::string &result) result.append(" -help "); result.append(": show help\n"); result.append(" -getTrustlist "); - result.append(": show all get trusted list:\n\n"); - LOGI("result is %s", result.c_str()); + result.append(": show all get trusted list\n\n"); return DM_OK; } @@ -105,7 +117,7 @@ int32_t HiDumpHelper::ShowIllealInfomation(std::string &result) { LOGI("ShowIllealInfomation Dump"); result.clear(); - result.append("unrecognized option, -h for help."); + result.append("unrecognized option, -help for help."); return DM_OK; } diff --git a/utils/src/dfx/standard/dm_hitrace.cpp b/utils/src/dfx/standard/dm_hitrace.cpp index 1bbe65fa3..1e10d20dd 100644 --- a/utils/src/dfx/standard/dm_hitrace.cpp +++ b/utils/src/dfx/standard/dm_hitrace.cpp @@ -26,5 +26,15 @@ void DmTraceEnd() { FinishTrace(HITRACE_TAG_DEVICE_MANAGER); } + +void DmStartAsyncTrace(const std::string& msg) +{ + StartAsyncTrace(HITRACE_TAG_DEVICE_MANAGER, msg, DeviceManager_OPEN_CHANNEL_TASKID, -1); +} + +void DmFinishAsyncTrace(const std::string& msg) +{ + FinishAsyncTrace(HITRACE_TAG_DEVICE_MANAGER, msg, DeviceManager_OPEN_CHANNEL_TASKID); +} } // namespace DistributedHardware } // namespace OHOS -- Gitee From 6abd15cec12eb78d81544640debaf8aeb389b4c3 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Mon, 4 Jul 2022 11:04:05 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9dfx=20Signed-off-by:=20?= =?UTF-8?q?wangyb0625=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../implementation/src/dependency/hichain/hichain_connector.cpp | 2 ++ services/service/BUILD.gn | 1 + services/service/src/softbus/softbus_listener.cpp | 2 ++ 3 files changed, 5 insertions(+) diff --git a/services/implementation/src/dependency/hichain/hichain_connector.cpp b/services/implementation/src/dependency/hichain/hichain_connector.cpp index a5ad68440..49d06ae7d 100644 --- a/services/implementation/src/dependency/hichain/hichain_connector.cpp +++ b/services/implementation/src/dependency/hichain/hichain_connector.cpp @@ -24,6 +24,8 @@ #include "dm_anonymous.h" #include "dm_constants.h" #include "dm_hisysevent.h" +#include "dm_dfx_constants.h" +#include "dm_hitrace.h" #include "dm_log.h" #include "dm_random.h" #include "hichain_connector_callback.h" diff --git a/services/service/BUILD.gn b/services/service/BUILD.gn index 2fe1b24d0..18564165f 100644 --- a/services/service/BUILD.gn +++ b/services/service/BUILD.gn @@ -248,6 +248,7 @@ if (defined(ohos_lite)) { external_deps = [ "dsoftbus:softbus_client", + "hitrace_native:hitrace_meter", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr_standard:samgr_proxy", diff --git a/services/service/src/softbus/softbus_listener.cpp b/services/service/src/softbus/softbus_listener.cpp index 63573cced..ee5db6555 100644 --- a/services/service/src/softbus/softbus_listener.cpp +++ b/services/service/src/softbus/softbus_listener.cpp @@ -30,6 +30,8 @@ #include "dm_constants.h" #include "dm_device_info.h" #include "dm_log.h" +#include "dm_dfx_constants.h" +#include "dm_hitrace.h" #include "nlohmann/json.hpp" #include "parameter.h" #include "system_ability_definition.h" -- Gitee From 3e6ec9913d469f2223b5a8ec3d8722c3b47b1908 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Mon, 4 Jul 2022 11:28:40 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9L1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangyb0625 --- services/implementation/BUILD.gn | 2 -- services/service/BUILD.gn | 30 +++++++----------------------- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/services/implementation/BUILD.gn b/services/implementation/BUILD.gn index 4293cc0f5..5d98bfdb9 100644 --- a/services/implementation/BUILD.gn +++ b/services/implementation/BUILD.gn @@ -91,8 +91,6 @@ if (defined(ohos_lite)) { "${servicesimpl_path}/src/dependency/softbus/softbus_connector.cpp", "${servicesimpl_path}/src/dependency/softbus/softbus_session.cpp", "${servicesimpl_path}/src/dependency/timer/mini/dm_timer.cpp", - "${servicesimpl_path}/src/device_manager_service.cpp", - "${servicesimpl_path}/src/deviceinfo/dm_device_info_manager.cpp", "${servicesimpl_path}/src/devicestate/dm_device_state_manager.cpp", "${servicesimpl_path}/src/discovery/dm_discovery_manager.cpp", "${servicesimpl_path}/src/dispatch/command_dispatch.cpp", diff --git a/services/service/BUILD.gn b/services/service/BUILD.gn index 18564165f..172c7e6d4 100644 --- a/services/service/BUILD.gn +++ b/services/service/BUILD.gn @@ -75,29 +75,13 @@ if (defined(ohos_lite)) { ] sources = [ - "${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", - "${servicesimpl_path}/src/authentication/auth_response_state.cpp", - "${servicesimpl_path}/src/authentication/dm_auth_manager.cpp", - "${servicesimpl_path}/src/authentication/showconfirm/lite/show_confirm.cpp", - "${servicesimpl_path}/src/config/mini/dm_config_manager.cpp", - "${servicesimpl_path}/src/config/mini/pin_auth.cpp", - "${servicesimpl_path}/src/dependency/hichain/hichain_connector.cpp", - "${servicesimpl_path}/src/dependency/mini/dm_mutex.cpp", - "${servicesimpl_path}/src/dependency/mini/dm_thread.cpp", - "${servicesimpl_path}/src/dependency/multipleuser/multiple_user_connector.cpp", - "${servicesimpl_path}/src/dependency/softbus/softbus_listener.cpp", - "${servicesimpl_path}/src/dependency/softbus/softbus_session.cpp", - "${servicesimpl_path}/src/dependency/timer/mini/dm_timer.cpp", - "${servicesimpl_path}/src/device_manager_service.cpp", - "${servicesimpl_path}/src/deviceinfo/dm_device_info_manager.cpp", - "${servicesimpl_path}/src/devicestate/dm_device_state_manager.cpp", - "${servicesimpl_path}/src/discovery/dm_discovery_manager.cpp", - "${servicesimpl_path}/src/dispatch/command_dispatch.cpp", - "${servicesimpl_path}/src/dispatch/device_manager_service_listener_mini.cpp", - "${servicesimpl_path}/src/dispatch/server_stub.cpp", + "src/device_manager_service.cpp", + "src/device_manager_service_listener.cpp", + "src/ipc/lite/ipc_cmd_parser.cpp", + "src/ipc/lite/ipc_server_listener.cpp", + "src/ipc/lite/ipc_server_stub.cpp", + "src/ipc/lite/ipc_server_main", + "src/softbus/softbus_listener.cpp", ] defines = [ -- Gitee From 4c0aacbff447f7345a8fd00de871641b20367511 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Mon, 4 Jul 2022 11:59:01 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangyb0625 --- services/service/BUILD.gn | 8 +++----- test/unittest/BUILD.gn | 18 +++++++++--------- utils/include/dfx/dm_dfx_constants.h | 1 - utils/src/dfx/standard/dm_hidumper.cpp | 4 ++-- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/services/service/BUILD.gn b/services/service/BUILD.gn index 172c7e6d4..9ed0830d4 100644 --- a/services/service/BUILD.gn +++ b/services/service/BUILD.gn @@ -79,8 +79,8 @@ if (defined(ohos_lite)) { "src/device_manager_service_listener.cpp", "src/ipc/lite/ipc_cmd_parser.cpp", "src/ipc/lite/ipc_server_listener.cpp", - "src/ipc/lite/ipc_server_stub.cpp", "src/ipc/lite/ipc_server_main", + "src/ipc/lite/ipc_server_stub.cpp", "src/softbus/softbus_listener.cpp", ] @@ -154,9 +154,7 @@ if (defined(ohos_lite)) { "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include", ] - sources = [ - "src/ipc/lite/ipc_server_main.cpp", - ] + sources = [ "src/ipc/lite/ipc_server_main.cpp" ] ldflags = dm_ldflags defines = [ @@ -245,4 +243,4 @@ if (defined(ohos_lite)) { part_name = "device_manager" } -} \ No newline at end of file +} diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index 1438652e4..2c6661c6e 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -142,9 +142,6 @@ ohos_unittest("UTTest_softbus_connector") { module_out_path = module_out_path sources = [ - "${servicesimpl_path}/src/device_manager_service.cpp", - "${servicesimpl_path}/src/device_manager_service_listener.cpp", - "${servicesimpl_path}/src/softbus/softbus_listener.cpp", "${servicesimpl_path}/src/adapter/standard/dm_adapter_manager.cpp", "${servicesimpl_path}/src/config/dm_config_manager.cpp", "${servicesimpl_path}/src/dependency/hichain/hichain_connector.cpp", @@ -152,8 +149,11 @@ ohos_unittest("UTTest_softbus_connector") { "${servicesimpl_path}/src/dependency/softbus/softbus_connector.cpp", "${servicesimpl_path}/src/dependency/softbus/softbus_session.cpp", "${servicesimpl_path}/src/dependency/timer/dm_timer.cpp", + "${servicesimpl_path}/src/device_manager_service.cpp", + "${servicesimpl_path}/src/device_manager_service_listener.cpp", "${servicesimpl_path}/src/devicestate/dm_device_state_manager.cpp", "${servicesimpl_path}/src/discovery/dm_discovery_manager.cpp", + "${servicesimpl_path}/src/softbus/softbus_listener.cpp", "//foundation/distributedhardware/device_manager/test/unittest/mock/ipc_server_listener.cpp", "//foundation/distributedhardware/device_manager/test/unittest/mock/parameter.cpp", "UTTest_softbus_connector.cpp", @@ -359,9 +359,6 @@ ohos_unittest("UTTest_dm_device_state_manager") { module_out_path = module_out_path sources = [ - "${servicesimpl_path}/src/device_manager_service.cpp", - "${servicesimpl_path}/src/device_manager_service_listener.cpp", - "${servicesimpl_path}/src/softbus/softbus_listener.cpp", "${servicesimpl_path}/src/adapter/standard/dm_adapter_manager.cpp", "${servicesimpl_path}/src/config/dm_config_manager.cpp", "${servicesimpl_path}/src/dependency/hichain/hichain_connector.cpp", @@ -369,8 +366,11 @@ ohos_unittest("UTTest_dm_device_state_manager") { "${servicesimpl_path}/src/dependency/softbus/softbus_connector.cpp", "${servicesimpl_path}/src/dependency/softbus/softbus_session.cpp", "${servicesimpl_path}/src/dependency/timer/dm_timer.cpp", + "${servicesimpl_path}/src/device_manager_service.cpp", + "${servicesimpl_path}/src/device_manager_service_listener.cpp", "${servicesimpl_path}/src/devicestate/dm_device_state_manager.cpp", "${servicesimpl_path}/src/discovery/dm_discovery_manager.cpp", + "${servicesimpl_path}/src/softbus/softbus_listener.cpp", "//foundation/distributedhardware/device_manager/test/unittest/mock/ipc_server_listener.cpp", "//foundation/distributedhardware/device_manager/test/unittest/mock/parameter.cpp", "UTTest_dm_device_state_manager.cpp", @@ -460,13 +460,13 @@ ohos_unittest("UTTest_dm_discovery_manager") { module_out_path = module_out_path sources = [ - "${servicesimpl_path}/src/device_manager_service.cpp", - "${servicesimpl_path}/src/device_manager_service_listener.cpp", - "${servicesimpl_path}/src/softbus/softbus_listener.cpp", "${servicesimpl_path}/src/dependency/softbus/softbus_connector.cpp", "${servicesimpl_path}/src/dependency/softbus/softbus_session.cpp", "${servicesimpl_path}/src/dependency/timer/dm_timer.cpp", + "${servicesimpl_path}/src/device_manager_service.cpp", + "${servicesimpl_path}/src/device_manager_service_listener.cpp", "${servicesimpl_path}/src/discovery/dm_discovery_manager.cpp", + "${servicesimpl_path}/src/softbus/softbus_listener.cpp", "//foundation/distributedhardware/device_manager/test/unittest/mock/ipc_server_listener.cpp", "//foundation/distributedhardware/device_manager/test/unittest/mock/parameter.cpp", "UTTest_dm_discovery_manager.cpp", diff --git a/utils/include/dfx/dm_dfx_constants.h b/utils/include/dfx/dm_dfx_constants.h index 69319407e..499dcb53a 100644 --- a/utils/include/dfx/dm_dfx_constants.h +++ b/utils/include/dfx/dm_dfx_constants.h @@ -106,7 +106,6 @@ static DumperDeviceTypeId dumperDeviceType[] = { {DEVICE_TYPE_CAR, "DEVICE_TYPE_CAR"}, {DEVICE_TYPE_TV, "DEVICE_TYPE_TV"}, }; - } // namespace DistributedHardware } // namespace OHOS #endif // OHOS_DM_DFX_CONSTANTS_H diff --git a/utils/src/dfx/standard/dm_hidumper.cpp b/utils/src/dfx/standard/dm_hidumper.cpp index c441adfe9..285a8938f 100644 --- a/utils/src/dfx/standard/dm_hidumper.cpp +++ b/utils/src/dfx/standard/dm_hidumper.cpp @@ -90,8 +90,8 @@ int32_t HiDumpHelper::ShowAllLoadTrustedList(std::string &result) return ret; } -std::string HiDumpHelper::GetDeviceType(int32_t deviceTypeId) { - +std::string HiDumpHelper::GetDeviceType(int32_t deviceTypeId) +{ std::string dmDeviceTypeIdString = ""; for (int32_t i = 0; i < (sizeof(dumperDeviceType) / sizeof(dumperDeviceType[0])); i++) { if (deviceTypeId == dumperDeviceType[i].dmDeviceTypeId) { -- Gitee From 2834df8f31a32f976fbea1045111763929ded806 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Mon, 4 Jul 2022 14:12:47 +0800 Subject: [PATCH 05/10] 11 Signed-off-by: wangyb0625 --- test/unittest/BUILD.gn | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index 2c6661c6e..1b2f8ca9f 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -142,6 +142,9 @@ ohos_unittest("UTTest_softbus_connector") { module_out_path = module_out_path sources = [ + "${services_path}/src/device_manager_service.cpp", + "${services_path}/src/device_manager_service_listener.cpp", + "${services_path}/src/softbus/softbus_listener.cpp", "${servicesimpl_path}/src/adapter/standard/dm_adapter_manager.cpp", "${servicesimpl_path}/src/config/dm_config_manager.cpp", "${servicesimpl_path}/src/dependency/hichain/hichain_connector.cpp", @@ -149,11 +152,8 @@ ohos_unittest("UTTest_softbus_connector") { "${servicesimpl_path}/src/dependency/softbus/softbus_connector.cpp", "${servicesimpl_path}/src/dependency/softbus/softbus_session.cpp", "${servicesimpl_path}/src/dependency/timer/dm_timer.cpp", - "${servicesimpl_path}/src/device_manager_service.cpp", - "${servicesimpl_path}/src/device_manager_service_listener.cpp", "${servicesimpl_path}/src/devicestate/dm_device_state_manager.cpp", "${servicesimpl_path}/src/discovery/dm_discovery_manager.cpp", - "${servicesimpl_path}/src/softbus/softbus_listener.cpp", "//foundation/distributedhardware/device_manager/test/unittest/mock/ipc_server_listener.cpp", "//foundation/distributedhardware/device_manager/test/unittest/mock/parameter.cpp", "UTTest_softbus_connector.cpp", @@ -359,6 +359,9 @@ ohos_unittest("UTTest_dm_device_state_manager") { module_out_path = module_out_path sources = [ + "${services_path}/src/device_manager_service.cpp", + "${services_path}/src/device_manager_service_listener.cpp", + "${services_path}/src/softbus/softbus_listener.cpp", "${servicesimpl_path}/src/adapter/standard/dm_adapter_manager.cpp", "${servicesimpl_path}/src/config/dm_config_manager.cpp", "${servicesimpl_path}/src/dependency/hichain/hichain_connector.cpp", @@ -366,11 +369,8 @@ ohos_unittest("UTTest_dm_device_state_manager") { "${servicesimpl_path}/src/dependency/softbus/softbus_connector.cpp", "${servicesimpl_path}/src/dependency/softbus/softbus_session.cpp", "${servicesimpl_path}/src/dependency/timer/dm_timer.cpp", - "${servicesimpl_path}/src/device_manager_service.cpp", - "${servicesimpl_path}/src/device_manager_service_listener.cpp", "${servicesimpl_path}/src/devicestate/dm_device_state_manager.cpp", "${servicesimpl_path}/src/discovery/dm_discovery_manager.cpp", - "${servicesimpl_path}/src/softbus/softbus_listener.cpp", "//foundation/distributedhardware/device_manager/test/unittest/mock/ipc_server_listener.cpp", "//foundation/distributedhardware/device_manager/test/unittest/mock/parameter.cpp", "UTTest_dm_device_state_manager.cpp", @@ -391,7 +391,7 @@ ohos_unittest("UTTest_device_manager_service_listener") { module_out_path = module_out_path sources = [ - "${servicesimpl_path}/src/device_manager_service_listener.cpp", + "${services_path}/src/device_manager_service_listener.cpp", "//foundation/distributedhardware/device_manager/test/unittest/mock/ipc_server_listener.cpp", "UTTest_device_manager_service_listener.cpp", ] @@ -460,13 +460,13 @@ ohos_unittest("UTTest_dm_discovery_manager") { module_out_path = module_out_path sources = [ + "${services_path}/src/device_manager_service.cpp", + "${services_path}/src/device_manager_service_listener.cpp", + "${services_path}/src/softbus/softbus_listener.cpp", "${servicesimpl_path}/src/dependency/softbus/softbus_connector.cpp", "${servicesimpl_path}/src/dependency/softbus/softbus_session.cpp", "${servicesimpl_path}/src/dependency/timer/dm_timer.cpp", - "${servicesimpl_path}/src/device_manager_service.cpp", - "${servicesimpl_path}/src/device_manager_service_listener.cpp", "${servicesimpl_path}/src/discovery/dm_discovery_manager.cpp", - "${servicesimpl_path}/src/softbus/softbus_listener.cpp", "//foundation/distributedhardware/device_manager/test/unittest/mock/ipc_server_listener.cpp", "//foundation/distributedhardware/device_manager/test/unittest/mock/parameter.cpp", "UTTest_dm_discovery_manager.cpp", -- Gitee From cff1a769994add91ac2c0939169d9c4c2f1b5375 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Mon, 4 Jul 2022 16:43:47 +0800 Subject: [PATCH 06/10] 11 Signed-off-by: wangyb0625 --- .../src/authentication/dm_auth_manager.cpp | 2 ++ .../dependency/hichain/hichain_connector.cpp | 1 - services/service/BUILD.gn | 1 - .../service/src/softbus/softbus_listener.cpp | 3 -- utils/include/dfx/dm_dfx_constants.h | 29 +++++++------------ utils/include/dfx/lite/dm_hitrace.h | 2 -- utils/include/dfx/standard/dm_hitrace.h | 2 -- utils/src/dfx/lite/dm_hitrace.cpp | 10 ------- utils/src/dfx/standard/dm_hidumper.cpp | 4 +-- utils/src/dfx/standard/dm_hitrace.cpp | 10 ------- 10 files changed, 14 insertions(+), 50 deletions(-) diff --git a/services/implementation/src/authentication/dm_auth_manager.cpp b/services/implementation/src/authentication/dm_auth_manager.cpp index ce134e4e6..92b30842a 100644 --- a/services/implementation/src/authentication/dm_auth_manager.cpp +++ b/services/implementation/src/authentication/dm_auth_manager.cpp @@ -310,6 +310,7 @@ void DmAuthManager::OnDataReceived(const int32_t sessionId, const std::string me void DmAuthManager::OnGroupCreated(int64_t requestId, const std::string &groupId) { + //wyb if (authResponseContext_ == nullptr) { LOGE("failed to OnGroupCreated because authResponseContext_ is nullptr"); return; @@ -648,6 +649,7 @@ void DmAuthManager::AuthenticateFinish() authPtr_ = nullptr; authTimes_ = 0; } + //wyb LOGI("DmAuthManager::AuthenticateFinish complete"); } diff --git a/services/implementation/src/dependency/hichain/hichain_connector.cpp b/services/implementation/src/dependency/hichain/hichain_connector.cpp index 49d06ae7d..3cd21e99a 100644 --- a/services/implementation/src/dependency/hichain/hichain_connector.cpp +++ b/services/implementation/src/dependency/hichain/hichain_connector.cpp @@ -273,7 +273,6 @@ void HiChainConnector::onFinish(int64_t requestId, int operationCode, const char LOGI("Create group success"); SysEventWrite(DM_CREATE_GROUP_SUCCESS, DM_HISYEVENT_BEHAVIOR, DM_CREATE_GROUP_SUCCESS_MSG); if (hiChainConnectorCallback_ != nullptr) { - DmStartAsyncTrace(DM_HITRACE_DEVICE_ONLINE); hiChainConnectorCallback_->OnMemberJoin(requestId, DM_OK); hiChainConnectorCallback_->OnGroupCreated(requestId, data); } diff --git a/services/service/BUILD.gn b/services/service/BUILD.gn index 9ed0830d4..bfab02527 100644 --- a/services/service/BUILD.gn +++ b/services/service/BUILD.gn @@ -230,7 +230,6 @@ if (defined(ohos_lite)) { external_deps = [ "dsoftbus:softbus_client", - "hitrace_native:hitrace_meter", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr_standard:samgr_proxy", diff --git a/services/service/src/softbus/softbus_listener.cpp b/services/service/src/softbus/softbus_listener.cpp index ee5db6555..e4b5c5e1c 100644 --- a/services/service/src/softbus/softbus_listener.cpp +++ b/services/service/src/softbus/softbus_listener.cpp @@ -30,8 +30,6 @@ #include "dm_constants.h" #include "dm_device_info.h" #include "dm_log.h" -#include "dm_dfx_constants.h" -#include "dm_hitrace.h" #include "nlohmann/json.hpp" #include "parameter.h" #include "system_ability_definition.h" @@ -223,7 +221,6 @@ int32_t SoftbusListener::GetUuidByNetworkId(const char *networkId, std::string & void SoftbusListener::OnSoftBusDeviceOnline(NodeBasicInfo *info) { - DmFinishAsyncTrace(DM_HITRACE_DEVICE_ONLINE); LOGI("OnSoftBusDeviceOnline: received device online callback from softbus."); if (info == nullptr) { LOGE("SoftbusListener::OnSoftbusDeviceOffline NodeBasicInfo is nullptr"); diff --git a/utils/include/dfx/dm_dfx_constants.h b/utils/include/dfx/dm_dfx_constants.h index 499dcb53a..689ee04b4 100644 --- a/utils/include/dfx/dm_dfx_constants.h +++ b/utils/include/dfx/dm_dfx_constants.h @@ -65,13 +65,8 @@ const std::string DM_HITRACE_START_DEVICE = "DM_HITRACE_START_DEVICE"; const std::string DM_HITRACE_GET_LOCAL_DEVICE_INFO = "DM_HITRACE_GET_LOCAL_DEVICE_INFO"; const std::string DM_HITRACE_AUTH_TO_CONSULT = "DM_HITRACE_AUTH_TO_CONSULT"; const std::string DM_HITRACE_AUTH_TO_OPPEN_SESSION = "DM_HITRACE_AUTH_TO_OPPEN_SESSION"; -const std::string DM_HITRACE_DEVICE_ONLINE = "DM_HITRACE_DEVICE_ONLINE"; const std::string DM_HITRACE_INIT = "DM_HITRACE_INIT"; -enum DeviceManagerTaskId { - DeviceManager_OPEN_CHANNEL_TASKID = 0, -}; - // HiDumper Flag enum class HidumperFlag { HIDUMPER_UNKNOWN = 0, @@ -90,21 +85,17 @@ const std::unordered_map MAP_ARGS = { { HIDUMPER_GET_TRUSTED_LIST_INFO, HidumperFlag::HIDUMPER_GET_TRUSTED_LIST }, }; -typedef struct DumperDeviceTypeId { - DmDeviceType dmDeviceTypeId; - std::string dmDeviceTypeIdString; -} ERROR_INFO; - +// HiDumper device type static DumperDeviceTypeId dumperDeviceType[] = { - {DEVICE_TYPE_UNKNOWN, "DEVICE_TYPE_UNKNOWN"}, - {DEVICE_TYPE_WIFI_CAMERA, "DEVICE_TYPE_WIFI_CAMERA"}, - {DEVICE_TYPE_AUDIO, "DEVICE_TYPE_AUDIO"}, - {DEVICE_TYPE_PC, "DEVICE_TYPE_PC"}, - {DEVICE_TYPE_PHONE, "DEVICE_TYPE_PHONE"}, - {DEVICE_TYPE_PAD, "DEVICE_TYPE_PAD"}, - {DEVICE_TYPE_WATCH, "DEVICE_TYPE_WATCH"}, - {DEVICE_TYPE_CAR, "DEVICE_TYPE_CAR"}, - {DEVICE_TYPE_TV, "DEVICE_TYPE_TV"}, + {0x00, "DEVICE_TYPE_UNKNOWN"}, + {0x08, "DEVICE_TYPE_WIFI_CAMERA"}, + {0x0A, "DEVICE_TYPE_AUDIO"}, + {0x0C, "DEVICE_TYPE_PC"}, + {0x0E, "DEVICE_TYPE_PHONE"}, + {0x11, "DEVICE_TYPE_PAD"}, + {0x6D, "DEVICE_TYPE_WATCH"}, + {0x83, "DEVICE_TYPE_CAR"}, + {0x9C, "DEVICE_TYPE_TV"}, }; } // namespace DistributedHardware } // namespace OHOS diff --git a/utils/include/dfx/lite/dm_hitrace.h b/utils/include/dfx/lite/dm_hitrace.h index 3d8d237ac..ae1e2e316 100644 --- a/utils/include/dfx/lite/dm_hitrace.h +++ b/utils/include/dfx/lite/dm_hitrace.h @@ -25,8 +25,6 @@ namespace OHOS { namespace DistributedHardware { void DmTraceStart(const std::string &msg); void DmTraceEnd(); -void DmStartAsyncTrace(const std::string& msg); -void DmFinishAsyncTrace(const std::string& msg); } // namespace DistributedHardware } // namespace OHOS #endif diff --git a/utils/include/dfx/standard/dm_hitrace.h b/utils/include/dfx/standard/dm_hitrace.h index ad0ef44f9..a8374deba 100644 --- a/utils/include/dfx/standard/dm_hitrace.h +++ b/utils/include/dfx/standard/dm_hitrace.h @@ -27,8 +27,6 @@ namespace OHOS { namespace DistributedHardware { void DmTraceStart(const std::string &msg); void DmTraceEnd(); -void DmStartAsyncTrace(const std::string& msg); -void DmFinishAsyncTrace(const std::string& msg); } // namespace DistributedHardware } // namespace OHOS #endif diff --git a/utils/src/dfx/lite/dm_hitrace.cpp b/utils/src/dfx/lite/dm_hitrace.cpp index 725199c1e..6030b8577 100644 --- a/utils/src/dfx/lite/dm_hitrace.cpp +++ b/utils/src/dfx/lite/dm_hitrace.cpp @@ -25,15 +25,5 @@ void DmTraceEnd() { return; } - -void DmStartAsyncTrace(const std::string& msg) -{ - return; -} - -void DmFinishAsyncTrace(const std::string& msg) -{ - return; -} } // namespace DistributedHardware } // namespace OHOS diff --git a/utils/src/dfx/standard/dm_hidumper.cpp b/utils/src/dfx/standard/dm_hidumper.cpp index 285a8938f..e90f756d8 100644 --- a/utils/src/dfx/standard/dm_hidumper.cpp +++ b/utils/src/dfx/standard/dm_hidumper.cpp @@ -82,7 +82,7 @@ int32_t HiDumpHelper::ShowAllLoadTrustedList(std::string &result) result.append("\n{\n deviceName : ").append(nodeInfos_[i].deviceName); result.append("\n{\n networkId : ").append(GetAnonyString(nodeInfos_[i].networkId).c_str()); std::string deviceType = GetDeviceType(nodeInfos_[i].deviceTypeId); - result.append("\n{\n deviceTypeId : ").append(deviceType); + result.append("\n{\n deviceType : ").append(deviceType); } nodeInfos_.clear(); @@ -109,7 +109,7 @@ int32_t HiDumpHelper::ShowHelp(std::string &result) result.append(" -help "); result.append(": show help\n"); result.append(" -getTrustlist "); - result.append(": show all get trusted list\n\n"); + result.append(": show all trusted device list\n\n"); return DM_OK; } diff --git a/utils/src/dfx/standard/dm_hitrace.cpp b/utils/src/dfx/standard/dm_hitrace.cpp index 1e10d20dd..1bbe65fa3 100644 --- a/utils/src/dfx/standard/dm_hitrace.cpp +++ b/utils/src/dfx/standard/dm_hitrace.cpp @@ -26,15 +26,5 @@ void DmTraceEnd() { FinishTrace(HITRACE_TAG_DEVICE_MANAGER); } - -void DmStartAsyncTrace(const std::string& msg) -{ - StartAsyncTrace(HITRACE_TAG_DEVICE_MANAGER, msg, DeviceManager_OPEN_CHANNEL_TASKID, -1); -} - -void DmFinishAsyncTrace(const std::string& msg) -{ - FinishAsyncTrace(HITRACE_TAG_DEVICE_MANAGER, msg, DeviceManager_OPEN_CHANNEL_TASKID); -} } // namespace DistributedHardware } // namespace OHOS -- Gitee From 83a6580af3292ce9d06e1ef474968234b3a5c101 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Mon, 4 Jul 2022 16:45:24 +0800 Subject: [PATCH 07/10] 22 Signed-off-by: wangyb0625 --- services/implementation/src/authentication/dm_auth_manager.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/services/implementation/src/authentication/dm_auth_manager.cpp b/services/implementation/src/authentication/dm_auth_manager.cpp index 92b30842a..ce134e4e6 100644 --- a/services/implementation/src/authentication/dm_auth_manager.cpp +++ b/services/implementation/src/authentication/dm_auth_manager.cpp @@ -310,7 +310,6 @@ void DmAuthManager::OnDataReceived(const int32_t sessionId, const std::string me void DmAuthManager::OnGroupCreated(int64_t requestId, const std::string &groupId) { - //wyb if (authResponseContext_ == nullptr) { LOGE("failed to OnGroupCreated because authResponseContext_ is nullptr"); return; @@ -649,7 +648,6 @@ void DmAuthManager::AuthenticateFinish() authPtr_ = nullptr; authTimes_ = 0; } - //wyb LOGI("DmAuthManager::AuthenticateFinish complete"); } -- Gitee From cdef138f198241c79f18a2e5dba28cfd65fcddf4 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Mon, 4 Jul 2022 17:40:27 +0800 Subject: [PATCH 08/10] q Signed-off-by: wangyb0625 --- utils/include/dfx/dm_dfx_constants.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/utils/include/dfx/dm_dfx_constants.h b/utils/include/dfx/dm_dfx_constants.h index 689ee04b4..6ca860046 100644 --- a/utils/include/dfx/dm_dfx_constants.h +++ b/utils/include/dfx/dm_dfx_constants.h @@ -85,17 +85,22 @@ const std::unordered_map MAP_ARGS = { { HIDUMPER_GET_TRUSTED_LIST_INFO, HidumperFlag::HIDUMPER_GET_TRUSTED_LIST }, }; -// HiDumper device type -static DumperDeviceTypeId dumperDeviceType[] = { - {0x00, "DEVICE_TYPE_UNKNOWN"}, - {0x08, "DEVICE_TYPE_WIFI_CAMERA"}, - {0x0A, "DEVICE_TYPE_AUDIO"}, - {0x0C, "DEVICE_TYPE_PC"}, - {0x0E, "DEVICE_TYPE_PHONE"}, - {0x11, "DEVICE_TYPE_PAD"}, - {0x6D, "DEVICE_TYPE_WATCH"}, - {0x83, "DEVICE_TYPE_CAR"}, - {0x9C, "DEVICE_TYPE_TV"}, +// HiDumper device type +typedef struct Dumper_INFO { + DmDeviceType deviceTypeId; + std::string deviceTypeInfo; +} Dumper_INFO; + +static Dumper_INFO dumperDeviceType[] = { + {DEVICE_TYPE_UNKNOWN, "DEVICE_TYPE_UNKNOWN"}, + {DEVICE_TYPE_WIFI_CAMERA, "DEVICE_TYPE_WIFI_CAMERA"}, + {DEVICE_TYPE_AUDIO, "DEVICE_TYPE_AUDIO"}, + {DEVICE_TYPE_PC, "DEVICE_TYPE_PC"}, + {DEVICE_TYPE_PHONE, "DEVICE_TYPE_PHONE"}, + {DEVICE_TYPE_PAD, "DEVICE_TYPE_PAD"}, + {DEVICE_TYPE_WATCH, "DEVICE_TYPE_WATCH"}, + {DEVICE_TYPE_CAR, "DEVICE_TYPE_CAR"}, + {DEVICE_TYPE_TV, "DEVICE_TYPE_TV"}, }; } // namespace DistributedHardware } // namespace OHOS -- Gitee From 22a10f728d9bc51539379cfbaa2f671a661e9439 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Mon, 4 Jul 2022 18:02:50 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangyb0625 --- .../src/dependency/hichain/hichain_connector.cpp | 2 -- utils/src/dfx/standard/dm_hidumper.cpp | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/services/implementation/src/dependency/hichain/hichain_connector.cpp b/services/implementation/src/dependency/hichain/hichain_connector.cpp index 3cd21e99a..7e5b908d2 100644 --- a/services/implementation/src/dependency/hichain/hichain_connector.cpp +++ b/services/implementation/src/dependency/hichain/hichain_connector.cpp @@ -24,8 +24,6 @@ #include "dm_anonymous.h" #include "dm_constants.h" #include "dm_hisysevent.h" -#include "dm_dfx_constants.h" -#include "dm_hitrace.h" #include "dm_log.h" #include "dm_random.h" #include "hichain_connector_callback.h" diff --git a/utils/src/dfx/standard/dm_hidumper.cpp b/utils/src/dfx/standard/dm_hidumper.cpp index e90f756d8..e50237481 100644 --- a/utils/src/dfx/standard/dm_hidumper.cpp +++ b/utils/src/dfx/standard/dm_hidumper.cpp @@ -94,8 +94,8 @@ std::string HiDumpHelper::GetDeviceType(int32_t deviceTypeId) { std::string dmDeviceTypeIdString = ""; for (int32_t i = 0; i < (sizeof(dumperDeviceType) / sizeof(dumperDeviceType[0])); i++) { - if (deviceTypeId == dumperDeviceType[i].dmDeviceTypeId) { - dmDeviceTypeIdString = dumperDeviceType[i].dmDeviceTypeIdString; + if (deviceTypeId == dumperDeviceType[i].deviceTypeId) { + dmDeviceTypeIdString = dumperDeviceType[i].deviceTypeInfo; break; } } -- Gitee From 06b4996db055515a49a768206f51b59f52bf6543 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Mon, 4 Jul 2022 18:35:20 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangyb0625 --- utils/include/dfx/dm_dfx_constants.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/include/dfx/dm_dfx_constants.h b/utils/include/dfx/dm_dfx_constants.h index 6ca860046..32dad7ae9 100644 --- a/utils/include/dfx/dm_dfx_constants.h +++ b/utils/include/dfx/dm_dfx_constants.h @@ -86,12 +86,12 @@ const std::unordered_map MAP_ARGS = { }; // HiDumper device type -typedef struct Dumper_INFO { +typedef struct DumperInfo { DmDeviceType deviceTypeId; std::string deviceTypeInfo; -} Dumper_INFO; +} DumperInfo; -static Dumper_INFO dumperDeviceType[] = { +static DumperInfo dumperDeviceType[] = { {DEVICE_TYPE_UNKNOWN, "DEVICE_TYPE_UNKNOWN"}, {DEVICE_TYPE_WIFI_CAMERA, "DEVICE_TYPE_WIFI_CAMERA"}, {DEVICE_TYPE_AUDIO, "DEVICE_TYPE_AUDIO"}, -- Gitee