Move common audio AIDL types to audio.media.audio.common
Since tests depend statically on libaudiofoundation, they also need to depend on the generated interfaces code, which contains vtables for interface classes. Update 'sthal_cli_3' test app. Bug: 188932434 Test: m HalAudioV6_0GeneratorTest Test: m sthal_cli_3 Change-Id: Ifb8f81d02764f7710ce207603aa6fe2d20123e89
This commit is contained in:
parent
3e771216b7
commit
e9f41f1fff
2 changed files with 21 additions and 8 deletions
|
@ -58,6 +58,7 @@ cc_test {
|
|||
"libmedia_helper",
|
||||
"android.hardware.audio@2.0",
|
||||
"android.hardware.audio.common@2.0",
|
||||
"android.media.audio.common.types-V1-cpp",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=2",
|
||||
|
@ -84,6 +85,7 @@ cc_test {
|
|||
"libmedia_helper",
|
||||
"android.hardware.audio@4.0",
|
||||
"android.hardware.audio.common@4.0",
|
||||
"android.media.audio.common.types-V1-cpp",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=4",
|
||||
|
@ -110,6 +112,7 @@ cc_test {
|
|||
"libmedia_helper",
|
||||
"android.hardware.audio@5.0",
|
||||
"android.hardware.audio.common@5.0",
|
||||
"android.media.audio.common.types-V1-cpp",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=5",
|
||||
|
@ -137,6 +140,7 @@ cc_test {
|
|||
"libmedia_helper",
|
||||
"android.hardware.audio@6.0",
|
||||
"android.hardware.audio.common@6.0",
|
||||
"android.media.audio.common.types-V1-cpp",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=6",
|
||||
|
@ -200,6 +204,7 @@ cc_test {
|
|||
static_libs: [
|
||||
"android.hardware.audio@6.0",
|
||||
"android.hardware.audio.common@6.0",
|
||||
"android.media.audio.common.types-V1-cpp",
|
||||
"libaudiofoundation",
|
||||
"libaudiopolicycomponents",
|
||||
"libmedia_helper",
|
||||
|
|
|
@ -19,7 +19,11 @@ import android.annotation.NonNull;
|
|||
import android.hardware.soundtrigger3.ISoundTriggerHw;
|
||||
import android.hardware.soundtrigger3.ISoundTriggerHwCallback;
|
||||
import android.hardware.soundtrigger3.ISoundTriggerHwGlobalCallback;
|
||||
import android.media.audio.common.AudioChannelLayout;
|
||||
import android.media.audio.common.AudioConfig;
|
||||
import android.media.audio.common.AudioFormatDescription;
|
||||
import android.media.audio.common.AudioFormatType;
|
||||
import android.media.audio.common.PcmType;
|
||||
import android.media.soundtrigger.ConfidenceLevel;
|
||||
import android.media.soundtrigger.ModelParameterRange;
|
||||
import android.media.soundtrigger.PhraseRecognitionEvent;
|
||||
|
@ -36,7 +40,6 @@ import android.os.ParcelFileDescriptor;
|
|||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.SystemProperties;
|
||||
|
||||
import java.util.Scanner;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
@ -196,9 +199,7 @@ public class SthalCli {
|
|||
event.type = SoundModelType.GENERIC;
|
||||
event.status = status;
|
||||
event.captureAvailable = true;
|
||||
event.audioConfig.channelMask = 16;
|
||||
event.audioConfig.format = 1;
|
||||
event.audioConfig.sampleRateHz = 16000;
|
||||
event.audioConfig = createConfig();
|
||||
try {
|
||||
model.callback.recognitionCallback(modelHandle, event);
|
||||
} catch (RemoteException e) {
|
||||
|
@ -216,10 +217,7 @@ public class SthalCli {
|
|||
event.common.type = SoundModelType.KEYPHRASE;
|
||||
event.common.status = status;
|
||||
event.common.captureAvailable = true;
|
||||
event.common.audioConfig = new AudioConfig();
|
||||
event.common.audioConfig.channelMask = 16;
|
||||
event.common.audioConfig.format = 1;
|
||||
event.common.audioConfig.sampleRateHz = 16000;
|
||||
event.common.audioConfig = createConfig();
|
||||
if (model.phraseModel.phrases.length > 0) {
|
||||
PhraseRecognitionExtra extra = new PhraseRecognitionExtra();
|
||||
extra.id = model.phraseModel.phrases[0].id;
|
||||
|
@ -250,6 +248,16 @@ public class SthalCli {
|
|||
}
|
||||
}
|
||||
|
||||
private AudioConfig createConfig() {
|
||||
AudioConfig config = new AudioConfig();
|
||||
config.channelMask = AudioChannelLayout.layoutMask(AudioChannelLayout.LAYOUT_MONO);
|
||||
config.format = new AudioFormatDescription();
|
||||
config.format.type = AudioFormatType.PCM;
|
||||
config.format.pcm = PcmType.INT_16_BIT;
|
||||
config.sampleRateHz = 16000;
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerGlobalCallback(ISoundTriggerHwGlobalCallback callback) {
|
||||
System.out.println("registerGlobalCallback()");
|
||||
|
|
Loading…
Reference in a new issue