From 0edb9a4d5d1651ab2dd961bb1ebbaaa35b330164 Mon Sep 17 00:00:00 2001 From: xdongs Date: Mon, 23 Jun 2025 18:59:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E5=9C=BA=E6=99=AF=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xdongs --- services/ans/include/smart_reminder_center.h | 3 +-- services/ans/src/distributed_device_status.cpp | 2 +- .../smart_reminder_center.cpp | 10 ++++------ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/services/ans/include/smart_reminder_center.h b/services/ans/include/smart_reminder_center.h index cab44d153..c2e2ac5fa 100644 --- a/services/ans/include/smart_reminder_center.h +++ b/services/ans/include/smart_reminder_center.h @@ -110,11 +110,10 @@ private: constexpr static const char* SPLIT_FLAG = "|"; constexpr static const char* STATUS_UNUSED = "xxx0"; constexpr static const char* STATUS_UNLOCK_OWNER = "x01x"; - constexpr static const uint32_t STATUS_USED_FLAG = 1; + constexpr static const uint32_t STATUS_UNLOCKED_USED_FLAG = 3; const std::string EXTEND_INFO_PRE = "notification_collaboration"; const std::string EXTEND_INFO_APP_NAME = "app_name"; const std::string EXTEND_INFO_APP_LABEL = "app_label"; - const std::string EXTEND_INFO_APP_ICON = "app_icon"; const std::string EXTEND_INFO_APP_INDEX = "app_index"; const std::string EXTEND_INFO_DEVICE_ID = "deviceId"; const std::string EXTEND_INFO_USER_ID = "userId"; diff --git a/services/ans/src/distributed_device_status.cpp b/services/ans/src/distributed_device_status.cpp index 1f01300aa..4787dc796 100644 --- a/services/ans/src/distributed_device_status.cpp +++ b/services/ans/src/distributed_device_status.cpp @@ -146,7 +146,7 @@ DeviceStatus DistributedDeviceStatus::GetMultiDeviceStatus( { std::lock_guard lock(mapLock_); for (DeviceStatus device : deviceInfo_) { - if (device.deviceType == deviceType && (device.status & status) > 0) { + if (device.deviceType == deviceType && (device.status & status) == status) { return device; } } diff --git a/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp b/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp index b62dd8482..9e990318b 100644 --- a/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp +++ b/services/ans/src/notification_smart_reminder/smart_reminder_center.cpp @@ -289,6 +289,7 @@ void SmartReminderCenter::ReminderDecisionProcess(const sptr> statusMap; InitValidDevices(syncDevices, smartDevices, statusMap, request); if (syncDevices.size() <= 1) { + request->SetDeviceFlags(notificationFlagsOfDevices); return; } @@ -400,7 +401,7 @@ void SmartReminderCenter::InitPcPadDevices(const string &deviceType, } // used device DeviceStatus deviceStatus = DelayedSingleton::GetInstance()-> - GetMultiDeviceStatus(deviceType, STATUS_USED_FLAG); + GetMultiDeviceStatus(deviceType, STATUS_UNLOCKED_USED_FLAG); if (deviceStatus.deviceType.empty()) { ANS_LOGI("PC/PAD init, not get any used device, type = %{public}s", deviceType.c_str()); return; @@ -478,8 +479,6 @@ void SmartReminderCenter::FillRequestExtendInfo(const string &deviceType, Device extendInfo->SetParam(EXTEND_INFO_PRE + "_" + EXTEND_INFO_APP_NAME, AAFwk::String::Box(appInfo.name)); extendInfo->SetParam(EXTEND_INFO_PRE + "_" + EXTEND_INFO_APP_LABEL, AAFwk::String::Box(bundleResourceInfo.label)); - extendInfo->SetParam(EXTEND_INFO_PRE + "_" + EXTEND_INFO_APP_ICON, - AAFwk::String::Box(bundleResourceInfo.icon)); extendInfo->SetParam(EXTEND_INFO_PRE + "_" + EXTEND_INFO_APP_INDEX, AAFwk::Integer::Box(appInfo.appIndex)); @@ -488,9 +487,8 @@ void SmartReminderCenter::FillRequestExtendInfo(const string &deviceType, Device extendInfo->SetParam(EXTEND_INFO_PRE + "_" + EXTEND_INFO_USER_ID + "_" + deviceType, AAFwk::Integer::Box(deviceStatus.userId)); request->SetExtendInfo(extendInfo); - ANS_LOGI("FillRequestExtendInfo result: %{public}s %{public}s %{public}s %{public}d %{public}s %{public}d", - appInfo.name.c_str(), bundleResourceInfo.label.c_str(), - bundleResourceInfo.icon.c_str(), appInfo.appIndex, + ANS_LOGI("FillRequestExtendInfo result: %{public}s %{public}s %{public}d %{public}s %{public}d", + appInfo.name.c_str(), bundleResourceInfo.label.c_str(), appInfo.appIndex, deviceStatus.deviceId.c_str(), deviceStatus.userId); return; } -- Gitee