Loading audio/2.0/default/PrimaryDevice.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #define LOG_TAG "PrimaryDeviceHAL" #include "PrimaryDevice.h" #include "Util.h" namespace android { namespace hardware { Loading Loading @@ -126,6 +127,10 @@ Return<void> PrimaryDevice::debugDump(const hidl_handle& fd) { // Methods from ::android::hardware::audio::V2_0::IPrimaryDevice follow. Return<Result> PrimaryDevice::setVoiceVolume(float volume) { if (!isGainNormalized(volume)) { ALOGW("Can not set a voice volume (%f) outside [0,1]", volume); return Result::INVALID_ARGUMENTS; } return mDevice->analyzeStatus( "set_voice_volume", mDevice->device()->set_voice_volume(mDevice->device(), volume)); Loading audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp +5 −9 Original line number Diff line number Diff line Loading @@ -1037,16 +1037,12 @@ static void testUnitaryGain(std::function<Return<Result>(float)> setGain) { for (float value : (float[]){-INFINITY, -1.0, 1.0 + std::numeric_limits<float>::epsilon(), 2.0, INFINITY, NAN}) { SCOPED_TRACE("value=" + to_string(value)); // FIXME: NAN should never be accepted // FIXME: Missing api doc. What should the impl do if the volume is // outside [0,1] ? ASSERT_RESULT(Result::INVALID_ARGUMENTS, setGain(value)); EXPECT_RESULT(Result::INVALID_ARGUMENTS, setGain(value)) << "value=" << value; } // Do not consider -0.0 as an invalid value as it is == with 0.0 for (float value : {-0.0, 0.0, 0.01, 0.5, 0.09, 1.0 /* Restore volume*/}) { SCOPED_TRACE("value=" + to_string(value)); ASSERT_OK(setGain(value)); EXPECT_OK(setGain(value)) << "value=" << value; } } Loading Loading @@ -1075,7 +1071,7 @@ static void testPrepareForReading(IStreamIn* stream, uint32_t frameSize, ASSERT_OK(stream->prepareForReading( frameSize, framesCount, [&res](auto r, auto&, auto&, auto&, auto&) { res = r; })); EXPECT_RESULT(invalidArgsOrNotSupported, res); EXPECT_RESULT(Result::INVALID_ARGUMENTS, res); } TEST_P(InputStreamTest, PrepareForReadingWithZeroBuffer) { Loading Loading @@ -1143,7 +1139,7 @@ static void testPrepareForWriting(IStreamOut* stream, uint32_t frameSize, ASSERT_OK(stream->prepareForWriting( frameSize, framesCount, [&res](auto r, auto&, auto&, auto&, auto&) { res = r; })); EXPECT_RESULT(invalidArgsOrNotSupported, res); EXPECT_RESULT(Result::INVALID_ARGUMENTS, res); } TEST_P(OutputStreamTest, PrepareForWriteWithZeroBuffer) { Loading Loading
audio/2.0/default/PrimaryDevice.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #define LOG_TAG "PrimaryDeviceHAL" #include "PrimaryDevice.h" #include "Util.h" namespace android { namespace hardware { Loading Loading @@ -126,6 +127,10 @@ Return<void> PrimaryDevice::debugDump(const hidl_handle& fd) { // Methods from ::android::hardware::audio::V2_0::IPrimaryDevice follow. Return<Result> PrimaryDevice::setVoiceVolume(float volume) { if (!isGainNormalized(volume)) { ALOGW("Can not set a voice volume (%f) outside [0,1]", volume); return Result::INVALID_ARGUMENTS; } return mDevice->analyzeStatus( "set_voice_volume", mDevice->device()->set_voice_volume(mDevice->device(), volume)); Loading
audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp +5 −9 Original line number Diff line number Diff line Loading @@ -1037,16 +1037,12 @@ static void testUnitaryGain(std::function<Return<Result>(float)> setGain) { for (float value : (float[]){-INFINITY, -1.0, 1.0 + std::numeric_limits<float>::epsilon(), 2.0, INFINITY, NAN}) { SCOPED_TRACE("value=" + to_string(value)); // FIXME: NAN should never be accepted // FIXME: Missing api doc. What should the impl do if the volume is // outside [0,1] ? ASSERT_RESULT(Result::INVALID_ARGUMENTS, setGain(value)); EXPECT_RESULT(Result::INVALID_ARGUMENTS, setGain(value)) << "value=" << value; } // Do not consider -0.0 as an invalid value as it is == with 0.0 for (float value : {-0.0, 0.0, 0.01, 0.5, 0.09, 1.0 /* Restore volume*/}) { SCOPED_TRACE("value=" + to_string(value)); ASSERT_OK(setGain(value)); EXPECT_OK(setGain(value)) << "value=" << value; } } Loading Loading @@ -1075,7 +1071,7 @@ static void testPrepareForReading(IStreamIn* stream, uint32_t frameSize, ASSERT_OK(stream->prepareForReading( frameSize, framesCount, [&res](auto r, auto&, auto&, auto&, auto&) { res = r; })); EXPECT_RESULT(invalidArgsOrNotSupported, res); EXPECT_RESULT(Result::INVALID_ARGUMENTS, res); } TEST_P(InputStreamTest, PrepareForReadingWithZeroBuffer) { Loading Loading @@ -1143,7 +1139,7 @@ static void testPrepareForWriting(IStreamOut* stream, uint32_t frameSize, ASSERT_OK(stream->prepareForWriting( frameSize, framesCount, [&res](auto r, auto&, auto&, auto&, auto&) { res = r; })); EXPECT_RESULT(invalidArgsOrNotSupported, res); EXPECT_RESULT(Result::INVALID_ARGUMENTS, res); } TEST_P(OutputStreamTest, PrepareForWriteWithZeroBuffer) { Loading