Remove rolled out flag automatic_bt_device_type

This flag has been rolled out in 24Q3 and can be removed.

Test: atest BluetoothDetailsAudioDeviceTypeControllerTest
Bug: 302323921
Flag: EXEMPT removing com.android.media.automatic_bt_device_type
Change-Id: I9997ef60f195b36298c36078eadf6c0a82bc662d
This commit is contained in:
Vlad Popa
2025-02-05 16:04:50 -08:00
parent b5299b17d9
commit b136fcfe18
2 changed files with 9 additions and 38 deletions

View File

@@ -16,14 +16,12 @@
package com.android.settings.bluetooth;
import static android.bluetooth.BluetoothDevice.DEVICE_TYPE_LE;
import static android.media.AudioManager.AUDIO_DEVICE_CATEGORY_CARKIT;
import static android.media.AudioManager.AUDIO_DEVICE_CATEGORY_HEADPHONES;
import static android.media.AudioManager.AUDIO_DEVICE_CATEGORY_HEARING_AID;
import static android.media.AudioManager.AUDIO_DEVICE_CATEGORY_OTHER;
import static android.media.AudioManager.AUDIO_DEVICE_CATEGORY_SPEAKER;
import static android.media.AudioManager.AUDIO_DEVICE_CATEGORY_UNKNOWN;
import static android.media.audio.Flags.automaticBtDeviceType;
import android.content.Context;
import android.media.AudioManager;
@@ -108,15 +106,8 @@ public class BluetoothDetailsAudioDeviceTypeController extends BluetoothDetailsC
final int index = pref.findIndexOfValue(value);
if (index >= 0) {
pref.setSummary(pref.getEntries()[index]);
if (automaticBtDeviceType()) {
mAudioManager.setBluetoothAudioDeviceCategory(
mCachedDevice.getAddress(), Integer.parseInt(value));
} else {
mAudioManager.setBluetoothAudioDeviceCategory_legacy(
mCachedDevice.getAddress(),
mCachedDevice.getDevice().getType() == DEVICE_TYPE_LE,
Integer.parseInt(value));
}
mAudioManager.setBluetoothAudioDeviceCategory(
mCachedDevice.getAddress(), Integer.parseInt(value));
mCachedDevice.onAudioDeviceCategoryChanged();
}
}
@@ -174,15 +165,8 @@ public class BluetoothDetailsAudioDeviceTypeController extends BluetoothDetailsC
Integer.toString(AUDIO_DEVICE_CATEGORY_OTHER),
});
@AudioDeviceCategory int deviceCategory;
if (automaticBtDeviceType()) {
deviceCategory = mAudioManager.getBluetoothAudioDeviceCategory(
mCachedDevice.getAddress());
} else {
deviceCategory = mAudioManager.getBluetoothAudioDeviceCategory_legacy(
mCachedDevice.getAddress(),
mCachedDevice.getDevice().getType() == DEVICE_TYPE_LE);
}
@AudioDeviceCategory int deviceCategory = mAudioManager.getBluetoothAudioDeviceCategory(
mCachedDevice.getAddress());
if (DEBUG) {
Log.v(TAG, "getBluetoothAudioDeviceCategory() device: "
+ mCachedDevice.getDevice().getAnonymizedAddress()
@@ -190,10 +174,8 @@ public class BluetoothDetailsAudioDeviceTypeController extends BluetoothDetailsC
}
mAudioDeviceTypePreference.setValue(Integer.toString(deviceCategory));
if (automaticBtDeviceType()) {
if (mAudioManager.isBluetoothAudioDeviceCategoryFixed(mCachedDevice.getAddress())) {
mAudioDeviceTypePreference.setEnabled(false);
}
if (mAudioManager.isBluetoothAudioDeviceCategoryFixed(mCachedDevice.getAddress())) {
mAudioDeviceTypePreference.setEnabled(false);
}
mAudioDeviceTypePreference.setSummary(mAudioDeviceTypePreference.getEntry());

View File

@@ -18,7 +18,6 @@ package com.android.settings.bluetooth;
import static android.bluetooth.BluetoothDevice.DEVICE_TYPE_LE;
import static android.media.AudioManager.AUDIO_DEVICE_CATEGORY_SPEAKER;
import static android.media.audio.Flags.automaticBtDeviceType;
import static com.google.common.truth.Truth.assertThat;
@@ -98,12 +97,7 @@ public class BluetoothDetailsAudioDeviceTypeControllerTest extends
@Test
public void createAudioDeviceTypePreference_btDeviceIsCategorized_checkSelection() {
int deviceType = AUDIO_DEVICE_CATEGORY_SPEAKER;
if (automaticBtDeviceType()) {
when(mAudioManager.getBluetoothAudioDeviceCategory(MAC_ADDRESS)).thenReturn(deviceType);
} else {
when(mAudioManager.getBluetoothAudioDeviceCategory_legacy(MAC_ADDRESS, /*isBle=*/
true)).thenReturn(deviceType);
}
when(mAudioManager.getBluetoothAudioDeviceCategory(MAC_ADDRESS)).thenReturn(deviceType);
mController.createAudioDeviceTypePreference(mContext);
mAudioDeviceTypePref = mController.getAudioDeviceTypePreference();
@@ -118,12 +112,7 @@ public class BluetoothDetailsAudioDeviceTypeControllerTest extends
mController.onPreferenceChange(mAudioDeviceTypePref, Integer.toString(deviceType));
if (automaticBtDeviceType()) {
verify(mAudioManager).setBluetoothAudioDeviceCategory(eq(MAC_ADDRESS),
eq(AUDIO_DEVICE_CATEGORY_SPEAKER));
} else {
verify(mAudioManager).setBluetoothAudioDeviceCategory_legacy(eq(MAC_ADDRESS), eq(true),
eq(AUDIO_DEVICE_CATEGORY_SPEAKER));
}
verify(mAudioManager).setBluetoothAudioDeviceCategory(eq(MAC_ADDRESS),
eq(AUDIO_DEVICE_CATEGORY_SPEAKER));
}
}