summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2015-10-30 02:43:06 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2015-10-30 02:43:06 -0700
commitf0d03f2537dd88c9f7d7f13442e6c9c772081822 (patch)
tree1cbf1e233fb011928ec72718b96060b6549c34d8
parent6e4b3b70ef2adfeea1a7614968280e68711ddaf7 (diff)
parentb13e4049b0aae0b086f64eba6871e25057e99b27 (diff)
downloadandroid_hardware_qcom_audio-f0d03f2537dd88c9f7d7f13442e6c9c772081822.tar.gz
android_hardware_qcom_audio-f0d03f2537dd88c9f7d7f13442e6c9c772081822.tar.bz2
android_hardware_qcom_audio-f0d03f2537dd88c9f7d7f13442e6c9c772081822.zip
Merge "audio_policy: modify few methods to appropriately override base"
-rw-r--r--policy_hal/AudioPolicyManager.cpp26
-rw-r--r--policy_hal/AudioPolicyManager.h6
2 files changed, 23 insertions, 9 deletions
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index c5b2e8e2..b9d75054 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -905,18 +905,23 @@ void AudioPolicyManagerCustom::setPhoneState(audio_mode_t state)
mLimitRingtoneVolume = false;
}
}
-status_t AudioPolicyManagerCustom::stopSource(sp<SwAudioOutputDescriptor> outputDesc,
+
+status_t AudioPolicyManagerCustom::stopSource(sp<AudioOutputDescriptor> outputDesc,
audio_stream_type_t stream,
bool forceDeviceUpdate)
{
+ if (stream < 0 || stream >= AUDIO_STREAM_CNT) {
+ ALOGW("stopSource() invalid stream %d", stream);
+ return INVALID_OPERATION;
+ }
// always handle stream stop, check which stream type is stopping
handleEventForBeacon(stream == AUDIO_STREAM_TTS ? STOPPING_BEACON : STOPPING_OUTPUT);
// handle special case for sonification while in call
if (isInCall() && (outputDesc->mRefCount[stream] == 1)) {
if (outputDesc->isDuplicated()) {
- handleIncallSonification(stream, false, false, outputDesc->mOutput1->mIoHandle);
- handleIncallSonification(stream, false, false, outputDesc->mOutput2->mIoHandle);
+ handleIncallSonification(stream, false, false, outputDesc->subOutput1()->mIoHandle);
+ handleIncallSonification(stream, false, false, outputDesc->subOutput2()->mIoHandle);
}
handleIncallSonification(stream, false, false, outputDesc->mIoHandle);
}
@@ -951,7 +956,7 @@ status_t AudioPolicyManagerCustom::stopSource(sp<SwAudioOutputDescriptor> output
if (dev == prevDevice) {
delayMs = 0;
} else {
- delayMs = outputDesc->mLatency*2;
+ delayMs = outputDesc->latency()*2;
}
setOutputDevice(desc,
dev,
@@ -968,7 +973,7 @@ status_t AudioPolicyManagerCustom::stopSource(sp<SwAudioOutputDescriptor> output
return INVALID_OPERATION;
}
}
-status_t AudioPolicyManagerCustom::startSource(sp<SwAudioOutputDescriptor> outputDesc,
+status_t AudioPolicyManagerCustom::startSource(sp<AudioOutputDescriptor> outputDesc,
audio_stream_type_t stream,
audio_devices_t device,
uint32_t *delayMs)
@@ -976,6 +981,11 @@ status_t AudioPolicyManagerCustom::startSource(sp<SwAudioOutputDescriptor> outpu
// cannot start playback of STREAM_TTS if any other output is being used
uint32_t beaconMuteLatency = 0;
+ if (stream < 0 || stream >= AUDIO_STREAM_CNT) {
+ ALOGW("startSource() invalid stream %d", stream);
+ return INVALID_OPERATION;
+ }
+
*delayMs = 0;
if (stream == AUDIO_STREAM_TTS) {
ALOGV("\t found BEACON stream");
@@ -1119,10 +1129,14 @@ void AudioPolicyManagerCustom::handleNotificationRoutingForStream(audio_stream_t
}
status_t AudioPolicyManagerCustom::checkAndSetVolume(audio_stream_type_t stream,
int index,
- const sp<SwAudioOutputDescriptor>& outputDesc,
+ const sp<AudioOutputDescriptor>& outputDesc,
audio_devices_t device,
int delayMs, bool force)
{
+ if (stream < 0 || stream >= AUDIO_STREAM_CNT) {
+ ALOGW("checkAndSetVolume() invalid stream %d", stream);
+ return INVALID_OPERATION;
+ }
// do not change actual stream volume if the stream is muted
if (outputDesc->mMuteCount[stream] != 0) {
ALOGVV("checkAndSetVolume() stream %d muted count %d",
diff --git a/policy_hal/AudioPolicyManager.h b/policy_hal/AudioPolicyManager.h
index af621cdf..f70cfb00 100644
--- a/policy_hal/AudioPolicyManager.h
+++ b/policy_hal/AudioPolicyManager.h
@@ -73,7 +73,7 @@ protected:
status_t checkAndSetVolume(audio_stream_type_t stream,
int index,
- const sp<SwAudioOutputDescriptor>& outputDesc,
+ const sp<AudioOutputDescriptor>& outputDesc,
audio_devices_t device,
int delayMs = 0, bool force = false);
@@ -88,11 +88,11 @@ protected:
// if argument "device" is different from AUDIO_DEVICE_NONE, startSource() will force
// the re-evaluation of the output device.
- status_t startSource(sp<SwAudioOutputDescriptor> outputDesc,
+ status_t startSource(sp<AudioOutputDescriptor> outputDesc,
audio_stream_type_t stream,
audio_devices_t device,
uint32_t *delayMs);
- status_t stopSource(sp<SwAudioOutputDescriptor> outputDesc,
+ status_t stopSource(sp<AudioOutputDescriptor> outputDesc,
audio_stream_type_t stream,
bool forceDeviceUpdate);
// event is one of STARTING_OUTPUT, STARTING_BEACON, STOPPING_OUTPUT, STOPPING_BEACON