From 2f0da26cd5f1261d5c9408def4012eba54c6fe16 Mon Sep 17 00:00:00 2001 From: mike dooley Date: Tue, 18 Dec 2018 19:59:14 +0100 Subject: [PATCH] Enabling sound trigger V2_2 V2_2 has the same functionality as V2_1 except it adds one new api, getModelState. Note: V2_1 will be removed in a subsequent cl. Test: built android and tested using SoundTriggerTestApp Bug: 70206501 Change-Id: Ia1567bfc988482195b89b8d6a0901d51e870bfbf --- audio/common/all-versions/default/service/Android.mk | 3 ++- audio/common/all-versions/default/service/service.cpp | 6 ++++-- compatibility_matrices/compatibility_matrix.current.xml | 2 +- soundtrigger/2.2/default/SoundTriggerHw.cpp | 5 +++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/audio/common/all-versions/default/service/Android.mk b/audio/common/all-versions/default/service/Android.mk index 32110eec60..58987c7810 100644 --- a/audio/common/all-versions/default/service/Android.mk +++ b/audio/common/all-versions/default/service/Android.mk @@ -50,7 +50,8 @@ LOCAL_SHARED_LIBRARIES := \ android.hardware.audio.effect@5.0 \ android.hardware.bluetooth.a2dp@1.0 \ android.hardware.soundtrigger@2.0 \ - android.hardware.soundtrigger@2.1 + android.hardware.soundtrigger@2.1 \ + android.hardware.soundtrigger@2.2 # Can not switch to Android.bp until AUDIOSERVER_MULTILIB # is deprecated as build config variable are not supported diff --git a/audio/common/all-versions/default/service/service.cpp b/audio/common/all-versions/default/service/service.cpp index 7b5da814be..15ce5e0bca 100644 --- a/audio/common/all-versions/default/service/service.cpp +++ b/audio/common/all-versions/default/service/service.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -58,9 +59,10 @@ int main(int /* argc */, char* /* argv */ []) { registerPassthroughServiceImplementation() != OK, LOG_ALWAYS_FATAL_IF(fail, "Could not register audio effect API 2, 4 nor 5"); - fail = registerPassthroughServiceImplementation() != OK && + fail = registerPassthroughServiceImplementation() != OK && + registerPassthroughServiceImplementation() != OK && registerPassthroughServiceImplementation() != OK, - ALOGW_IF(fail, "Could not register soundtrigger API 2.0 nor 2.1"); + ALOGW_IF(fail, "Could not register soundtrigger API 2.0, 2.1 nor 2.2"); fail = registerPassthroughServiceImplementation() != diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index ceb53be8a6..6b931a0aec 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -374,7 +374,7 @@ android.hardware.soundtrigger - 2.0-1 + 2.0-2 ISoundTriggerHw default diff --git a/soundtrigger/2.2/default/SoundTriggerHw.cpp b/soundtrigger/2.2/default/SoundTriggerHw.cpp index 3cf72c8d8e..4586544406 100644 --- a/soundtrigger/2.2/default/SoundTriggerHw.cpp +++ b/soundtrigger/2.2/default/SoundTriggerHw.cpp @@ -704,6 +704,11 @@ Return SoundTriggerHw::getModelState(int32_t modelHandle) { } } + if (mHwDevice->common.version < SOUND_TRIGGER_DEVICE_API_VERSION_1_2) { + ALOGE("Get model state not supported"); + return -ENODEV; + } + if (mHwDevice->get_model_state == NULL) { ALOGE("Failed to get model state from device, no such method"); return -ENODEV;