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:
@@ -16,14 +16,12 @@
|
|||||||
|
|
||||||
package com.android.settings.bluetooth;
|
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_CARKIT;
|
||||||
import static android.media.AudioManager.AUDIO_DEVICE_CATEGORY_HEADPHONES;
|
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_HEARING_AID;
|
||||||
import static android.media.AudioManager.AUDIO_DEVICE_CATEGORY_OTHER;
|
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_SPEAKER;
|
||||||
import static android.media.AudioManager.AUDIO_DEVICE_CATEGORY_UNKNOWN;
|
import static android.media.AudioManager.AUDIO_DEVICE_CATEGORY_UNKNOWN;
|
||||||
import static android.media.audio.Flags.automaticBtDeviceType;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
@@ -108,15 +106,8 @@ public class BluetoothDetailsAudioDeviceTypeController extends BluetoothDetailsC
|
|||||||
final int index = pref.findIndexOfValue(value);
|
final int index = pref.findIndexOfValue(value);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
pref.setSummary(pref.getEntries()[index]);
|
pref.setSummary(pref.getEntries()[index]);
|
||||||
if (automaticBtDeviceType()) {
|
|
||||||
mAudioManager.setBluetoothAudioDeviceCategory(
|
mAudioManager.setBluetoothAudioDeviceCategory(
|
||||||
mCachedDevice.getAddress(), Integer.parseInt(value));
|
mCachedDevice.getAddress(), Integer.parseInt(value));
|
||||||
} else {
|
|
||||||
mAudioManager.setBluetoothAudioDeviceCategory_legacy(
|
|
||||||
mCachedDevice.getAddress(),
|
|
||||||
mCachedDevice.getDevice().getType() == DEVICE_TYPE_LE,
|
|
||||||
Integer.parseInt(value));
|
|
||||||
}
|
|
||||||
mCachedDevice.onAudioDeviceCategoryChanged();
|
mCachedDevice.onAudioDeviceCategoryChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,15 +165,8 @@ public class BluetoothDetailsAudioDeviceTypeController extends BluetoothDetailsC
|
|||||||
Integer.toString(AUDIO_DEVICE_CATEGORY_OTHER),
|
Integer.toString(AUDIO_DEVICE_CATEGORY_OTHER),
|
||||||
});
|
});
|
||||||
|
|
||||||
@AudioDeviceCategory int deviceCategory;
|
@AudioDeviceCategory int deviceCategory = mAudioManager.getBluetoothAudioDeviceCategory(
|
||||||
if (automaticBtDeviceType()) {
|
|
||||||
deviceCategory = mAudioManager.getBluetoothAudioDeviceCategory(
|
|
||||||
mCachedDevice.getAddress());
|
mCachedDevice.getAddress());
|
||||||
} else {
|
|
||||||
deviceCategory = mAudioManager.getBluetoothAudioDeviceCategory_legacy(
|
|
||||||
mCachedDevice.getAddress(),
|
|
||||||
mCachedDevice.getDevice().getType() == DEVICE_TYPE_LE);
|
|
||||||
}
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.v(TAG, "getBluetoothAudioDeviceCategory() device: "
|
Log.v(TAG, "getBluetoothAudioDeviceCategory() device: "
|
||||||
+ mCachedDevice.getDevice().getAnonymizedAddress()
|
+ mCachedDevice.getDevice().getAnonymizedAddress()
|
||||||
@@ -190,11 +174,9 @@ public class BluetoothDetailsAudioDeviceTypeController extends BluetoothDetailsC
|
|||||||
}
|
}
|
||||||
mAudioDeviceTypePreference.setValue(Integer.toString(deviceCategory));
|
mAudioDeviceTypePreference.setValue(Integer.toString(deviceCategory));
|
||||||
|
|
||||||
if (automaticBtDeviceType()) {
|
|
||||||
if (mAudioManager.isBluetoothAudioDeviceCategoryFixed(mCachedDevice.getAddress())) {
|
if (mAudioManager.isBluetoothAudioDeviceCategoryFixed(mCachedDevice.getAddress())) {
|
||||||
mAudioDeviceTypePreference.setEnabled(false);
|
mAudioDeviceTypePreference.setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
mAudioDeviceTypePreference.setSummary(mAudioDeviceTypePreference.getEntry());
|
mAudioDeviceTypePreference.setSummary(mAudioDeviceTypePreference.getEntry());
|
||||||
mAudioDeviceTypePreference.setOnPreferenceChangeListener(this);
|
mAudioDeviceTypePreference.setOnPreferenceChangeListener(this);
|
||||||
|
@@ -18,7 +18,6 @@ package com.android.settings.bluetooth;
|
|||||||
|
|
||||||
import static android.bluetooth.BluetoothDevice.DEVICE_TYPE_LE;
|
import static android.bluetooth.BluetoothDevice.DEVICE_TYPE_LE;
|
||||||
import static android.media.AudioManager.AUDIO_DEVICE_CATEGORY_SPEAKER;
|
import static android.media.AudioManager.AUDIO_DEVICE_CATEGORY_SPEAKER;
|
||||||
import static android.media.audio.Flags.automaticBtDeviceType;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
@@ -98,12 +97,7 @@ public class BluetoothDetailsAudioDeviceTypeControllerTest extends
|
|||||||
@Test
|
@Test
|
||||||
public void createAudioDeviceTypePreference_btDeviceIsCategorized_checkSelection() {
|
public void createAudioDeviceTypePreference_btDeviceIsCategorized_checkSelection() {
|
||||||
int deviceType = AUDIO_DEVICE_CATEGORY_SPEAKER;
|
int deviceType = AUDIO_DEVICE_CATEGORY_SPEAKER;
|
||||||
if (automaticBtDeviceType()) {
|
|
||||||
when(mAudioManager.getBluetoothAudioDeviceCategory(MAC_ADDRESS)).thenReturn(deviceType);
|
when(mAudioManager.getBluetoothAudioDeviceCategory(MAC_ADDRESS)).thenReturn(deviceType);
|
||||||
} else {
|
|
||||||
when(mAudioManager.getBluetoothAudioDeviceCategory_legacy(MAC_ADDRESS, /*isBle=*/
|
|
||||||
true)).thenReturn(deviceType);
|
|
||||||
}
|
|
||||||
|
|
||||||
mController.createAudioDeviceTypePreference(mContext);
|
mController.createAudioDeviceTypePreference(mContext);
|
||||||
mAudioDeviceTypePref = mController.getAudioDeviceTypePreference();
|
mAudioDeviceTypePref = mController.getAudioDeviceTypePreference();
|
||||||
@@ -118,12 +112,7 @@ public class BluetoothDetailsAudioDeviceTypeControllerTest extends
|
|||||||
|
|
||||||
mController.onPreferenceChange(mAudioDeviceTypePref, Integer.toString(deviceType));
|
mController.onPreferenceChange(mAudioDeviceTypePref, Integer.toString(deviceType));
|
||||||
|
|
||||||
if (automaticBtDeviceType()) {
|
|
||||||
verify(mAudioManager).setBluetoothAudioDeviceCategory(eq(MAC_ADDRESS),
|
verify(mAudioManager).setBluetoothAudioDeviceCategory(eq(MAC_ADDRESS),
|
||||||
eq(AUDIO_DEVICE_CATEGORY_SPEAKER));
|
eq(AUDIO_DEVICE_CATEGORY_SPEAKER));
|
||||||
} else {
|
|
||||||
verify(mAudioManager).setBluetoothAudioDeviceCategory_legacy(eq(MAC_ADDRESS), eq(true),
|
|
||||||
eq(AUDIO_DEVICE_CATEGORY_SPEAKER));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user