aboutsummaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothUuid.java
diff options
context:
space:
mode:
authorJaikumar Ganesh <jaikumar@google.com>2009-09-16 17:50:52 -0700
committerJaikumar Ganesh <jaikumar@google.com>2009-09-16 17:50:52 -0700
commit97c84ce71b56cb4b803f084ffa8534ef435f8df6 (patch)
tree8ec6178a5842b9778e648c706776346a6ea9b176 /framework/java/android/bluetooth/BluetoothUuid.java
parent55a0c0380ff13ec02ae83f4cef32674018942208 (diff)
Make ParcelUuid helper functions consistent.
Treat zero length arrays and null arrays to be same. Change-Id: I8c6c28e5dc3da1f31f6f6abfc747db4c2975a90b
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothUuid.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothUuid.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/framework/java/android/bluetooth/BluetoothUuid.java b/framework/java/android/bluetooth/BluetoothUuid.java
index 409c744111..0596b21b03 100644
--- a/framework/java/android/bluetooth/BluetoothUuid.java
+++ b/framework/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) {