Add LE audio hardware offload development option

Bug: 197296692
Bug: 215492586
Test: make RunSettingsRoboTests ROBOTEST_FILTER=BluetoothLeAudioHwOffloadPreferenceControllerTest
Test: make RunSettingsRoboTests
ROBOTEST_FILTER=BluetoothA2dpHwOffloadPreferenceControllerTest

Change-Id: If1203c50d1d94ac9ed377293b5cb389b7b6f54a1
Merged-In: If1203c50d1d94ac9ed377293b5cb389b7b6f54a1
This commit is contained in:
Alice Kuo
2022-03-11 07:35:46 +08:00
parent aee21e8cbd
commit 25c2e31242
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
@@ -514,6 +535,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));