From efa7920b9db144ee188c77deb92e66d53e985847 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sat, 7 Feb 2015 13:20:38 +0100 Subject: [PATCH] do not disable/enable NotificationListener at runtime (leads to loss of permissions to read notifications) --- .../gadgetbridge/BluetoothCommunicationService.java | 2 +- .../freeyourgadget/gadgetbridge/PhoneCallReceiver.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/BluetoothCommunicationService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/BluetoothCommunicationService.java index f1cf57cc..7da5a6ee 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/BluetoothCommunicationService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/BluetoothCommunicationService.java @@ -58,7 +58,7 @@ public class BluetoothCommunicationService extends Service { PhoneCallReceiver.class, SMSReceiver.class, K9Receiver.class, - NotificationListener.class, + //NotificationListener.class, // disabling this leads to loss of permission to read notifications }; int newState; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/PhoneCallReceiver.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/PhoneCallReceiver.java index bb6986aa..4df2922f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/PhoneCallReceiver.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/PhoneCallReceiver.java @@ -50,7 +50,13 @@ public class PhoneCallReceiver extends BroadcastReceiver { } break; case TelephonyManager.CALL_STATE_IDLE: - pebblePhoneCommand = PebbleProtocol.PHONECONTROL_END; + if (mLastState == TelephonyManager.CALL_STATE_RINGING) { + //pebblePhoneCommand = PebbleProtocol.PHONECONTROL_MISSEDCALL; + pebblePhoneCommand = PebbleProtocol.PHONECONTROL_END; // MISSED CALL DOES NOT WORK + } + else { + pebblePhoneCommand = PebbleProtocol.PHONECONTROL_END; + } break; } if (pebblePhoneCommand != -1) {