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

Commit 3acaa668 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

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
parent be31e7c5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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<
+4 −18
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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;