Introduce BluetoothAudioCodecPreferenceController
- Create new BluetoothAudioCodecPreferenceController - Create controller inside the DashboardFragment - Port logic from DevelopmentSettings into the controller Bug: 34203528 Test: make RunSettingsRoboTests -j40 Change-Id: I90a0e58328196315fccbecd6d46531b4f0fcaef1
This commit is contained in:
@@ -60,7 +60,8 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
||||
|
||||
private static final String TAG = "DevSettingsDashboard";
|
||||
|
||||
private final Object mBluetoothA2dpLock = new Object();
|
||||
private final BluetoothA2dpConfigStore mBluetoothA2dpConfigStore =
|
||||
new BluetoothA2dpConfigStore();
|
||||
|
||||
private boolean mIsAvailable = true;
|
||||
private SwitchBar mSwitchBar;
|
||||
@@ -104,7 +105,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
||||
@Override
|
||||
public void onServiceConnected(int profile,
|
||||
BluetoothProfile proxy) {
|
||||
synchronized (mBluetoothA2dpLock) {
|
||||
synchronized (mBluetoothA2dpConfigStore) {
|
||||
mBluetoothA2dp = (BluetoothA2dp) proxy;
|
||||
}
|
||||
for (AbstractPreferenceController controller : mPreferenceControllers) {
|
||||
@@ -117,7 +118,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(int profile) {
|
||||
synchronized (mBluetoothA2dpLock) {
|
||||
synchronized (mBluetoothA2dpConfigStore) {
|
||||
mBluetoothA2dp = null;
|
||||
}
|
||||
for (AbstractPreferenceController controller : mPreferenceControllers) {
|
||||
@@ -298,7 +299,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
||||
@Override
|
||||
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
|
||||
mPreferenceControllers = buildPreferenceControllers(context, getActivity(), getLifecycle(),
|
||||
this /* devOptionsDashboardFragment */, mBluetoothA2dpLock,
|
||||
this /* devOptionsDashboardFragment */,
|
||||
new BluetoothA2dpConfigStore());
|
||||
return mPreferenceControllers;
|
||||
}
|
||||
@@ -334,7 +335,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
||||
|
||||
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
|
||||
Activity activity, Lifecycle lifecycle, DevelopmentSettingsDashboardFragment fragment,
|
||||
Object bluetoothA2dpLock, BluetoothA2dpConfigStore bluetoothA2dpConfigStore) {
|
||||
BluetoothA2dpConfigStore bluetoothA2dpConfigStore) {
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
controllers.add(new BugReportPreferenceControllerV2(context));
|
||||
controllers.add(new LocalBackupPasswordPreferenceController(context));
|
||||
@@ -376,10 +377,10 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
||||
controllers.add(new BluetoothAbsoluteVolumePreferenceController(context));
|
||||
controllers.add(new BluetoothInbandRingingPreferenceController(context));
|
||||
controllers.add(new BluetoothAvrcpVersionPreferenceController(context));
|
||||
//controllers.add(new BluetoothAudioCodecPreferenceController(context, lifecycle,
|
||||
// bluetoothA2dpLock, bluetoothA2dpConfigStore));
|
||||
controllers.add(new BluetoothAudioCodecPreferenceController(context, lifecycle,
|
||||
bluetoothA2dpConfigStore));
|
||||
controllers.add(new BluetoothAudioSampleRatePreferenceController(context, lifecycle,
|
||||
bluetoothA2dpLock, bluetoothA2dpConfigStore));
|
||||
bluetoothA2dpConfigStore));
|
||||
// bluetooth audio bits per sample
|
||||
// bluetooth audio channel mode
|
||||
// bluetooth audio ldac codec: playback quality
|
||||
@@ -447,7 +448,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
||||
context) {
|
||||
return buildPreferenceControllers(context, null /* activity */,
|
||||
null /* lifecycle */, null /* devOptionsDashboardFragment */,
|
||||
null /* bluetoothA2dpLock */, null /* bluetoothA2dpConfigStore */);
|
||||
null /* bluetoothA2dpConfigStore */);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user