Merge "soundtrigger: Remove get/setParameters interface methods"

This commit is contained in:
Mikhail Naganov
2018-01-23 16:59:50 +00:00
committed by Android (Google) Code Review
3 changed files with 2 additions and 168 deletions

View File

@@ -92,7 +92,7 @@ interface ISoundTriggerHw extends @2.0::ISoundTriggerHw {
* @return modelHandle A unique handle assigned by the HAL for use by the
* framework when controlling activity for this sound model.
*/
@callflow(next={"startRecognition_2_1", "setSoundModelParameters", "unloadSoundModel"})
@callflow(next={"startRecognition_2_1", "unloadSoundModel"})
loadSoundModel_2_1(SoundModel soundModel,
ISoundTriggerHwCallback callback,
CallbackCookie cookie)
@@ -126,7 +126,7 @@ interface ISoundTriggerHw extends @2.0::ISoundTriggerHw {
* @return modelHandle A unique handle assigned by the HAL for use by the
* framework when controlling activity for this sound model.
*/
@callflow(next={"startRecognition_2_1", "setSoundModelParameters", "unloadSoundModel"})
@callflow(next={"startRecognition_2_1", "unloadSoundModel"})
loadPhraseSoundModel_2_1(PhraseSoundModel soundModel,
ISoundTriggerHwCallback callback,
CallbackCookie cookie)
@@ -161,74 +161,4 @@ interface ISoundTriggerHw extends @2.0::ISoundTriggerHw {
ISoundTriggerHwCallback callback,
CallbackCookie cookie)
generates (int32_t retval);
struct ParameterValue {
string key;
string value;
};
/**
* Generic method for retrieving vendor-specific parameter values.
* The framework does not interpret the parameters, they are passed
* in an opaque manner between a vendor application and HAL.
*
* @param keys parameter keys.
* @return retval Operation completion status: 0 in case of success,
* -EINVAL in case of invalid keys,
* -ENOSYS in case if this operation is not supported,
* -ENOMEM in case of memory allocation failure,
* -ENODEV in case of initialization error.
* @return parameters parameter key value pairs.
*/
getParameters(vec<string> keys)
generates (int32_t retval, vec<ParameterValue> parameters);
/**
* Generic method for setting vendor-specific parameter values.
* The framework does not interpret the parameters, they are passed
* in an opaque manner between a vendor application and HAL.
*
* @param parameters parameter key value pairs.
* @return retval Operation completion status: 0 in case of success,
* -EINVAL in case of invalid keys,
* -ENOSYS in case if this operation is not supported,
* -ENOMEM in case of memory allocation failure,
* -ENODEV in case of initialization error.
*/
setParameters(vec<ParameterValue> parameters) generates (int32_t retval);
/**
* Generic method for retrieving vendor-specific parameter values.
* The framework does not interpret the parameters, they are passed
* in an opaque manner between a vendor application and HAL.
*
* @param modelHandle the handle of the sound model to get parameters about.
* @param keys parameter keys.
* @return retval Operation completion status: 0 in case of success,
* -EINVAL in case of invalid keys,
* -ENOSYS in case if this operation is not supported,
* -ENOMEM in case of memory allocation failure,
* -ENODEV in case of initialization error.
* @return parameters parameter key value pairs.
*/
getSoundModelParameters(SoundModelHandle modelHandle, vec<string> keys)
generates (int32_t retval, vec<ParameterValue> parameters);
/**
* Generic method for setting vendor-specific parameter values.
* The framework does not interpret the parameters, they are passed
* in an opaque manner between a vendor application and HAL.
*
* @param modelHandle the handle of the sound model to set parameters for.
* @param parameters parameter key value pairs.
* @return retval Operation completion status: 0 in case of success,
* -EINVAL in case of invalid keys,
* -ENOSYS in case if this operation is not supported,
* -ENOMEM in case of memory allocation failure,
* -ENODEV in case of initialization error.
*/
setSoundModelParameters(
SoundModelHandle modelHandle, vec<ParameterValue> parameters)
generates (int32_t retval);
};

View File

@@ -102,26 +102,6 @@ struct SoundTriggerHw : public V2_0::implementation::SoundTriggerHalImpl {
int32_t /*cookie*/) override {
return mImpl->startRecognition_2_1(modelHandle, config);
}
Return<void> getParameters(const hidl_vec<hidl_string>& /*keys*/,
getParameters_cb _hidl_cb) override {
_hidl_cb(-ENOSYS, hidl_vec<ParameterValue>());
return Void();
}
Return<int32_t> setParameters(
const hidl_vec<V2_1::ISoundTriggerHw::ParameterValue>& /*parameters*/) override {
return -ENOSYS;
}
Return<void> getSoundModelParameters(int32_t /*modelHandle*/,
const hidl_vec<hidl_string>& /*keys*/,
getSoundModelParameters_cb _hidl_cb) override {
_hidl_cb(-ENOSYS, hidl_vec<ParameterValue>());
return Void();
}
Return<int32_t> setSoundModelParameters(
int32_t /*modelHandle*/,
const hidl_vec<V2_1::ISoundTriggerHw::ParameterValue>& /*parameters*/) override {
return -ENOSYS;
}
private:
sp<SoundTriggerHw> mImpl;

View File

@@ -51,7 +51,6 @@ using V2_0_ISoundTriggerHw = ::android::hardware::soundtrigger::V2_0::ISoundTrig
using V2_0_ISoundTriggerHwCallback =
::android::hardware::soundtrigger::V2_0::ISoundTriggerHwCallback;
using ::android::hardware::soundtrigger::V2_1::ISoundTriggerHw;
using ParameterValue = ::android::hardware::soundtrigger::V2_1::ISoundTriggerHw::ParameterValue;
using ::android::hardware::soundtrigger::V2_1::ISoundTriggerHwCallback;
using ::android::hidl::allocator::V1_0::IAllocator;
using ::android::hidl::memory::V1_0::IMemory;
@@ -481,78 +480,3 @@ TEST_F(SoundTriggerHidlTest, stopAllRecognitions) {
EXPECT_TRUE(hidlReturn.isOk());
EXPECT_TRUE(hidlReturn == 0 || hidlReturn == -ENOSYS);
}
/**
* Test ISoundTriggerHw::getParameters() and setParameters() methods
*
* Verifies that:
* - the implementation implements these optional methods or indicates it is not supported by
* returning -ENOSYS
*/
TEST_F(SoundTriggerHidlTest, getAndSetParameters) {
hidl_vec<hidl_string> keys;
hidl_vec<ParameterValue> values;
int32_t ret = -ENODEV;
Return<void> hidlReturn =
mSoundTriggerHal->getParameters(keys, [&](int32_t retval, auto params) {
ret = retval;
values = params;
});
EXPECT_TRUE(hidlReturn.isOk());
EXPECT_TRUE(ret == 0 || ret == -ENOSYS);
if (ret == 0) {
Return<int32_t> hidlReturn = mSoundTriggerHal->setParameters(values);
EXPECT_TRUE(hidlReturn.isOk());
EXPECT_EQ(0, hidlReturn);
}
}
/**
* Test ISoundTriggerHw::setParameters() method
*
* Verifies that:
* - the implementation accepts empty parameters to be set or indicates it is not supported by
* returning -ENOSYS
*/
TEST_F(SoundTriggerHidlTest, setParameters) {
hidl_vec<ParameterValue> values;
Return<int32_t> hidlReturn = mSoundTriggerHal->setParameters(values);
EXPECT_TRUE(hidlReturn.isOk());
EXPECT_TRUE(hidlReturn == 0 || hidlReturn == -ENOSYS);
}
/**
* Test ISoundTriggerHw::getSoundModelParameters() and setSoundModelParameters() methods
*
* Verifies that:
* - the implementation implements these optional methods or indicates it is not supported by
* returning -ENOSYS;
* - if the methods are supported, the implementation returns an error when called without
* an active recognition running.
*
*/
TEST_F(SoundTriggerHidlTest, getAndSetSoundModelParameters) {
SoundModelHandle handle = 0;
hidl_vec<hidl_string> keys;
hidl_vec<ParameterValue> values;
{
int32_t ret = 0;
Return<void> hidlReturn = mSoundTriggerHal->getSoundModelParameters(
handle, keys, [&](int32_t retval, auto params) {
ret = retval;
values = params;
});
EXPECT_TRUE(hidlReturn.isOk());
EXPECT_NE(0, ret);
EXPECT_EQ(0u, values.size());
}
values.resize(0);
{
Return<int32_t> hidlReturn = mSoundTriggerHal->setSoundModelParameters(handle, values);
EXPECT_TRUE(hidlReturn.isOk());
EXPECT_NE(0, hidlReturn);
}
}