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

Commit 780fc38c authored by Robert Wu's avatar Robert Wu Committed by Android (Google) Code Review
Browse files

Merge "Use DeviceIdVector for outputs in Audio Policy" into main

parents 1ba6c203 fb971196
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -1224,7 +1224,7 @@ status_t AudioSystem::getOutputForAttr(audio_attributes_t* attr,
                                       const AttributionSourceState& attributionSource,
                                       audio_config_t* config,
                                       audio_output_flags_t flags,
                                       audio_port_handle_t* selectedDeviceId,
                                       DeviceIdVector* selectedDeviceIds,
                                       audio_port_handle_t* portId,
                                       std::vector<audio_io_handle_t>* secondaryOutputs,
                                       bool *isSpatialized,
@@ -1239,8 +1239,8 @@ status_t AudioSystem::getOutputForAttr(audio_attributes_t* attr,
        ALOGE("%s NULL output - shouldn't happen", __func__);
        return BAD_VALUE;
    }
    if (selectedDeviceId == nullptr) {
        ALOGE("%s NULL selectedDeviceId - shouldn't happen", __func__);
    if (selectedDeviceIds == nullptr) {
        ALOGE("%s NULL selectedDeviceIds - shouldn't happen", __func__);
        return BAD_VALUE;
    }
    if (portId == nullptr) {
@@ -1262,14 +1262,14 @@ status_t AudioSystem::getOutputForAttr(audio_attributes_t* attr,
            legacy2aidl_audio_config_t_AudioConfig(*config, false /*isInput*/));
    int32_t flagsAidl = VALUE_OR_RETURN_STATUS(
            legacy2aidl_audio_output_flags_t_int32_t_mask(flags));
    int32_t selectedDeviceIdAidl = VALUE_OR_RETURN_STATUS(
            legacy2aidl_audio_port_handle_t_int32_t(*selectedDeviceId));
    auto selectedDeviceIdsAidl = VALUE_OR_RETURN_STATUS(convertContainer<std::vector<int32_t>>(
            *selectedDeviceIds, legacy2aidl_audio_port_handle_t_int32_t));

    media::GetOutputForAttrResponse responseAidl;

    status_t status = statusTFromBinderStatus(
            aps->getOutputForAttr(attrAidl, sessionAidl, attributionSource, configAidl, flagsAidl,
                                  selectedDeviceIdAidl, &responseAidl));
                                  selectedDeviceIdsAidl, &responseAidl));
    if (status != NO_ERROR) {
        config->format = VALUE_OR_RETURN_STATUS(
                aidl2legacy_AudioFormatDescription_audio_format_t(responseAidl.configBase.format));
@@ -1287,8 +1287,8 @@ status_t AudioSystem::getOutputForAttr(audio_attributes_t* attr,
        *stream = VALUE_OR_RETURN_STATUS(
                aidl2legacy_AudioStreamType_audio_stream_type_t(responseAidl.stream));
    }
    *selectedDeviceId = VALUE_OR_RETURN_STATUS(
            aidl2legacy_int32_t_audio_port_handle_t(responseAidl.selectedDeviceId));
    *selectedDeviceIds = VALUE_OR_RETURN_STATUS(convertContainer<DeviceIdVector>(
            responseAidl.selectedDeviceIds, aidl2legacy_int32_t_audio_port_handle_t));
    *portId = VALUE_OR_RETURN_STATUS(aidl2legacy_int32_t_audio_port_handle_t(responseAidl.portId));
    *secondaryOutputs = VALUE_OR_RETURN_STATUS(convertContainer<std::vector<audio_io_handle_t>>(
            responseAidl.secondaryOutputs, aidl2legacy_int32_t_audio_io_handle_t));
+2 −2
Original line number Diff line number Diff line
@@ -26,8 +26,8 @@ parcelable GetOutputForAttrResponse {
    /** Interpreted as audio_io_handle_t. */
    int output;
    AudioStreamType stream;
    /** Interpreted as audio_port_handle_t. */
    int selectedDeviceId;
    /** Interpreted as audio_port_handle_t[]. */
    int[] selectedDeviceIds;
    /** Interpreted as audio_port_handle_t. */
    int portId;
    /** Interpreted as audio_io_handle_t[]. */
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ interface IAudioPolicyService {
                                              in AttributionSourceState attributionSource,
                                              in AudioConfig config,
                                              int /* Bitmask, indexed by AudioOutputFlags */ flags,
                                              int /* audio_port_handle_t */ selectedDeviceId);
                                              in int[] /* audio_port_handle_t */ selectedDeviceIds);

    void startOutput(int /* audio_port_handle_t */ portId);

+1 −1
Original line number Diff line number Diff line
@@ -342,7 +342,7 @@ public:
                                     const AttributionSourceState& attributionSource,
                                     audio_config_t *config,
                                     audio_output_flags_t flags,
                                     audio_port_handle_t *selectedDeviceId,
                                     DeviceIdVector *selectedDeviceIds,
                                     audio_port_handle_t *portId,
                                     std::vector<audio_io_handle_t> *secondaryOutputs,
                                     bool *isSpatialized,
+3 −3
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ std::string dumpMixerBehaviors(const MixerBehaviorSet& mixerBehaviors) {
    return ss.str();
}

std::string toString(const DeviceIdSet& deviceIds) {
std::string toString(const DeviceIdVector& deviceIds) {
    if (deviceIds.empty()) {
        return "AUDIO_PORT_HANDLE_NONE";
    }
@@ -144,11 +144,11 @@ std::string toString(const DeviceIdSet& deviceIds) {
    return ss.str();
}

audio_port_handle_t getFirstDeviceId(const DeviceIdSet& deviceIds) {
audio_port_handle_t getFirstDeviceId(const DeviceIdVector& deviceIds) {
    if (deviceIds.empty()) {
        return AUDIO_PORT_HANDLE_NONE;
    }
    return *(deviceIds.begin());
    return deviceIds[0];
}

AudioProfileAttributesMultimap createAudioProfilesAttrMap(audio_profile profiles[],
Loading