diff --git a/services/distributed/src/soft_bus/distributed_cmd_service.cpp b/services/distributed/src/soft_bus/distributed_cmd_service.cpp index 6573549c35d511d642caac8739983a95f012dbdd..2d7ef67620174ed5b77b6e5ff44c3ac938021142 100644 --- a/services/distributed/src/soft_bus/distributed_cmd_service.cpp +++ b/services/distributed/src/soft_bus/distributed_cmd_service.cpp @@ -49,6 +49,8 @@ std::string TransDeviceTypeIdToName(uint16_t deviceType) namespace { constexpr uint32_t DEFAULT_LOCK_SCREEN_FLAG = 2; +constexpr static const char* WEARABLE_DEVICE_TYPE = "wearable"; +constexpr static const char* LITEWEARABLE_DEVICE_TYPE = "liteWearable"; } void DistributedService::InitDeviceState(const DistributedDeviceInfo device) @@ -140,8 +142,22 @@ void DistributedService::SyncAllLiveViewNotification(const DistributedDeviceInfo return; } + // wearable switch set by litewearable + std::string deviceType = TransDeviceTypeIdToName(iter->second.deviceType_); + if (deviceType == WEARABLE_DEVICE_TYPE) { + deviceType = LITEWEARABLE_DEVICE_TYPE; + } + + bool enable = false; + auto result = NotificationHelper::IsDistributedEnabledBySlot(NotificationConstant::SlotType::LIVE_VIEW, + deviceType, enable); + if (result != ERR_OK || !enable) { + ANS_LOGW("Dans get switch %{public}s failed %{public}d.", deviceType.c_str(), result); + return; + } + std::vector> notifications; - auto result = NotificationHelper::GetAllNotificationsBySlotType(notifications, + result = NotificationHelper::GetAllNotificationsBySlotType(notifications, NotificationConstant::SlotType::LIVE_VIEW); if (result != ERR_OK) { ANS_LOGI("Dans get all active %{public}d.", result); @@ -219,8 +235,6 @@ void DistributedService::HandleMatchSync(const std::shared_ptr& boxMessa SyncAllLiveViewNotification(peerDevice, true); } else if (matchType == MatchType::MATCH_ACK) { InitDeviceState(peerDevice); - RequestBundlesIcon(peerDevice); - ReportBundleIconList(peerDevice); SubscribeNotifictaion(peerDevice); SyncAllLiveViewNotification(peerDevice, false); } diff --git a/services/distributed/src/soft_bus/distributed_service.cpp b/services/distributed/src/soft_bus/distributed_service.cpp index 98a4859c68870f20aa5d861fd4b5a8e639ba974c..0109d56e867ae00a260a81a19791d107c487319c 100644 --- a/services/distributed/src/soft_bus/distributed_service.cpp +++ b/services/distributed/src/soft_bus/distributed_service.cpp @@ -159,9 +159,6 @@ void DistributedService::OnHandleMsg(std::shared_ptr& box) case NotificationEventType::REMOVE_ALL_NOTIFICATIONS: RemoveNotifications(box); break; - case NotificationEventType::BUNDLE_ICON_SYNC: - HandleBundleIconSync(box); - break; case NotificationEventType::SYNC_NOTIFICATION: HandleNotificationSync(box); break; @@ -201,10 +198,11 @@ int64_t DistributedService::GetCurrentTime() void DistributedService::SendEventReport( int32_t messageType, int32_t errCode, const std::string& errorReason) { - if (sendReportCallback_ != nullptr || + if (sendReportCallback_ == nullptr || localDevice_.deviceType_ != DistributedHardware::DmDeviceType::DEVICE_TYPE_PHONE) { - sendReportCallback_(messageType, errCode, errorReason); + return; } + sendReportCallback_(messageType, errCode, errorReason); } void DistributedService::InitHACallBack( diff --git a/services/distributed/src/soft_bus/distributed_subscribe_service.cpp b/services/distributed/src/soft_bus/distributed_subscribe_service.cpp index 1a7b4b168e2c0f4b0cfb211f73def58b1185df5b..c4fad07ea28a0e026102d492c4f1e02aae07266d 100644 --- a/services/distributed/src/soft_bus/distributed_subscribe_service.cpp +++ b/services/distributed/src/soft_bus/distributed_subscribe_service.cpp @@ -301,8 +301,12 @@ void DistributedService::OnBatchCanceled(const std::vectorsubmit(task); } @@ -329,8 +333,12 @@ void DistributedService::OnCanceled(const std::shared_ptr& notific ANS_LOGW("dans OnCanceled serialize failed"); return; } + TransDataType dataType = TransDataType::DATA_TYPE_MESSAGE; + if (peerDevice.deviceType_ != DistributedHardware::DmDeviceType::DEVICE_TYPE_PHONE) { + dataType = TransDataType::DATA_TYPE_BYTES; + } DistributedClient::GetInstance().SendMessage(removeBox.GetByteBuffer(), removeBox.GetByteLength(), - TransDataType::DATA_TYPE_MESSAGE, peerDevice.deviceId_, peerDevice.deviceType_); + dataType, peerDevice.deviceId_, peerDevice.deviceType_); }); serviceQueue_->submit(task); }