Loading android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpBipClient.java +14 −4 Original line number Diff line number Diff line Loading @@ -118,7 +118,9 @@ public class AvrcpBipClient { } /** * Creates a BIP image pull client and connects to a remote device's BIP image push server. * Creates a BIP image pull client * * <p>{@link connectAsync()} must be called separately. */ public AvrcpBipClient(BluetoothDevice remoteDevice, int psm, Callback callback) { if (remoteDevice == null) { Loading @@ -138,7 +140,6 @@ public class AvrcpBipClient { Looper looper = mThread.getLooper(); mHandler = new AvrcpBipClientHandler(looper, this); mHandler.obtainMessage(CONNECT).sendToTarget(); } /** Loading @@ -165,7 +166,7 @@ public class AvrcpBipClient { public void shutdown() { debug("Shutdown client"); try { mHandler.obtainMessage(DISCONNECT).sendToTarget(); disconnectAsync(); } catch (IllegalStateException e) { // Means we haven't been started or we're already stopped. Doing this makes this call // always safe no matter the state. Loading Loading @@ -242,6 +243,11 @@ public class AvrcpBipClient { } } /** Connects asynchronously */ void connectAsync() { mHandler.obtainMessage(CONNECT).sendToTarget(); } /** * Connects to the remote device's BIP Image Pull server */ Loading Loading @@ -316,10 +322,14 @@ public class AvrcpBipClient { } } /** Disconnects asynchronously */ void disconnectAsync() { mHandler.obtainMessage(DISCONNECT).sendToTarget(); } /** * Permanently disconnects this client from the remote device's BIP server and notifies of the * new connection status. * */ private synchronized void disconnect() { if (mSession != null) { Loading android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtManager.java +1 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,7 @@ public class AvrcpCoverArtManager { debug("Connect " + device + ", psm: " + psm); if (mClients.containsKey(device)) return false; AvrcpBipClient client = new AvrcpBipClient(device, psm, new BipClientCallback(device)); client.connectAsync(); mClients.put(device, client); mBipSessions.put(device, new AvrcpBipSession(device)); return true; Loading android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpBipClientTest.java +7 −6 Original line number Diff line number Diff line Loading @@ -143,11 +143,12 @@ public class AvrcpBipClientTest { @Test public void toString_returnsClientInfo() { AvrcpBipClient client = new AvrcpBipClient(mTestDevice, TEST_PSM, mArtManager.new BipClientCallback(mTestDevice)); String expected = "<AvrcpBipClient" + " device=" + mTestDevice + " psm=" + TEST_PSM + " state=" + client.getStateName() + ">"; assertThat(client.toString()).isEqualTo(expected); String expected = "<AvrcpBipClient" + (" device=" + mTestDevice) + (" psm=" + TEST_PSM) + (" state=" + mClient.getStateName()) + ">"; assertThat(mClient.toString()).isEqualTo(expected); } } Loading
android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpBipClient.java +14 −4 Original line number Diff line number Diff line Loading @@ -118,7 +118,9 @@ public class AvrcpBipClient { } /** * Creates a BIP image pull client and connects to a remote device's BIP image push server. * Creates a BIP image pull client * * <p>{@link connectAsync()} must be called separately. */ public AvrcpBipClient(BluetoothDevice remoteDevice, int psm, Callback callback) { if (remoteDevice == null) { Loading @@ -138,7 +140,6 @@ public class AvrcpBipClient { Looper looper = mThread.getLooper(); mHandler = new AvrcpBipClientHandler(looper, this); mHandler.obtainMessage(CONNECT).sendToTarget(); } /** Loading @@ -165,7 +166,7 @@ public class AvrcpBipClient { public void shutdown() { debug("Shutdown client"); try { mHandler.obtainMessage(DISCONNECT).sendToTarget(); disconnectAsync(); } catch (IllegalStateException e) { // Means we haven't been started or we're already stopped. Doing this makes this call // always safe no matter the state. Loading Loading @@ -242,6 +243,11 @@ public class AvrcpBipClient { } } /** Connects asynchronously */ void connectAsync() { mHandler.obtainMessage(CONNECT).sendToTarget(); } /** * Connects to the remote device's BIP Image Pull server */ Loading Loading @@ -316,10 +322,14 @@ public class AvrcpBipClient { } } /** Disconnects asynchronously */ void disconnectAsync() { mHandler.obtainMessage(DISCONNECT).sendToTarget(); } /** * Permanently disconnects this client from the remote device's BIP server and notifies of the * new connection status. * */ private synchronized void disconnect() { if (mSession != null) { Loading
android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtManager.java +1 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,7 @@ public class AvrcpCoverArtManager { debug("Connect " + device + ", psm: " + psm); if (mClients.containsKey(device)) return false; AvrcpBipClient client = new AvrcpBipClient(device, psm, new BipClientCallback(device)); client.connectAsync(); mClients.put(device, client); mBipSessions.put(device, new AvrcpBipSession(device)); return true; Loading
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpBipClientTest.java +7 −6 Original line number Diff line number Diff line Loading @@ -143,11 +143,12 @@ public class AvrcpBipClientTest { @Test public void toString_returnsClientInfo() { AvrcpBipClient client = new AvrcpBipClient(mTestDevice, TEST_PSM, mArtManager.new BipClientCallback(mTestDevice)); String expected = "<AvrcpBipClient" + " device=" + mTestDevice + " psm=" + TEST_PSM + " state=" + client.getStateName() + ">"; assertThat(client.toString()).isEqualTo(expected); String expected = "<AvrcpBipClient" + (" device=" + mTestDevice) + (" psm=" + TEST_PSM) + (" state=" + mClient.getStateName()) + ">"; assertThat(mClient.toString()).isEqualTo(expected); } }