Signed-off-by: wangyb0625 <wangyibo38@huawei.com>
This commit is contained in:
wangyb0625
2022-06-16 16:40:24 +08:00
parent 52ae2bf96f
commit 6917c62d45
4 changed files with 29 additions and 29 deletions
@@ -71,19 +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))
#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
#endif
return ERR_DM_INIT_FAILED;
}
DeviceManagerNotify::GetInstance().RegisterDeathRecipientCallback(pkgName, dmInitCallback);
LOGI("InitDeviceManager success");
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
#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
#endif
return DM_OK;
}
@@ -151,19 +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))
#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
#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))
#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
#endif
return DM_OK;
}
@@ -225,18 +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))
#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
#endif
return ret;
}
LOGI("StartDeviceDiscovery completed, pkgName: %s", pkgName.c_str());
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
#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
#endif
return DM_OK;
}
@@ -291,14 +291,16 @@ 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))
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(DM_SEND_REQUEST_FAILED,
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "send request failed.");
#endif
return ERR_DM_IPC_SEND_REQUEST_FAILED;
}
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(DM_SEND_REQUEST_SUCCESS,
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "send request success.");
#endif
ret = rsp->GetErrCode();
if (ret != DM_OK) {
@@ -330,16 +332,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))
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(UNAUTHENTICATE_DEVICE_FAILED,
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "unauthenticate device failed.");
#endif
#endif
return ERR_DM_IPC_RESPOND_FAILED;
}
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
DistributedDM::HisyseventUtil::GetInstance().SysEventWrite(UNAUTHENTICATE_DEVICE_SUCCESS,
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "unauthenticate device success.");
#endif
#endif
LOGI("UnAuthenticateDevice completed, pkgName: %s", pkgName.c_str());
return DM_OK;
+1 -3
View File
@@ -108,9 +108,7 @@ if (defined(ohos_lite)) {
if (os_account_part_exists) {
defines += [ "OS_ACCOUNT_PART_EXISTS" ]
include_dirs += [
"//base/account/os_account/interfaces/innerkits/osaccount/native/include",
]
include_dirs += [ "//base/account/os_account/interfaces/innerkits/osaccount/native/include" ]
}
ldflags = dm_ldflags
@@ -264,20 +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))
#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
#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))
#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
#endif
if (hiChainConnectorCallback_ != nullptr) {
hiChainConnectorCallback_->OnMemberJoin(requestId, DM_OK);
hiChainConnectorCallback_->OnGroupCreated(requestId, data);
@@ -307,10 +307,10 @@ void HiChainConnector::onError(int64_t requestId, int operationCode, int errorCo
}
if (operationCode == GroupOperationCode::GROUP_CREATE) {
LOGE("Create group failed");
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
#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
#endif
if (hiChainConnectorCallback_ != nullptr) {
hiChainConnectorCallback_->OnGroupCreated(requestId, "{}");
}
+2 -2
View File
@@ -159,7 +159,7 @@ ohos_unittest("UTTest_softbus_connector") {
deps = [ ":device_manager_test" ]
external_deps = [ "hisysevent_native:libhisysevent", ]
external_deps = [ "hisysevent_native:libhisysevent" ]
}
## UnitTest UTTest_softbus_connector }}}
@@ -364,7 +364,7 @@ ohos_unittest("UTTest_dm_device_state_manager") {
deps = [ ":device_manager_test" ]
external_deps = [ "hisysevent_native:libhisysevent", ]
external_deps = [ "hisysevent_native:libhisysevent" ]
}
## UnitTest UTTest_dm_device_state_manager }}}