diff options
author | Jaikumar Ganesh <jaikumar@google.com> | 2010-10-18 16:41:53 -0700 |
---|---|---|
committer | Jaikumar Ganesh <jaikumar@google.com> | 2010-10-22 11:36:27 -0700 |
commit | 03cd78cf5e51c3adb78d2e3d314838dcf3e36b26 (patch) | |
tree | 898125c6e6cfc7f22a44ce986205557d7f571dff /core/java/android/bluetooth/BluetoothA2dp.java | |
parent | e1627c9d0e472cf32bc52533570ce8768048db29 (diff) | |
download | frameworks_base-03cd78cf5e51c3adb78d2e3d314838dcf3e36b26.zip frameworks_base-03cd78cf5e51c3adb78d2e3d314838dcf3e36b26.tar.gz frameworks_base-03cd78cf5e51c3adb78d2e3d314838dcf3e36b26.tar.bz2 |
Convert return type of APIs from Set to List.
Most of the time it will either be empty or have 1 device.
Using list makes it much a better API and since its supported
by the AIDL format, the code becomes much nicer.
Change-Id: I5a2508b33ba754fc8cc738409d658e1235aaf2cf
Diffstat (limited to 'core/java/android/bluetooth/BluetoothA2dp.java')
-rw-r--r-- | core/java/android/bluetooth/BluetoothA2dp.java | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java index 920ef89..61b4303 100644 --- a/core/java/android/bluetooth/BluetoothA2dp.java +++ b/core/java/android/bluetooth/BluetoothA2dp.java @@ -26,11 +26,8 @@ import android.os.ServiceManager; import android.server.BluetoothA2dpService; import android.util.Log; -import java.util.Collections; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Set; +import java.util.ArrayList; +import java.util.List; /** @@ -167,35 +164,35 @@ public final class BluetoothA2dp implements BluetoothProfile { /** * {@inheritDoc} */ - public Set<BluetoothDevice> getConnectedDevices() { + public List<BluetoothDevice> getConnectedDevices() { if (DBG) log("getConnectedDevices()"); if (mService != null && isEnabled()) { try { - return toDeviceSet(mService.getConnectedDevices()); + return mService.getConnectedDevices(); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); - return toDeviceSet(new BluetoothDevice[0]); + return new ArrayList<BluetoothDevice>(); } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); - return toDeviceSet(new BluetoothDevice[0]); + return new ArrayList<BluetoothDevice>(); } /** * {@inheritDoc} */ - public Set<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) { + public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) { if (DBG) log("getDevicesMatchingStates()"); if (mService != null && isEnabled()) { try { - return toDeviceSet(mService.getDevicesMatchingConnectionStates(states)); + return mService.getDevicesMatchingConnectionStates(states); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); - return toDeviceSet(new BluetoothDevice[0]); + return new ArrayList<BluetoothDevice>(); } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); - return toDeviceSet(new BluetoothDevice[0]); + return new ArrayList<BluetoothDevice>(); } /** @@ -396,11 +393,6 @@ public final class BluetoothA2dp implements BluetoothProfile { return false; } - private Set<BluetoothDevice> toDeviceSet(BluetoothDevice[] devices) { - return Collections.unmodifiableSet( - new HashSet<BluetoothDevice>(Arrays.asList(devices))); - } - private static void log(String msg) { Log.d(TAG, msg); } |