mirror of
https://github.com/openharmony/device_profile_core.git
synced 2026-07-19 17:05:37 -04:00
!52 sync code review fixes
Merge pull request !52 from Gymee/code_review
This commit is contained in:
@@ -241,14 +241,12 @@ void DistributedDeviceProfileClient::MergeSubscribeInfoLocked(std::list<Subscrib
|
||||
[&newSubscribeInfo](const auto& subscribeInfo) {
|
||||
return subscribeInfo.profileEvent == newSubscribeInfo.profileEvent;
|
||||
});
|
||||
if (iter != subscribeInfos.end()) {
|
||||
if (iter == subscribeInfos.end()) {
|
||||
subscribeInfos.emplace_back(newSubscribeInfo);
|
||||
continue;
|
||||
}
|
||||
// override with the new suscribe info for same profile event
|
||||
if (*iter != newSubscribeInfo) {
|
||||
*iter = newSubscribeInfo;
|
||||
}
|
||||
// override with the new subscribe info for same profile event
|
||||
*iter = newSubscribeInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,4 +299,4 @@ void DistributedDeviceProfileClient::DeviceProfileDeathRecipient::OnRemoteDied(c
|
||||
DistributedDeviceProfileClient::GetInstance().OnServiceDied(remote.promote());
|
||||
}
|
||||
} // namespace DeviceProfile
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -68,7 +68,7 @@ int32_t DistributedDeviceProfileProxy::DeleteDeviceProfile(const std::string& se
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(IDistributedDeviceProfile::GetDescriptor())) {
|
||||
HILOGE("write inteface token failed");
|
||||
HILOGE("write interface token failed");
|
||||
return ERR_FLATTEN_OBJECT;
|
||||
}
|
||||
PARCEL_WRITE_HELPER(data, String, serviceId);
|
||||
@@ -84,7 +84,7 @@ int32_t DistributedDeviceProfileProxy::SubscribeProfileEvents(
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(IDistributedDeviceProfile::GetDescriptor())) {
|
||||
HILOGE("write inteface token failed");
|
||||
HILOGE("write interface token failed");
|
||||
return ERR_FLATTEN_OBJECT;
|
||||
}
|
||||
size_t size = subscribeInfos.size();
|
||||
@@ -116,7 +116,7 @@ int32_t DistributedDeviceProfileProxy::UnsubscribeProfileEvents(
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(IDistributedDeviceProfile::GetDescriptor())) {
|
||||
HILOGE("write inteface token failed");
|
||||
HILOGE("write interface token failed");
|
||||
return ERR_FLATTEN_OBJECT;
|
||||
}
|
||||
if (!DeviceProfileUtils::WriteProfileEvents(profileEvents, data)) {
|
||||
@@ -142,7 +142,7 @@ int32_t DistributedDeviceProfileProxy::SyncDeviceProfile(const SyncOptions& sync
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(IDistributedDeviceProfile::GetDescriptor())) {
|
||||
HILOGE("write inteface token failed");
|
||||
HILOGE("write interface token failed");
|
||||
return ERR_FLATTEN_OBJECT;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ ProfileEventNotifierStub::HandlersMap ProfileEventNotifierStub::InitHandlersMap(
|
||||
int32_t ProfileEventNotifierStub::OnRemoteRequest(uint32_t code, MessageParcel& data,
|
||||
MessageParcel& reply, MessageOption& option)
|
||||
{
|
||||
HILOGI("code = %{public}d", code);
|
||||
HILOGI("code = %{public}u", code);
|
||||
std::u16string descriptor = ProfileEventNotifierStub::GetDescriptor();
|
||||
std::u16string remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (descriptor != remoteDescriptor) {
|
||||
|
||||
@@ -69,12 +69,12 @@ bool TrustGroupManager::CheckTrustGroup(const std::string& deviceId)
|
||||
int32_t ret = hichainGmInstance_->getRelatedGroups(ANY_OS_ACCOUNT, AUTH_APPID.c_str(), deviceId.c_str(),
|
||||
&returnGroups, &groupNum);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("faild , ret: %d", ret);
|
||||
HILOGE("failed, ret:%{public}d", ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (returnGroups == nullptr || groupNum == 0) {
|
||||
HILOGE("faild, returnGroups is nullptr");
|
||||
HILOGE("failed, returnGroups is nullptr");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ bool SyncCoordinator::Init()
|
||||
bool SyncCoordinator::AcquireSync()
|
||||
{
|
||||
if (isOnSync_) {
|
||||
HILOGI("acquire from %{publiic}s", isOnlineTrigger_ ? "online" : "manual");
|
||||
HILOGI("acquire from %{public}s", isOnlineTrigger_ ? "online" : "manual");
|
||||
return false;
|
||||
}
|
||||
isOnSync_ = true;
|
||||
@@ -72,4 +72,4 @@ bool SyncCoordinator::DispatchSyncTask(const SyncTask& syncTask, int64_t delayTi
|
||||
return true;
|
||||
}
|
||||
} // namespace DeviceProfile
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -49,7 +49,7 @@ bool DistributedDeviceProfileStub::EnforceInterfaceToken(MessageParcel& data)
|
||||
int32_t DistributedDeviceProfileStub::OnRemoteRequest(uint32_t code, MessageParcel& data,
|
||||
MessageParcel& reply, MessageOption& option)
|
||||
{
|
||||
HILOGI("code = %{public}d, flags = %{public}d", code, option.GetFlags());
|
||||
HILOGI("code = %{public}u, flags = %{public}d", code, option.GetFlags());
|
||||
|
||||
auto iter = funcsMap_.find(code);
|
||||
if (iter != funcsMap_.end()) {
|
||||
|
||||
@@ -57,6 +57,9 @@ std::unique_ptr<ProfileKey> ProfileKey::Parse(const std::string& entryKey)
|
||||
|
||||
int32_t index = 0;
|
||||
auto profileKey = std::make_unique<ProfileKey>();
|
||||
if (profileKey == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
profileKey->udid = std::move(vec[index++]);
|
||||
if (profileKey->udid.size() != DEVICE_ID_SIZE) {
|
||||
HILOGE("parse udid failed");
|
||||
@@ -191,7 +194,7 @@ void ProfileChangeHandler::NotifyProfileChangedLocked(const ProfileChangeNotific
|
||||
for (auto index : indexes) {
|
||||
filteredEntries.emplace_back(profileEntries[index]);
|
||||
}
|
||||
HILOGI("filtered with %{public}zu entrie(s)", size);
|
||||
HILOGI("filtered with %{public}zu entries", size);
|
||||
bool isLocal = changeNotification.IsLocal();
|
||||
std::string deviceId = changeNotification.GetDeviceId();
|
||||
ProfileChangeNotification filteredNotification(filteredEntries, deviceId, isLocal);
|
||||
|
||||
@@ -421,7 +421,7 @@ HWTEST_F(EventSubscribeTest, SubscribeWithUnsusbscribe002, TestSize.Level2)
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.steps: step4. put a other subscribed service profile
|
||||
* @tc.steps: step4. put a subscribed service profile
|
||||
* @tc.expected: step4. can't receive notification.
|
||||
*/
|
||||
errCode = PutFakeStorage();
|
||||
|
||||
@@ -119,7 +119,7 @@ HWTEST_F(ProfileAuthorityTest, CheckAuthority_003, TestSize.Level0)
|
||||
|
||||
/**
|
||||
* @tc.name: CheckAuthority_004
|
||||
* @tc.desc: check authority of a empty serviceId
|
||||
* @tc.desc: check authority of an empty serviceId
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ProfileAuthorityTest, CheckAuthority_004, TestSize.Level0)
|
||||
@@ -173,7 +173,7 @@ HWTEST_F(ProfileAuthorityTest, CheckAuthority_006, TestSize.Level0)
|
||||
|
||||
/**
|
||||
* @tc.name: CheckAuthority_007
|
||||
* @tc.desc: check authority of mulitiple serviceIds
|
||||
* @tc.desc: check authority of multiple serviceIds
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ProfileAuthorityTest, CheckAuthority_007, TestSize.Level0)
|
||||
@@ -206,4 +206,4 @@ HWTEST_F(ProfileAuthorityTest, CheckAuthority_008, TestSize.Level0)
|
||||
EXPECT_FALSE(AuthorityManager::GetInstance().CheckInterfaceAuthority(""));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ ErrCode DpShellCommand::HelpCommand()
|
||||
ErrCode DpShellCommand::GetDeviceCommand()
|
||||
{
|
||||
resultReceiver_.append("[remote device list]\n");
|
||||
NodeBasicInfo *info = NULL;
|
||||
NodeBasicInfo *info = nullptr;
|
||||
int32_t infoNum = 0;
|
||||
int32_t ret = GetAllNodeDeviceInfo("dp", &info, &infoNum);
|
||||
if (ret != ERR_OK) {
|
||||
|
||||
Reference in New Issue
Block a user