2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-09-05 16:45:08 +00:00

Added setting to filter notifications from certain applications

REVIEW: 121687
This commit is contained in:
Vineet Garg
2015-01-10 00:22:53 -08:00
committed by Albert Vaca
parent 75697cedca
commit 5e905ddd63
7 changed files with 358 additions and 5 deletions

View File

@@ -64,7 +64,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
@Override
public boolean hasSettings() {
return false;
return true;
}
@Override
@@ -199,6 +199,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
public void sendNotification(StatusBarNotification statusBarNotification, boolean requestAnswer) {
Notification notification = statusBarNotification.getNotification();
AppDatabase appDatabase = new AppDatabase(context);
if ((notification.flags & Notification.FLAG_FOREGROUND_SERVICE) != 0
|| (notification.flags & Notification.FLAG_ONGOING_EVENT) != 0
@@ -207,6 +208,13 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
return;
}
appDatabase.open();
if (!appDatabase.isFilterEnabled(statusBarNotification.getPackageName())){
return;
// we dont want notification from this app
}
appDatabase.close();
NotificationId id = NotificationId.fromNotification(statusBarNotification);
NetworkPackage np = new NetworkPackage(NetworkPackage.PACKAGE_TYPE_NOTIFICATION);