From ee8eeaf16f47566cae8b6d905fc909a0321f5296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Tue, 26 Nov 2024 21:27:43 +0000 Subject: [PATCH] Garmin: Improve logging if notification picture is not found --- .../gadgetbridge/service/devices/garmin/GarminSupport.java | 7 ++++++- .../service/devices/garmin/NotificationsHandler.java | 1 + .../service/devices/garmin/ProtocolBufferHandler.java | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/GarminSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/GarminSupport.java index fc4a45ac5..77956bc93 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/GarminSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/GarminSupport.java @@ -240,7 +240,12 @@ public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommuni } protected Bitmap getNotificationAttachmentBitmap(int notificationId) { - return BitmapFactory.decodeFile(getNotificationAttachmentPath(notificationId)); + final String picturePath = getNotificationAttachmentPath(notificationId); + final Bitmap bitmap = BitmapFactory.decodeFile(picturePath); + if (bitmap == null) { + LOG.warn("Failed to load bitmap for {} from {}", notificationId, picturePath); + } + return bitmap; } @Override 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 84d1ee776..de2aebeed 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 @@ -135,6 +135,7 @@ public class NotificationsHandler implements MessageHandler { return e; } } + LOG.warn("Failed to find notificationSpec in queue for {}", id); return null; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/ProtocolBufferHandler.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/ProtocolBufferHandler.java index 72f9ee57b..31a2bf3c2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/ProtocolBufferHandler.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/ProtocolBufferHandler.java @@ -370,7 +370,6 @@ public class ProtocolBufferHandler implements MessageHandler { final int notificationId = pictureRequest.getNotificationId(); final Bitmap bmp = deviceSupport.getNotificationAttachmentBitmap(notificationId); if (bmp == null) { - LOG.warn("Failed to find bitmap for notification id {}", notificationId); return null; }