!559 屏蔽deviceid在log全量输出

Merge pull request !559 from 王移波/master
This commit is contained in:
openharmony_ci
2022-05-17 02:09:08 +00:00
committed by Gitee
9 changed files with 33 additions and 31 deletions
+2 -1
View File
@@ -15,6 +15,7 @@
#include "profile_connector.h"
#include "dm_anonymous.h"
#include "dm_constants.h"
#include "dm_log.h"
@@ -111,7 +112,7 @@ void ProfileConnector::OnSyncCompleted(const SyncResult &syncResults)
deviceId = iterResult.first;
SyncStatus = iterResult.second;
}
LOGI("ProfileEventCallback::OnSyncCompleted, deviceId = %s", deviceId.c_str());
LOGI("ProfileEventCallback::OnSyncCompleted, deviceId = %s", GetAnonyString(deviceId).c_str());
std::lock_guard<std::mutex> mutexLock(callbackMapMutex_);
for (auto &iter : callbackMap_) {
iter.second->OnProfileComplete(iter.first, deviceId);
@@ -16,6 +16,7 @@
#include "device_manager_impl.h"
#include <unistd.h>
#include "device_manager_notify.h"
#include "dm_anonymous.h"
#include "dm_constants.h"
#include "dm_log.h"
#include "ipc_authenticate_device_req.h"
@@ -278,7 +279,7 @@ int32_t DeviceManagerImpl::AuthenticateDevice(const std::string &pkgName, int32_
int32_t DeviceManagerImpl::UnAuthenticateDevice(const std::string &pkgName, const DmDeviceInfo &deviceInfo)
{
LOGI("DeviceManager::UnAuthenticateDevice start , pkgName: %s, deviceId: %s", pkgName.c_str(),
deviceInfo.deviceId);
GetAnonyString(std::string(deviceInfo.deviceId)).c_str());
if (pkgName.empty() || (deviceInfo.deviceId[0] == '\0')) {
LOGE("UnAuthenticateDevice error: Invalid para");
return ERR_DM_INPUT_PARAMETER_EMPTY;
@@ -240,7 +240,8 @@ int32_t DeviceManagerImpl::AuthenticateDevice(const std::string &pkgName, int32_
int32_t DeviceManagerImpl::UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId)
{
LOGI("DeviceManager::UnAuthenticateDevice start , pkgName: %s, deviceId: %s", pkgName.c_str(), deviceId.c_str());
LOGI("DeviceManager::UnAuthenticateDevice start , pkgName: %s, deviceId: %s", pkgName.c_str(),
GetAnonyString(deviceId).c_str());
if (deviceId.empty()) {
LOGE("UnAuthenticateDevice error: Invalid para");
return ERR_DM_INPUT_PARAMETER_EMPTY;
@@ -1099,7 +1099,7 @@ void DeviceManagerNapi::CallGetTrustedDeviceListStatusSync(napi_env env, napi_st
{
for (unsigned int i = 0; i < deviceInfoListAsyncCallbackInfo->devList.size(); i++) {
LOGI("DeviceManager::GetTrustedDeviceList deviceId:%s deviceName:%s deviceTypeId:%d ",
deviceInfoListAsyncCallbackInfo->devList[i].deviceId,
GetAnonyString(deviceInfoListAsyncCallbackInfo->devList[i].deviceId).c_str(),
deviceInfoListAsyncCallbackInfo->devList[i].deviceName,
deviceInfoListAsyncCallbackInfo->devList[i].deviceTypeId);
}
@@ -1178,7 +1178,7 @@ void DeviceManagerNapi::CallGetTrustedDeviceListStatus(napi_env env, napi_status
{
for (unsigned int i = 0; i < deviceInfoListAsyncCallbackInfo->devList.size(); i++) {
LOGI("DeviceManager::GetTrustedDeviceList deviceId:%s deviceName:%s deviceTypeId:%d ",
deviceInfoListAsyncCallbackInfo->devList[i].deviceId,
GetAnonyString(deviceInfoListAsyncCallbackInfo->devList[i].deviceId).c_str(),
deviceInfoListAsyncCallbackInfo->devList[i].deviceName,
deviceInfoListAsyncCallbackInfo->devList[i].deviceTypeId);
}
@@ -1221,7 +1221,8 @@ void DeviceManagerNapi::CallGetLocalDeviceInfoSync(napi_env env, napi_status &st
napi_value result[DM_NAPI_ARGS_TWO] = {0};
LOGI("DeviceManager::CallGetLocalDeviceInfoSync deviceId:%s deviceName:%s deviceTypeId:%d ",
deviceInfoAsyncCallbackInfo->deviceInfo.deviceId, deviceInfoAsyncCallbackInfo->deviceInfo.deviceName,
GetAnonyString(deviceInfoAsyncCallbackInfo->deviceInfo.deviceId).c_str(),
deviceInfoAsyncCallbackInfo->deviceInfo.deviceName,
deviceInfoAsyncCallbackInfo->deviceInfo.deviceTypeId);
if (deviceInfoAsyncCallbackInfo->status == 0) {
@@ -1239,7 +1240,8 @@ void DeviceManagerNapi::CallGetLocalDeviceInfo(napi_env env, napi_status &status
{
napi_value result[DM_NAPI_ARGS_TWO] = {0};
LOGI("DeviceManager::CallGetLocalDeviceInfo deviceId:%s deviceName:%s deviceTypeId:%d ",
deviceInfoAsyncCallbackInfo->deviceInfo.deviceId, deviceInfoAsyncCallbackInfo->deviceInfo.deviceName,
GetAnonyString(deviceInfoAsyncCallbackInfo->deviceInfo.deviceId).c_str(),
deviceInfoAsyncCallbackInfo->deviceInfo.deviceName,
deviceInfoAsyncCallbackInfo->deviceInfo.deviceTypeId);
napi_value callResult = nullptr;
napi_value handler = nullptr;
@@ -1427,9 +1429,6 @@ napi_value DeviceManagerNapi::GetTrustedDeviceListSync(napi_env env, napi_callba
LOGI("GetTrustedDeviceListSync in");
napi_value result = nullptr;
napi_value thisVar = nullptr;
DmDeviceInfo deviceInfo;
LOGI("DeviceManager::GetTrustedDeviceListSync deviceId:%s deviceName:%s deviceTypeId:%d ", deviceInfo.deviceId,
deviceInfo.deviceName, deviceInfo.deviceTypeId);
size_t argc = 0;
bool isArray = false;
napi_create_array(env, &result);
@@ -1512,8 +1511,6 @@ napi_value DeviceManagerNapi::GetLocalDeviceInfoSync(napi_env env, napi_callback
napi_value result = nullptr;
napi_value thisVar = nullptr;
DmDeviceInfo deviceInfo;
LOGI("DeviceManager::GetLocalDeviceInfoSync deviceId:%s deviceName:%s deviceTypeId:%d ", deviceInfo.deviceId,
deviceInfo.deviceName, deviceInfo.deviceTypeId);
size_t argc = 0;
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, nullptr, &thisVar, nullptr));
@@ -1525,8 +1522,8 @@ napi_value DeviceManagerNapi::GetLocalDeviceInfoSync(napi_env env, napi_callback
LOGE("GetLocalDeviceInfoSync for failed, ret %d", ret);
return result;
}
LOGI("DeviceManager::GetLocalDeviceInfoSync deviceId:%s deviceName:%s deviceTypeId:%d ", deviceInfo.deviceId,
deviceInfo.deviceName, deviceInfo.deviceTypeId);
LOGI("DeviceManager::GetLocalDeviceInfoSync deviceId:%s deviceName:%s deviceTypeId:%d ",
GetAnonyString(std::string(deviceInfo.deviceId)).c_str(), deviceInfo.deviceName, deviceInfo.deviceTypeId);
DmDeviceInfotoJsDeviceInfo(env, deviceInfo, result);
return result;
}
@@ -1580,7 +1577,7 @@ napi_value DeviceManagerNapi::UnAuthenticateDevice(napi_env env, napi_callback_i
DmDeviceInfo deviceInfo;
JsToDmDeviceInfo(env, argv[0], deviceInfo);
LOGI("UnAuthenticateDevice deviceId = %s", deviceInfo.deviceId);
LOGI("UnAuthenticateDevice deviceId=%s", GetAnonyString(deviceInfo.deviceId).c_str());
DeviceManagerNapi *deviceManagerWrapper = nullptr;
napi_unwrap(env, thisVar, reinterpret_cast<void **>(&deviceManagerWrapper));
int32_t ret = DeviceManager::GetInstance().UnAuthenticateDevice(deviceManagerWrapper->bundleName_, deviceInfo);
@@ -766,7 +766,7 @@ JSIValue DeviceManagerModule::UnAuthenticateDevice(const JSIValue thisVal, const
}
std::string bundleName = GetJSIAppBundleName();
std::string deviceId = JSI::GetStringProperty(args[0], "deviceId");
LOGI("UnAuthenticateDevice deviceId=%s", deviceId.c_str());
LOGI("UnAuthenticateDevice deviceId=%s", GetAnonyString(deviceId.c_str()));
int32_t ret = 0;
ret = OHOS::DistributedHardware::DeviceManager::GetInstance().UnAuthenticateDevice(bundleName, deviceId);
if (ret != 0) {
@@ -789,8 +789,8 @@ JSIValue DeviceManagerModule::GetLocalDeviceInfoSync(const JSIValue thisVal, con
LOGE("GetLocalDeviceInfoSync for failed, ret %d", ret);
return JSI::CreateNull();
}
LOGI("DeviceManager::GetLocalDeviceInfoSync deviceId:%s deviceName:%s deviceTypeId:%d ", deviceInfo.deviceId,
deviceInfo.deviceName, deviceInfo.deviceTypeId);
LOGI("DeviceManager::GetLocalDeviceInfoSync deviceId:%s deviceName:%s deviceTypeId:%d ",
GetAnonyString(deviceInfo.deviceId), deviceInfo.deviceName, deviceInfo.deviceTypeId);
JSIValue result = JSI::CreateObject();
char *deviceId = const_cast<char *>(deviceInfo.deviceId);
char *deviceName = const_cast<char *>(deviceInfo.deviceName);
@@ -985,7 +985,7 @@ JSIValue DeviceManagerModule::AuthenticateDevice(const JSIValue thisVal, const J
DmDeviceInfo deviceInfo;
JsToDmDeviceInfo(args[0], deviceInfo);
LOGI("deviceInfo %s , %s, %d", deviceInfo.deviceId,
LOGI("deviceInfo %s , %s, %d", GetAnonyString(deviceInfo.deviceId),
deviceInfo.deviceName, deviceInfo.deviceTypeId);
DmAppImageInfo appImageInfo(nullptr, 0, nullptr, 0);
std::string extra;
@@ -16,6 +16,7 @@
#include "auth_message_processor.h"
#include "dm_auth_manager.h"
#include "dm_anonymous.h"
#include "dm_constants.h"
#include "dm_log.h"
@@ -130,7 +131,7 @@ void AuthMessageProcessor::CreateResponseAuthMessage(nlohmann::json &json)
json[TAG_TOKEN] = authResponseContext_->token;
if (authResponseContext_->reply == 0) {
std::string groupId = authResponseContext_->groupId;
LOGI("AuthMessageProcessor::CreateSimpleMessage groupId %d", groupId.c_str());
LOGI("AuthMessageProcessor::CreateSimpleMessage groupId %s", GetAnonyString(groupId).c_str());
nlohmann::json jsonObject = nlohmann::json::parse(groupId, nullptr, false);
if (jsonObject.is_discarded()) {
LOGE("DecodeRequestAuth jsonStr error");
@@ -142,8 +143,8 @@ void AuthMessageProcessor::CreateResponseAuthMessage(nlohmann::json &json)
json[TAG_GROUP_ID] = groupId;
json[TAG_GROUP_NAME] = authResponseContext_->groupName;
json[TAG_AUTH_TOKEN] = authResponseContext_->authToken;
LOGI("AuthMessageProcessor::ParseAuthResponseMessage %s,%s", groupId.c_str(),
authResponseContext_->groupName.c_str());
LOGI("AuthMessageProcessor::ParseAuthResponseMessage %s,%s", GetAnonyString(groupId).c_str(),
GetAnonyString(authResponseContext_->groupName).c_str());
}
}
@@ -234,8 +235,8 @@ void AuthMessageProcessor::ParseAuthResponseMessage(nlohmann::json &json)
authResponseContext_->groupId = json[TAG_GROUP_ID];
authResponseContext_->groupName = json[TAG_GROUP_NAME];
authResponseContext_->authToken = json[TAG_AUTH_TOKEN];
LOGI("AuthMessageProcessor::ParseAuthResponseMessage %s,%s", authResponseContext_->groupId.c_str(),
authResponseContext_->groupName.c_str());
LOGI("AuthMessageProcessor::ParseAuthResponseMessage %s,%s",
GetAnonyString(authResponseContext_->groupId).c_str(), authResponseContext_->groupName.c_str());
}
LOGI("AuthMessageProcessor::ParseAuthResponseMessage ");
}
@@ -19,6 +19,7 @@
#include "auth_message_processor.h"
#include "dm_ability_manager.h"
#include "dm_anonymous.h"
#include "dm_config_manager.h"
#include "dm_constants.h"
#include "dm_log.h"
@@ -142,8 +143,8 @@ int32_t DmAuthManager::UnAuthenticateDevice(const std::string &pkgName, const st
hiChainConnector_->GetRelatedGroups(deviceUdid, groupList);
if (groupList.size() > 0) {
groupId = groupList.front().groupId;
LOGI(" DmAuthManager::UnAuthenticateDevice groupId=%s, deviceId=%s, deviceUdid=%s", groupId.c_str(),
deviceId.c_str(), deviceUdid.c_str());
LOGI(" DmAuthManager::UnAuthenticateDevice groupId=%s, deviceId=%s, deviceUdid=%s",
GetAnonyString(groupId).c_str(), GetAnonyString(deviceId).c_str(), GetAnonyString(deviceUdid).c_str());
hiChainConnector_->DeleteGroup(groupId);
} else {
LOGE("DmAuthManager::UnAuthenticateDevice groupList.size = 0");
@@ -333,7 +334,6 @@ void DmAuthManager::OnGroupCreated(int64_t requestId, const std::string &groupId
jsonObj[QR_CODE_KEY] = GenerateGroupName();
jsonObj[NFC_CODE_KEY] = GenerateGroupName();
authResponseContext_->authToken = jsonObj.dump();
LOGI("DmAuthManager::AddMember start %s", authResponseContext_->authToken.c_str());
authResponseContext_->groupId = groupId;
authResponseContext_->code = pinCode;
authMessageProcessor_->SetResponseContext(authResponseContext_);
@@ -529,7 +529,6 @@ int32_t DmAuthManager::AddMember(const std::string &deviceId)
return ERR_DM_FAILED;
}
LOGI("DmAuthManager::AddMember start %s", authResponseContext_->authToken.c_str());
nlohmann::json jsonObject;
jsonObject[TAG_GROUP_ID] = authResponseContext_->groupId;
jsonObject[TAG_GROUP_NAME] = authResponseContext_->groupName;
@@ -60,7 +60,8 @@ int32_t DmDeviceStateManager::RegisterProfileListener(const std::string &pkgName
remoteDeviceInfos_[uuid] = saveInfo;
}
LOGI("RegisterProfileListener in, deviceId = %s, deviceUdid = %s, uuid = %s",
info.deviceId, deviceUdid.c_str(), uuid.c_str());
GetAnonyString(std::string(info.deviceId)).c_str(), GetAnonyString(deviceUdid).c_str(),
GetAnonyString(uuid).c_str());
profileAdapter->RegisterProfileListener(pkgName, deviceUdid, shared_from_this());
}
}
@@ -17,6 +17,7 @@
#include "device_manager_service.h"
#include "dm_constants.h"
#include "dm_anonymous.h"
#include "dm_device_info.h"
#include "dm_log.h"
#include "dm_subscribe_info.h"
@@ -360,7 +361,7 @@ ON_IPC_CMD(UNAUTHENTICATE_DEVICE, MessageParcel &data, MessageParcel &reply)
std::string pkgName = data.ReadString();
std::string deviceId = data.ReadString();
int32_t result = DM_OK;
LOGI("pkgName:%s, trustedDeviceInfo: %d", pkgName.c_str(), deviceId.c_str());
LOGI("pkgName:%s, trustedDeviceInfo: %s", pkgName.c_str(), GetAnonyString(deviceId).c_str());
result = DeviceManagerService::GetInstance().UnAuthenticateDevice(pkgName, deviceId);
if (!reply.WriteInt32(result)) {
LOGE("write result failed");
@@ -395,7 +396,7 @@ ON_IPC_CMD(GET_LOCAL_DEVICE_INFO, MessageParcel &data, MessageParcel &reply)
LOGE("write result failed");
return ERR_DM_IPC_WRITE_FAILED;
}
LOGI("localDeviceInfo: %s", localDeviceInfo.deviceId);
LOGI("localDeviceInfo: %s", GetAnonyString(std::string(localDeviceInfo.deviceId)).c_str());
return DM_OK;
}