Merge change 27057 into eclair
* changes: Restrict Bluetooth adapater name length to 200 characters.
This commit is contained in:
@@ -26,7 +26,9 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.preference.EditTextPreference;
|
import android.preference.EditTextPreference;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
import android.text.InputFilter;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.text.InputFilter.LengthFilter;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
@@ -38,6 +40,8 @@ import android.widget.EditText;
|
|||||||
*/
|
*/
|
||||||
public class BluetoothNamePreference extends EditTextPreference implements TextWatcher {
|
public class BluetoothNamePreference extends EditTextPreference implements TextWatcher {
|
||||||
private static final String TAG = "BluetoothNamePreference";
|
private static final String TAG = "BluetoothNamePreference";
|
||||||
|
// TODO(): Investigate bluetoothd/dbus crash when length is set to 248, limit as per spec.
|
||||||
|
private static final int BLUETOOTH_NAME_MAX_LENGTH = 200;
|
||||||
|
|
||||||
private LocalBluetoothManager mLocalManager;
|
private LocalBluetoothManager mLocalManager;
|
||||||
|
|
||||||
@@ -71,6 +75,7 @@ public class BluetoothNamePreference extends EditTextPreference implements TextW
|
|||||||
|
|
||||||
// Make sure the OK button is disabled (if necessary) after rotation
|
// Make sure the OK button is disabled (if necessary) after rotation
|
||||||
EditText et = getEditText();
|
EditText et = getEditText();
|
||||||
|
et.setFilters(new InputFilter[] {new LengthFilter(BLUETOOTH_NAME_MAX_LENGTH)});
|
||||||
if (et != null) {
|
if (et != null) {
|
||||||
et.addTextChangedListener(this);
|
et.addTextChangedListener(this);
|
||||||
Dialog d = getDialog();
|
Dialog d = getDialog();
|
||||||
|
Reference in New Issue
Block a user