Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9aa081c authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Check for device type match when changing audio device info in route.

Some OEMs have reported an issue where there are multiple audio device
infos reported for a device in the transition between HFP<->LE.  This
can cause the wrong info to be re-associated with the AudioRoute.
Changing to also check the device type matches.

Test: Manual testing with flag on and off.
Test: Verified unit test behavior.
Flag: com.android.server.telecom.flags.check_device_type_on_route_change
Fixes: 388509460
Change-Id: Idbecc32fd235d4c7d2cc59f05c542b45f62f9def
parent 226e9c5b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -151,3 +151,14 @@ flag {
    purpose: PURPOSE_BUGFIX
  }
}

# OWNER=tgunn TARGET=25Q2
flag {
  name: "check_device_type_on_route_change"
  namespace: "telecom"
  description: "When comparing devices on route change, also consider device type."
  bug: "388509460"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
+10 −1
Original line number Diff line number Diff line
@@ -291,8 +291,17 @@ public class AudioRoute {
            for (AudioDeviceInfo deviceInfo : devices) {
                // It's possible for the AudioDeviceInfo to be updated for the BT device so adjust
                // mInfo accordingly.
                // Note: we need to check the device type as well since a dual mode (LE and HFP) BT
                // device can change type during a call if the user toggles LE for the device.
                boolean isSameDeviceType =
                        !pendingAudioRoute.getFeatureFlags().checkDeviceTypeOnRouteChange() ||
                                (pendingAudioRoute.getFeatureFlags().checkDeviceTypeOnRouteChange()
                                        && mAudioRouteType
                                        == DEVICE_INFO_TYPE_TO_AUDIO_ROUTE_TYPE.get(
                                        deviceInfo.getType()));
                if (BT_AUDIO_ROUTE_TYPES.contains(mAudioRouteType) && mBluetoothAddress
                        .equals(deviceInfo.getAddress())) {
                        .equals(deviceInfo.getAddress())
                        && isSameDeviceType) {
                    mInfo = deviceInfo;
                }
                if (deviceInfo.equals(mInfo)) {