summaryrefslogtreecommitdiff
path: root/media
diff options
context:
space:
mode:
authorJakub Tyszkowski <tyszkowski@google.com>2022-09-02 09:18:26 +0000
committerJakub Tyszkowski <tyszkowski@google.com>2022-09-09 12:33:18 +0000
commit142729a64da8a7d05f3ec5bc927ec100e29075d9 (patch)
treed6eca87433e6d8a82dee8d9b975bc2f8bd5bb7e8 /media
parentabcf028aa915c788db0c7306834ccbc2c20be6bc (diff)
downloadbase-142729a64da8a7d05f3ec5bc927ec100e29075d9.tar.gz
LeAudio: Fix volume control
The calculation formula is now set to be the inverse of the one used in VolumeControlService.java when calculating volume index from the BLE audio volume level. This also fixes not using the absolute volume for BLE audio stream, which could result with very low volume levels at the lower registers of the volume slider. It was caused by lowering the volume on both ends. Not transmitting the sound at the maximum volume level could also reduce the sound quality due to effective sound sample resolution being lower. Bug: 238587620 Bug: 241501978 Test: built and manually tested Tag: #feature Change-Id: I368c8978be5fbd94b0f62df2551fe179a9f203a0 Merged-In: I368c8978be5fbd94b0f62df2551fe179a9f203a0 (cherry picked from commit 51d75fbc69935531464e4adfbdefacc999cbb96c)
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioSystem.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index 650f36059495..7ccbe51bbd49 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -2385,6 +2385,14 @@ public class AudioSystem
return types.size() == 1 && types.contains(type);
}
+ /**
+ * @hide
+ * Return true if the audio device type is a Bluetooth LE Audio device.
+ */
+ public static boolean isLeAudioDeviceType(int type) {
+ return DEVICE_OUT_ALL_BLE_SET.contains(type);
+ }
+
/** @hide */
public static final int DEFAULT_MUTE_STREAMS_AFFECTED =
(1 << STREAM_MUSIC) |