Loading res/xml/connected_devices_advanced.xml +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" android:key="connected_devices_screen" android:key="connected_devices_advanced_screen" android:title="@string/connected_device_connections_title"> <SwitchPreference Loading src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java +2 −2 Original line number Diff line number Diff line Loading @@ -93,9 +93,9 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback { } } public BluetoothDeviceUpdater(DashboardFragment fragment, public BluetoothDeviceUpdater(Context context, DashboardFragment fragment, DevicePreferenceCallback devicePreferenceCallback) { this(fragment, devicePreferenceCallback, Utils.getLocalBtManager(fragment.getContext())); this(fragment, devicePreferenceCallback, Utils.getLocalBtManager(context)); } @VisibleForTesting Loading src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java +3 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.settings.bluetooth; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.content.Context; import android.support.annotation.VisibleForTesting; import com.android.settings.connecteddevice.DevicePreferenceCallback; Loading @@ -29,9 +30,9 @@ import com.android.settingslib.bluetooth.LocalBluetoothManager; */ public class ConnectedBluetoothDeviceUpdater extends BluetoothDeviceUpdater { public ConnectedBluetoothDeviceUpdater(DashboardFragment fragment, public ConnectedBluetoothDeviceUpdater(Context context, DashboardFragment fragment, DevicePreferenceCallback devicePreferenceCallback) { super(fragment, devicePreferenceCallback); super(context, fragment, devicePreferenceCallback); } @VisibleForTesting Loading src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdater.java +3 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.settings.bluetooth; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.content.Context; import android.support.annotation.VisibleForTesting; import com.android.settings.connecteddevice.DevicePreferenceCallback; Loading @@ -29,9 +30,9 @@ import com.android.settingslib.bluetooth.LocalBluetoothManager; */ public class SavedBluetoothDeviceUpdater extends BluetoothDeviceUpdater { public SavedBluetoothDeviceUpdater(DashboardFragment fragment, public SavedBluetoothDeviceUpdater(Context context, DashboardFragment fragment, DevicePreferenceCallback devicePreferenceCallback) { super(fragment, devicePreferenceCallback); super(context, fragment, devicePreferenceCallback); } @VisibleForTesting Loading src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java +29 −9 Original line number Diff line number Diff line Loading @@ -26,17 +26,22 @@ import com.android.settings.dashboard.DashboardFragment; import com.android.settings.dashboard.SummaryLoader; import com.android.settings.nfc.NfcPreferenceController; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.Indexable; import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.lifecycle.Lifecycle; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class ConnectedDeviceDashboardFragment extends DashboardFragment { private static final String TAG = "ConnectedDeviceFrag"; @VisibleForTesting static final String KEY_CONNECTED_DEVICES = "connected_device_list"; @VisibleForTesting static final String KEY_SAVED_DEVICES = "saved_device_list"; @Override public int getMetricsCategory() { return MetricsProto.MetricsEvent.SETTINGS_CONNECTED_DEVICE_CATEGORY; Loading @@ -59,11 +64,14 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment { @Override protected List<AbstractPreferenceController> createPreferenceControllers(Context context) { final List<AbstractPreferenceController> controllers = new ArrayList<>(); final Lifecycle lifecycle = getLifecycle(); return buildPreferenceControllers(context, getLifecycle(), this); } controllers.add(new ConnectedDeviceGroupController(this, lifecycle)); controllers.add(new SavedDeviceGroupController(this, lifecycle)); private static List<AbstractPreferenceController> buildPreferenceControllers(Context context, Lifecycle lifecycle, DashboardFragment dashboardFragment) { final List<AbstractPreferenceController> controllers = new ArrayList<>(); controllers.add(new ConnectedDeviceGroupController(context, dashboardFragment, lifecycle)); controllers.add(new SavedDeviceGroupController(context, dashboardFragment, lifecycle)); return controllers; } Loading Loading @@ -108,18 +116,30 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment { /** * For Search. */ //TODO(b/69333961): update the index for this new fragment public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = new BaseSearchIndexProvider() { @Override public List<SearchIndexableResource> getXmlResourcesToIndex( Context context, boolean enabled) { return new ArrayList<>(); final SearchIndexableResource sir = new SearchIndexableResource(context); sir.xmlResId = R.xml.connected_devices; return Arrays.asList(sir); } @Override public List<AbstractPreferenceController> createPreferenceControllers(Context context) { return buildPreferenceControllers(context, null /* lifecycle */, null /* dashboardFragment */); } @Override public List<String> getNonIndexableKeys(Context context) { return new ArrayList<>(); List<String> keys = super.getNonIndexableKeys(context); // Disable because they show dynamic data keys.add(KEY_CONNECTED_DEVICES); keys.add(KEY_SAVED_DEVICES); return keys; } }; } Loading
res/xml/connected_devices_advanced.xml +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" android:key="connected_devices_screen" android:key="connected_devices_advanced_screen" android:title="@string/connected_device_connections_title"> <SwitchPreference Loading
src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java +2 −2 Original line number Diff line number Diff line Loading @@ -93,9 +93,9 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback { } } public BluetoothDeviceUpdater(DashboardFragment fragment, public BluetoothDeviceUpdater(Context context, DashboardFragment fragment, DevicePreferenceCallback devicePreferenceCallback) { this(fragment, devicePreferenceCallback, Utils.getLocalBtManager(fragment.getContext())); this(fragment, devicePreferenceCallback, Utils.getLocalBtManager(context)); } @VisibleForTesting Loading
src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java +3 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.settings.bluetooth; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.content.Context; import android.support.annotation.VisibleForTesting; import com.android.settings.connecteddevice.DevicePreferenceCallback; Loading @@ -29,9 +30,9 @@ import com.android.settingslib.bluetooth.LocalBluetoothManager; */ public class ConnectedBluetoothDeviceUpdater extends BluetoothDeviceUpdater { public ConnectedBluetoothDeviceUpdater(DashboardFragment fragment, public ConnectedBluetoothDeviceUpdater(Context context, DashboardFragment fragment, DevicePreferenceCallback devicePreferenceCallback) { super(fragment, devicePreferenceCallback); super(context, fragment, devicePreferenceCallback); } @VisibleForTesting Loading
src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdater.java +3 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.settings.bluetooth; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.content.Context; import android.support.annotation.VisibleForTesting; import com.android.settings.connecteddevice.DevicePreferenceCallback; Loading @@ -29,9 +30,9 @@ import com.android.settingslib.bluetooth.LocalBluetoothManager; */ public class SavedBluetoothDeviceUpdater extends BluetoothDeviceUpdater { public SavedBluetoothDeviceUpdater(DashboardFragment fragment, public SavedBluetoothDeviceUpdater(Context context, DashboardFragment fragment, DevicePreferenceCallback devicePreferenceCallback) { super(fragment, devicePreferenceCallback); super(context, fragment, devicePreferenceCallback); } @VisibleForTesting Loading
src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java +29 −9 Original line number Diff line number Diff line Loading @@ -26,17 +26,22 @@ import com.android.settings.dashboard.DashboardFragment; import com.android.settings.dashboard.SummaryLoader; import com.android.settings.nfc.NfcPreferenceController; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.Indexable; import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.lifecycle.Lifecycle; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class ConnectedDeviceDashboardFragment extends DashboardFragment { private static final String TAG = "ConnectedDeviceFrag"; @VisibleForTesting static final String KEY_CONNECTED_DEVICES = "connected_device_list"; @VisibleForTesting static final String KEY_SAVED_DEVICES = "saved_device_list"; @Override public int getMetricsCategory() { return MetricsProto.MetricsEvent.SETTINGS_CONNECTED_DEVICE_CATEGORY; Loading @@ -59,11 +64,14 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment { @Override protected List<AbstractPreferenceController> createPreferenceControllers(Context context) { final List<AbstractPreferenceController> controllers = new ArrayList<>(); final Lifecycle lifecycle = getLifecycle(); return buildPreferenceControllers(context, getLifecycle(), this); } controllers.add(new ConnectedDeviceGroupController(this, lifecycle)); controllers.add(new SavedDeviceGroupController(this, lifecycle)); private static List<AbstractPreferenceController> buildPreferenceControllers(Context context, Lifecycle lifecycle, DashboardFragment dashboardFragment) { final List<AbstractPreferenceController> controllers = new ArrayList<>(); controllers.add(new ConnectedDeviceGroupController(context, dashboardFragment, lifecycle)); controllers.add(new SavedDeviceGroupController(context, dashboardFragment, lifecycle)); return controllers; } Loading Loading @@ -108,18 +116,30 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment { /** * For Search. */ //TODO(b/69333961): update the index for this new fragment public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = new BaseSearchIndexProvider() { @Override public List<SearchIndexableResource> getXmlResourcesToIndex( Context context, boolean enabled) { return new ArrayList<>(); final SearchIndexableResource sir = new SearchIndexableResource(context); sir.xmlResId = R.xml.connected_devices; return Arrays.asList(sir); } @Override public List<AbstractPreferenceController> createPreferenceControllers(Context context) { return buildPreferenceControllers(context, null /* lifecycle */, null /* dashboardFragment */); } @Override public List<String> getNonIndexableKeys(Context context) { return new ArrayList<>(); List<String> keys = super.getNonIndexableKeys(context); // Disable because they show dynamic data keys.add(KEY_CONNECTED_DEVICES); keys.add(KEY_SAVED_DEVICES); return keys; } }; }