diff --git a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java --- a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java +++ b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java @@ -57,12 +57,8 @@ public final static String PACKAGE_TYPE_NOTIFICATION_REQUEST = "kdeconnect.notification.request"; public final static String PACKAGE_TYPE_NOTIFICATION_REPLY = "kdeconnect.notification.reply"; - - private boolean sendIcons = true; - private Map pendingIntents; - @Override public String getDisplayName() { return context.getResources().getString(R.string.pref_plugin_notifications); @@ -95,7 +91,7 @@ @Override public boolean onCreate() { - pendingIntents = new HashMap(); + pendingIntents = new HashMap<>(); if (hasPermission()) { NotificationReceiver.RunCommand(context, new NotificationReceiver.InstanceCallback() { @@ -195,26 +191,24 @@ np.set("requestAnswer", true); //For compatibility with old desktop versions of KDE Connect that don't support "silent" } - if (sendIcons) { - try { - Bitmap appIcon = notification.largeIcon; + try { + Bitmap appIcon = notification.largeIcon; - if (appIcon != null) { - ByteArrayOutputStream outStream = new ByteArrayOutputStream(); - if (appIcon.getWidth() > 128) { - appIcon = Bitmap.createScaledBitmap(appIcon, 96, 96, true); - } - appIcon.compress(Bitmap.CompressFormat.PNG, 90, outStream); - byte[] bitmapData = outStream.toByteArray(); + if (appIcon != null) { + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + if (appIcon.getWidth() > 128) { + appIcon = Bitmap.createScaledBitmap(appIcon, 96, 96, true); + } + appIcon.compress(Bitmap.CompressFormat.PNG, 90, outStream); + byte[] bitmapData = outStream.toByteArray(); - np.setPayload(bitmapData); + np.setPayload(bitmapData); - np.set("payloadHash", getChecksum(bitmapData)); - } - } catch (Exception e) { - e.printStackTrace(); - Log.e("NotificationsPlugin", "Error retrieving icon"); + np.set("payloadHash", getChecksum(bitmapData)); } + } catch (Exception e) { + e.printStackTrace(); + Log.e("NotificationsPlugin", "Error retrieving icon"); } RepliableNotification rn = extractRepliableNotification(statusBarNotification); @@ -407,11 +401,7 @@ @Override public boolean onPackageReceived(final NetworkPackage np) { -/* - if (np.getBoolean("sendIcons")) { - sendIcons = true; - } -*/ + if (np.getBoolean("request")) { NotificationReceiver.RunCommand(context, new NotificationReceiver.InstanceCallback() {