Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c42df45d authored by Eric Laurent's avatar Eric Laurent
Browse files

audio: add device definitions for BLE Audio

Add support for device type enums for BLE Audio.
This CL just adds basic support in parsers and voloume curve
categories.
No policy implemented yet for the new devices.

Bug: 161358428
Test: make flash and boot
Change-Id: I86134ea8436b24f817a9fe0f856e3489dd22fcc8
parent a524c363
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@ const OutputDeviceConverter::Table OutputDeviceConverter::mTable[] = {
    MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_OUT_USB_HEADSET),
    MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_OUT_HEARING_AID),
    MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_OUT_ECHO_CANCELLER),
    MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_OUT_BLE_HEADSET),
    MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_OUT_BLE_SPEAKER),
    MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_OUT_DEFAULT),
    // STUB must be after DEFAULT, so the latter is picked up by toString first.
    MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_OUT_STUB),
@@ -96,6 +98,7 @@ const InputDeviceConverter::Table InputDeviceConverter::mTable[] = {
    MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_IN_USB_HEADSET),
    MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_IN_BLUETOOTH_BLE),
    MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_IN_ECHO_REFERENCE),
    MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_IN_BLE_HEADSET),
    MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_IN_DEFAULT),
    // STUB must be after DEFAULT, so the latter is picked up by toString first.
    MAKE_STRING_FROM_ENUM(AUDIO_DEVICE_IN_STUB),
+2 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ public:
        case AUDIO_DEVICE_OUT_BLUETOOTH_A2DP:
        case AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES:
        case AUDIO_DEVICE_OUT_USB_HEADSET:
        case AUDIO_DEVICE_OUT_BLE_HEADSET:
            return DEVICE_CATEGORY_HEADSET;
        case AUDIO_DEVICE_OUT_HEARING_AID:
            return DEVICE_CATEGORY_HEARING_AID;
@@ -139,6 +140,7 @@ public:
        case AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER:
        case AUDIO_DEVICE_OUT_USB_ACCESSORY:
        case AUDIO_DEVICE_OUT_REMOTE_SUBMIX:
        case AUDIO_DEVICE_OUT_BLE_SPEAKER:
        default:
            return DEVICE_CATEGORY_SPEAKER;
        }
+2 −1
Original line number Diff line number Diff line
@@ -6053,7 +6053,8 @@ float AudioPolicyManager::computeVolume(IVolumeCurves &curves,
    if (!Intersection(deviceTypes,
            {AUDIO_DEVICE_OUT_BLUETOOTH_A2DP, AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES,
             AUDIO_DEVICE_OUT_WIRED_HEADSET, AUDIO_DEVICE_OUT_WIRED_HEADPHONE,
             AUDIO_DEVICE_OUT_USB_HEADSET, AUDIO_DEVICE_OUT_HEARING_AID}).empty() &&
             AUDIO_DEVICE_OUT_USB_HEADSET, AUDIO_DEVICE_OUT_HEARING_AID,
             AUDIO_DEVICE_OUT_BLE_HEADSET}).empty() &&
            ((volumeSource == alarmVolumeSrc ||
              volumeSource == ringVolumeSrc) ||
             (volumeSource == toVolumeSource(AUDIO_STREAM_NOTIFICATION)) ||
+3 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ const std::unordered_map<std::string, int64_t>& getAudioDeviceInMap() {
        {"AUDIO_DEVICE_IN_ECHO_REFERENCE",         1LL << 27},
        {"AUDIO_DEVICE_IN_DEFAULT",                1LL << 28},
        // R values above.
        {"AUDIO_DEVICE_IN_BLE_HEADSET",            1LL << 29},
    };
    return map;
}
@@ -121,6 +122,8 @@ const std::unordered_map<std::string, int64_t>& getAudioDeviceOutMap() {
        {"AUDIO_DEVICE_OUT_ECHO_CANCELLER",            1LL << 29},
        {"AUDIO_DEVICE_OUT_DEFAULT",                   1LL << 30},
        // R values above.
        {"AUDIO_DEVICE_OUT_BLE_HEADSET",               1LL << 31},
        {"AUDIO_DEVICE_OUT_BLE_SPAEKER",               1LL << 32},
    };
    return map;
}