diff options
Diffstat (limited to 'android')
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java | 4 | ||||
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/util/BluetoothOperator.java | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java index f2ead2868a4e..d7915c3a9d57 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java @@ -302,6 +302,10 @@ public class CommunicationService extends Service implements Runnable, MessagesL } private void restoreBluetoothState() { + if (!BluetoothOperator.isStateValid(mBluetoothState)) { + return; + } + if (mBluetoothState.wasBluetoothEnabled()) { return; } diff --git a/android/sdremote/src/org/libreoffice/impressremote/util/BluetoothOperator.java b/android/sdremote/src/org/libreoffice/impressremote/util/BluetoothOperator.java index 4be74e172d31..56b05aa5af43 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/util/BluetoothOperator.java +++ b/android/sdremote/src/org/libreoffice/impressremote/util/BluetoothOperator.java @@ -39,9 +39,17 @@ public final class BluetoothOperator { } public static State getState() { + if (!isAvailable()) { + return null; + } + return new State(getAdapter().isEnabled()); } + public static boolean isStateValid(State aState) { + return aState != null; + } + public static void enable() { if (!isAvailable()) { return; |