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

Commit 6ebf8068 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9682161 from 4da12781 to udc-release

Change-Id: If16d70eb460891e9db992bcbe8ce760bb1d21f14
parents bab329e3 4da12781
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -611,6 +611,7 @@ interface IModule {
     * @param mute Whether the output from the module is muted.
     * @throws EX_UNSUPPORTED_OPERATION If muting of combined output
     *                                  is not supported by the module.
     * @throws EX_ILLEGAL_STATE If any error happens while muting of combined output.
     */
    void setMasterMute(boolean mute);

@@ -642,6 +643,8 @@ interface IModule {
     *                             accepted range.
     * @throws EX_UNSUPPORTED_OPERATION If attenuation of combined output
     *                                  is not supported by the module.
     * @throws EX_ILLEGAL_STATE If any error happens while updating attenuation of
                                combined output.
     */
    void setMasterVolume(float volume);

+2 −1
Original line number Diff line number Diff line
@@ -98,7 +98,8 @@ interface IStreamOut {
     * @throws EX_ILLEGAL_ARGUMENT If the number of elements in the provided
     *                             array does not match the channel count, or
     *                             attenuation values are out of range.
     * @throws EX_ILLEGAL_STATE If the stream is closed.
     * @throws EX_ILLEGAL_STATE If the stream is closed or there is any error happens
                                when applying hardware volume.
     * @throws EX_UNSUPPORTED_OPERATION If hardware volume control is not supported.
     */
    void setHwVolume(in float[] channelVolumes);
+1 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ cc_library_static {
        "Telephony.cpp",
        "usb/ModuleUsb.cpp",
        "usb/StreamUsb.cpp",
        "usb/UsbAlsaMixerControl.cpp",
        "usb/UsbAlsaUtils.cpp",
    ],
    generated_sources: [
+42 −6
Original line number Diff line number Diff line
@@ -460,6 +460,7 @@ ndk::ScopedAStatus Module::connectExternalDevice(const AudioPort& in_templateIdA
        connectedPort.profiles = connectedProfilesIt->second;
    }
    ports.push_back(connectedPort);
    onExternalDeviceConnectionChanged(connectedPort, true /*connected*/);
    *_aidl_return = std::move(connectedPort);

    std::vector<AudioRoute> newRoutes;
@@ -513,6 +514,7 @@ ndk::ScopedAStatus Module::disconnectExternalDevice(int32_t in_portId) {
                   << configIt->id;
        return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
    }
    onExternalDeviceConnectionChanged(*portIt, false /*connected*/);
    ports.erase(portIt);
    mConnectedDevicePorts.erase(in_portId);
    LOG(DEBUG) << __func__ << ": connected device port " << in_portId << " released";
@@ -983,8 +985,17 @@ ndk::ScopedAStatus Module::getMasterMute(bool* _aidl_return) {

ndk::ScopedAStatus Module::setMasterMute(bool in_mute) {
    LOG(DEBUG) << __func__ << ": " << in_mute;
    auto result = mDebug.simulateDeviceConnections ? ndk::ScopedAStatus::ok()
                                                   : onMasterMuteChanged(in_mute);
    if (result.isOk()) {
        mMasterMute = in_mute;
    return ndk::ScopedAStatus::ok();
    } else {
        LOG(ERROR) << __func__ << ": failed calling onMasterMuteChanged(" << in_mute
                   << "), error=" << result;
        // Reset master mute if it failed.
        onMasterMuteChanged(mMasterMute);
    }
    return std::move(result);
}

ndk::ScopedAStatus Module::getMasterVolume(float* _aidl_return) {
@@ -996,8 +1007,17 @@ ndk::ScopedAStatus Module::getMasterVolume(float* _aidl_return) {
ndk::ScopedAStatus Module::setMasterVolume(float in_volume) {
    LOG(DEBUG) << __func__ << ": " << in_volume;
    if (in_volume >= 0.0f && in_volume <= 1.0f) {
        auto result = mDebug.simulateDeviceConnections ? ndk::ScopedAStatus::ok()
                                                       : onMasterVolumeChanged(in_volume);
        if (result.isOk()) {
            mMasterVolume = in_volume;
        return ndk::ScopedAStatus::ok();
        } else {
            // Reset master volume if it failed.
            LOG(ERROR) << __func__ << ": failed calling onMasterVolumeChanged(" << in_volume
                       << "), error=" << result;
            onMasterVolumeChanged(mMasterVolume);
        }
        return std::move(result);
    }
    LOG(ERROR) << __func__ << ": invalid master volume value: " << in_volume;
    return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
@@ -1251,14 +1271,30 @@ bool Module::isMmapSupported() {
}

ndk::ScopedAStatus Module::populateConnectedDevicePort(AudioPort* audioPort __unused) {
    LOG(DEBUG) << __func__ << ": do nothing and return ok";
    LOG(VERBOSE) << __func__ << ": do nothing and return ok";
    return ndk::ScopedAStatus::ok();
}

ndk::ScopedAStatus Module::checkAudioPatchEndpointsMatch(
        const std::vector<AudioPortConfig*>& sources __unused,
        const std::vector<AudioPortConfig*>& sinks __unused) {
    LOG(DEBUG) << __func__ << ": do nothing and return ok";
    LOG(VERBOSE) << __func__ << ": do nothing and return ok";
    return ndk::ScopedAStatus::ok();
}

void Module::onExternalDeviceConnectionChanged(
        const ::aidl::android::media::audio::common::AudioPort& audioPort __unused,
        bool connected __unused) {
    LOG(DEBUG) << __func__ << ": do nothing and return";
}

ndk::ScopedAStatus Module::onMasterMuteChanged(bool mute __unused) {
    LOG(VERBOSE) << __func__ << ": do nothing and return ok";
    return ndk::ScopedAStatus::ok();
}

ndk::ScopedAStatus Module::onMasterVolumeChanged(float volume __unused) {
    LOG(VERBOSE) << __func__ << ": do nothing and return ok";
    return ndk::ScopedAStatus::ok();
}

+7 −2
Original line number Diff line number Diff line
@@ -181,8 +181,6 @@ class Module : public BnModule {
    // Maps port ids and port config ids to patch ids.
    // Multimap because both ports and configs can be used by multiple patches.
    std::multimap<int32_t, int32_t> mPatches;
    bool mMasterMute = false;
    float mMasterVolume = 1.0f;
    bool mMicMute = false;
    ChildInterface<sounddose::ISoundDose> mSoundDose;
    std::optional<bool> mIsMmapSupported;
@@ -197,6 +195,13 @@ class Module : public BnModule {
    virtual ndk::ScopedAStatus checkAudioPatchEndpointsMatch(
            const std::vector<::aidl::android::media::audio::common::AudioPortConfig*>& sources,
            const std::vector<::aidl::android::media::audio::common::AudioPortConfig*>& sinks);
    virtual void onExternalDeviceConnectionChanged(
            const ::aidl::android::media::audio::common::AudioPort& audioPort, bool connected);
    virtual ndk::ScopedAStatus onMasterMuteChanged(bool mute);
    virtual ndk::ScopedAStatus onMasterVolumeChanged(float volume);

    bool mMasterMute = false;
    float mMasterVolume = 1.0f;
};

}  // namespace aidl::android::hardware::audio::core
Loading