The maximum Bluetooth device name length is 248 bytes. There are bugs in
Bluez and D-Bus that can cause the Bluetooth service to go into a reboot
loop when the device name is set to the maximum length. Changed Settings
app to limit the device name length to 246 bytes.
Bug: 3246147
Change-Id: I2f46303cf44951f0b3907c43d4b096736f08765b
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
Split BluetoothDevice into BluetoothDevice and BluetoothAdapter.
BluetoothAdapter: Represents the local BT adapter. Operations on the local
adapter (start a scan, etc).
BluetoothDevice: Represents a remote BT device. Operations on remote devices
(pair, connect, etc).