summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java43
1 files changed, 7 insertions, 36 deletions
diff --git a/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java b/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java
index ed2a72c0a..644d9aeda 100644
--- a/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java
+++ b/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java
@@ -45,7 +45,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Map;
-import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
@@ -135,8 +134,7 @@ public class BluetoothRouteManager extends StateMachine {
@Override
public void enter() {
BluetoothDevice erroneouslyConnectedDevice = getBluetoothAudioConnectedDevice();
- if (erroneouslyConnectedDevice != null &&
- !erroneouslyConnectedDevice.equals(mHearingAidActiveDeviceCache)) {
+ if (erroneouslyConnectedDevice != null) {
Log.w(LOG_TAG, "Entering AudioOff state but device %s appears to be connected. " +
"Switching to audio-on state for that device.", erroneouslyConnectedDevice);
// change this to just transition to the new audio on state
@@ -254,27 +252,6 @@ public class BluetoothRouteManager extends StateMachine {
SomeArgs args = (SomeArgs) msg.obj;
String address = (String) args.arg2;
boolean switchingBtDevices = !Objects.equals(mDeviceAddress, address);
-
- if (switchingBtDevices == true) { // check if it is an hearing aid pair
- BluetoothAdapter bluetoothAdapter = mDeviceManager.getBluetoothAdapter();
- if (bluetoothAdapter != null) {
- List<BluetoothDevice> activeHearingAids =
- bluetoothAdapter.getActiveDevices(BluetoothProfile.HEARING_AID);
- for (BluetoothDevice hearingAid : activeHearingAids) {
- if (hearingAid != null) {
- String hearingAidAddress = hearingAid.getAddress();
- if (hearingAidAddress != null) {
- if (hearingAidAddress.equals(address) ||
- hearingAidAddress.equals(mDeviceAddress)) {
- switchingBtDevices = false;
- break;
- }
- }
- }
- }
-
- }
- }
try {
switch (msg.what) {
case NEW_DEVICE_CONNECTED:
@@ -887,18 +864,12 @@ public class BluetoothRouteManager extends StateMachine {
: mDeviceManager.isHearingAidSetAsCommunicationDevice();
if (bluetoothHearingAid != null) {
if (isHearingAidSetForCommunication) {
- List<BluetoothDevice> hearingAidsActiveDevices = bluetoothAdapter.getActiveDevices(
- BluetoothProfile.HEARING_AID);
- if (hearingAidsActiveDevices.contains(mHearingAidActiveDeviceCache)) {
- hearingAidActiveDevice = mHearingAidActiveDeviceCache;
- activeDevices++;
- } else {
- for (BluetoothDevice device : hearingAidsActiveDevices) {
- if (device != null) {
- hearingAidActiveDevice = device;
- activeDevices++;
- break;
- }
+ for (BluetoothDevice device : bluetoothAdapter.getActiveDevices(
+ BluetoothProfile.HEARING_AID)) {
+ if (device != null) {
+ hearingAidActiveDevice = device;
+ activeDevices++;
+ break;
}
}
}