SpatializerHelper: Fix device name translation

In the spatializer metrics, bt_a2dp was aliasing to (wired) headphone.

Test: adb shell dumpsys media.metrics
Bug: 233773341
Merged-In: Ic6cbeb8bfadbe961eea04517a404b49db9eb2b34
Change-Id: Ic6cbeb8bfadbe961eea04517a404b49db9eb2b34
(cherry picked from commit 5b3731851f)
This commit is contained in:
Andy Hung
2022-08-17 17:37:43 -07:00
parent 829e25dfd3
commit 5392e89fc7

View File

@@ -571,7 +571,9 @@ public class SpatializerHelper {
// There may be different devices with the same device type (aliasing).
// We always send the full device state info on each change.
private void logDeviceState(SADeviceState deviceState, String event) {
final String deviceName = AudioSystem.getDeviceName(deviceState.mDeviceType);
final int deviceType = AudioDeviceInfo.convertDeviceTypeToInternalDevice(
deviceState.mDeviceType);
final String deviceName = AudioSystem.getDeviceName(deviceType);
new MediaMetrics.Item(METRICS_DEVICE_PREFIX + deviceName)
.set(MediaMetrics.Property.ADDRESS, deviceState.mDeviceAddress)
.set(MediaMetrics.Property.ENABLED, deviceState.mEnabled ? "true" : "false")