diff options
| author | 2023-08-21 13:19:43 +0000 | |
|---|---|---|
| committer | 2023-08-21 13:19:43 +0000 | |
| commit | 32016143ac86f4cdb68f6f354b18eec817f49b08 (patch) | |
| tree | b5196970dc0f43a783734be493a5e4cd5720d3a1 | |
| parent | 6e8121990eec27b6d932f3271ec8e0fa36744a4e (diff) | |
| parent | 9fc8e9d837869aa4e71617eb0a4e1441cc35746b (diff) | |
Merge "AudioDeviceBroker: restore use of hearing aids by default for VoIP calls" into udc-qpr-dev am: f9f3eead35 am: 9fc8e9d837
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24481987
Change-Id: Ie39edc9ef97ed6039c1aaa220dc0162c39cbaf5a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/core/java/com/android/server/audio/AudioDeviceBroker.java | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/services/core/java/com/android/server/audio/AudioDeviceBroker.java b/services/core/java/com/android/server/audio/AudioDeviceBroker.java index 4e01997e678f..4a523af142a4 100644 --- a/services/core/java/com/android/server/audio/AudioDeviceBroker.java +++ b/services/core/java/com/android/server/audio/AudioDeviceBroker.java @@ -2409,7 +2409,11 @@ public class AudioDeviceBroker { } @GuardedBy("mDeviceStateLock") - private boolean communnicationDeviceCompatOn() { + // LE Audio: For system server (Telecom) and APKs targeting S and above, we let the audio + // policy routing rules select the default communication device. + // For older APKs, we force LE Audio headset when connected as those APKs cannot select a LE + // Audiodevice explicitly. + private boolean communnicationDeviceLeAudioCompatOn() { return mAudioModeOwner.mMode == AudioSystem.MODE_IN_COMMUNICATION && !(CompatChanges.isChangeEnabled( USE_SET_COMMUNICATION_DEVICE, mAudioModeOwner.mUid) @@ -2417,19 +2421,25 @@ public class AudioDeviceBroker { } @GuardedBy("mDeviceStateLock") + // Hearing Aid: For system server (Telecom) and IN_CALL mode we let the audio + // policy routing rules select the default communication device. + // For 3p apps and IN_COMMUNICATION mode we force Hearing aid when connected to maintain + // backwards compatibility + private boolean communnicationDeviceHaCompatOn() { + return mAudioModeOwner.mMode == AudioSystem.MODE_IN_COMMUNICATION + && !(mAudioModeOwner.mUid == android.os.Process.SYSTEM_UID); + } + + @GuardedBy("mDeviceStateLock") AudioDeviceAttributes getDefaultCommunicationDevice() { - // For system server (Telecom) and APKs targeting S and above, we let the audio - // policy routing rules select the default communication device. - // For older APKs, we force Hearing Aid or LE Audio headset when connected as - // those APKs cannot select a LE Audio or Hearing Aid device explicitly. AudioDeviceAttributes device = null; - if (communnicationDeviceCompatOn()) { - // If both LE and Hearing Aid are active (thie should not happen), - // priority to Hearing Aid. + // If both LE and Hearing Aid are active (thie should not happen), + // priority to Hearing Aid. + if (communnicationDeviceHaCompatOn()) { device = mDeviceInventory.getDeviceOfType(AudioSystem.DEVICE_OUT_HEARING_AID); - if (device == null) { - device = mDeviceInventory.getDeviceOfType(AudioSystem.DEVICE_OUT_BLE_HEADSET); - } + } + if (device == null && communnicationDeviceLeAudioCompatOn()) { + device = mDeviceInventory.getDeviceOfType(AudioSystem.DEVICE_OUT_BLE_HEADSET); } return device; } |