Merge "omx: Removed dead files." into oc-dev
diff --git a/media/libaaudio/include/aaudio/AAudio.h b/media/libaaudio/include/aaudio/AAudio.h
index bc65acc..d0c7c22 100644
--- a/media/libaaudio/include/aaudio/AAudio.h
+++ b/media/libaaudio/include/aaudio/AAudio.h
@@ -344,7 +344,7 @@
* AAudioStream_requestStop() is called.
*
* This callback function will be called on a real-time thread owned by AAudio. See
- * {@link aaudio_data_callback_proc_t} for more information.
+ * {@link AAudioStream_dataCallback} for more information.
*
* Note that the AAudio callbacks will never be called simultaneously from multiple threads.
*
@@ -506,7 +506,6 @@
* set to AAUDIO_STREAM_STATE_UNKNOWN and a zero timeout.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
- * @param state pointer to a variable that will be set to the current state
*/
AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream);
diff --git a/media/libaudiohal/Android.mk b/media/libaudiohal/Android.mk
index 032b3e9..68a1f7b 100644
--- a/media/libaudiohal/Android.mk
+++ b/media/libaudiohal/Android.mk
@@ -4,8 +4,6 @@
LOCAL_SHARED_LIBRARIES := \
libcutils \
- libeffects \
- libhardware \
liblog \
libutils
@@ -22,6 +20,10 @@
EffectsFactoryHalLocal.cpp \
StreamHalLocal.cpp
+LOCAL_SHARED_LIBRARIES += \
+ libeffects \
+ libhardware
+
else # if !USE_LEGACY_LOCAL_AUDIO_HAL
LOCAL_SRC_FILES := \
diff --git a/media/libaudiohal/EffectsFactoryHalHidl.cpp b/media/libaudiohal/EffectsFactoryHalHidl.cpp
index 605c059..a8081b7 100644
--- a/media/libaudiohal/EffectsFactoryHalHidl.cpp
+++ b/media/libaudiohal/EffectsFactoryHalHidl.cpp
@@ -18,7 +18,6 @@
//#define LOG_NDEBUG 0
#include <cutils/native_handle.h>
-#include <media/EffectsFactoryApi.h>
#include "ConversionHelperHidl.h"
#include "EffectHalHidl.h"
@@ -39,7 +38,7 @@
// static
bool EffectsFactoryHalInterface::isNullUuid(const effect_uuid_t *pEffectUuid) {
- return EffectIsNullUuid(pEffectUuid);
+ return memcmp(pEffectUuid, EFFECT_UUID_NULL, sizeof(effect_uuid_t)) == 0;
}
EffectsFactoryHalHidl::EffectsFactoryHalHidl() : ConversionHelperHidl("EffectsFactory") {
diff --git a/media/libmedia/Android.bp b/media/libmedia/Android.bp
index 4b14543..772555d 100644
--- a/media/libmedia/Android.bp
+++ b/media/libmedia/Android.bp
@@ -1,3 +1,9 @@
+cc_library_headers {
+ name: "libmedia_headers",
+ vendor_available: true,
+ export_include_dirs: ["include"],
+}
+
cc_library {
name: "libmedia_helper",
srcs: ["AudioParameter.cpp", "TypeConverter.cpp"],
diff --git a/media/mtp/MtpFfsHandle.cpp b/media/mtp/MtpFfsHandle.cpp
index 565a2fe..c78002c 100644
--- a/media/mtp/MtpFfsHandle.cpp
+++ b/media/mtp/MtpFfsHandle.cpp
@@ -520,7 +520,16 @@
// When receiving files, the incoming length is given in 32 bits.
// A >4G file is given as 0xFFFFFFFF
uint32_t file_length = mfr.length;
- uint64_t offset = lseek(mfr.fd, 0, SEEK_CUR);
+ uint64_t offset = mfr.offset;
+ struct usb_endpoint_descriptor mBulkOut_desc;
+ int packet_size;
+
+ if (ioctl(mBulkOut, FUNCTIONFS_ENDPOINT_DESC, reinterpret_cast<unsigned long>(&mBulkOut_desc))) {
+ PLOG(ERROR) << "Could not get FFS bulk-out descriptor";
+ packet_size = MAX_PACKET_SIZE_HS;
+ } else {
+ packet_size = mBulkOut_desc.wMaxPacketSize;
+ }
char *data = mBuffer1.data();
char *data2 = mBuffer2.data();
@@ -573,21 +582,26 @@
}
if (read) {
- // Enqueue a new write request
- aio.aio_buf = data;
- aio.aio_sink = mfr.fd;
- aio.aio_offset = offset;
- aio.aio_nbytes = ret;
- aio_write(&aio);
-
if (file_length == MAX_MTP_FILE_SIZE) {
// For larger files, receive until a short packet is received.
if (static_cast<size_t>(ret) < length) {
file_length = 0;
}
} else {
+ // Receive an empty packet if size is a multiple of the endpoint size.
file_length -= ret;
+ if (file_length == 0 && ret % packet_size == 0) {
+ if (TEMP_FAILURE_RETRY(::read(mBulkOut, data, packet_size)) != 0) {
+ return -1;
+ }
+ }
}
+ // Enqueue a new write request
+ aio.aio_buf = data;
+ aio.aio_sink = mfr.fd;
+ aio.aio_offset = offset;
+ aio.aio_nbytes = ret;
+ aio_write(&aio);
offset += ret;
std::swap(data, data2);
@@ -695,9 +709,11 @@
}
}
- if (given_length == MAX_MTP_FILE_SIZE && ret % packet_size == 0) {
+ if (ret % packet_size == 0) {
// If the last packet wasn't short, send a final empty packet
- if (writeHandle(mBulkIn, data, 0) == -1) return -1;
+ if (TEMP_FAILURE_RETRY(::write(mBulkIn, data, 0)) != 0) {
+ return -1;
+ }
}
return 0;
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index ce6354d..8f3a61f 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -1040,13 +1040,7 @@
outputDesc->mStopTime[stream] = 0;
outputDesc->mDirectOpenCount = 1;
outputDesc->mDirectClientUid = clientUid;
-
- audio_io_handle_t srcOutput = getOutputForEffect();
addOutput(output, outputDesc);
- audio_io_handle_t dstOutput = getOutputForEffect();
- if (dstOutput == output) {
- mpClientInterface->moveEffects(AUDIO_SESSION_OUTPUT_MIX, srcOutput, dstOutput);
- }
mPreviousOutputs = mOutputs;
ALOGV("getOutput() returns new direct output %d", output);
mpClientInterface->onAudioPortListUpdate();
@@ -1254,11 +1248,16 @@
// necessary for a correct control of hardware output routing by startOutput() and stopOutput()
outputDesc->changeRefCount(stream, 1);
+ if (stream == AUDIO_STREAM_MUSIC) {
+ selectOutputForMusicEffects();
+ }
+
if (outputDesc->mRefCount[stream] == 1 || device != AUDIO_DEVICE_NONE) {
// starting an output being rerouted?
if (device == AUDIO_DEVICE_NONE) {
device = getNewOutputDevice(outputDesc, false /*fromCache*/);
}
+
routing_strategy strategy = getStrategy(stream);
bool shouldWait = (strategy == STRATEGY_SONIFICATION) ||
(strategy == STRATEGY_SONIFICATION_RESPECTFUL) ||
@@ -1411,6 +1410,9 @@
// update the outputs if stopping one with a stream that can affect notification routing
handleNotificationRoutingForStream(stream);
}
+ if (stream == AUDIO_STREAM_MUSIC) {
+ selectOutputForMusicEffects();
+ }
return NO_ERROR;
} else {
ALOGW("stopOutput() refcount is already 0");
@@ -1454,13 +1456,6 @@
}
if (--desc->mDirectOpenCount == 0) {
closeOutput(output);
- // If effects where present on the output, audioflinger moved them to the primary
- // output by default: move them back to the appropriate output.
- audio_io_handle_t dstOutput = getOutputForEffect();
- if (hasPrimaryOutput() && dstOutput != mPrimaryOutput->mIoHandle) {
- mpClientInterface->moveEffects(AUDIO_SESSION_OUTPUT_MIX,
- mPrimaryOutput->mIoHandle, dstOutput);
- }
mpClientInterface->onAudioPortListUpdate();
}
}
@@ -2116,8 +2111,7 @@
return NO_ERROR;
}
-audio_io_handle_t AudioPolicyManager::selectOutputForEffects(
- const SortedVector<audio_io_handle_t>& outputs)
+audio_io_handle_t AudioPolicyManager::selectOutputForMusicEffects()
{
// select one output among several suitable for global effects.
// The priority is as follows:
@@ -2125,53 +2119,68 @@
// AudioFlinger will invalidate the track and the offloaded output
// will be closed causing the effect to be moved to a PCM output.
// 2: A deep buffer output
- // 3: the first output in the list
-
- if (outputs.size() == 0) {
- return 0;
- }
-
- audio_io_handle_t outputOffloaded = 0;
- audio_io_handle_t outputDeepBuffer = 0;
-
- for (size_t i = 0; i < outputs.size(); i++) {
- sp<SwAudioOutputDescriptor> desc = mOutputs.valueFor(outputs[i]);
- ALOGV("selectOutputForEffects outputs[%zu] flags %x", i, desc->mFlags);
- if ((desc->mFlags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) != 0) {
- outputOffloaded = outputs[i];
- }
- if ((desc->mFlags & AUDIO_OUTPUT_FLAG_DEEP_BUFFER) != 0) {
- outputDeepBuffer = outputs[i];
- }
- }
-
- ALOGV("selectOutputForEffects outputOffloaded %d outputDeepBuffer %d",
- outputOffloaded, outputDeepBuffer);
- if (outputOffloaded != 0) {
- return outputOffloaded;
- }
- if (outputDeepBuffer != 0) {
- return outputDeepBuffer;
- }
-
- return outputs[0];
-}
-
-audio_io_handle_t AudioPolicyManager::getOutputForEffect(const effect_descriptor_t *desc)
-{
- // apply simple rule where global effects are attached to the same output as MUSIC streams
+ // 3: The primary output
+ // 4: the first output in the list
routing_strategy strategy = getStrategy(AUDIO_STREAM_MUSIC);
audio_devices_t device = getDeviceForStrategy(strategy, false /*fromCache*/);
- SortedVector<audio_io_handle_t> dstOutputs = getOutputsForDevice(device, mOutputs);
+ SortedVector<audio_io_handle_t> outputs = getOutputsForDevice(device, mOutputs);
- audio_io_handle_t output = selectOutputForEffects(dstOutputs);
- ALOGV("getOutputForEffect() got output %d for fx %s flags %x",
- output, (desc == NULL) ? "unspecified" : desc->name, (desc == NULL) ? 0 : desc->flags);
+ if (outputs.size() == 0) {
+ return AUDIO_IO_HANDLE_NONE;
+ }
+ audio_io_handle_t output = AUDIO_IO_HANDLE_NONE;
+ bool activeOnly = true;
+
+ while (output == AUDIO_IO_HANDLE_NONE) {
+ audio_io_handle_t outputOffloaded = AUDIO_IO_HANDLE_NONE;
+ audio_io_handle_t outputDeepBuffer = AUDIO_IO_HANDLE_NONE;
+ audio_io_handle_t outputPrimary = AUDIO_IO_HANDLE_NONE;
+
+ for (size_t i = 0; i < outputs.size(); i++) {
+ sp<SwAudioOutputDescriptor> desc = mOutputs.valueFor(outputs[i]);
+ if (activeOnly && !desc->isStreamActive(AUDIO_STREAM_MUSIC)) {
+ continue;
+ }
+ ALOGV("selectOutputForMusicEffects activeOnly %d outputs[%zu] flags 0x%08x",
+ activeOnly, i, desc->mFlags);
+ if ((desc->mFlags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) != 0) {
+ outputOffloaded = outputs[i];
+ }
+ if ((desc->mFlags & AUDIO_OUTPUT_FLAG_DEEP_BUFFER) != 0) {
+ outputDeepBuffer = outputs[i];
+ }
+ if ((desc->mFlags & AUDIO_OUTPUT_FLAG_PRIMARY) != 0) {
+ outputPrimary = outputs[i];
+ }
+ }
+ if (outputOffloaded != AUDIO_IO_HANDLE_NONE) {
+ output = outputOffloaded;
+ } else if (outputDeepBuffer != AUDIO_IO_HANDLE_NONE) {
+ output = outputDeepBuffer;
+ } else if (outputPrimary != AUDIO_IO_HANDLE_NONE) {
+ output = outputPrimary;
+ } else {
+ output = outputs[0];
+ }
+ activeOnly = false;
+ }
+
+ if (output != mMusicEffectOutput) {
+ mpClientInterface->moveEffects(AUDIO_SESSION_OUTPUT_MIX, mMusicEffectOutput, output);
+ mMusicEffectOutput = output;
+ }
+
+ ALOGV("selectOutputForMusicEffects selected output %d", output);
return output;
}
+audio_io_handle_t AudioPolicyManager::getOutputForEffect(const effect_descriptor_t *desc __unused)
+{
+ return selectOutputForMusicEffects();
+}
+
status_t AudioPolicyManager::registerEffect(const effect_descriptor_t *desc,
audio_io_handle_t io,
uint32_t strategy,
@@ -3368,7 +3377,8 @@
mBeaconPlayingRefCount(0),
mBeaconMuted(false),
mTtsOutputAvailable(false),
- mMasterMono(false)
+ mMasterMono(false),
+ mMusicEffectOutput(AUDIO_IO_HANDLE_NONE)
{
mUidCached = getuid();
mpClientInterface = clientInterface;
@@ -3813,12 +3823,14 @@
outputDesc->setIoHandle(output);
mOutputs.add(output, outputDesc);
updateMono(output); // update mono status when adding to output list
+ selectOutputForMusicEffects();
nextAudioPortGeneration();
}
void AudioPolicyManager::removeOutput(audio_io_handle_t output)
{
mOutputs.removeItem(output);
+ selectOutputForMusicEffects();
}
void AudioPolicyManager::addInput(audio_io_handle_t input, const sp<AudioInputDescriptor>& inputDesc)
@@ -4406,22 +4418,7 @@
// Move effects associated to this strategy from previous output to new output
if (strategy == STRATEGY_MEDIA) {
- audio_io_handle_t fxOutput = selectOutputForEffects(dstOutputs);
- SortedVector<audio_io_handle_t> moved;
- for (size_t i = 0; i < mEffects.size(); i++) {
- sp<EffectDescriptor> effectDesc = mEffects.valueAt(i);
- if (effectDesc->mSession == AUDIO_SESSION_OUTPUT_MIX &&
- effectDesc->mIo != fxOutput) {
- if (moved.indexOf(effectDesc->mIo) < 0) {
- ALOGV("checkOutputForStrategy() moving effect %d to output %d",
- mEffects.keyAt(i), fxOutput);
- mpClientInterface->moveEffects(AUDIO_SESSION_OUTPUT_MIX, effectDesc->mIo,
- fxOutput);
- moved.add(effectDesc->mIo);
- }
- effectDesc->mIo = fxOutput;
- }
- }
+ selectOutputForMusicEffects();
}
// Move tracks associated to this strategy from previous output to new output
for (int i = 0; i < AUDIO_STREAM_FOR_POLICY_CNT; i++) {
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index 3dfcde6..9e552d7 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -452,7 +452,7 @@
audio_channel_mask_t channelMask,
audio_output_flags_t flags);
- audio_io_handle_t selectOutputForEffects(const SortedVector<audio_io_handle_t>& outputs);
+ audio_io_handle_t selectOutputForMusicEffects();
virtual status_t addAudioPatch(audio_patch_handle_t handle, const sp<AudioPatch>& patch)
{
@@ -570,6 +570,8 @@
bool mMasterMono; // true if we wish to force all outputs to mono
AudioPolicyMixCollection mPolicyMixes; // list of registered mixes
+ audio_io_handle_t mMusicEffectOutput; // output selected for music effects
+
#ifdef AUDIO_POLICY_TEST
Mutex mLock;
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
index 47c7e3f..ab077f0 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
@@ -200,20 +200,36 @@
}
std::shared_ptr<RequestMetadataQueue> queue;
- auto getQueueRet = session->getCaptureRequestMetadataQueue([&queue](const auto& descriptor) {
- queue = std::make_shared<RequestMetadataQueue>(descriptor);
- if (!queue->isValid() || queue->availableToWrite() <= 0) {
- ALOGW("HAL returns empty request metadata fmq, not use it");
- queue = nullptr;
- // don't use the queue onwards.
- }
- });
- if (!getQueueRet.isOk()) {
- ALOGW("Transaction error when getting request metadata fmq: %s, not use it",
- getQueueRet.description().c_str());
+ auto requestQueueRet = session->getCaptureRequestMetadataQueue(
+ [&queue](const auto& descriptor) {
+ queue = std::make_shared<RequestMetadataQueue>(descriptor);
+ if (!queue->isValid() || queue->availableToWrite() <= 0) {
+ ALOGE("HAL returns empty request metadata fmq, not use it");
+ queue = nullptr;
+ // don't use the queue onwards.
+ }
+ });
+ if (!requestQueueRet.isOk()) {
+ ALOGE("Transaction error when getting request metadata fmq: %s, not use it",
+ requestQueueRet.description().c_str());
queue = nullptr;
// Don't use the queue onwards.
}
+ auto resultQueueRet = session->getCaptureResultMetadataQueue(
+ [&queue = mResultMetadataQueue](const auto& descriptor) {
+ queue = std::make_unique<ResultMetadataQueue>(descriptor);
+ if (!queue->isValid() || queue->availableToWrite() <= 0) {
+ ALOGE("HAL returns empty result metadata fmq, not use it");
+ queue = nullptr;
+ // Don't use the queue onwards.
+ }
+ });
+ if (!resultQueueRet.isOk()) {
+ ALOGE("Transaction error when getting result metadata queue from camera session: %s",
+ resultQueueRet.description().c_str());
+ mResultMetadataQueue = nullptr;
+ // Don't use the queue onwards.
+ }
// TODO: camera service will absorb 3_2/3_3/3_4 differences in the future
// for now use 3_4 to keep legacy devices working
@@ -954,24 +970,56 @@
return res;
}
-
+// Only one processCaptureResult should be called at a time, so
+// the locks won't block. The locks are present here simply to enforce this.
hardware::Return<void> Camera3Device::processCaptureResult(
const hardware::hidl_vec<
hardware::camera::device::V3_2::CaptureResult>& results) {
- for (const auto& result : results) {
- processOneCaptureResult(result);
+
+ if (mProcessCaptureResultLock.tryLock() != OK) {
+ // This should never happen; it indicates a wrong client implementation
+ // that doesn't follow the contract. But, we can be tolerant here.
+ ALOGE("%s: callback overlapped! waiting 1s...",
+ __FUNCTION__);
+ if (mProcessCaptureResultLock.timedLock(1000000000 /* 1s */) != OK) {
+ ALOGE("%s: cannot acquire lock in 1s, dropping results",
+ __FUNCTION__);
+ // really don't know what to do, so bail out.
+ return hardware::Void();
+ }
}
+ for (const auto& result : results) {
+ processOneCaptureResultLocked(result);
+ }
+ mProcessCaptureResultLock.unlock();
return hardware::Void();
}
-void Camera3Device::processOneCaptureResult(
+void Camera3Device::processOneCaptureResultLocked(
const hardware::camera::device::V3_2::CaptureResult& result) {
camera3_capture_result r;
status_t res;
r.frame_number = result.frameNumber;
- if (result.result.size() != 0) {
- r.result = reinterpret_cast<const camera_metadata_t*>(result.result.data());
- size_t expected_metadata_size = result.result.size();
+
+ hardware::camera::device::V3_2::CameraMetadata resultMetadata;
+ if (result.fmqResultSize > 0) {
+ resultMetadata.resize(result.fmqResultSize);
+ if (mResultMetadataQueue == nullptr) {
+ return; // logged in initialize()
+ }
+ if (!mResultMetadataQueue->read(resultMetadata.data(), result.fmqResultSize)) {
+ ALOGE("%s: Frame %d: Cannot read camera metadata from fmq, size = %" PRIu64,
+ __FUNCTION__, result.frameNumber, result.fmqResultSize);
+ return;
+ }
+ } else {
+ resultMetadata.setToExternal(const_cast<uint8_t *>(result.result.data()),
+ result.result.size());
+ }
+
+ if (resultMetadata.size() != 0) {
+ r.result = reinterpret_cast<const camera_metadata_t*>(resultMetadata.data());
+ size_t expected_metadata_size = resultMetadata.size();
if ((res = validate_camera_metadata_structure(r.result, &expected_metadata_size)) != OK) {
ALOGE("%s: Frame %d: Invalid camera metadata received by camera service from HAL: %s (%d)",
__FUNCTION__, result.frameNumber, strerror(-res), res);
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index 844106b..eaffad8 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -185,6 +185,7 @@
// internal typedefs
using RequestMetadataQueue = hardware::MessageQueue<uint8_t, hardware::kSynchronizedReadWrite>;
+ using ResultMetadataQueue = hardware::MessageQueue<uint8_t, hardware::kSynchronizedReadWrite>;
static const size_t kDumpLockAttempts = 10;
static const size_t kDumpSleepDuration = 100000; // 0.10 sec
@@ -223,6 +224,9 @@
// Flag indicating is the current active stream configuration is constrained high speed.
bool mIsConstrainedHighSpeedConfiguration;
+ // FMQ to write result on. Must be guarded by mProcessCaptureResultLock.
+ std::unique_ptr<ResultMetadataQueue> mResultMetadataQueue;
+
/**** Scope for mLock ****/
/**
@@ -463,12 +467,15 @@
const hardware::hidl_vec<
hardware::camera::device::V3_2::NotifyMsg>& msgs) override;
- // Handle one capture result
- void processOneCaptureResult(
+ // Handle one capture result. Assume that mProcessCaptureResultLock is held.
+ void processOneCaptureResultLocked(
const hardware::camera::device::V3_2::CaptureResult& results);
// Handle one notify message
void notify(const hardware::camera::device::V3_2::NotifyMsg& msg);
+ // lock to ensure only one processCaptureResult is called at a time.
+ Mutex mProcessCaptureResultLock;
+
/**
* Common initialization code shared by both HAL paths
*
diff --git a/services/mediacodec/main_codecservice.cpp b/services/mediacodec/main_codecservice.cpp
index 3a4546b..c4e4cff 100644
--- a/services/mediacodec/main_codecservice.cpp
+++ b/services/mediacodec/main_codecservice.cpp
@@ -46,6 +46,11 @@
int main(int argc __unused, char** argv)
{
LOG(INFO) << "mediacodecservice starting";
+ bool treble = property_get_bool("persist.media.treble_omx", true);
+ if (treble) {
+ android::ProcessState::initWithDriver("/dev/vndbinder");
+ }
+
signal(SIGPIPE, SIG_IGN);
SetUpMinijail(kSystemSeccompPolicyPath, kVendorSeccompPolicyPath);
@@ -54,7 +59,7 @@
::android::hardware::configureRpcThreadpool(64, false);
sp<ProcessState> proc(ProcessState::self());
- if (property_get_bool("persist.media.treble_omx", true)) {
+ if (treble) {
using namespace ::android::hardware::media::omx::V1_0;
sp<IOmx> omx = new implementation::Omx();
if (omx == nullptr) {
diff --git a/services/soundtrigger/Android.mk b/services/soundtrigger/Android.mk
index 3e7a7ce..e21aae3 100644
--- a/services/soundtrigger/Android.mk
+++ b/services/soundtrigger/Android.mk
@@ -17,6 +17,9 @@
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
diff --git a/services/soundtrigger/SoundTriggerHalHidl.cpp b/services/soundtrigger/SoundTriggerHalHidl.cpp
index 7cc8a2b..0cd5cf7 100644
--- a/services/soundtrigger/SoundTriggerHalHidl.cpp
+++ b/services/soundtrigger/SoundTriggerHalHidl.cpp
@@ -252,6 +252,8 @@
SoundTriggerHalHidl::SoundTriggerHalHidl(const char *moduleName)
: mModuleName(moduleName), mNextUniqueId(1)
{
+ LOG_ALWAYS_FATAL_IF(strcmp(mModuleName, "primary") != 0,
+ "Treble soundtrigger only supports primary module");
}
SoundTriggerHalHidl::~SoundTriggerHalHidl()
@@ -265,9 +267,7 @@
if (mModuleName == NULL) {
mModuleName = "primary";
}
- std::string serviceName = "sound_trigger.";
- serviceName.append(mModuleName);
- mISoundTrigger = ISoundTriggerHw::getService(serviceName);
+ mISoundTrigger = ISoundTriggerHw::getService();
if (mISoundTrigger != 0) {
mISoundTrigger->linkToDeath(HalDeathHandler::getInstance(), 0 /*cookie*/);
}