Add selectPresentation API to IAudioTrack
The Java AudioTrack interface has a setPresentation API. This
calls the setParameters API in IAudioTrack. However, this does
not eventuate into a call into the android.hardware.audio@4.0
IStreamOut selectPresentation API.
Add selectPresentation API to IAudioTrack and call down to the
android.hardware.audio@4.0 IStreamOut selectPresentation API.
Translate into calls to setParameters API for legacy HAL
interfaces.
Bug: 63901775
Test: compile
Change-Id: Id634a107f3f93ab18dc80d2bd0af67bda35e859f
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index f2617ae..91a3286 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -326,6 +326,10 @@
return mTrack->setParameters(keyValuePairs);
}
+status_t AudioFlinger::TrackHandle::selectPresentation(int presentationId, int programId) {
+ return mTrack->selectPresentation(presentationId, programId);
+}
+
VolumeShaper::Status AudioFlinger::TrackHandle::applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration,
const sp<VolumeShaper::Operation>& operation) {
@@ -976,6 +980,19 @@
}
}
+status_t AudioFlinger::PlaybackThread::Track::selectPresentation(int presentationId,
+ int programId) {
+ sp<ThreadBase> thread = mThread.promote();
+ if (thread == 0) {
+ ALOGE("thread is dead");
+ return FAILED_TRANSACTION;
+ } else if ((thread->type() == ThreadBase::DIRECT) || (thread->type() == ThreadBase::OFFLOAD)) {
+ DirectOutputThread *directOutputThread = static_cast<DirectOutputThread*>(thread.get());
+ return directOutputThread->selectPresentation(presentationId, programId);
+ }
+ return INVALID_OPERATION;
+}
+
VolumeShaper::Status AudioFlinger::PlaybackThread::Track::applyVolumeShaper(
const sp<VolumeShaper::Configuration>& configuration,
const sp<VolumeShaper::Operation>& operation)