mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-06-29 16:26:18 +02:00
Fixed notification remove callback by looking up the original id
This commit is contained in:
parent
5c0c5ed952
commit
12bf3e43ca
|
@ -629,6 +629,9 @@ public class NotificationListener extends NotificationListenerService {
|
||||||
@Override
|
@Override
|
||||||
public void onNotificationRemoved(StatusBarNotification sbn) {
|
public void onNotificationRemoved(StatusBarNotification sbn) {
|
||||||
LOG.info("Notification removed: " + sbn.getPackageName());
|
LOG.info("Notification removed: " + sbn.getPackageName());
|
||||||
|
|
||||||
|
int originalId = (int) mNotificationHandleLookup.lookupByValue(sbn.getPostTime());
|
||||||
|
|
||||||
if (GBApplication.isRunningLollipopOrLater()) {
|
if (GBApplication.isRunningLollipopOrLater()) {
|
||||||
LOG.info("Notification removed: " + sbn.getPackageName() + ", category: " + sbn.getNotification().category);
|
LOG.info("Notification removed: " + sbn.getPackageName() + ", category: " + sbn.getNotification().category);
|
||||||
if (Notification.CATEGORY_CALL.equals(sbn.getNotification().category) && activeCallPostTime == sbn.getPostTime()) {
|
if (Notification.CATEGORY_CALL.equals(sbn.getNotification().category) && activeCallPostTime == sbn.getPostTime()) {
|
||||||
|
@ -638,17 +641,14 @@ public class NotificationListener extends NotificationListenerService {
|
||||||
GBApplication.deviceService().onSetCallState(callSpec);
|
GBApplication.deviceService().onSetCallState(callSpec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// FIXME: DISABLED for now
|
|
||||||
/*
|
|
||||||
if (shouldIgnore(sbn))
|
if (shouldIgnore(sbn))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
if (prefs.getBoolean("autoremove_notifications", false)) {
|
if (prefs.getBoolean("autoremove_notifications", true)) {
|
||||||
LOG.info("notification removed, will ask device to delete it");
|
LOG.info("notification removed, will ask device to delete it");
|
||||||
GBApplication.deviceService().onDeleteNotification((int) sbn.getPostTime());
|
GBApplication.deviceService().onDeleteNotification(originalId);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,4 +53,13 @@ public class LimitedQueue {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronized public Object lookupByValue(Object value){
|
||||||
|
for (Pair entry : list) {
|
||||||
|
if (value.equals(entry.second)) {
|
||||||
|
return entry.first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user