Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Fixed notification remove callback by looking up the original id #1693

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,9 @@ public boolean handleMediaSessionNotification(MediaSessionCompat.Token mediaSess
@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()) {
Expand All @@ -638,17 +641,14 @@ public void onNotificationRemoved(StatusBarNotification sbn) {
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)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the default?

LOG.info("notification removed, will ask device to delete it");
GBApplication.deviceService().onDeleteNotification((int) sbn.getPostTime());
GBApplication.deviceService().onDeleteNotification(originalId);
}
*/
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,13 @@ synchronized public Object lookup(int id) {
}
return null;
}

synchronized public Object lookupByValue(Object value){
for (Pair entry : list) {
if (value.equals(entry.second)) {
return entry.first;
}
}
return null;
}
}