diff options
| author | Jaikumar Ganesh <jaikumar@google.com> | 2009-09-16 17:50:52 -0700 |
|---|---|---|
| committer | Jaikumar Ganesh <jaikumar@google.com> | 2009-09-16 17:50:52 -0700 |
| commit | dca2f0fec30e6acbdc466fd6dffb425877e7728a (patch) | |
| tree | 140c813ee308adaaef52569d6b3ef48c0ea3c20f /core/java/android | |
| parent | dd0463aef18d251c741bfc9dc7a2787443ef36f1 (diff) | |
| download | frameworks_base-dca2f0fec30e6acbdc466fd6dffb425877e7728a.zip frameworks_base-dca2f0fec30e6acbdc466fd6dffb425877e7728a.tar.gz frameworks_base-dca2f0fec30e6acbdc466fd6dffb425877e7728a.tar.bz2 | |
Make ParcelUuid helper functions consistent.
Treat zero length arrays and null arrays to be same.
Change-Id: I8c6c28e5dc3da1f31f6f6abfc747db4c2975a90b
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/bluetooth/BluetoothUuid.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/core/java/android/bluetooth/BluetoothUuid.java b/core/java/android/bluetooth/BluetoothUuid.java index 409c744..0596b21 100644 --- a/core/java/android/bluetooth/BluetoothUuid.java +++ b/core/java/android/bluetooth/BluetoothUuid.java @@ -98,7 +98,14 @@ public final class BluetoothUuid { */ public static boolean containsAnyUuid(ParcelUuid[] uuidA, ParcelUuid[] uuidB) { if (uuidA == null && uuidB == null) return true; - if (uuidA == null || uuidB == null) return false; + + if (uuidA == null) { + return uuidB.length == 0 ? true : false; + } + + if (uuidB == null) { + return uuidA.length == 0 ? true : false; + } HashSet<ParcelUuid> uuidSet = new HashSet<ParcelUuid> (Arrays.asList(uuidA)); for (ParcelUuid uuid: uuidB) { @@ -117,7 +124,12 @@ public final class BluetoothUuid { */ public static boolean containsAllUuids(ParcelUuid[] uuidA, ParcelUuid[] uuidB) { if (uuidA == null && uuidB == null) return true; - if (uuidA == null || uuidB == null) return false; + + if (uuidA == null) { + return uuidB.length == 0 ? true : false; + } + + if (uuidB == null) return true; HashSet<ParcelUuid> uuidSet = new HashSet<ParcelUuid> (Arrays.asList(uuidA)); for (ParcelUuid uuid: uuidB) { |
