summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Rotkiewicz <rotkiewicz@google.com>2024-04-02 09:08:32 +0000
committerJakub Rotkiewicz <rotkiewicz@google.com>2024-04-16 06:08:46 +0000
commitc9231031426dec31b45cdf2bda85ff6988fa00e2 (patch)
tree1195a68dc76a572e86e919cf9afd9868e8a0b8b7
parentb5d874d9ebe5e65b6762357e577751b7b5306a9f (diff)
downloadSettings-c9231031426dec31b45cdf2bda85ff6988fa00e2.tar.gz
Bluetooth Codec Settings: Assure flag enabled
Assure flag a2dpOffloadCodecExtensibilitySettings is enabled before calling BluetoothA2dp API. Bug: 331612641 Tag: #feature Test: atest SettingsRoboTests:com.android.settings.development.bluetooth.AbstractBluetoothListPreferenceController Test: atest SettingsRoboTests:com.android.settings.development.bluetooth.BluetoothCodecListPreferenceControllerTest Merged-In: Iac33a6c95a544230e034807b320c80a727ade307 Change-Id: I2b0ed6c7ac91401b958b206817aca55e0aa47170
-rw-r--r--src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceController.java8
-rw-r--r--tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceControllerTest.java4
2 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceController.java b/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceController.java
index 79b629efcb6..863cd2795c4 100644
--- a/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceController.java
+++ b/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceController.java
@@ -78,6 +78,10 @@ public class BluetoothCodecListPreferenceController
@Override
public boolean onPreferenceChange(@Nullable Preference preference, @NonNull Object newValue) {
+ if (!Flags.a2dpOffloadCodecExtensibilitySettings()) {
+ return false;
+ }
+
if (DEBUG) {
Log.d(TAG, "onPreferenceChange: newValue=" + (String) newValue);
}
@@ -120,6 +124,10 @@ public class BluetoothCodecListPreferenceController
@Override
public void updateState(@Nullable Preference preference) {
super.updateState(preference);
+ if (!Flags.a2dpOffloadCodecExtensibilitySettings()) {
+ return;
+ }
+
final List<String> codecIds = new ArrayList<>();
final List<String> labels = new ArrayList<>();
String selectedCodecId = mDefaultValue;
diff --git a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceControllerTest.java
index b86d9df1c85..fab867fa0cf 100644
--- a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecListPreferenceControllerTest.java
@@ -35,12 +35,14 @@ import android.bluetooth.BluetoothCodecType;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
+import android.platform.test.annotations.RequiresFlagsEnabled;
import androidx.lifecycle.LifecycleOwner;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.development.BluetoothA2dpConfigStore;
+import com.android.settings.development.Flags;
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.Before;
@@ -57,7 +59,6 @@ import java.util.List;
@RunWith(RobolectricTestRunner.class)
public class BluetoothCodecListPreferenceControllerTest {
-
private static final String DEVICE_ADDRESS = "00:11:22:33:44:55";
@Mock private BluetoothA2dp mBluetoothA2dp;
@@ -245,6 +246,7 @@ public class BluetoothCodecListPreferenceControllerTest {
}
@Test
+ @RequiresFlagsEnabled(Flags.FLAG_A2DP_OFFLOAD_CODEC_EXTENSIBILITY_SETTINGS)
public void onPreferenceChange_notifyPreference() {
assertFalse(
mController.onPreferenceChange(