Do not disable LE audio offload as the developer option being disabled
The logic wrong to check the a2dp offload disable status to disable LE audio offload together as the user turn off the developer option. Change to use the support status, and reset the state to align the support status. Bug: 395725497 Fix: 395725497 Flag: EXEMPT, trivial bug fix Test: Manual turn off developer option to check the status change Test: atest SettingsRoboTests:com.android.settings.development.BluetoothLeAudioHwOffloadPreferenceControllerTest Change-Id: I59d3e378495c90f007b46f05b74fdaf19d1520ce
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
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;
|
||||
@@ -105,13 +106,14 @@ public class BluetoothLeAudioHwOffloadPreferenceController
|
||||
(mBluetoothAdapter.isLeAudioSupported() == BluetoothStatusCodes.FEATURE_SUPPORTED);
|
||||
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) {
|
||||
((TwoStatePreference) mPreference).setChecked(true);
|
||||
SystemProperties.set(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY, "true");
|
||||
} else {
|
||||
final boolean a2dpOffloadSupported =
|
||||
SystemProperties.getBoolean(A2DP_OFFLOAD_SUPPORTED_PROPERTY, false);
|
||||
|
||||
if(!leAudioEnabled || !leAudioOffloadSupported || !a2dpOffloadSupported) {
|
||||
mPreference.setEnabled(false);
|
||||
} else {
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
SystemProperties.set(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY, "false");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ import static android.bluetooth.BluetoothStatusCodes.FEATURE_SUPPORTED;
|
||||
|
||||
import static com.android.settings.development.BluetoothA2dpHwOffloadPreferenceController
|
||||
.A2DP_OFFLOAD_DISABLED_PROPERTY;
|
||||
import static com.android.settings.development.BluetoothA2dpHwOffloadPreferenceController
|
||||
.A2DP_OFFLOAD_SUPPORTED_PROPERTY;
|
||||
import static com.android.settings.development.BluetoothLeAudioHwOffloadPreferenceController
|
||||
.LE_AUDIO_OFFLOAD_DISABLED_PROPERTY;
|
||||
import static com.android.settings.development.BluetoothLeAudioHwOffloadPreferenceController
|
||||
@@ -120,4 +122,17 @@ public class BluetoothLeAudioHwOffloadPreferenceControllerTest {
|
||||
leAueioDisabled = SystemProperties.getBoolean(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY, false);
|
||||
assertThat(leAueioDisabled).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void asDisableDeveloperOption_ResetLEOffloadBasedOnA2dpLeAudioOffloadSupported() {
|
||||
SystemProperties.set(LE_AUDIO_OFFLOAD_SUPPORTED_PROPERTY, Boolean.toString(true));
|
||||
SystemProperties.set(A2DP_OFFLOAD_SUPPORTED_PROPERTY, Boolean.toString(true));
|
||||
|
||||
SystemProperties.set(
|
||||
LE_AUDIO_OFFLOAD_DISABLED_PROPERTY, Boolean.toString(true));
|
||||
mController.onDeveloperOptionsSwitchDisabled();
|
||||
boolean leAueioDisabled =
|
||||
SystemProperties.getBoolean(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY, false);
|
||||
assertThat(leAueioDisabled).isFalse();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user