soundtrigger: Use "default" instance name for HAL service

"default" implies using "primary" legacy device module.
This doesn't change anything for binderized mode, because
the server was only registering itself as "sound_trigger.primary",
so it was the only possibility anyways.

Usage of "stub" (debugging) module is still possible
if audioflinger and corresponding services are built with
USE_LEGACY_LOCAL_AUDIO_HAL=true (added makefile check to ensure
that).

Test: "Ok Google" from screen off state on sailfish
Bug: 36570720
Change-Id: I88f1ebd4c1efd0f91e37458746c336a4beef33ae
This commit is contained in:
Mikhail Naganov
2017-04-13 11:00:11 -07:00
parent be31e7c571
commit 3acaa668c1
3 changed files with 6 additions and 20 deletions

View File

@@ -50,7 +50,7 @@ int main(int /* argc */, char* /* argv */ []) {
status = registerPassthroughServiceImplementation<IEffectsFactory>();
LOG_ALWAYS_FATAL_IF(status != OK, "Error while registering audio effects service: %d", status);
// Soundtrigger and FM radio might be not present.
status = registerPassthroughServiceImplementation<ISoundTriggerHw>("sound_trigger.primary");
status = registerPassthroughServiceImplementation<ISoundTriggerHw>();
ALOGE_IF(status != OK, "Error while registering soundtrigger service: %d", status);
if (useBroadcastRadioFutureFeatures) {
status = registerPassthroughServiceImplementation<

View File

@@ -294,8 +294,8 @@ exit:
return ret;
}
SoundTriggerHalImpl::SoundTriggerHalImpl(const char *moduleName)
: mModuleName(moduleName), mHwDevice(NULL), mNextModelId(1)
SoundTriggerHalImpl::SoundTriggerHalImpl()
: mModuleName("primary"), mHwDevice(NULL), mNextModelId(1)
{
}
@@ -304,9 +304,6 @@ void SoundTriggerHalImpl::onFirstRef()
const hw_module_t *mod;
int rc;
if (mModuleName == NULL || strlen(mModuleName) == 0) {
mModuleName = "primary";
}
rc = hw_get_module_by_class(SOUND_TRIGGER_HARDWARE_MODULE_ID, mModuleName, &mod);
if (rc != 0) {
ALOGE("couldn't load sound trigger module %s.%s (%s)",
@@ -570,20 +567,9 @@ void SoundTriggerHalImpl::convertPhraseRecognitionExtraFromHal(
delete[] levels;
}
ISoundTriggerHw *HIDL_FETCH_ISoundTriggerHw(const char *name)
ISoundTriggerHw *HIDL_FETCH_ISoundTriggerHw(const char* /* name */)
{
if (name != NULL) {
if (strncmp(SOUND_TRIGGER_HARDWARE_MODULE_ID, name,
strlen(SOUND_TRIGGER_HARDWARE_MODULE_ID)) != 0) {
return NULL;
}
name = strchr(name, '.');
if (name == NULL) {
return NULL;
}
name++;
}
return new SoundTriggerHalImpl(name);
return new SoundTriggerHalImpl();
}
} // namespace implementation
} // namespace V2_0

View File

@@ -38,7 +38,7 @@ using ::android::hardware::soundtrigger::V2_0::ISoundTriggerHwCallback;
class SoundTriggerHalImpl : public ISoundTriggerHw {
public:
explicit SoundTriggerHalImpl(const char *moduleName = NULL);
SoundTriggerHalImpl();
// Methods from ::android::hardware::soundtrigger::V2_0::ISoundTriggerHw follow.
Return<void> getProperties(getProperties_cb _hidl_cb) override;