From 89e495c6b15911b1d6051b751e770fc938739c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Sat, 23 May 2026 15:15:58 +0100 Subject: [PATCH] Garmin: Fix empty caller when unknown --- .../service/devices/garmin/NotificationsHandler.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/NotificationsHandler.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/NotificationsHandler.java index b05cbf6a06..d9147e4489 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/NotificationsHandler.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/NotificationsHandler.java @@ -22,6 +22,7 @@ import java.util.Map; import java.util.Queue; import nodomain.freeyourgadget.gadgetbridge.GBApplication; +import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCallControl; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventNotificationControl; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; @@ -80,12 +81,13 @@ public class NotificationsHandler implements MessageHandler { return null; final int id = StringUtils.firstNonBlank(callSpec.number, "Gadgetbridge Call").hashCode(); if (callSpec.command == CallSpec.CALL_INCOMING) { - NotificationSpec callNotificationSpec = new NotificationSpec(id); + final String caller = StringUtils.firstNonBlank(callSpec.name, callSpec.number, GBApplication.getContext().getString(R.string.unknown)); + final NotificationSpec callNotificationSpec = new NotificationSpec(id); callNotificationSpec.phoneNumber = callSpec.number; callNotificationSpec.sourceAppId = callSpec.sourceAppId; - callNotificationSpec.title = StringUtils.isEmpty(callSpec.name) ? callSpec.number : callSpec.name; + callNotificationSpec.title = caller; callNotificationSpec.type = NotificationType.GENERIC_PHONE; - callNotificationSpec.body = StringUtils.isEmpty(callSpec.name) ? callSpec.number : callSpec.name; + callNotificationSpec.body = caller; // add an empty bogus action to toggle the hasActions boolean. The actions are hardcoded on the watch in case of incoming calls. callNotificationSpec.attachedActions = new ArrayList<>();