Remove A2dp offload disabled and LE audio offload enabled combination

In order to reduce the complexity, LE audio offload couldn't be
enabled as a2dp offload disabled. Remove the combination from the
developer option
1. As a2dp offload disabled, LE audio offload couldn't be switched.
2. As the user disable a2dp offload, LE audio offload would be disabled
   as well

Bug: 238268927
Test: make RunSettingsRoboTests ROBOTEST_FILTER=BluetoothLeAudioHwOffloadPreferenceControllerTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=BluetoothA2dpHwOffloadPreferenceControllerTest
Change-Id: I9ebe26c6a8058798ea654523ad1405a8447268b8
This commit is contained in:
Alice Kuo
2022-10-04 23:28:59 +08:00
parent 6626e50dd8
commit 7cc845026c
4 changed files with 51 additions and 20 deletions

View File

@@ -102,7 +102,7 @@ public class BluetoothA2dpHwOffloadPreferenceController extends DeveloperOptions
final boolean offloadDisabled =
SystemProperties.getBoolean(A2DP_OFFLOAD_DISABLED_PROPERTY, false);
SystemProperties.set(A2DP_OFFLOAD_DISABLED_PROPERTY, Boolean.toString(!offloadDisabled));
if (offloadDisabled) {
if (!offloadDisabled) {
SystemProperties.set(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY,
Boolean.toString(!offloadDisabled));
}

View File

@@ -16,7 +16,8 @@
package com.android.settings.development;
import static com.android.settings.development.BluetoothA2dpHwOffloadPreferenceController.A2DP_OFFLOAD_SUPPORTED_PROPERTY;
import static com.android.settings.development.BluetoothA2dpHwOffloadPreferenceController.A2DP_OFFLOAD_DISABLED_PROPERTY;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothManager;
@@ -79,11 +80,11 @@ public class BluetoothLeAudioHwOffloadPreferenceController
final boolean leAudioEnabled =
(mBluetoothAdapter.isLeAudioSupported() == BluetoothStatusCodes.FEATURE_SUPPORTED);
final boolean offloadSupported =
SystemProperties.getBoolean(A2DP_OFFLOAD_SUPPORTED_PROPERTY, false)
&& SystemProperties.getBoolean(LE_AUDIO_OFFLOAD_SUPPORTED_PROPERTY, false);
if (leAudioEnabled && offloadSupported) {
final boolean leAudioOffloadSupported =
SystemProperties.getBoolean(LE_AUDIO_OFFLOAD_SUPPORTED_PROPERTY, false);
final boolean a2dpOffloadDisabled =
SystemProperties.getBoolean(A2DP_OFFLOAD_DISABLED_PROPERTY, false);
if (leAudioEnabled && leAudioOffloadSupported && !a2dpOffloadDisabled) {
final boolean offloadDisabled =
SystemProperties.getBoolean(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY, true);
((SwitchPreference) mPreference).setChecked(offloadDisabled);
@@ -102,10 +103,11 @@ public class BluetoothLeAudioHwOffloadPreferenceController
final boolean leAudioEnabled =
(mBluetoothAdapter.isLeAudioSupported() == BluetoothStatusCodes.FEATURE_SUPPORTED);
final boolean offloadSupported =
SystemProperties.getBoolean(A2DP_OFFLOAD_SUPPORTED_PROPERTY, false)
&& SystemProperties.getBoolean(LE_AUDIO_OFFLOAD_SUPPORTED_PROPERTY, false);
if (leAudioEnabled && offloadSupported) {
final boolean leAudioOffloadSupported =
SystemProperties.getBoolean(LE_AUDIO_OFFLOAD_SUPPORTED_PROPERTY, false);
final boolean a2dpOffloadDisabled =
SystemProperties.getBoolean(A2DP_OFFLOAD_DISABLED_PROPERTY, false);
if (leAudioEnabled && leAudioOffloadSupported && !a2dpOffloadDisabled) {
((SwitchPreference) mPreference).setChecked(true);
SystemProperties.set(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY, "true");
} else {
@@ -118,7 +120,7 @@ public class BluetoothLeAudioHwOffloadPreferenceController
*/
public boolean isDefaultValue() {
final boolean offloadSupported =
SystemProperties.getBoolean(A2DP_OFFLOAD_SUPPORTED_PROPERTY, false)
!SystemProperties.getBoolean(A2DP_OFFLOAD_DISABLED_PROPERTY, false)
&& SystemProperties.getBoolean(LE_AUDIO_OFFLOAD_SUPPORTED_PROPERTY, false);
final boolean offloadDisabled =
SystemProperties.getBoolean(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY, false);
@@ -133,11 +135,11 @@ public class BluetoothLeAudioHwOffloadPreferenceController
return;
}
final boolean offloadDisabled =
final boolean leaudioOffloadDisabled =
SystemProperties.getBoolean(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY,
false);
SystemProperties.set(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY,
Boolean.toString(!offloadDisabled));
Boolean.toString(!leaudioOffloadDisabled));
}
/**