From 1f1a34cf258f50ad30e1855d2d73c25448f2844e Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Sat, 17 Dec 2016 18:16:28 +0100 Subject: [PATCH 1/6] Replace the contributors.md file with a self-generating contributors.rst file. The contributors.rst file is a bash quine originally found here https://gist.github.com/danielegobbetti/c691740ec6f815c75c065049fdc35243 --- CONTRIBUTORS.md | 39 ------------------------------ CONTRIBUTORS.rst | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 39 deletions(-) delete mode 100644 CONTRIBUTORS.md create mode 100644 CONTRIBUTORS.rst diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md deleted file mode 100644 index e876751d7..000000000 --- a/CONTRIBUTORS.md +++ /dev/null @@ -1,39 +0,0 @@ - Andreas Shimokawa - Carsten Pfeiffer - Daniele Gobbetti - Julien Pivotto - Steffen Liebergeld - Lem Dulfo - Sergey Trofimov - JohnnySun - Uwe Hermann - 0nse <0nse@users.noreply.github.com> - Gergely Peidl - Christian Fischer - Normano64 - Ⲇⲁⲛⲓ Φi - xzovy - xphnx - Tarik Sekmen - Szymon Tomasz Stefanek - Roman Plevka - rober - Nicolò Balzarotti - Natanael Arndt - Marc Schlaich - kevlarcade - Kevin Richter - Kasha - Ivan - Gilles MOREL - Gilles Émilien MOREL - Chris Perelstein - Carlos Ferreira - atkyritsis - andre - Alexey Afanasev - 6arms1leg - -And all the Transifex translators, which I cannot automatically list, at the moment. - -git log --raw | grep "^Author: " | sort | uniq -c | sort -k 1 -n -r | cut -f 2- -d: > CONTRIBUTORS.md diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst new file mode 100644 index 000000000..e6698fda0 --- /dev/null +++ b/CONTRIBUTORS.rst @@ -0,0 +1,63 @@ +.. 2>/dev/null + names () + { + echo -e "\n exit;\n**Contributors (sorted by number of commits):**\n"; + git log --all --format='%aN:%aE' | sed 's/@users.github.com/@users.noreply.github.com/g' | awk 'BEGIN{FS=":"}{ct[$2]+=1;if (length($1) > length(e[$2])) {e[$2]=$1}}END{for (i in e) { n[e[i]]=i;c[e[i]]+=ct[i] }; for (a in n) print c[a]"\t* "a" <"n[a]">";}' | sort -n -r | cut -f 2- + } + quine () + { + { + echo ".. 2>/dev/null"; + declare -f names | sed -e 's/^[[:space:]]*/ /'; + declare -f quine | sed -e 's/^[[:space:]]*/ /'; + echo -e " quine\n"; + names; + echo -e "\nAnd all the Transifex translators, which I cannot automatically list, at the moment.\n\n*To update the contributors list just run this file with bash*" + } > CONTRIBUTORS.rst; + exit + } + quine + + + exit; +**Contributors (sorted by number of commits):** + +* Andreas Shimokawa +* Carsten Pfeiffer +* Daniele Gobbetti +* Julien Pivotto +* Steffen Liebergeld +* Lem Dulfo +* Sergey Trofimov +* JohnnySun +* Uwe Hermann +* Gergely Peidl +* 0nse <0nse@users.noreply.github.com> +* Christian Fischer +* Normano64 +* Ⲇⲁⲛⲓ Φi +* xzovy +* xphnx +* Tarik Sekmen +* Szymon Tomasz Stefanek +* Roman Plevka +* rober +* Nicolò Balzarotti +* Natanael Arndt +* Marc Schlaich +* kevlarcade +* Kevin Richter +* Kasha +* Ivan +* Gilles MOREL +* Gilles Émilien MOREL +* Chris Perelstein +* Carlos Ferreira +* atkyritsis +* andre +* Alexey Afanasev +* 6arms1leg + +And all the Transifex translators, which I cannot automatically list, at the moment. + +*To update the contributors list just run this file with bash* From 861c655b5d864455ec37b5602038fb0c4fad3b76 Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Sun, 18 Dec 2016 10:40:30 +0100 Subject: [PATCH 2/6] Log the incoming notification flags. Should help further diagnosing #456 --- .../gadgetbridge/externalevents/NotificationListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java index 0c29c664f..b8208441e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java @@ -197,12 +197,12 @@ public class NotificationListener extends NotificationListenerService { //don't forward group summary notifications to the wearable, they are meant for the android device only if ((notification.flags & Notification.FLAG_GROUP_SUMMARY) == Notification.FLAG_GROUP_SUMMARY) { - LOG.info("Not forwarding notification, FLAG_GROUP_SUMMARY is set"); + LOG.info("Not forwarding notification, FLAG_GROUP_SUMMARY is set. Notification flags: " + notification.flags); return; } if ((notification.flags & Notification.FLAG_ONGOING_EVENT) == Notification.FLAG_ONGOING_EVENT) { - LOG.info("Not forwarding notification, FLAG_ONGOING_EVENT is set"); + LOG.info("Not forwarding notification, FLAG_ONGOING_EVENT is set. Notification flags: " + notification.flags); return; } From f1965c7b009efa485c8d0e50bbc92433ce6f4468 Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Sun, 18 Dec 2016 11:03:54 +0100 Subject: [PATCH 3/6] Log the flags also when passing the notification to device #456 --- .../gadgetbridge/externalevents/NotificationListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java index b8208441e..5264422a0 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java @@ -258,7 +258,7 @@ public class NotificationListener extends NotificationListenerService { notificationSpec.type = AppNotificationType.getInstance().get(source); - LOG.info("Processing notification from source " + source); + LOG.info("Processing notification from source " + source + " with flags: " + notification.flags); dissectNotificationTo(notification, notificationSpec, preferBigText); notificationSpec.id = (int) sbn.getPostTime(); //FIMXE: a truly unique id would be better From 846c74aa86370fb88cb21445aeb8398757bdbd7c Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Sun, 18 Dec 2016 18:00:16 +0100 Subject: [PATCH 4/6] Forward also group summary notifications, if they contain wearable actions. Hopefully helps with #456 Tested with conversations and there is no regression. Also a specific workaround for telegram was removed, hopefully this does not break #395 --- .../externalevents/NotificationListener.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java index 5264422a0..c3cd2b3c7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java @@ -34,7 +34,6 @@ import nodomain.freeyourgadget.gadgetbridge.model.AppNotificationType; import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationType; import nodomain.freeyourgadget.gadgetbridge.service.DeviceCommunicationService; import nodomain.freeyourgadget.gadgetbridge.util.LimitedQueue; import nodomain.freeyourgadget.gadgetbridge.util.Prefs; @@ -190,19 +189,13 @@ public class NotificationListener extends NotificationListenerService { if (!prefs.getBoolean("notifications_generic_whenscreenon", false)) { PowerManager powermanager = (PowerManager) getSystemService(POWER_SERVICE); if (powermanager.isScreenOn()) { - LOG.info("Not forwarding notification, screen seems to be on and settings do not allow this"); +// LOG.info("Not forwarding notification, screen seems to be on and settings do not allow this"); return; } } - //don't forward group summary notifications to the wearable, they are meant for the android device only - if ((notification.flags & Notification.FLAG_GROUP_SUMMARY) == Notification.FLAG_GROUP_SUMMARY) { - LOG.info("Not forwarding notification, FLAG_GROUP_SUMMARY is set. Notification flags: " + notification.flags); - return; - } - if ((notification.flags & Notification.FLAG_ONGOING_EVENT) == Notification.FLAG_ONGOING_EVENT) { - LOG.info("Not forwarding notification, FLAG_ONGOING_EVENT is set. Notification flags: " + notification.flags); +// LOG.info("Not forwarding notification, FLAG_ONGOING_EVENT is set. Notification flags: " + notification.flags); return; } @@ -266,8 +259,9 @@ public class NotificationListener extends NotificationListenerService { NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender(notification); List actions = wearableExtender.getActions(); - if (actions.isEmpty() && notificationSpec.type == NotificationType.TELEGRAM) { - return; // workaround for duplicate telegram message + if (actions.isEmpty() && (notification.flags & Notification.FLAG_GROUP_SUMMARY) == Notification.FLAG_GROUP_SUMMARY) { //this could cause #395 to come back + LOG.info("Not forwarding notification, FLAG_GROUP_SUMMARY is set and no wearable action present. Notification flags: " + notification.flags); + return; } for (NotificationCompat.Action act : actions) { From 771ca948a4caa88acaa6f48adb69f90ba8ca3529 Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Mon, 19 Dec 2016 18:20:32 +0100 Subject: [PATCH 5/6] Add changelog regarding #456 --- CHANGELOG.md | 3 +++ app/src/main/res/xml/changelog_master.xml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82c8ebdbd..ec7726c69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ###Changelog +####Version next +* Improved handling of notifications for some apps + ####Version 0.15.0 * New device: Liveview * Liveview: initial support (set the time and receive notifications) diff --git a/app/src/main/res/xml/changelog_master.xml b/app/src/main/res/xml/changelog_master.xml index 4f1ec60ea..5141cf200 100644 --- a/app/src/main/res/xml/changelog_master.xml +++ b/app/src/main/res/xml/changelog_master.xml @@ -1,5 +1,8 @@ + + * Improved handling of notifications for some apps + New device: Liveview Liveview: initial support (set the time and receive notifications) From bd5dc6bfbc037da63a45fa755aa029ee5765b997 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Mon, 19 Dec 2016 23:28:06 +0100 Subject: [PATCH 6/6] Pebble 2/LE: Add setting to limit the MTU (for debugging broken BLE stacks) --- .../service/devices/pebble/ble/PebbleLESupport.java | 8 +++++++- app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/preferences.xml | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleLESupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleLESupport.java index 6fa3d2c2e..883cc13d8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleLESupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleLESupport.java @@ -10,6 +10,8 @@ import java.io.IOException; import java.io.PipedInputStream; import java.io.PipedOutputStream; +import nodomain.freeyourgadget.gadgetbridge.GBApplication; + public class PebbleLESupport { private static final Logger LOG = LoggerFactory.getLogger(PebbleLESupport.class); private final BluetoothDevice mBtDevice; @@ -19,6 +21,7 @@ public class PebbleLESupport { private PipedInputStream mPipedInputStream; private PipedOutputStream mPipedOutputStream; private int mMTU = 20; + private int mMTULimit = Integer.MAX_VALUE; boolean mIsConnected = false; public PebbleLESupport(Context context, final BluetoothDevice btDevice, PipedInputStream pipedInputStream, PipedOutputStream pipedOutputStream) throws IOException { @@ -31,6 +34,9 @@ public class PebbleLESupport { } catch (IOException e) { LOG.warn("could not connect input stream"); } + mMTULimit = GBApplication.getPrefs().getInt("pebble_mtu_limit", 512); + mMTULimit = Math.max(mMTULimit, 20); + mMTULimit = Math.min(mMTULimit, 512); mPebbleGATTServer = new PebbleGATTServer(this, context, mBtDevice); if (mPebbleGATTServer.initialize()) { @@ -99,7 +105,7 @@ public class PebbleLESupport { } void setMTU(int mtu) { - mMTU = mtu; + mMTU = Math.min(mtu, mMTULimit); } private class PipeReader extends Thread { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 09c215ed1..a9d2e3e2b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -120,6 +120,8 @@ Enable features that are untested. ENABLE ONLY IF YOU KNOW WHAT YOU ARE DOING! Always prefer BLE Use experimental Pebble LE support for all Pebbles instead of BT classic, requires paring a "Pebble LE" after non LE had been connected once + Pebble 2/LE GATT MTU limit + If your Pebble 2/Pebble LE does not work as expected, try this setting to limit the MTU (valid range 20–512) Enable Watch App Logging Will cause logs from watch apps to be logged by Gadgetbridge (requires reconnect) diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index efe3e4c7f..b721a88f7 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -341,6 +341,13 @@ android:key="pebble_force_le" android:summary="@string/pref_summary_pebble_forcele" android:title="@string/pref_title_pebble_forcele" /> +