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

Commit 68f912b8 authored by Mikhail Naganov's avatar Mikhail Naganov Committed by Android (Google) Code Review
Browse files

Merge "Remove last references to hardware/audio.h"

parents bd0f59e4 9ee0540d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -33,9 +33,6 @@ class DeviceHalInterface : public RefBase
    // Sets the value of 'devices' to a bitmask of 1 or more values of audio_devices_t.
    virtual status_t getSupportedDevices(uint32_t *devices) = 0;

    // Get the hardware module version.
    virtual status_t getVersion(uint32_t *version) = 0;

    // Check to see if the audio hardware interface has been initialized.
    virtual status_t initCheck() = 0;

@@ -88,6 +85,9 @@ class DeviceHalInterface : public RefBase
            audio_source_t source,
            sp<StreamInHalInterface> *inStream) = 0;

    // Returns whether createAudioPatch and releaseAudioPatch operations are supported.
    virtual status_t supportsAudioPatches(bool *supportsPatches) = 0;

    // Creates an audio patch between several source and sink ports.
    virtual status_t createAudioPatch(
            unsigned int num_sources,
+20 −8
Original line number Diff line number Diff line
@@ -40,11 +40,6 @@ status_t DeviceHalLocal::getSupportedDevices(uint32_t *devices) {
    return OK;
}

status_t DeviceHalLocal::getVersion(uint32_t *version) {
    *version = mDev->common.version;
    return OK;
}

status_t DeviceHalLocal::initCheck() {
    return mDev->init_check(mDev);
}
@@ -139,17 +134,31 @@ status_t DeviceHalLocal::openInputStream(
    return openResult;
}

status_t DeviceHalLocal::supportsAudioPatches(bool *supportsPatches) {
    *supportsPatches = version() >= AUDIO_DEVICE_API_VERSION_3_0;
    return OK;
}

status_t DeviceHalLocal::createAudioPatch(
        unsigned int num_sources,
        const struct audio_port_config *sources,
        unsigned int num_sinks,
        const struct audio_port_config *sinks,
        audio_patch_handle_t *patch) {
    return mDev->create_audio_patch(mDev, num_sources, sources, num_sinks, sinks, patch);
    if (version() >= AUDIO_DEVICE_API_VERSION_3_0) {
        return mDev->create_audio_patch(
                mDev, num_sources, sources, num_sinks, sinks, patch);
    } else {
        return INVALID_OPERATION;
    }
}

status_t DeviceHalLocal::releaseAudioPatch(audio_patch_handle_t patch) {
    if (version() >= AUDIO_DEVICE_API_VERSION_3_0) {
        return mDev->release_audio_patch(mDev, patch);
    } else {
        return INVALID_OPERATION;
    }
}

status_t DeviceHalLocal::getAudioPort(struct audio_port *port) {
@@ -157,7 +166,10 @@ status_t DeviceHalLocal::getAudioPort(struct audio_port *port) {
}

status_t DeviceHalLocal::setAudioPortConfig(const struct audio_port_config *config) {
    if (version() >= AUDIO_DEVICE_API_VERSION_3_0)
        return mDev->set_audio_port_config(mDev, config);
    else
        return INVALID_OPERATION;
}

status_t DeviceHalLocal::dump(int fd) {
+5 −3
Original line number Diff line number Diff line
@@ -28,9 +28,6 @@ class DeviceHalLocal : public DeviceHalInterface
    // Sets the value of 'devices' to a bitmask of 1 or more values of audio_devices_t.
    virtual status_t getSupportedDevices(uint32_t *devices);

    // Get the hardware module version.
    virtual status_t getVersion(uint32_t *version);

    // Check to see if the audio hardware interface has been initialized.
    virtual status_t initCheck();

@@ -83,6 +80,9 @@ class DeviceHalLocal : public DeviceHalInterface
            audio_source_t source,
            sp<StreamInHalInterface> *inStream);

    // Returns whether createAudioPatch and releaseAudioPatch operations are supported.
    virtual status_t supportsAudioPatches(bool *supportsPatches);

    // Creates an audio patch between several source and sink ports.
    virtual status_t createAudioPatch(
            unsigned int num_sources,
@@ -115,6 +115,8 @@ class DeviceHalLocal : public DeviceHalInterface

    // The destructor automatically closes the device.
    virtual ~DeviceHalLocal();

    uint32_t version() const { return mDev->common.version; }
};

} // namespace android
+0 −2
Original line number Diff line number Diff line
@@ -67,8 +67,6 @@
#include <mediautils/BatteryNotifier.h>
#include <private/android_filesystem_config.h>

#include <hardware/audio.h>  // for AUDIO_HARDWARE_MODULE_...

// ----------------------------------------------------------------------------

// Note: the following macro is used for extremely verbose logging message.  In
+4 −4
Original line number Diff line number Diff line
@@ -93,10 +93,10 @@ status_t AudioHwDevice::openOutputStream(
    return status;
}

uint32_t AudioHwDevice::version() const
{
    uint32_t result;
    return mHwDevice->getVersion(&result) == OK ? result : 0;
bool AudioHwDevice::supportsAudioPatches() const {
    bool result;
    return mHwDevice->supportsAudioPatches(&result) == OK ? result : false;
}


}; // namespace android
Loading