mirror of
https://github.com/openharmony/device_manager.git
synced 2026-07-20 21:58:27 -04:00
@@ -35,7 +35,9 @@
|
||||
#include "ipc_verify_authenticate_req.h"
|
||||
#include "ipc_register_dev_state_callback_req.h"
|
||||
#include "securec.h"
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
#include "dm_hisysevent.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
@@ -69,15 +71,19 @@ int32_t DeviceManagerImpl::InitDeviceManager(const std::string &pkgName, std::sh
|
||||
}
|
||||
if (ret != DM_OK) {
|
||||
LOGE("InitDeviceManager error: proxy init failed ret: %d", ret);
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(DM_INIT_DEVICE_MANAGER_FAILED,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, "init devicemanager failed.");
|
||||
#endif
|
||||
return ERR_DM_INIT_FAILED;
|
||||
}
|
||||
|
||||
DeviceManagerNotify::GetInstance().RegisterDeathRecipientCallback(pkgName, dmInitCallback);
|
||||
LOGI("InitDeviceManager success");
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(DM_INIT_DEVICE_MANAGER_SUCCESS,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "init devicemanager success.");
|
||||
#endif
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
@@ -145,15 +151,19 @@ int32_t DeviceManagerImpl::GetLocalDeviceInfo(const std::string &pkgName, DmDevi
|
||||
ret = rsp->GetErrCode();
|
||||
if (ret != DM_OK) {
|
||||
LOGI("GetLocalDeviceInfo error: failed ret: %d", ret);
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(GET_LOCAL_DEVICE_INFO_FAILED,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "get local device info failed.");
|
||||
#endif
|
||||
return ERR_DM_IPC_RESPOND_FAILED;
|
||||
}
|
||||
|
||||
info = rsp->GetLocalDeviceInfo();
|
||||
LOGI("GetLocalDeviceInfo completed,pkgname%s", req->GetPkgName().c_str());
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(GET_LOCAL_DEVICE_INFO_SUCCESS,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "get local device info success.");
|
||||
#endif
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
@@ -215,14 +225,18 @@ int32_t DeviceManagerImpl::StartDeviceDiscovery(const std::string &pkgName, cons
|
||||
ret = rsp->GetErrCode();
|
||||
if (ret != DM_OK) {
|
||||
LOGE("StartDeviceDiscovery error: Failed with ret %d", ret);
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(START_DEVICE_DISCOVERY_FAILED,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "device manager discovery failed.");
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
LOGI("StartDeviceDiscovery completed, pkgName: %s", pkgName.c_str());
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(START_DEVICE_DISCOVERY_SUCCESS,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "device manager discovery success.");
|
||||
#endif
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
@@ -277,10 +291,12 @@ int32_t DeviceManagerImpl::AuthenticateDevice(const std::string &pkgName, int32_
|
||||
int32_t ret = ipcClientProxy_->SendRequest(AUTHENTICATE_DEVICE, req, rsp);
|
||||
if (ret != DM_OK) {
|
||||
LOGE("AuthenticateDevice error: Send Request failed ret: %d", ret);
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(DM_SEND_REQUEST_FAILED,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "send request failed.");
|
||||
return ERR_DM_IPC_SEND_REQUEST_FAILED;
|
||||
}
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(DM_SEND_REQUEST_SUCCESS,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "send request success.");
|
||||
|
||||
@@ -314,12 +330,16 @@ int32_t DeviceManagerImpl::UnAuthenticateDevice(const std::string &pkgName, cons
|
||||
ret = rsp->GetErrCode();
|
||||
if (ret != DM_OK) {
|
||||
LOGE("UnAuthenticateDevice error: Failed with ret %d", ret);
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(UNAUTHENTICATE_DEVICE_FAILED,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "unauthenticate device failed.");
|
||||
#endif
|
||||
return ERR_DM_IPC_RESPOND_FAILED;
|
||||
}
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(UNAUTHENTICATE_DEVICE_SUCCESS,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "unauthenticate device success.");
|
||||
#endif
|
||||
|
||||
LOGI("UnAuthenticateDevice completed, pkgName: %s", pkgName.c_str());
|
||||
return DM_OK;
|
||||
|
||||
@@ -45,7 +45,6 @@ if (defined(ohos_lite)) {
|
||||
"${common_path}/include/ipc",
|
||||
"${common_path}/include/ipc/model",
|
||||
"//base/security/deviceauth/interfaces/innerkits",
|
||||
"//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include",
|
||||
"//third_party/json/include",
|
||||
"${utils_path}/include",
|
||||
"${utils_path}/include/permission/lite",
|
||||
@@ -56,7 +55,6 @@ if (defined(ohos_lite)) {
|
||||
]
|
||||
|
||||
include_dirs += [
|
||||
"//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include",
|
||||
"//base/security/deviceauth/interfaces/innerkits",
|
||||
"//base/startup/syspara_lite/interfaces/innerkits/native/syspara/include",
|
||||
"//utils/native/lite/include",
|
||||
@@ -112,7 +110,6 @@ if (defined(ohos_lite)) {
|
||||
defines += [ "OS_ACCOUNT_PART_EXISTS" ]
|
||||
include_dirs += [
|
||||
"//base/account/os_account/interfaces/innerkits/osaccount/native/include",
|
||||
"//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -164,7 +161,6 @@ if (defined(ohos_lite)) {
|
||||
"${innerkits_path}/native_cpp/include/ipc/lite",
|
||||
]
|
||||
include_dirs += [
|
||||
"//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include",
|
||||
"//base/security/deviceauth/interfaces/innerkits",
|
||||
"//base/startup/syspara_lite/interfaces/innerkits/native/syspara/include",
|
||||
"//utils/native/lite/include",
|
||||
@@ -263,7 +259,6 @@ if (defined(ohos_lite)) {
|
||||
"${utils_path}/include/fwkload/standard",
|
||||
"${utils_path}/include/permission/standard",
|
||||
"//base/security/deviceauth/interfaces/innerkits",
|
||||
"//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include",
|
||||
"//third_party/json/include",
|
||||
]
|
||||
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
*/
|
||||
|
||||
#include "hichain_connector.h"
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
#include "dm_hisysevent.h"
|
||||
#endif
|
||||
|
||||
#include <securec.h>
|
||||
|
||||
@@ -262,16 +264,20 @@ void HiChainConnector::onFinish(int64_t requestId, int operationCode, const char
|
||||
LOGI("HiChainConnector::onFinish reqId:%lld, operation:%d", requestId, operationCode);
|
||||
if (operationCode == GroupOperationCode::MEMBER_JOIN) {
|
||||
LOGI("Add Member To Group success");
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(ADD_HICHAIN_GROUP_SUCCESS,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "dm add member to group success.");
|
||||
#endif
|
||||
if (hiChainConnectorCallback_ != nullptr) {
|
||||
hiChainConnectorCallback_->OnMemberJoin(requestId, DM_OK);
|
||||
}
|
||||
}
|
||||
if (operationCode == GroupOperationCode::GROUP_CREATE) {
|
||||
LOGI("Create group success");
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(DM_CREATE_GROUP_SUCCESS,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "dm create group success.");
|
||||
#endif
|
||||
if (hiChainConnectorCallback_ != nullptr) {
|
||||
hiChainConnectorCallback_->OnMemberJoin(requestId, DM_OK);
|
||||
hiChainConnectorCallback_->OnGroupCreated(requestId, data);
|
||||
@@ -291,16 +297,20 @@ void HiChainConnector::onError(int64_t requestId, int operationCode, int errorCo
|
||||
LOGI("HichainAuthenCallBack::onError reqId:%lld, operation:%d, errorCode:%d.", requestId, operationCode, errorCode);
|
||||
if (operationCode == GroupOperationCode::MEMBER_JOIN) {
|
||||
LOGE("Add Member To Group failed");
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(ADD_HICHAIN_GROUP_FAILED,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "dm add member to group failed.");
|
||||
#endif
|
||||
if (hiChainConnectorCallback_ != nullptr) {
|
||||
hiChainConnectorCallback_->OnMemberJoin(requestId, ERR_DM_FAILED);
|
||||
}
|
||||
}
|
||||
if (operationCode == GroupOperationCode::GROUP_CREATE) {
|
||||
LOGE("Create group failed");
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(DM_CREATE_GROUP_FAILED,
|
||||
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "dm create group failed.");
|
||||
#endif
|
||||
if (hiChainConnectorCallback_ != nullptr) {
|
||||
hiChainConnectorCallback_->OnGroupCreated(requestId, "{}");
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
|
||||
#include "dm_log.h"
|
||||
#include "dm_constants.h"
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
#include "dm_hisysevent.h"
|
||||
#endif
|
||||
#include "dm_adapter_manager.h"
|
||||
#include "ipc_notify_device_state_req.h"
|
||||
#include "ipc_notify_auth_result_req.h"
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
#include "dm_anonymous.h"
|
||||
#include "dm_constants.h"
|
||||
#include "dm_device_info.h"
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
#include "dm_hisysevent.h"
|
||||
#endif
|
||||
#include "dm_log.h"
|
||||
#include "ipc_notify_auth_result_req.h"
|
||||
#include "ipc_notify_device_state_req.h"
|
||||
|
||||
@@ -35,7 +35,6 @@ if (defined(ohos_lite)) {
|
||||
"//utils/system/safwk/native/include",
|
||||
"//third_party/json/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits",
|
||||
"//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
|
||||
]
|
||||
@@ -57,7 +56,6 @@ if (defined(ohos_lite)) {
|
||||
|
||||
deps = [
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static",
|
||||
"//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include",
|
||||
"//base/startup/syspara_lite/frameworks/parameter/src:sysparam",
|
||||
"//foundation/distributedschedule/samgr_lite/samgr",
|
||||
"//third_party/bounds_checking_function:libsec_static",
|
||||
@@ -84,7 +82,6 @@ if (defined(ohos_lite)) {
|
||||
"//utils/system/safwk/native/include",
|
||||
"//third_party/json/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits",
|
||||
"//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"//foundation/communication/ipc/interfaces/innerkits/c/ipc/include",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/bus_center",
|
||||
|
||||
Reference in New Issue
Block a user