summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2023-11-30 00:24:37 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2023-11-30 00:24:37 +0000
commitedfc965759800d31a06ebef666dd2f80952c8500 (patch)
treed7fb6532176bba66dff7b05268c8e0611544753b /src
parent1014751959823d91aa8718f1c7fb2eeb11c7fcee (diff)
parent1963b1f1f5ec56f714e37033ef3c39ab922d9319 (diff)
downloadTelecomm-edfc965759800d31a06ebef666dd2f80952c8500.tar.gz
Merge "Revert "Hearing Aid: Connect route when right HA is connected first"" into main
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;
}
}
}