mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01: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
|
||||
public void onNotificationRemoved(StatusBarNotification sbn) {
|
||||
LOG.info("Notification removed: " + sbn.getPackageName());
|
||||
|
||||
int originalId = (int) mNotificationHandleLookup.lookupByValue(sbn.getPostTime());
|
||||
|
||||
if (GBApplication.isRunningLollipopOrLater()) {
|
||||
LOG.info("Notification removed: " + sbn.getPackageName() + ", category: " + sbn.getNotification().category);
|
||||
if (Notification.CATEGORY_CALL.equals(sbn.getNotification().category) && activeCallPostTime == sbn.getPostTime()) {
|
||||
@ -638,17 +641,14 @@ public class NotificationListener extends NotificationListenerService {
|
||||
GBApplication.deviceService().onSetCallState(callSpec);
|
||||
}
|
||||
}
|
||||
// FIXME: DISABLED for now
|
||||
/*
|
||||
if (shouldIgnore(sbn))
|
||||
return;
|
||||
|
||||
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");
|
||||
GBApplication.deviceService().onDeleteNotification((int) sbn.getPostTime());
|
||||
GBApplication.deviceService().onDeleteNotification(originalId);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,4 +53,13 @@ public class LimitedQueue {
|
||||
}
|
||||
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