Merge "Add LE audio hardware offload development option"

This commit is contained in:
Treehugger Robot
2022-03-21 05:24:10 +00:00
committed by Gerrit Code Review
10 changed files with 357 additions and 44 deletions

View File

@@ -79,7 +79,7 @@ import java.util.List;
public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFragment
implements OnMainSwitchChangeListener, OemUnlockDialogHost, AdbDialogHost,
AdbClearKeysDialogHost, LogPersistDialogHost,
BluetoothA2dpHwOffloadRebootDialog.OnA2dpHwDialogConfirmedListener,
BluetoothHwOffloadRebootDialog.OnHwOffloadDialogListener,
AbstractBluetoothPreferenceController.Callback {
private static final String TAG = "DevSettingsDashboard";
@@ -287,12 +287,16 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
if (isChecked) {
EnableDevelopmentSettingWarningDialog.show(this /* host */);
} else {
final BluetoothA2dpHwOffloadPreferenceController controller =
final BluetoothA2dpHwOffloadPreferenceController a2dpController =
getDevelopmentOptionsController(
BluetoothA2dpHwOffloadPreferenceController.class);
// If A2DP hardware offload isn't default value, we must reboot after disable
final BluetoothLeAudioHwOffloadPreferenceController leAudioController =
getDevelopmentOptionsController(
BluetoothLeAudioHwOffloadPreferenceController.class);
// If hardware offload isn't default value, we must reboot after disable
// developer options. Show a dialog for the user to confirm.
if (controller == null || controller.isDefaultValue()) {
if ((a2dpController == null || a2dpController.isDefaultValue())
&& (leAudioController == null || leAudioController.isDefaultValue())) {
disableDeveloperOptions();
} else {
DisableDevSettingsDialogFragment.show(this /* host */);
@@ -352,10 +356,27 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
}
@Override
public void onA2dpHwDialogConfirmed() {
final BluetoothA2dpHwOffloadPreferenceController controller =
public void onHwOffloadDialogConfirmed() {
final BluetoothA2dpHwOffloadPreferenceController a2dpController =
getDevelopmentOptionsController(BluetoothA2dpHwOffloadPreferenceController.class);
controller.onA2dpHwDialogConfirmed();
a2dpController.onHwOffloadDialogConfirmed();
final BluetoothLeAudioHwOffloadPreferenceController leAudioController =
getDevelopmentOptionsController(
BluetoothLeAudioHwOffloadPreferenceController.class);
leAudioController.onHwOffloadDialogConfirmed();
}
@Override
public void onHwOffloadDialogCanceled() {
final BluetoothA2dpHwOffloadPreferenceController a2dpController =
getDevelopmentOptionsController(BluetoothA2dpHwOffloadPreferenceController.class);
a2dpController.onHwOffloadDialogCanceled();
final BluetoothLeAudioHwOffloadPreferenceController leAudioController =
getDevelopmentOptionsController(
BluetoothLeAudioHwOffloadPreferenceController.class);
leAudioController.onHwOffloadDialogCanceled();
}
@Override
@@ -512,6 +533,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
controllers.add(new BluetoothAvrcpVersionPreferenceController(context));
controllers.add(new BluetoothMapVersionPreferenceController(context));
controllers.add(new BluetoothA2dpHwOffloadPreferenceController(context, fragment));
controllers.add(new BluetoothLeAudioHwOffloadPreferenceController(context, fragment));
controllers.add(new BluetoothMaxConnectedAudioDevicesPreferenceController(context));
controllers.add(new NfcStackDebugLogPreferenceController(context));
controllers.add(new ShowTapsPreferenceController(context));