diff options
author | Mikhail Naganov <mnaganov@google.com> | 2019-11-14 13:57:15 -0800 |
---|---|---|
committer | Mikhail Naganov <mnaganov@google.com> | 2019-11-18 11:39:26 -0800 |
commit | 7623ed9258081a20a530e6b052121966e1f1f55e (patch) | |
tree | 75249a48dcadb192eb8045b6af0e0ffca506c694 /audio/core/all-versions/default/PrimaryDevice.cpp | |
parent | 81c40d7f81340f0ff9bed49006b89f0d9dd8a9f3 (diff) |
Audio V6 wrapper: IDevice|IStream|IEffect.close releases HAL resource
Fixed behavior of IStream|IEffect.close to release the underlying
HAL resource synchronously. This is to avoid adding artificial
delays in VTS that become totally unpractical in V6.
Added clarification about expected client behavior for
IStream|IEffect.close w.r.t. audio data transfer.
Added IDevice.close method which releases HAL device resource.
Updated VTS tests to remove delays in V6.
Bug: 114451103
Bug: 141989952
Test: atest VtsHalAudioV6_0TargetTest
Change-Id: I439f0f923c091af2ab234d15ca847cfade341f25
Diffstat (limited to 'audio/core/all-versions/default/PrimaryDevice.cpp')
-rw-r--r-- | audio/core/all-versions/default/PrimaryDevice.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/audio/core/all-versions/default/PrimaryDevice.cpp b/audio/core/all-versions/default/PrimaryDevice.cpp index 99590b0bdc..3cf09320aa 100644 --- a/audio/core/all-versions/default/PrimaryDevice.cpp +++ b/audio/core/all-versions/default/PrimaryDevice.cpp @@ -31,7 +31,11 @@ namespace implementation { PrimaryDevice::PrimaryDevice(audio_hw_device_t* device) : mDevice(new Device(device)) {} -PrimaryDevice::~PrimaryDevice() {} +PrimaryDevice::~PrimaryDevice() { + // Do not call mDevice->close here. If there are any unclosed streams, + // they only hold IDevice instance, not IPrimaryDevice, thus IPrimaryDevice + // "part" of a device can be destroyed before the streams. +} // Methods from ::android::hardware::audio::CPP_VERSION::IDevice follow. Return<Result> PrimaryDevice::initCheck() { @@ -160,6 +164,11 @@ Return<Result> PrimaryDevice::setConnectedState(const DeviceAddress& address, bo return mDevice->setConnectedState(address, connected); } #endif +#if MAJOR_VERSION >= 6 +Return<Result> PrimaryDevice::close() { + return mDevice->close(); +} +#endif // Methods from ::android::hardware::audio::CPP_VERSION::IPrimaryDevice follow. Return<Result> PrimaryDevice::setVoiceVolume(float volume) { |