[Libreoffice-commits] .: android/sdremote

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Aug 20 03:11:23 PDT 2012


 android/sdremote/res/layout/fragment_blankscreen.xml                                       |    2 -
 android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java      |    6 ++-
 android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java |   18 ++--------
 android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java         |    2 -
 4 files changed, 11 insertions(+), 17 deletions(-)

New commits:
commit 661b032902147a81f7557afac759880e7dadec11
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Mon Aug 20 12:10:12 2012 +0200

    Prevent deadlock on pairing.
    
    Change-Id: I1c746861e1e5c6625e03f4761ecf2fd641fcf071

diff --git a/android/sdremote/res/layout/fragment_blankscreen.xml b/android/sdremote/res/layout/fragment_blankscreen.xml
index cf287ba..87ecf03 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 bfe10a9..d93ea5c 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 b25fcc0..efa6514 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 67a8862..c88d018 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);
 


More information about the Libreoffice-commits mailing list