From ec1f539267e1acaee9238393aa3e5d8c6d9c9fe0 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sun, 11 Sep 2016 00:38:26 +0200 Subject: [PATCH] revert accidentially commited stuff --- .../gadgetbridge/externalevents/NotificationListener.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java index 74c63af3..0c07eee6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java @@ -56,6 +56,7 @@ public class NotificationListener extends NotificationListenerService { private LimitedQueue mActionLookup = new LimitedQueue(16); private final BroadcastReceiver mReceiver = new BroadcastReceiver() { + @SuppressLint("NewApi") @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); @@ -68,7 +69,7 @@ public class NotificationListener extends NotificationListenerService { StatusBarNotification[] sbns = NotificationListener.this.getActiveNotifications(); int handle = intent.getIntExtra("handle", -1); for (StatusBarNotification sbn : sbns) { - if (sbn.getId() == handle) { + if ((int) sbn.getPostTime() == handle) { if (action.equals(ACTION_OPEN)) { try { PendingIntent pi = sbn.getNotification().contentIntent; @@ -91,7 +92,7 @@ public class NotificationListener extends NotificationListenerService { StatusBarNotification[] sbns = NotificationListener.this.getActiveNotifications(); int handle = intent.getIntExtra("handle", -1); for (StatusBarNotification sbn : sbns) { - if (sbn.getId() == handle) { + if ((int) sbn.getPostTime() == handle) { if (GBApplication.isRunningLollipopOrLater()) { String key = sbn.getKey(); NotificationListener.this.cancelNotification(key); @@ -275,7 +276,8 @@ public class NotificationListener extends NotificationListenerService { LOG.info("Processing notification from source " + source); dissectNotificationTo(notification, notificationSpec); - notificationSpec.id = sbn.getId(); + notificationSpec.id = (int) sbn.getPostTime(); //FIMXE: a truly unique id would be better + NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender(notification); List actions = wearableExtender.getActions(); for (NotificationCompat.Action act : actions) {