From 1b512c05f46465a7b1a1d69f82937d7199d5d926 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Mon, 17 Mar 2014 12:42:06 -0700 Subject: audio policy: remove obsolete AudioPolicyManager class members Remove mHasA2dp, mHasUsb and mHasRemoteSubmix members from AudoPolicyManager. They are not needed any more since we use device descriptors with additional attributes. Also remove obsolete limitation on device address length (MAX_DEVICE_ADDRESS_LEN). Change-Id: Iffe760a521692a4b50be3f6b935af84afb61bb86 --- services/audiopolicy/AudioPolicyManager.cpp | 34 ----------------------------- services/audiopolicy/AudioPolicyManager.h | 4 ---- 2 files changed, 38 deletions(-) (limited to 'services/audiopolicy') diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp index eeba124..d9d7b6e 100644 --- a/services/audiopolicy/AudioPolicyManager.cpp +++ b/services/audiopolicy/AudioPolicyManager.cpp @@ -170,27 +170,8 @@ status_t AudioPolicyManager::setDeviceConnectionState(audio_devices_t device, // connect/disconnect only 1 device at a time if (!audio_is_output_device(device) && !audio_is_input_device(device)) return BAD_VALUE; - if (strlen(device_address) >= MAX_DEVICE_ADDRESS_LEN) { - ALOGE("setDeviceConnectionState() invalid address: %s", device_address); - return BAD_VALUE; - } - // handle output devices if (audio_is_output_device(device)) { - - if (!mHasA2dp && audio_is_a2dp_device(device)) { - ALOGE("setDeviceConnectionState() invalid A2DP device: %x", device); - return BAD_VALUE; - } - if (!mHasUsb && audio_is_usb_device(device)) { - ALOGE("setDeviceConnectionState() invalid USB audio device: %x", device); - return BAD_VALUE; - } - if (!mHasRemoteSubmix && audio_is_remote_submix_device((audio_devices_t)device)) { - ALOGE("setDeviceConnectionState() invalid remote submix audio device: %x", device); - return BAD_VALUE; - } - sp devDesc = new DeviceDescriptor(device, address, AUDIO_CHANNEL_NONE); @@ -2354,10 +2335,6 @@ void AudioPolicyManager::checkOutputForAllStrategies() audio_io_handle_t AudioPolicyManager::getA2dpOutput() { - if (!mHasA2dp) { - return 0; - } - for (size_t i = 0; i < mOutputs.size(); i++) { AudioOutputDescriptor *outputDesc = mOutputs.valueAt(i); if (!outputDesc->isDuplicated() && outputDesc->device() & AUDIO_DEVICE_OUT_ALL_A2DP) { @@ -2370,9 +2347,6 @@ audio_io_handle_t AudioPolicyManager::getA2dpOutput() void AudioPolicyManager::checkA2dpSuspend() { - if (!mHasA2dp) { - return; - } audio_io_handle_t a2dpOutput = getA2dpOutput(); if (a2dpOutput == 0) { mA2dpSuspended = false; @@ -4190,14 +4164,6 @@ void AudioPolicyManager::loadHwModule(cnode *root) HwModule *module = new HwModule(root->name); if (node != NULL) { - if (strcmp(root->name, AUDIO_HARDWARE_MODULE_ID_A2DP) == 0) { - mHasA2dp = true; - } else if (strcmp(root->name, AUDIO_HARDWARE_MODULE_ID_USB) == 0) { - mHasUsb = true; - } else if (strcmp(root->name, AUDIO_HARDWARE_MODULE_ID_REMOTE_SUBMIX) == 0) { - mHasRemoteSubmix = true; - } - node = node->first_child; while (node) { ALOGV("loadHwModule() loading output %s", node->name); diff --git a/services/audiopolicy/AudioPolicyManager.h b/services/audiopolicy/AudioPolicyManager.h index 4c366bd..0887fcf 100644 --- a/services/audiopolicy/AudioPolicyManager.h +++ b/services/audiopolicy/AudioPolicyManager.h @@ -30,7 +30,6 @@ namespace android { // ---------------------------------------------------------------------------- -#define MAX_DEVICE_ADDRESS_LEN 20 // Attenuation applied to STRATEGY_SONIFICATION streams when a headset is connected: 6dB #define SONIFICATION_HEADSET_VOLUME_FACTOR 0.5 // Min volume for STRATEGY_SONIFICATION streams when limited by music volume: -36dB @@ -584,9 +583,6 @@ protected: uint32_t mTotalEffectsMemory; // current memory used by effects KeyedVector mEffects; // list of registered audio effects bool mA2dpSuspended; // true if A2DP output is suspended - bool mHasA2dp; // true on platforms with support for bluetooth A2DP - bool mHasUsb; // true on platforms with support for USB audio - bool mHasRemoteSubmix; // true on platforms with support for remote presentation of a submix sp mDefaultOutputDevice; // output device selected by default at boot time bool mSpeakerDrcEnabled;// true on devices that use DRC on the DEVICE_CATEGORY_SPEAKER path // to boost soft sounds, used to adjust volume curves accordingly -- cgit v1.1