From 4fd96062f699e9db55029e94092d5d98f1ca8f27 Mon Sep 17 00:00:00 2001 From: Mariusz Fik Date: Sat, 15 Mar 2014 17:31:44 +0100 Subject: [PATCH] Fix crash when user tries to unload plugin, which is not supported by platform. --- .../Plugins/NotificationsPlugin/NotificationsPlugin.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java b/src/main/java/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java index fa641d88..a6e04d62 100644 --- a/src/main/java/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java +++ b/src/main/java/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java @@ -116,7 +116,9 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver. @Override public boolean onCreate() { - if (Build.VERSION.SDK_INT < 18) return false; + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { + return false; + } //Check for permissions String notificationListenerList = Settings.Secure.getString(context.getContentResolver(), "enabled_notification_listeners"); @@ -146,6 +148,11 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver. @Override public void onDestroy() { + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { + return; + } + NotificationReceiver.RunCommand(context, new NotificationReceiver.InstanceCallback() { @Override public void onServiceStart(NotificationReceiver service) {