[Libreoffice-commits] core.git: android/sdremote
Michael Meeks
michael.meeks at suse.com
Thu Aug 1 06:37:44 PDT 2013
android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServerConnection.java | 1
android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java | 2 -
android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java | 13 ++++++++--
3 files changed, 13 insertions(+), 3 deletions(-)
New commits:
commit 687b62f4812f88c9aef3bdd864358282850aa2ec
Author: Michael Meeks <michael.meeks at suse.com>
Date: Thu Aug 1 15:35:41 2013 +0200
android: don't mess with the system bluetooth setting unless we have to.
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServerConnection.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServerConnection.java
index 6ecaabe..fe5834d 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServerConnection.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServerConnection.java
@@ -6,6 +6,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+
package org.libreoffice.impressremote.communication;
import java.io.IOException;
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java
index a236ac5..35be694 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java
@@ -27,7 +27,7 @@ import org.libreoffice.impressremote.util.Intents;
import org.libreoffice.impressremote.communication.Server.Protocol;
class BluetoothServersFinder extends BroadcastReceiver implements ServersFinder, Runnable {
- private static final int SEARCH_DELAY_IN_MILLISECONDS = 1000 * 10;
+ private static final int SEARCH_DELAY_IN_MILLISECONDS = 1000 * 5;
private final Context mContext;
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
index 6041190..8ded38f 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
@@ -37,6 +37,8 @@ public class CommunicationService extends Service implements Runnable, MessagesL
private IBinder mBinder;
private ServersManager mServersManager;
+ private static boolean gWasBluetoothEnabled = false;
+ private static boolean gWasBluetoothEnabledFetched = false;
private ServerConnection mServerConnection;
@@ -162,7 +164,13 @@ public class CommunicationService extends Service implements Runnable, MessagesL
mState = State.SEARCHING;
if (BluetoothAdapter.getDefaultAdapter() != null) {
- BluetoothAdapter.getDefaultAdapter().enable();
+ if (!gWasBluetoothEnabledFetched) {
+ gWasBluetoothEnabled = BluetoothAdapter.getDefaultAdapter().isEnabled();
+ gWasBluetoothEnabledFetched = true;
+
+ if (!gWasBluetoothEnabled)
+ BluetoothAdapter.getDefaultAdapter().enable();
+ }
}
mServersManager.startServersSearch();
@@ -172,7 +180,8 @@ public class CommunicationService extends Service implements Runnable, MessagesL
mServersManager.stopServersSearch();
if (BluetoothAdapter.getDefaultAdapter() != null) {
- BluetoothAdapter.getDefaultAdapter().disable();
+ if (!gWasBluetoothEnabled)
+ BluetoothAdapter.getDefaultAdapter().disable();
}
}
More information about the Libreoffice-commits
mailing list