Adapt AudioPolicyManagerCustom to changes in AudioPolicyManager.
Some virtual function signatures changed, and the vectorsEqual function vanished.
Reference to base class changes:
platform/frameworks/av/+/8fc147b21a7627eeda6383ae501add4dc903634e
platform/frameworks/av/+/9de8bd18b21642f6f1fb4e3ef75e44a2cc79f3ce
Change-Id: I8cba570b6dec263e1fa5ba3472d0478f99910b90
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 76ad64e..ac50f46 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -486,7 +486,7 @@
}
}
- if (!vectorsEqual(srcOutputs,dstOutputs) && isInvalidationOfMusicStreamNeeded(strategy)) {
+ if ((srcOutputs != dstOutputs) && isInvalidationOfMusicStreamNeeded(strategy)) {
AudioPolicyManager::checkOutputForStrategy(strategy);
}
}
@@ -1950,21 +1950,22 @@
return count;
}
-status_t AudioPolicyManagerCustom::startInput(audio_io_handle_t input,
- audio_session_t session,
+status_t AudioPolicyManagerCustom::startInput(audio_port_handle_t portId,
bool silenced,
concurrency_type__mask_t *concurrency)
{
- ALOGV("startInput(input:%d, session:%d, silenced:%d, concurrency:%d)",
- input, session, silenced, *concurrency);
+ ALOGV("startInput(portId:%d, silenced:%d, concurrency:%d)",
+ portId, silenced, *concurrency);
*concurrency = API_INPUT_CONCURRENCY_NONE;
- ssize_t index = mInputs.indexOfKey(input);
- if (index < 0) {
- ALOGW("startInput() unknown input %d", input);
+ sp<AudioInputDescriptor> inputDesc = mInputs.getInputForClient(portId);
+ if (inputDesc == 0) {
+ ALOGW("startInput() no input for client %d", portId);
return BAD_VALUE;
}
- sp<AudioInputDescriptor> inputDesc = mInputs.valueAt(index);
+ sp<RecordClientDescriptor> client = inputDesc->clients()[portId];
+ audio_session_t session = client->session();
+ audio_io_handle_t input = inputDesc->mIoHandle;
sp<AudioSession> audioSession = inputDesc->getAudioSession(session);
if (audioSession == 0) {
@@ -2012,9 +2013,8 @@
sp<AudioSession> activeSession = activeSessions.valueAt(0);
if (activeSession->isSilenced()) {
audio_io_handle_t activeInput = activeDesc->mIoHandle;
- audio_session_t activeSessionId = activeSession->session();
- stopInput(activeInput, activeSessionId);
- releaseInput(activeInput, activeSessionId);
+ stopInput(activeInput);
+ releaseInput(portId);
ALOGV("startInput(%d) stopping silenced input %d", input, activeInput);
activeInputs = mInputs.getActiveInputs();
}
@@ -2074,8 +2074,8 @@
SortedVector<audio_session_t> sessions = activeDesc->getPreemptedSessions();
sessions.add(activeSession);
inputDesc->setPreemptedSessions(sessions);
- stopInput(activeHandle, activeSession);
- releaseInput(activeHandle, activeSession);
+ stopInput(activeHandle);
+ releaseInput(activeHandle);
ALOGV("startInput(%d) for HOTWORD preempting HOTWORD input %d",
input, activeDesc->mIoHandle);
}
@@ -2189,11 +2189,10 @@
return NO_ERROR;
}
-status_t AudioPolicyManagerCustom::stopInput(audio_io_handle_t input,
- audio_session_t session)
+status_t AudioPolicyManagerCustom::stopInput(audio_io_handle_t input)
{
status_t status;
- status = AudioPolicyManager::stopInput(input, session);
+ status = AudioPolicyManager::stopInput(input);
if (property_get_bool("persist.vendor.audio.va_concurrency_enabled", false)) {
ssize_t index = mInputs.indexOfKey(input);
sp<AudioInputDescriptor> inputDesc = mInputs.valueAt(index);
diff --git a/policy_hal/AudioPolicyManager.h b/policy_hal/AudioPolicyManager.h
index 60f25fd..2080edb 100644
--- a/policy_hal/AudioPolicyManager.h
+++ b/policy_hal/AudioPolicyManager.h
@@ -106,13 +106,11 @@
uint32_t activeNonSoundTriggerInputsCountOnDevices(
audio_devices_t devices = AUDIO_DEVICE_IN_DEFAULT) const;
// indicates to the audio policy manager that the input starts being used.
- virtual status_t startInput(audio_io_handle_t input,
- audio_session_t session,
+ virtual status_t startInput(audio_port_handle_t portId,
bool silenced,
concurrency_type__mask_t *concurrency);
// indicates to the audio policy manager that the input stops being used.
- virtual status_t stopInput(audio_io_handle_t input,
- audio_session_t session);
+ virtual status_t stopInput(audio_port_handle_t portId);
protected: