diff options
author | 2025-02-17 02:20:25 -0800 | |
---|---|---|
committer | 2025-02-17 02:20:25 -0800 | |
commit | 85c1adef5abf2ba2eb6af7d3cf913de5cffb44ac (patch) | |
tree | 17e7c577d5fb8aa31a780d36d88b4ce408396699 /packages/SettingsLib/src | |
parent | 2190f8fa812c03c738d59c6de9524b81f2f93152 (diff) | |
parent | 7909b5e804e149376ec3c1b9a0e2ee74dcb7e9ab (diff) |
Merge changes from topic "audioMode" into main
* changes:
When an audio sharing session is active, devices should not be classified as audio sharing device during phone call.
Pass in `isOngoingCall` to avoid calling `AudioManager.getMode` for better performance
Diffstat (limited to 'packages/SettingsLib/src')
-rw-r--r-- | packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java index a00484ac28ab..522a436b0732 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java @@ -555,22 +555,17 @@ public class BluetoothUtils { * connected 2) is Hearing Aid or LE Audio OR 3) connected profile matches currentAudioProfile * * @param cachedDevice the CachedBluetoothDevice - * @param audioManager audio manager to get the current audio profile + * @param isOngoingCall get the current audio profile based on if in phone call * @return if the device is AvailableMediaBluetoothDevice */ @WorkerThread public static boolean isAvailableMediaBluetoothDevice( - CachedBluetoothDevice cachedDevice, AudioManager audioManager) { - int audioMode = audioManager.getMode(); + CachedBluetoothDevice cachedDevice, boolean isOngoingCall) { int currentAudioProfile; - if (audioMode == AudioManager.MODE_RINGTONE - || audioMode == AudioManager.MODE_IN_CALL - || audioMode == AudioManager.MODE_IN_COMMUNICATION) { - // in phone call + if (isOngoingCall) { currentAudioProfile = BluetoothProfile.HEADSET; } else { - // without phone call currentAudioProfile = BluetoothProfile.A2DP; } @@ -859,22 +854,17 @@ public class BluetoothUtils { * currentAudioProfile * * @param cachedDevice the CachedBluetoothDevice - * @param audioManager audio manager to get the current audio profile + * @param isOngoingCall get the current audio profile based on if in phone call * @return if the device is AvailableMediaBluetoothDevice */ @WorkerThread public static boolean isConnectedBluetoothDevice( - CachedBluetoothDevice cachedDevice, AudioManager audioManager) { - int audioMode = audioManager.getMode(); + CachedBluetoothDevice cachedDevice, boolean isOngoingCall) { int currentAudioProfile; - if (audioMode == AudioManager.MODE_RINGTONE - || audioMode == AudioManager.MODE_IN_CALL - || audioMode == AudioManager.MODE_IN_COMMUNICATION) { - // in phone call + if (isOngoingCall) { currentAudioProfile = BluetoothProfile.HEADSET; } else { - // without phone call currentAudioProfile = BluetoothProfile.A2DP; } |