Remove USE_LEGACY_LOCAL_AUDIO_HAL in libsoundtriggerservice
This had been removed from libaudiohal last year in
9e79c70529c07f2157f8077f024f42fa5c9e22f9
Test: treehugger
Change-Id: I8feb2eb88f8f0ba76b3417cf6f724cd6aa55bd0e
diff --git a/services/soundtrigger/Android.mk b/services/soundtrigger/Android.mk
index 65f1a44..0f09393 100644
--- a/services/soundtrigger/Android.mk
+++ b/services/soundtrigger/Android.mk
@@ -16,13 +16,6 @@
include $(CLEAR_VARS)
-ifeq ($(SOUND_TRIGGER_USE_STUB_MODULE), 1)
- ifneq ($(USE_LEGACY_LOCAL_AUDIO_HAL), true)
- $(error Requires building with USE_LEGACY_LOCAL_AUDIO_HAL=true)
- endif
- LOCAL_CFLAGS += -DSOUND_TRIGGER_USE_STUB_MODULE
-endif
-
LOCAL_SRC_FILES:= \
SoundTriggerHwService.cpp
@@ -36,11 +29,6 @@
libaudioclient \
libmediautils \
-ifeq ($(USE_LEGACY_LOCAL_AUDIO_HAL),true)
-# libhardware configuration
-LOCAL_SRC_FILES += \
- SoundTriggerHalLegacy.cpp
-else
# Treble configuration
LOCAL_SRC_FILES += \
SoundTriggerHalHidl.cpp
@@ -59,7 +47,6 @@
android.hardware.audio.common@2.0 \
android.hidl.allocator@1.0 \
android.hidl.memory@1.0
-endif
LOCAL_C_INCLUDES += \
diff --git a/services/soundtrigger/SoundTriggerHalLegacy.cpp b/services/soundtrigger/SoundTriggerHalLegacy.cpp
deleted file mode 100644
index 2b78818..0000000
--- a/services/soundtrigger/SoundTriggerHalLegacy.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <utils/Log.h>
-#include "SoundTriggerHalLegacy.h"
-
-namespace android {
-
-/* static */
-sp<SoundTriggerHalInterface> SoundTriggerHalInterface::connectModule(const char *moduleName)
-{
- return new SoundTriggerHalLegacy(moduleName);
-}
-
-SoundTriggerHalLegacy::SoundTriggerHalLegacy(const char *moduleName)
- : mModuleName(moduleName), mHwDevice(NULL)
-{
-}
-
-void SoundTriggerHalLegacy::onFirstRef()
-{
- const hw_module_t *mod;
- int rc;
-
- if (mModuleName == NULL) {
- 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)",
- SOUND_TRIGGER_HARDWARE_MODULE_ID, mModuleName, strerror(-rc));
- return;
- }
- rc = sound_trigger_hw_device_open(mod, &mHwDevice);
- if (rc != 0) {
- ALOGE("couldn't open sound trigger hw device in %s.%s (%s)",
- SOUND_TRIGGER_HARDWARE_MODULE_ID, mModuleName, strerror(-rc));
- mHwDevice = NULL;
- return;
- }
- if (mHwDevice->common.version < SOUND_TRIGGER_DEVICE_API_VERSION_1_0 ||
- mHwDevice->common.version > SOUND_TRIGGER_DEVICE_API_VERSION_CURRENT) {
- ALOGE("wrong sound trigger hw device version %04x", mHwDevice->common.version);
- return;
- }
-}
-
-SoundTriggerHalLegacy::~SoundTriggerHalLegacy()
-{
- if (mHwDevice != NULL) {
- sound_trigger_hw_device_close(mHwDevice);
- }
-}
-
-int SoundTriggerHalLegacy::getProperties(struct sound_trigger_properties *properties)
-{
- if (mHwDevice == NULL) {
- return -ENODEV;
- }
- return mHwDevice->get_properties(mHwDevice, properties);
-}
-
-int SoundTriggerHalLegacy::loadSoundModel(struct sound_trigger_sound_model *sound_model,
- sound_model_callback_t callback,
- void *cookie,
- sound_model_handle_t *handle)
-{
- if (mHwDevice == NULL) {
- return -ENODEV;
- }
- return mHwDevice->load_sound_model(mHwDevice, sound_model, callback, cookie, handle);
-}
-
-int SoundTriggerHalLegacy::unloadSoundModel(sound_model_handle_t handle)
-{
- if (mHwDevice == NULL) {
- return -ENODEV;
- }
- return mHwDevice->unload_sound_model(mHwDevice, handle);
-}
-
-int SoundTriggerHalLegacy::startRecognition(sound_model_handle_t handle,
- const struct sound_trigger_recognition_config *config,
- recognition_callback_t callback,
- void *cookie)
-{
- if (mHwDevice == NULL) {
- return -ENODEV;
- }
- return mHwDevice->start_recognition(mHwDevice, handle, config, callback, cookie);
-}
-
-int SoundTriggerHalLegacy::stopRecognition(sound_model_handle_t handle)
-{
- if (mHwDevice == NULL) {
- return -ENODEV;
- }
- return mHwDevice->stop_recognition(mHwDevice, handle);
-}
-
-int SoundTriggerHalLegacy::stopAllRecognitions()
-{
- if (mHwDevice == NULL) {
- return -ENODEV;
- }
- if (mHwDevice->common.version >= SOUND_TRIGGER_DEVICE_API_VERSION_1_1 &&
- mHwDevice->stop_all_recognitions) {
- return mHwDevice->stop_all_recognitions(mHwDevice);
- }
- return -ENOSYS;
-}
-
-} // namespace android
diff --git a/services/soundtrigger/SoundTriggerHalLegacy.h b/services/soundtrigger/SoundTriggerHalLegacy.h
deleted file mode 100644
index 52488de..0000000
--- a/services/soundtrigger/SoundTriggerHalLegacy.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_SOUNDTRIGGER_HAL_LEGACY_H
-#define ANDROID_HARDWARE_SOUNDTRIGGER_HAL_LEGACY_H
-
-#include "SoundTriggerHalInterface.h"
-
-namespace android {
-
-class SoundTriggerHalLegacy : public SoundTriggerHalInterface
-
-{
-public:
- virtual ~SoundTriggerHalLegacy();
-
- virtual int getProperties(struct sound_trigger_properties *properties);
-
- /*
- * Load a sound model. Once loaded, recognition of this model can be started and stopped.
- * Only one active recognition per model at a time. The SoundTrigger service will handle
- * concurrent recognition requests by different users/applications on the same model.
- * The implementation returns a unique handle used by other functions (unload_sound_model(),
- * start_recognition(), etc...
- */
- virtual int loadSoundModel(struct sound_trigger_sound_model *sound_model,
- sound_model_callback_t callback,
- void *cookie,
- sound_model_handle_t *handle);
-
- /*
- * Unload a sound model. A sound model can be unloaded to make room for a new one to overcome
- * implementation limitations.
- */
- virtual int unloadSoundModel(sound_model_handle_t handle);
-
- /* Start recognition on a given model. Only one recognition active at a time per model.
- * Once recognition succeeds of fails, the callback is called.
- * TODO: group recognition configuration parameters into one struct and add key phrase options.
- */
- virtual int startRecognition(sound_model_handle_t handle,
- const struct sound_trigger_recognition_config *config,
- recognition_callback_t callback,
- void *cookie);
-
- /* Stop recognition on a given model.
- * The implementation does not have to call the callback when stopped via this method.
- */
- virtual int stopRecognition(sound_model_handle_t handle);
-
- /* Stop recognition on all models.
- * Only supported for device api versions SOUND_TRIGGER_DEVICE_API_VERSION_1_1 or above.
- * If no implementation is provided, stop_recognition will be called for each running model.
- */
- int stopAllRecognitions();
-
- // RefBase
- virtual void onFirstRef();
-
-private:
-
- friend class SoundTriggerHalInterface;
-
- explicit SoundTriggerHalLegacy(const char *moduleName = NULL);
-
- const char *mModuleName;
- struct sound_trigger_hw_device* mHwDevice;
-};
-
-} // namespace android
-
-#endif // ANDROID_HARDWARE_SOUNDTRIGGER_HAL_LEGACY_H
diff --git a/services/soundtrigger/SoundTriggerHwService.cpp b/services/soundtrigger/SoundTriggerHwService.cpp
index 7915068..944abcc 100644
--- a/services/soundtrigger/SoundTriggerHwService.cpp
+++ b/services/soundtrigger/SoundTriggerHwService.cpp
@@ -36,11 +36,7 @@
#include <system/sound_trigger.h>
#include "SoundTriggerHwService.h"
-#ifdef SOUND_TRIGGER_USE_STUB_MODULE
-#define HW_MODULE_PREFIX "stub"
-#else
#define HW_MODULE_PREFIX "primary"
-#endif
namespace android {
SoundTriggerHwService::SoundTriggerHwService()