diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-08-20 12:10:12 +0200 |
---|---|---|
committer | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-08-20 12:10:50 +0200 |
commit | 661b032902147a81f7557afac759880e7dadec11 (patch) | |
tree | 83561173bff7f8c06a6c9992f84f8bfdc5171288 /android | |
parent | 516c4f2a7f0af06f7e6301128df9885599128291 (diff) |
Prevent deadlock on pairing.
Change-Id: I1c746861e1e5c6625e03f4761ecf2fd641fcf071
Diffstat (limited to 'android')
4 files changed, 11 insertions, 17 deletions
diff --git a/android/sdremote/res/layout/fragment_blankscreen.xml b/android/sdremote/res/layout/fragment_blankscreen.xml index cf287ba1220a..87ecf0347ec8 100644 --- a/android/sdremote/res/layout/fragment_blankscreen.xml +++ b/android/sdremote/res/layout/fragment_blankscreen.xml @@ -3,7 +3,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="10dip" - android:gravity="left" + android:gravity="center_vertical" android:orientation="vertical" > <ImageView diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java index bfe10a9fefb3..d93ea5ce0b1c 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java @@ -40,7 +40,11 @@ public class BluetoothFinder { public void stopFinding() { mAdapter.cancelDiscovery(); - mContext.unregisterReceiver(mReceiver); + try { + mContext.unregisterReceiver(mReceiver); + } catch (IllegalArgumentException e) { + // The receiver wasn't registered + } } private HashMap<String, Server> mServerList = new HashMap<String, Server>(); diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java index b25fcc04b49b..efa65146d651 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java @@ -85,23 +85,13 @@ public class CommunicationService extends Service implements Runnable { } public void startSearching() { - synchronized (mConnectionVariableMutex) { - if (mState == State.CONNECTING || mState == State.CONNECTED) { - disconnect(); - } - mNetworkFinder.startFinding(); - mBluetoothFinder.startFinding(); - mState = State.SEARCHING; - } - new BluetoothFinder(this); + mNetworkFinder.startFinding(); + mBluetoothFinder.startFinding(); } public void stopSearching() { - synchronized (mConnectionVariableMutex) { - mNetworkFinder.stopFinding(); - mBluetoothFinder.stopFinding(); - mState = State.DISCONNECTED; - } + mNetworkFinder.stopFinding(); + mBluetoothFinder.stopFinding(); } public void connectTo(Server aServer) { diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java index 67a886223f3d..c88d018bcabe 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java @@ -63,7 +63,7 @@ public class ServerFinder { return; } Server aServer = new Server(Server.Protocol.NETWORK, aPacket - .getAddress().toString(), aName, + .getAddress().getHostAddress(), aName, System.currentTimeMillis()); mServerList.put(aServer.getAddress(), aServer); |