OSDN Git Service

Fix Bluetooth device name max length checking.
authorJake Hamby <jhamby@google.com>
Thu, 16 Sep 2010 23:55:43 +0000 (16:55 -0700)
committerJake Hamby <jhamby@google.com>
Wed, 22 Sep 2010 23:04:50 +0000 (16:04 -0700)
commit59091c08f4d0ad8f42013f58ce9bd23ac3306336
treee246230fb2794653dafb5a633de8cf5db0c317df
parent28580b4d9a36bb15e75423bc95747b9a746ea8b9
Fix Bluetooth device name max length checking.

The Bluetooth device name has a maximum length of 248 bytes in UTF-8
encoding. The settings app previously limited the Bluetooth device
name entered by the user based on the number of characters, which is
incorrect when the name includes non-ASCII characters.

Created a new Utf8ByteLengthFilter class for BluetoothNamePreference
which counts UTF-8 bytes instead of Unicode characters, along with
unit tests.

We can move Utf8ByteLengthFilter into the framework in the future
if it would be useful elsewhere in the system or for applications.

Change-Id: I9debface09659f09d750f3bfe8ad6ddfd34c75c5
src/com/android/settings/bluetooth/BluetoothNamePreference.java
tests/AndroidManifest.xml
tests/src/com/android/settings/tests/SettingsLaunchPerformance.java [moved from tests/src/com/android/settings/SettingsLaunchPerformance.java with 99% similarity]
tests/src/com/android/settings/tests/Utf8ByteLengthFilterTest.java [new file with mode: 0644]