mirror of
https://gitee.com/openharmony/deviceprofile_device_info_manager
synced 2024-11-27 01:31:01 +00:00
modify getlocaludid interface
Signed-off-by: gaoqiang_strong <gaoqiang64@huawei.com>
This commit is contained in:
parent
ae313126ee
commit
556541bba9
@ -32,7 +32,7 @@ namespace DistributedDeviceProfile {
|
||||
|
||||
#define WRITE_HELPER_NORET(parcel, type, value) \
|
||||
do { \
|
||||
bool ret = parcel.Write##type((value)); \
|
||||
bool ret = (parcel).Write##type((value)); \
|
||||
if (!ret) { \
|
||||
HILOGE("write value failed!"); \
|
||||
return; \
|
||||
@ -41,7 +41,7 @@ namespace DistributedDeviceProfile {
|
||||
|
||||
#define WRITE_HELPER_RET(parcel, type, value, failRet) \
|
||||
do { \
|
||||
bool ret = parcel.Write##type((value)); \
|
||||
bool ret = (parcel).Write##type((value)); \
|
||||
if (!ret) { \
|
||||
HILOGE("write value failed!"); \
|
||||
return failRet; \
|
||||
@ -59,7 +59,7 @@ namespace DistributedDeviceProfile {
|
||||
|
||||
#define READ_HELPER_RET(parcel, type, out, failRet) \
|
||||
do { \
|
||||
bool ret = parcel.Read##type((out)); \
|
||||
bool ret = (parcel).Read##type((out)); \
|
||||
if (!ret) { \
|
||||
HILOGE("read value failed!"); \
|
||||
return failRet; \
|
||||
|
@ -102,6 +102,7 @@ void DistributedDeviceProfileClient::LoadSystemAbilitySuccess(const sptr<IRemote
|
||||
remoteObject->AddDeathRecipient(dpDeathRecipient_);
|
||||
dpProxy_ = iface_cast<IDistributedDeviceProfile>(remoteObject);
|
||||
proxyConVar_.notify_one();
|
||||
DpRadarHelper::GetInstance().SetDeviceProfileInit(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -462,7 +463,8 @@ sptr<IDistributedDeviceProfile> DistributedDeviceProfileClient::GetDeviceProfile
|
||||
auto object = samgrProxy->CheckSystemAbility(DISTRIBUTED_DEVICE_PROFILE_SA_ID);
|
||||
int32_t stageRes = (object != nullptr) ?
|
||||
static_cast<int32_t>(StageRes::STAGE_SUCC) : static_cast<int32_t>(StageRes::STAGE_FAIL);
|
||||
if (!DpRadarHelper::GetInstance().ReportCheckDpSa(stageRes)) {
|
||||
if (!DpRadarHelper::GetInstance().IsDeviceProfileInit() &&
|
||||
!DpRadarHelper::GetInstance().ReportCheckDpSa(stageRes)) {
|
||||
HILOGE("ReportCheckDpSa failed");
|
||||
}
|
||||
if (object != nullptr) {
|
||||
@ -494,6 +496,7 @@ void DistributedDeviceProfileClient::OnServiceDied(const sptr<IRemoteObject>& re
|
||||
{
|
||||
HILOGI("called");
|
||||
std::lock_guard<std::mutex> lock(serviceLock_);
|
||||
DpRadarHelper::GetInstance().SetDeviceProfileInit(false);
|
||||
dpProxy_ = nullptr;
|
||||
}
|
||||
|
||||
|
@ -127,10 +127,13 @@ public:
|
||||
std::string GetPeerUdidList(const std::vector<AccessControlProfile>& accessControlProfiles);
|
||||
std::string GetPeerUdidList(const std::vector<ServiceProfile>& serviceProfiles);
|
||||
std::string GetPeerUdidList(const std::vector<CharacteristicProfile>& characteristicProfiles);
|
||||
bool IsDeviceProfileInit();
|
||||
void SetDeviceProfileInit(bool isInit);
|
||||
private:
|
||||
std::string GetAnonyUdid(std::string udid);
|
||||
std::string GetLocalUdid();
|
||||
std::string GetPeerUdid(std::string udid);
|
||||
bool isInit_ = false;
|
||||
};
|
||||
} // namespace DistributedDeviceProfile
|
||||
} // namespace OHOS
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <cJSON.h>
|
||||
#include <errors.h>
|
||||
#include "hisysevent.h"
|
||||
#include "content_sensor_manager_utils.h"
|
||||
#include "distributed_device_profile_log.h"
|
||||
#include "profile_utils.h"
|
||||
|
||||
@ -1208,12 +1209,23 @@ std::string DpRadarHelper::GetAnonyUdid(std::string udid)
|
||||
|
||||
std::string DpRadarHelper::GetLocalUdid()
|
||||
{
|
||||
return GetAnonyUdid(ProfileUtils::GetLocalUdidFromDM());
|
||||
return GetAnonyUdid(ContentSensorManagerUtils::GetInstance().ObtainLocalUdid());
|
||||
}
|
||||
|
||||
std::string DpRadarHelper::GetPeerUdid(std::string udid)
|
||||
{
|
||||
return udid.compare(ProfileUtils::GetLocalUdidFromDM()) == 0 ? "" : GetAnonyUdid(udid);
|
||||
std::string localUdid = ContentSensorManagerUtils::GetInstance().ObtainLocalUdid();
|
||||
return udid.compare(localUdid) == 0 ? "" : GetAnonyUdid(udid);
|
||||
}
|
||||
|
||||
bool DpRadarHelper::IsDeviceProfileInit()
|
||||
{
|
||||
return isInit_;
|
||||
}
|
||||
|
||||
void DpRadarHelper::SetDeviceProfileInit(bool isInit)
|
||||
{
|
||||
isInit_ = isInit;
|
||||
}
|
||||
} // namespace DistributedDeviceProfile
|
||||
} // namespace OHOS
|
@ -56,7 +56,7 @@ int32_t SubscribeProfileManager::NotifyProfileChange(ProfileType profileType, Ch
|
||||
return DP_INVALID_PARAMS;
|
||||
}
|
||||
if (!DpRadarHelper::GetInstance().ReportNotifyProfileChange(code)) {
|
||||
HILOGE("ReportPutAclProfile failed");
|
||||
HILOGE("ReportNotifyProfileChange failed");
|
||||
}
|
||||
return (this->*(funcsMap_[code]))(dbKey, dbValue);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user