summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2014-11-07 16:13:56 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-07 16:13:56 +0000
commite88fe4462e186f82f519e115a1d19d6f0089012a (patch)
tree63240b1b6877de439c3ba385b5bff12c0521cf85 /audio
parent7124b707bb87d000997fd6705d8596a42d803b5e (diff)
parentb4b0608b0560a7cad27aeec0af8b1728b971aa3a (diff)
downloadhardware_libhardware_legacy-e88fe4462e186f82f519e115a1d19d6f0089012a.zip
hardware_libhardware_legacy-e88fe4462e186f82f519e115a1d19d6f0089012a.tar.gz
hardware_libhardware_legacy-e88fe4462e186f82f519e115a1d19d6f0089012a.tar.bz2
am b4b0608b: Merge "legacy audio policy: check string parameters before use" into lmp-mr1-dev
* commit 'b4b0608b0560a7cad27aeec0af8b1728b971aa3a': legacy audio policy: check string parameters before use
Diffstat (limited to 'audio')
-rw-r--r--audio/AudioPolicyManagerBase.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp
index 7bca631..a768be8 100644
--- a/audio/AudioPolicyManagerBase.cpp
+++ b/audio/AudioPolicyManagerBase.cpp
@@ -53,6 +53,11 @@ status_t AudioPolicyManagerBase::setDeviceConnectionState(audio_devices_t device
AudioSystem::device_connection_state state,
const char *device_address)
{
+ // device_address can be NULL and should be handled as an empty string in this case,
+ // and it is not checked by AudioPolicyInterfaceImpl.cpp
+ if (device_address == NULL) {
+ device_address = "";
+ }
ALOGV("setDeviceConnectionState() device: 0x%X, state %d, address %s", device, state, device_address);
// connect/disconnect only 1 device at a time
@@ -245,6 +250,10 @@ status_t AudioPolicyManagerBase::setDeviceConnectionState(audio_devices_t device
AudioSystem::device_connection_state AudioPolicyManagerBase::getDeviceConnectionState(audio_devices_t device,
const char *device_address)
{
+ // similar to setDeviceConnectionState
+ if (device_address == NULL) {
+ device_address = "";
+ }
AudioSystem::device_connection_state state = AudioSystem::DEVICE_STATE_UNAVAILABLE;
String8 address = String8(device_address);
if (audio_is_output_device(device)) {