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

Commit 7e0183fc authored by Ytai Ben-Tsvi's avatar Ytai Ben-Tsvi
Browse files

Remove explicit use of the "exiting" parameter from AudioFlinger

Pushed into libaudiohal to establish a cleaner abstraction and allow
for a strongly-typed interface in the future.

Test: Manual verification of basic audio use-cases
Change-Id: I1eb2bd2013f7129e65fe8a672ac4305f928cc9ef
parent f997ffea
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -931,6 +931,11 @@ void StreamOutHalHidl::onRecommendedLatencyModeChanged(
    callback->onRecommendedLatencyModeChanged(modes);
}

status_t StreamOutHalHidl::exit() {
    // FIXME this is using hard-coded strings but in the future, this functionality will be
    //       converted to use audio HAL extensions required to support tunneling
    return setParameters(String8("exiting=1"));
}

StreamInHalHidl::StreamInHalHidl(
        const sp<::android::hardware::audio::CPP_VERSION::IStreamIn>& stream)
+2 −0
Original line number Diff line number Diff line
@@ -202,6 +202,8 @@ class StreamOutHalHidl : public StreamOutHalInterface, public StreamHalHidl {

    void onRecommendedLatencyModeChanged(const std::vector<audio_latency_mode_t>& modes);

    status_t exit() override;

  private:
    friend class DeviceHalHidl;
    typedef MessageQueue<WriteCommand, hardware::kSynchronizedReadWrite> CommandMQ;
+5 −0
Original line number Diff line number Diff line
@@ -248,6 +248,11 @@ class StreamOutHalInterface : public virtual StreamHalInterface {
    virtual status_t setLatencyModeCallback(
            const sp<StreamOutHalInterfaceLatencyModeCallback>& callback) = 0;

    /**
     * Signal the end of audio output, interrupting an ongoing 'write' operation.
     */
    virtual status_t exit() = 0;

  protected:
    virtual ~StreamOutHalInterface() {}
};
+2 −4
Original line number Diff line number Diff line
@@ -2104,10 +2104,8 @@ void AudioFlinger::PlaybackThread::onFirstRef()
void AudioFlinger::PlaybackThread::preExit()
{
    ALOGV("  preExit()");
    // FIXME this is using hard-coded strings but in the future, this functionality will be
    //       converted to use audio HAL extensions required to support tunneling
    status_t result = mOutput->stream->setParameters(String8("exiting=1"));
    ALOGE_IF(result != OK, "Error when setting parameters on exit: %d", result);
    status_t result = mOutput->stream->exit();
    ALOGE_IF(result != OK, "Error when calling exit(): %d", result);
}

void AudioFlinger::PlaybackThread::dumpTracks_l(int fd, const Vector<String16>& args __unused)