Split BluetoothSettings into two pages

This cl splits the BluetoothSettings into paired device page and
pairing page, including small changes about:
1. Refactor the pages so they could get as much as static preference
from xml file rather than dynamically add/remove them everytime.
2. Remove creating method in BluetoothDeviceNamePreferenceController
and add it in xml file
3. Create BluetoothPairingDetail page, basically move the logic from
BluetoothSettings.
4. Make pairing preference clickable and jump to BluetoothPairingDetail
5. Add and update bunch of tests

Bug: 35877041
Test: RunSettingsRoboTests
Change-Id: Ief9e9690c612f7b46c58e866e5cecc511af642c8
This commit is contained in:
jackqdyulei
2017-05-10 14:57:16 -07:00
parent 5333ecd1fb
commit 52ccb49fbe
14 changed files with 704 additions and 224 deletions

View File

@@ -40,8 +40,9 @@ import java.util.List;
* BluetoothSettings is the Settings screen for Bluetooth configuration and
* connection management.
*/
public final class DevicePickerFragment extends DeviceListPreferenceObsoleteFragment {
public final class DevicePickerFragment extends DeviceListPreferenceFragment {
private static final int MENU_ID_REFRESH = Menu.FIRST;
private static final String KEY_BT_DEVICE_LIST = "bt_device_list";
private static final String TAG = "DevicePickerFragment";
public DevicePickerFragment() {
@@ -54,7 +55,7 @@ public final class DevicePickerFragment extends DeviceListPreferenceObsoleteFrag
private boolean mStartScanOnStart;
@Override
void addPreferencesForActivity() {
void initPreferencesFromPreferenceScreen() {
Intent intent = getActivity().getIntent();
mNeedAuth = intent.getBooleanExtra(BluetoothDevicePicker.EXTRA_NEED_AUTH, false);
setFilter(intent.getIntExtra(BluetoothDevicePicker.EXTRA_FILTER_TYPE,
@@ -167,6 +168,11 @@ public final class DevicePickerFragment extends DeviceListPreferenceObsoleteFrag
return null;
}
@Override
public String getDeviceListKey() {
return KEY_BT_DEVICE_LIST;
}
private void sendDevicePickedIntent(BluetoothDevice device) {
Intent intent = new Intent(BluetoothDevicePicker.ACTION_DEVICE_SELECTED);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);