Add bluetooth visible item

Show "Visible as [Device name]". Also remove the menuitem for
changing device name.

This cl creates a preference controller to handle the logic for
device name preference.

Bug: 35876447
Test: RunSettingsRoboTests

Change-Id: I9ab6c9d2df5b053d15b8ff887073ef82616243a4
This commit is contained in:
jackqdyulei
2017-04-25 13:32:02 -07:00
parent 41aa446c7f
commit ae86781edd
5 changed files with 337 additions and 36 deletions

View File

@@ -58,7 +58,7 @@ public final class BluetoothNameDialogFragment extends InstrumentedDialogFragmen
// accessed from inner class (not private to avoid thunks)
static final String TAG = "BluetoothNameDialogFragment";
final LocalBluetoothAdapter mLocalAdapter;
LocalBluetoothAdapter mLocalAdapter;
EditText mDeviceNameView;
// This flag is set when the name is updated by code, to distinguish from user changes
@@ -85,16 +85,19 @@ public final class BluetoothNameDialogFragment extends InstrumentedDialogFragmen
}
};
public BluetoothNameDialogFragment() {
LocalBluetoothManager localManager = Utils.getLocalBtManager(getActivity());
mLocalAdapter = localManager.getBluetoothAdapter();
}
@Override
public int getMetricsCategory() {
return MetricsProto.MetricsEvent.DIALOG_BLUETOOTH_RENAME;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LocalBluetoothManager localManager = Utils.getLocalBtManager(getActivity());
mLocalAdapter = localManager.getBluetoothAdapter();
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
String deviceName = mLocalAdapter.getName();