Implement audio switch UI
* Implement available media devices group * Add AvailableMediaDeviceGroupController to realize UI, the user can see the all device that can be activated in this group. * ConnectedDeviceGroupController change to show the device that cannot be activated but is connected. * Refactoring the below class, implement the controller in connected_devices.xml. ConnectedDeviceGroupController.java SavedDeviceGroupController.java ConnectedDeviceDashboardFragment.java connected_devices.xml * Add AvailableMediaBluetoothDeviceUpdaterTest to verify the add/remove preference behavior when connectedStateChanged or profileAudioStateChanged * Add test that used to verify device is connected or not in BluetoothDeviceUpdaterTest. * Add test that used to verify the add/remove preference behavior when connectedStateChanged or profileAudioStateChanged in ConnectedBluetoothDeviceUpdaterTest. * Add AvailableMediaDeviceGroupControllerTest to verify bluetooth feature is supported or not and test register callback. * Add test that used to verify bluetooth feature is supported or not and test register callback in ConnectedDeviceGroupControllerTest. * Add test that used to verify bluetooth feature is supported or not and test register callback in SavedDeviceGroupControllerTest Bug: 74134939 Test: make -j40 RunSettingsRoboTests Change-Id: I54d03c2ddadc6a4be7519dd74cdbcb5055d44083
This commit is contained in:
@@ -40,7 +40,7 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment {
|
||||
@VisibleForTesting
|
||||
static final String KEY_CONNECTED_DEVICES = "connected_device_list";
|
||||
@VisibleForTesting
|
||||
static final String KEY_SAVED_DEVICES = "saved_device_list";
|
||||
static final String KEY_AVAILABLE_DEVICES = "available_device_list";
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
@@ -64,14 +64,12 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment {
|
||||
|
||||
@Override
|
||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
return buildPreferenceControllers(context, getLifecycle(), this);
|
||||
return buildPreferenceControllers(context, getLifecycle());
|
||||
}
|
||||
|
||||
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
|
||||
Lifecycle lifecycle, DashboardFragment dashboardFragment) {
|
||||
Lifecycle lifecycle) {
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
controllers.add(new ConnectedDeviceGroupController(context, dashboardFragment, lifecycle));
|
||||
|
||||
final NfcPreferenceController nfcPreferenceController =
|
||||
new NfcPreferenceController(context);
|
||||
controllers.add(nfcPreferenceController);
|
||||
@@ -83,6 +81,13 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment {
|
||||
return controllers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
use(AvailableMediaDeviceGroupController.class).init(this);
|
||||
use(ConnectedDeviceGroupController.class).init(this);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
static class SummaryProvider implements SummaryLoader.SummaryProvider {
|
||||
|
||||
@@ -136,16 +141,15 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment {
|
||||
@Override
|
||||
public List<AbstractPreferenceController> createPreferenceControllers(Context
|
||||
context) {
|
||||
return buildPreferenceControllers(context, null /* lifecycle */,
|
||||
null /* dashboardFragment */);
|
||||
return buildPreferenceControllers(context, null /* lifecycle */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
// Disable because they show dynamic data
|
||||
keys.add(KEY_AVAILABLE_DEVICES);
|
||||
keys.add(KEY_CONNECTED_DEVICES);
|
||||
keys.add(KEY_SAVED_DEVICES);
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user