Loading services/core/java/com/android/server/audio/AudioDeviceBroker.java +21 −11 Original line number Diff line number Diff line Loading @@ -2305,7 +2305,11 @@ import java.util.concurrent.atomic.AtomicBoolean; } @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) Loading @@ -2313,19 +2317,25 @@ import java.util.concurrent.atomic.AtomicBoolean; } @GuardedBy("mDeviceStateLock") AudioDeviceAttributes getDefaultCommunicationDevice() { // For system server (Telecom) and APKs targeting S and above, we let the audio // Hearing Aid: For system server (Telecom) and IN_CALL mode 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. // 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() { AudioDeviceAttributes device = null; if (communnicationDeviceCompatOn()) { // 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; } Loading Loading
services/core/java/com/android/server/audio/AudioDeviceBroker.java +21 −11 Original line number Diff line number Diff line Loading @@ -2305,7 +2305,11 @@ import java.util.concurrent.atomic.AtomicBoolean; } @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) Loading @@ -2313,19 +2317,25 @@ import java.util.concurrent.atomic.AtomicBoolean; } @GuardedBy("mDeviceStateLock") AudioDeviceAttributes getDefaultCommunicationDevice() { // For system server (Telecom) and APKs targeting S and above, we let the audio // Hearing Aid: For system server (Telecom) and IN_CALL mode 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. // 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() { AudioDeviceAttributes device = null; if (communnicationDeviceCompatOn()) { // 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; } Loading