diff options
author | Grace Jia <xiaotonj@google.com> | 2023-11-29 21:42:03 +0000 |
---|---|---|
committer | Grace Jia <xiaotonj@google.com> | 2023-11-29 23:39:50 +0000 |
commit | 9b62a3ec1c4caf5e06589427cef5848f72aa9c54 (patch) | |
tree | 0249feb458c7a9feecc4a1b0054dfa84d85f7d53 | |
parent | 82dce2df7a109fff9366f75f542c0b9fe309b52f (diff) | |
download | Telecomm-9b62a3ec1c4caf5e06589427cef5848f72aa9c54.tar.gz |
Revert "Avoid entering to the connected state of an inactive device in"
This reverts commit f7c970e42fdb6a3fcf63ff660736587658c2735c.
Reason for revert: This is unflagged code; we can re-add with a flag at a later date.
Bug: 300236761
Change-Id: Ia22ddaaf414d37a022527237f4081118c22320b9
-rw-r--r-- | src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java b/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java index 8124f6001..5b0eedeae 100644 --- a/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java +++ b/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java @@ -21,8 +21,8 @@ import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothHeadset; import android.bluetooth.BluetoothHearingAid; -import android.bluetooth.BluetoothLeAudio; import android.bluetooth.BluetoothProfile; +import android.bluetooth.BluetoothLeAudio; import android.content.Context; import android.media.AudioDeviceInfo; import android.os.Message; @@ -40,10 +40,12 @@ import com.android.server.telecom.TelecomSystem; import com.android.server.telecom.Timeouts; import com.android.server.telecom.flags.FeatureFlags; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; +import java.util.List; import java.util.Map; import java.util.List; import java.util.Objects; @@ -140,7 +142,7 @@ public class BluetoothRouteManager extends StateMachine { 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 - transitionToActualState(null /* excludeAddress */); + transitionToActualState(); } cleanupStatesForDisconnectedDevices(); if (mListener != null) { @@ -284,7 +286,7 @@ public class BluetoothRouteManager extends StateMachine { case LOST_DEVICE: removeDevice((String) args.arg2); if (Objects.equals(address, mDeviceAddress)) { - transitionToActualState(null /* excludeAddress */); + transitionToActualState(); } break; case CONNECT_BT: @@ -324,7 +326,7 @@ public class BluetoothRouteManager extends StateMachine { case CONNECTION_TIMEOUT: Log.i(LOG_TAG, "Connection with device %s timed out.", mDeviceAddress); - transitionToActualState(null /* excludeAddress */); + transitionToActualState(); break; case BT_AUDIO_IS_ON: if (Objects.equals(mDeviceAddress, address)) { @@ -341,7 +343,7 @@ public class BluetoothRouteManager extends StateMachine { if (Objects.equals(mDeviceAddress, address) || address == null) { Log.i(LOG_TAG, "Connection with device %s failed.", mDeviceAddress); - transitionToActualState(address); + transitionToActualState(); } else { Log.w(LOG_TAG, "Got BT lost message for device %s while" + " connecting to %s.", address, mDeviceAddress); @@ -401,7 +403,7 @@ public class BluetoothRouteManager extends StateMachine { case LOST_DEVICE: removeDevice((String) args.arg2); if (Objects.equals(address, mDeviceAddress)) { - transitionToActualState(null /* excludeAddress */); + transitionToActualState(); } break; case CONNECT_BT: @@ -463,7 +465,7 @@ public class BluetoothRouteManager extends StateMachine { case BT_AUDIO_LOST: if (Objects.equals(mDeviceAddress, address) || address == null) { Log.i(LOG_TAG, "BT connection with device %s lost.", mDeviceAddress); - transitionToActualState(address); + transitionToActualState(); } else { Log.w(LOG_TAG, "Got BT lost message for device %s while" + " connected to %s.", address, mDeviceAddress); @@ -796,7 +798,7 @@ public class BluetoothRouteManager extends StateMachine { actualAddress)) { Log.i(this, "trying to connect to already connected device -- skipping connection" + " and going into the actual connected state."); - transitionToActualState(null /* excludeAddress */); + transitionToActualState(); return null; } @@ -832,10 +834,9 @@ public class BluetoothRouteManager extends StateMachine { return null; } - private void transitionToActualState(String excludeAddress) { + private void transitionToActualState() { BluetoothDevice possiblyAlreadyConnectedDevice = getBluetoothAudioConnectedDevice(); - if (possiblyAlreadyConnectedDevice != null - && !possiblyAlreadyConnectedDevice.getAddress().equals(excludeAddress)) { + if (possiblyAlreadyConnectedDevice != null) { Log.i(LOG_TAG, "Device %s is already connected; going to AudioConnected.", possiblyAlreadyConnectedDevice); transitionTo(getConnectedStateForAddress( |