diff options
author | Nick Pelly <npelly@google.com> | 2009-09-18 11:37:06 -0700 |
---|---|---|
committer | Nick Pelly <npelly@google.com> | 2009-09-18 11:37:06 -0700 |
commit | 55e66f1b739097095f6b3c47f88de258898fc1c9 (patch) | |
tree | 56e22d5c97e4e1a115660e65a1d936caab78b74b /core/java | |
parent | 37e0828cf9a6e08d791b23057d98bf00fbf74505 (diff) | |
download | frameworks_base-55e66f1b739097095f6b3c47f88de258898fc1c9.zip frameworks_base-55e66f1b739097095f6b3c47f88de258898fc1c9.tar.gz frameworks_base-55e66f1b739097095f6b3c47f88de258898fc1c9.tar.bz2 |
Reject lowercase characters in checkBluetoothAddress().
This keeps consistency with Bluez which uses upper case string address. It's
important to keep the case the same so that .equals() in BluetoothService.java
work.
Change-Id: I6404ca137d0aec3cc2e6e7cb79763d5305a03547
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/bluetooth/BluetoothAdapter.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index 96a927b..1fc22fe 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -573,6 +573,7 @@ public final class BluetoothAdapter { /** * Validate a Bluetooth address, such as "00:43:A8:23:10:F0" + * <p>Alphabetic characters must be uppercase to be valid. * * @param address Bluetooth address as string * @return true if the address is valid, false otherwise @@ -586,8 +587,9 @@ public final class BluetoothAdapter { switch (i % 3) { case 0: case 1: - if (Character.digit(c, 16) != -1) { - break; // hex character, OK + if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')) { + // hex character, OK + break; } return false; case 2: |