From: Dmitry Shmidt Date: Mon, 24 Feb 2014 18:31:07 +0000 (+0000) Subject: am e5a16307: am c32be36f: Merge "wifi: check if supplicant is running before starting it" X-Git-Tag: android-x86-6.0-r1~123 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=19f21e355361e923e396bebe2f42e0d13de2acd0;hp=e5a16307ab7fdee029ea1fe0bfacd856f948b112;p=android-x86%2Fhardware-libhardware_legacy.git am e5a16307: am c32be36f: Merge "wifi: check if supplicant is running before starting it" * commit 'e5a16307ab7fdee029ea1fe0bfacd856f948b112': wifi: check if supplicant is running before starting it --- diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index 65e732f..8be4390 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -81,6 +81,7 @@ status_t AudioPolicyManagerBase::setDeviceConnectionState(audio_devices_t device // save a copy of the opened output descriptors before any output is opened or closed // by checkOutputsForDevice(). This will be needed by checkOutputForAllStrategies() mPreviousOutputs = mOutputs; + String8 paramStr; switch (state) { // handle output device connection @@ -91,7 +92,17 @@ status_t AudioPolicyManagerBase::setDeviceConnectionState(audio_devices_t device } ALOGV("setDeviceConnectionState() connecting device %x", device); - if (checkOutputsForDevice(device, state, outputs) != NO_ERROR) { + if (mHasA2dp && audio_is_a2dp_device(device)) { + // handle A2DP device connection + AudioParameter param; + param.add(String8(AUDIO_PARAMETER_A2DP_SINK_ADDRESS), String8(device_address)); + paramStr = param.toString(); + } else if (mHasUsb && audio_is_usb_device(device)) { + // handle USB device connection + paramStr = String8(device_address, MAX_DEVICE_ADDRESS_LEN); + } + + if (checkOutputsForDevice(device, state, outputs, paramStr) != NO_ERROR) { return INVALID_OPERATION; } ALOGV("setDeviceConnectionState() checkOutputsForDevice() returned %d outputs", @@ -99,31 +110,18 @@ status_t AudioPolicyManagerBase::setDeviceConnectionState(audio_devices_t device // register new device as available mAvailableOutputDevices = (audio_devices_t)(mAvailableOutputDevices | device); - if (!outputs.isEmpty()) { - String8 paramStr; - if (mHasA2dp && audio_is_a2dp_device(device)) { - // handle A2DP device connection - AudioParameter param; - param.add(String8(AUDIO_PARAMETER_A2DP_SINK_ADDRESS), String8(device_address)); - paramStr = param.toString(); - mA2dpDeviceAddress = String8(device_address, MAX_DEVICE_ADDRESS_LEN); - mA2dpSuspended = false; - } else if (audio_is_bluetooth_sco_device(device)) { - // handle SCO device connection - mScoDeviceAddress = String8(device_address, MAX_DEVICE_ADDRESS_LEN); - } else if (mHasUsb && audio_is_usb_device(device)) { - // handle USB device connection - mUsbCardAndDevice = String8(device_address, MAX_DEVICE_ADDRESS_LEN); - paramStr = mUsbCardAndDevice; - } - // not currently handling multiple simultaneous submixes: ignoring remote submix - // case and address - if (!paramStr.isEmpty()) { - for (size_t i = 0; i < outputs.size(); i++) { - mpClientInterface->setParameters(outputs[i], paramStr); - } - } + if (mHasA2dp && audio_is_a2dp_device(device)) { + // handle A2DP device connection + mA2dpDeviceAddress = String8(device_address, MAX_DEVICE_ADDRESS_LEN); + mA2dpSuspended = false; + } else if (audio_is_bluetooth_sco_device(device)) { + // handle SCO device connection + mScoDeviceAddress = String8(device_address, MAX_DEVICE_ADDRESS_LEN); + } else if (mHasUsb && audio_is_usb_device(device)) { + // handle USB device connection + mUsbCardAndDevice = String8(device_address, MAX_DEVICE_ADDRESS_LEN); } + break; // handle output device disconnection case AudioSystem::DEVICE_STATE_UNAVAILABLE: { @@ -136,7 +134,7 @@ status_t AudioPolicyManagerBase::setDeviceConnectionState(audio_devices_t device // remove device from available output devices mAvailableOutputDevices = (audio_devices_t)(mAvailableOutputDevices & ~device); - checkOutputsForDevice(device, state, outputs); + checkOutputsForDevice(device, state, outputs, paramStr); if (mHasA2dp && audio_is_a2dp_device(device)) { // handle A2DP device disconnection mA2dpDeviceAddress = ""; @@ -495,8 +493,8 @@ void AudioPolicyManagerBase::setSystemProperty(const char* property, const char* AudioPolicyManagerBase::IOProfile *AudioPolicyManagerBase::getProfileForDirectOutput( audio_devices_t device, uint32_t samplingRate, - uint32_t format, - uint32_t channelMask, + audio_format_t format, + audio_channel_mask_t channelMask, audio_output_flags_t flags) { for (size_t i = 0; i < mHwModules.size(); i++) { @@ -529,8 +527,8 @@ AudioPolicyManagerBase::IOProfile *AudioPolicyManagerBase::getProfileForDirectOu audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type stream, uint32_t samplingRate, - uint32_t format, - uint32_t channelMask, + audio_format_t format, + audio_channel_mask_t channelMask, AudioSystem::output_flags flags, const audio_offload_info_t *offloadInfo) { @@ -622,8 +620,8 @@ audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type str outputDesc = new AudioOutputDescriptor(profile); outputDesc->mDevice = device; outputDesc->mSamplingRate = samplingRate; - outputDesc->mFormat = (audio_format_t)format; - outputDesc->mChannelMask = (audio_channel_mask_t)channelMask; + outputDesc->mFormat = format; + outputDesc->mChannelMask = channelMask; outputDesc->mLatency = 0; outputDesc->mFlags =(audio_output_flags_t) (outputDesc->mFlags | flags); outputDesc->mRefCount[stream] = 0; @@ -641,7 +639,7 @@ audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type str // only accept an output with the requested parameters if (output == 0 || (samplingRate != 0 && samplingRate != outputDesc->mSamplingRate) || - (format != 0 && format != outputDesc->mFormat) || + (format != AUDIO_FORMAT_DEFAULT && format != outputDesc->mFormat) || (channelMask != 0 && channelMask != outputDesc->mChannelMask)) { ALOGV("getOutput() failed opening direct output: output %d samplingRate %d %d," "format %d %d, channelMask %04x %04x", output, samplingRate, @@ -669,7 +667,7 @@ audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type str // open a non direct output // for non direct outputs, only PCM is supported - if (audio_is_linear_pcm((audio_format_t)format)) { + if (audio_is_linear_pcm(format)) { // get which output is suitable for the specified stream. The actual // routing change will happen when startOutput() will be called SortedVector outputs = getOutputsForDevice(device, mOutputs); @@ -737,7 +735,7 @@ status_t AudioPolicyManagerBase::startOutput(audio_io_handle_t output, ALOGV("startOutput() output %d, stream %d, session %d", output, stream, session); ssize_t index = mOutputs.indexOfKey(output); if (index < 0) { - ALOGW("startOutput() unknow output %d", output); + ALOGW("startOutput() unknown output %d", output); return BAD_VALUE; } @@ -805,7 +803,7 @@ status_t AudioPolicyManagerBase::stopOutput(audio_io_handle_t output, ALOGV("stopOutput() output %d, stream %d, session %d", output, stream, session); ssize_t index = mOutputs.indexOfKey(output); if (index < 0) { - ALOGW("stopOutput() unknow output %d", output); + ALOGW("stopOutput() unknown output %d", output); return BAD_VALUE; } @@ -900,8 +898,8 @@ void AudioPolicyManagerBase::releaseOutput(audio_io_handle_t output) audio_io_handle_t AudioPolicyManagerBase::getInput(int inputSource, uint32_t samplingRate, - uint32_t format, - uint32_t channelMask, + audio_format_t format, + audio_channel_mask_t channelMask, AudioSystem::audio_in_acoustics acoustics) { audio_io_handle_t input = 0; @@ -918,13 +916,13 @@ audio_io_handle_t AudioPolicyManagerBase::getInput(int inputSource, // adapt channel selection to input source switch(inputSource) { case AUDIO_SOURCE_VOICE_UPLINK: - channelMask = AudioSystem::CHANNEL_IN_VOICE_UPLINK; + channelMask = AUDIO_CHANNEL_IN_VOICE_UPLINK; break; case AUDIO_SOURCE_VOICE_DOWNLINK: - channelMask = AudioSystem::CHANNEL_IN_VOICE_DNLINK; + channelMask = AUDIO_CHANNEL_IN_VOICE_DNLINK; break; case AUDIO_SOURCE_VOICE_CALL: - channelMask = (AudioSystem::CHANNEL_IN_VOICE_UPLINK | AudioSystem::CHANNEL_IN_VOICE_DNLINK); + channelMask = AUDIO_CHANNEL_IN_VOICE_UPLINK | AUDIO_CHANNEL_IN_VOICE_DNLINK; break; default: break; @@ -935,7 +933,7 @@ audio_io_handle_t AudioPolicyManagerBase::getInput(int inputSource, format, channelMask); if (profile == NULL) { - ALOGW("getInput() could not find profile for device %04x, samplingRate %d, format %d," + ALOGW("getInput() could not find profile for device %04x, samplingRate %d, format %d, " "channelMask %04x", device, samplingRate, format, channelMask); return 0; @@ -951,8 +949,8 @@ audio_io_handle_t AudioPolicyManagerBase::getInput(int inputSource, inputDesc->mInputSource = inputSource; inputDesc->mDevice = device; inputDesc->mSamplingRate = samplingRate; - inputDesc->mFormat = (audio_format_t)format; - inputDesc->mChannelMask = (audio_channel_mask_t)channelMask; + inputDesc->mFormat = format; + inputDesc->mChannelMask = channelMask; inputDesc->mRefCount = 0; input = mpClientInterface->openInput(profile->mModule->mHandle, &inputDesc->mDevice, @@ -965,7 +963,7 @@ audio_io_handle_t AudioPolicyManagerBase::getInput(int inputSource, (samplingRate != inputDesc->mSamplingRate) || (format != inputDesc->mFormat) || (channelMask != inputDesc->mChannelMask)) { - ALOGV("getInput() failed opening input: samplingRate %d, format %d, channelMask %d", + ALOGI("getInput() failed opening input: samplingRate %d, format %d, channelMask %x", samplingRate, format, channelMask); if (input != 0) { mpClientInterface->closeInput(input); @@ -982,7 +980,7 @@ status_t AudioPolicyManagerBase::startInput(audio_io_handle_t input) ALOGV("startInput() input %d", input); ssize_t index = mInputs.indexOfKey(input); if (index < 0) { - ALOGW("startInput() unknow input %d", input); + ALOGW("startInput() unknown input %d", input); return BAD_VALUE; } AudioInputDescriptor *inputDesc = mInputs.valueAt(index); @@ -1001,7 +999,7 @@ status_t AudioPolicyManagerBase::startInput(audio_io_handle_t input) stopInput(activeInput); releaseInput(activeInput); } else { - ALOGW("startInput() input %d failed: other input already started..", input); + ALOGW("startInput() input %d failed: other input already started", input); return INVALID_OPERATION; } } @@ -1038,7 +1036,7 @@ status_t AudioPolicyManagerBase::stopInput(audio_io_handle_t input) ALOGV("stopInput() input %d", input); ssize_t index = mInputs.indexOfKey(input); if (index < 0) { - ALOGW("stopInput() unknow input %d", input); + ALOGW("stopInput() unknown input %d", input); return BAD_VALUE; } AudioInputDescriptor *inputDesc = mInputs.valueAt(index); @@ -1818,7 +1816,8 @@ void AudioPolicyManagerBase::addOutput(audio_io_handle_t id, AudioOutputDescript status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device, AudioSystem::device_connection_state state, - SortedVector& outputs) + SortedVector& outputs, + const String8 paramStr) { AudioOutputDescriptor *desc; @@ -1869,7 +1868,7 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device, continue; } - ALOGV("opening output for device %08x", device); + ALOGV("opening output for device %08x with params %s", device, paramStr.string()); desc = new AudioOutputDescriptor(profile); desc->mDevice = device; audio_offload_info_t offloadInfo = AUDIO_INFO_INITIALIZER; @@ -1886,6 +1885,10 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device, desc->mFlags, &offloadInfo); if (output != 0) { + if (!paramStr.isEmpty()) { + mpClientInterface->setParameters(output, paramStr); + } + if (desc->mFlags & AUDIO_OUTPUT_FLAG_DIRECT) { String8 reply; char *value; @@ -1899,7 +1902,7 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device, loadSamplingRates(value + 1, profile); } } - if (profile->mFormats[0] == 0) { + if (profile->mFormats[0] == AUDIO_FORMAT_DEFAULT) { reply = mpClientInterface->getParameters(output, String8(AUDIO_PARAMETER_STREAM_SUP_FORMATS)); ALOGV("checkOutputsForDevice() direct output sup formats %s", @@ -1921,9 +1924,9 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device, } if (((profile->mSamplingRates[0] == 0) && (profile->mSamplingRates.size() < 2)) || - ((profile->mFormats[0] == 0) && + ((profile->mFormats[0] == AUDIO_FORMAT_DEFAULT) && (profile->mFormats.size() < 2)) || - ((profile->mFormats[0] == 0) && + ((profile->mFormats[0] == AUDIO_FORMAT_DEFAULT) && (profile->mChannelMasks.size() < 2))) { ALOGW("checkOutputsForDevice() direct output missing param"); mpClientInterface->closeOutput(output); @@ -2004,13 +2007,13 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device, profile->mSamplingRates.clear(); profile->mSamplingRates.add(0); } - if (profile->mFormats[0] == 0) { + if (profile->mFormats[0] == AUDIO_FORMAT_DEFAULT) { profile->mFormats.clear(); - profile->mFormats.add((audio_format_t)0); + profile->mFormats.add(AUDIO_FORMAT_DEFAULT); } if (profile->mChannelMasks[0] == 0) { profile->mChannelMasks.clear(); - profile->mChannelMasks.add((audio_channel_mask_t)0); + profile->mChannelMasks.add(0); } } } @@ -2661,8 +2664,8 @@ uint32_t AudioPolicyManagerBase::setOutputDevice(audio_io_handle_t output, AudioPolicyManagerBase::IOProfile *AudioPolicyManagerBase::getInputProfile(audio_devices_t device, uint32_t samplingRate, - uint32_t format, - uint32_t channelMask) + audio_format_t format, + audio_channel_mask_t channelMask) { // Choose an input profile based on the requested capture parameters: select the first available // profile supporting all requested parameters. @@ -2676,7 +2679,7 @@ AudioPolicyManagerBase::IOProfile *AudioPolicyManagerBase::getInputProfile(audio { IOProfile *profile = mHwModules[i]->mInputProfiles[j]; if (profile->isCompatibleProfile(device, samplingRate, format, - channelMask,(audio_output_flags_t)0)) { + channelMask, AUDIO_OUTPUT_FLAG_NONE)) { return profile; } } @@ -3248,8 +3251,8 @@ uint32_t AudioPolicyManagerBase::getMaxEffectsMemory() AudioPolicyManagerBase::AudioOutputDescriptor::AudioOutputDescriptor( const IOProfile *profile) - : mId(0), mSamplingRate(0), mFormat((audio_format_t)0), - mChannelMask((audio_channel_mask_t)0), mLatency(0), + : mId(0), mSamplingRate(0), mFormat(AUDIO_FORMAT_DEFAULT), + mChannelMask(0), mLatency(0), mFlags((audio_output_flags_t)0), mDevice(AUDIO_DEVICE_NONE), mOutput1(0), mOutput2(0), mProfile(profile), mDirectOpenCount(0) { @@ -3400,7 +3403,7 @@ status_t AudioPolicyManagerBase::AudioOutputDescriptor::dump(int fd) // --- AudioInputDescriptor class implementation AudioPolicyManagerBase::AudioInputDescriptor::AudioInputDescriptor(const IOProfile *profile) - : mSamplingRate(0), mFormat((audio_format_t)0), mChannelMask((audio_channel_mask_t)0), + : mSamplingRate(0), mFormat(AUDIO_FORMAT_DEFAULT), mChannelMask(0), mDevice(AUDIO_DEVICE_NONE), mRefCount(0), mInputSource(0), mProfile(profile) { @@ -3518,7 +3521,7 @@ void AudioPolicyManagerBase::HwModule::dump(int fd) result.append(buffer); write(fd, result.string(), result.size()); if (mOutputProfiles.size()) { - write(fd, " - outputs:\n", sizeof(" - outputs:\n")); + write(fd, " - outputs:\n", strlen(" - outputs:\n")); for (size_t i = 0; i < mOutputProfiles.size(); i++) { snprintf(buffer, SIZE, " output %d:\n", i); write(fd, buffer, strlen(buffer)); @@ -3526,7 +3529,7 @@ void AudioPolicyManagerBase::HwModule::dump(int fd) } } if (mInputProfiles.size()) { - write(fd, " - inputs:\n", sizeof(" - inputs:\n")); + write(fd, " - inputs:\n", strlen(" - inputs:\n")); for (size_t i = 0; i < mInputProfiles.size(); i++) { snprintf(buffer, SIZE, " input %d:\n", i); write(fd, buffer, strlen(buffer)); @@ -3549,11 +3552,11 @@ AudioPolicyManagerBase::IOProfile::~IOProfile() // get a valid a match bool AudioPolicyManagerBase::IOProfile::isCompatibleProfile(audio_devices_t device, uint32_t samplingRate, - uint32_t format, - uint32_t channelMask, + audio_format_t format, + audio_channel_mask_t channelMask, audio_output_flags_t flags) const { - if (samplingRate == 0 || format == 0 || channelMask == 0) { + if (samplingRate == 0 || !audio_is_valid_format(format) || channelMask == 0) { return false; } @@ -3787,7 +3790,7 @@ void AudioPolicyManagerBase::loadFormats(char *name, IOProfile *profile) // by convention, "0' in the first entry in mFormats indicates the supported formats // should be read from the output stream after it is opened for the first time if (str != NULL && strcmp(str, DYNAMIC_VALUE_TAG) == 0) { - profile->mFormats.add((audio_format_t)0); + profile->mFormats.add(AUDIO_FORMAT_DEFAULT); return; } @@ -3795,7 +3798,7 @@ void AudioPolicyManagerBase::loadFormats(char *name, IOProfile *profile) audio_format_t format = (audio_format_t)stringToEnum(sFormatNameToEnumTable, ARRAY_SIZE(sFormatNameToEnumTable), str); - if (format != 0) { + if (format != AUDIO_FORMAT_DEFAULT) { profile->mFormats.add(format); } str = strtok(NULL, "|"); @@ -3810,7 +3813,7 @@ void AudioPolicyManagerBase::loadInChannels(char *name, IOProfile *profile) ALOGV("loadInChannels() %s", name); if (str != NULL && strcmp(str, DYNAMIC_VALUE_TAG) == 0) { - profile->mChannelMasks.add((audio_channel_mask_t)0); + profile->mChannelMasks.add(0); return; } @@ -3837,7 +3840,7 @@ void AudioPolicyManagerBase::loadOutChannels(char *name, IOProfile *profile) // by convention, "0' in the first entry in mChannelMasks indicates the supported channel // masks should be read from the output stream after it is opened for the first time if (str != NULL && strcmp(str, DYNAMIC_VALUE_TAG) == 0) { - profile->mChannelMasks.add((audio_channel_mask_t)0); + profile->mChannelMasks.add(0); return; } diff --git a/audio/audio_policy_hal.cpp b/audio/audio_policy_hal.cpp index e44bc48..87c4131 100644 --- a/audio/audio_policy_hal.cpp +++ b/audio/audio_policy_hal.cpp @@ -145,7 +145,7 @@ static audio_io_handle_t ap_get_output(struct audio_policy *pol, ALOGV("%s: tid %d", __func__, gettid()); return lap->apm->getOutput((AudioSystem::stream_type)stream, - sampling_rate, (int) format, channelMask, + sampling_rate, format, channelMask, (AudioSystem::output_flags)flags, offloadInfo); } @@ -180,7 +180,7 @@ static audio_io_handle_t ap_get_input(struct audio_policy *pol, audio_source_t i audio_in_acoustics_t acoustics) { struct legacy_audio_policy *lap = to_lap(pol); - return lap->apm->getInput((int) inputSource, sampling_rate, (int) format, channelMask, + return lap->apm->getInput((int) inputSource, sampling_rate, format, channelMask, (AudioSystem::audio_in_acoustics)acoustics); } diff --git a/include/hardware_legacy/AudioPolicyInterface.h b/include/hardware_legacy/AudioPolicyInterface.h index 7847bdd..6a01684 100644 --- a/include/hardware_legacy/AudioPolicyInterface.h +++ b/include/hardware_legacy/AudioPolicyInterface.h @@ -90,12 +90,11 @@ public: // request an output appropriate for playback of the supplied stream type and parameters virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream, - uint32_t samplingRate = 0, - uint32_t format = AudioSystem::FORMAT_DEFAULT, - uint32_t channels = 0, - AudioSystem::output_flags flags = - AudioSystem::OUTPUT_FLAG_INDIRECT, - const audio_offload_info_t *offloadInfo = NULL) = 0; + uint32_t samplingRate, + audio_format_t format, + audio_channel_mask_t channelMask, + AudioSystem::output_flags flags, + const audio_offload_info_t *offloadInfo) = 0; // indicates to the audio policy manager that the output starts being used by corresponding stream. virtual status_t startOutput(audio_io_handle_t output, AudioSystem::stream_type stream, @@ -109,10 +108,10 @@ public: // request an input appropriate for record from the supplied device with supplied parameters. virtual audio_io_handle_t getInput(int inputSource, - uint32_t samplingRate = 0, - uint32_t Format = AudioSystem::FORMAT_DEFAULT, - uint32_t channels = 0, - AudioSystem::audio_in_acoustics acoustics = (AudioSystem::audio_in_acoustics)0) = 0; + uint32_t samplingRate, + audio_format_t format, + audio_channel_mask_t channelMask, + AudioSystem::audio_in_acoustics acoustics) = 0; // indicates to the audio policy manager that the input starts being used. virtual status_t startInput(audio_io_handle_t input) = 0; // indicates to the audio policy manager that the input stops being used. diff --git a/include/hardware_legacy/AudioPolicyManagerBase.h b/include/hardware_legacy/AudioPolicyManagerBase.h index 8343f2b..1ff409e 100644 --- a/include/hardware_legacy/AudioPolicyManagerBase.h +++ b/include/hardware_legacy/AudioPolicyManagerBase.h @@ -87,12 +87,11 @@ public: virtual void setSystemProperty(const char* property, const char* value); virtual status_t initCheck(); virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream, - uint32_t samplingRate = 0, - uint32_t format = AudioSystem::FORMAT_DEFAULT, - uint32_t channels = 0, - AudioSystem::output_flags flags = - AudioSystem::OUTPUT_FLAG_INDIRECT, - const audio_offload_info_t *offloadInfo = NULL); + uint32_t samplingRate, + audio_format_t format, + audio_channel_mask_t channelMask, + AudioSystem::output_flags flags, + const audio_offload_info_t *offloadInfo); virtual status_t startOutput(audio_io_handle_t output, AudioSystem::stream_type stream, int session = 0); @@ -102,8 +101,8 @@ public: virtual void releaseOutput(audio_io_handle_t output); virtual audio_io_handle_t getInput(int inputSource, uint32_t samplingRate, - uint32_t format, - uint32_t channels, + audio_format_t format, + audio_channel_mask_t channelMask, AudioSystem::audio_in_acoustics acoustics); // indicates to the audio policy manager that the input starts being used. @@ -209,8 +208,8 @@ protected: bool isCompatibleProfile(audio_devices_t device, uint32_t samplingRate, - uint32_t format, - uint32_t channelMask, + audio_format_t format, + audio_channel_mask_t channelMask, audio_output_flags_t flags) const; void dump(int fd); @@ -416,7 +415,8 @@ protected: // transfers the audio tracks and effects from one output thread to another accordingly. status_t checkOutputsForDevice(audio_devices_t device, AudioSystem::device_connection_state state, - SortedVector& outputs); + SortedVector& outputs, + const String8 paramStr); // close an output and its companion duplicating output. void closeOutput(audio_io_handle_t output); @@ -483,12 +483,12 @@ protected: AudioSystem::output_flags flags); IOProfile *getInputProfile(audio_devices_t device, uint32_t samplingRate, - uint32_t format, - uint32_t channelMask); + audio_format_t format, + audio_channel_mask_t channelMask); IOProfile *getProfileForDirectOutput(audio_devices_t device, uint32_t samplingRate, - uint32_t format, - uint32_t channelMask, + audio_format_t format, + audio_channel_mask_t channelMask, audio_output_flags_t flags); audio_io_handle_t selectOutputForEffects(const SortedVector& outputs); diff --git a/include/hardware_legacy/driver_nl80211.h b/include/hardware_legacy/driver_nl80211.h index eac0879..83d89af 100644 --- a/include/hardware_legacy/driver_nl80211.h +++ b/include/hardware_legacy/driver_nl80211.h @@ -31,6 +31,7 @@ #include "common.h" #include "eloop.h" #include "utils/list.h" +#include "common/qca-vendor.h" #include "common/ieee802_11_defs.h" #include "common/ieee802_11_common.h" #include "l2_packet/l2_packet.h" @@ -99,10 +100,12 @@ struct i802_bss { unsigned int added_bridge:1; unsigned int in_deinit:1; unsigned int wdev_id_set:1; + unsigned int added_if:1; u8 addr[ETH_ALEN]; int freq; + int if_dynamic; void *ctx; struct nl_handle *nl_preq, *nl_mgmt; @@ -131,6 +134,11 @@ struct wpa_driver_nl80211_data { int operstate; int scan_complete_events; + enum scan_states { + NO_SCAN, SCAN_REQUESTED, SCAN_STARTED, SCAN_COMPLETED, + SCAN_ABORTED, SCHED_SCAN_STARTED, SCHED_SCAN_STOPPED, + SCHED_SCAN_RESULTS + } scan_state; struct nl_cb *nl_cb; @@ -160,6 +168,9 @@ struct wpa_driver_nl80211_data { unsigned int use_monitor:1; unsigned int ignore_next_local_disconnect:1; unsigned int allow_p2p_device:1; + unsigned int hostapd:1; + unsigned int start_mode_ap:1; + unsigned int start_iface_up:1; u64 remain_on_chan_cookie; u64 send_action_cookie; @@ -169,21 +180,16 @@ struct wpa_driver_nl80211_data { struct wpa_driver_scan_filter *filter_ssids; size_t num_filter_ssids; - struct i802_bss first_bss; + struct i802_bss *first_bss; int eapol_tx_sock; -#ifdef HOSTAPD int eapol_sock; /* socket for EAPOL frames */ int default_if_indices[16]; int *if_indices; int num_if_indices; - int last_freq; - int last_freq_ht; -#endif /* HOSTAPD */ - /* From failed authentication command */ int auth_freq; u8 auth_bssid_[ETH_ALEN]; diff --git a/wifi/wifi.c b/wifi/wifi.c index f11c1ab..8783df2 100644 --- a/wifi/wifi.c +++ b/wifi/wifi.c @@ -336,84 +336,6 @@ int ensure_entropy_file_exists() return 0; } -int update_ctrl_interface(const char *config_file) { - - int srcfd, destfd; - int nread; - char ifc[PROPERTY_VALUE_MAX]; - char *pbuf; - char *sptr; - struct stat sb; - int ret; - - if (stat(config_file, &sb) != 0) - return -1; - - pbuf = malloc(sb.st_size + PROPERTY_VALUE_MAX); - if (!pbuf) - return 0; - srcfd = TEMP_FAILURE_RETRY(open(config_file, O_RDONLY)); - if (srcfd < 0) { - ALOGE("Cannot open \"%s\": %s", config_file, strerror(errno)); - free(pbuf); - return 0; - } - nread = TEMP_FAILURE_RETRY(read(srcfd, pbuf, sb.st_size)); - close(srcfd); - if (nread < 0) { - ALOGE("Cannot read \"%s\": %s", config_file, strerror(errno)); - free(pbuf); - return 0; - } - - if (!strcmp(config_file, SUPP_CONFIG_FILE)) { - property_get("wifi.interface", ifc, WIFI_TEST_INTERFACE); - } else { - strcpy(ifc, CONTROL_IFACE_PATH); - } - /* Assume file is invalid to begin with */ - ret = -1; - /* - * if there is a "ctrl_interface=" entry, re-write it ONLY if it is - * NOT a directory. The non-directory value option is an Android add-on - * that allows the control interface to be exchanged through an environment - * variable (initialized by the "init" program when it starts a service - * with a "socket" option). - * - * The is deemed to be a directory if the "DIR=" form is used or - * the value begins with "/". - */ - if ((sptr = strstr(pbuf, "ctrl_interface="))) { - ret = 0; - if ((!strstr(pbuf, "ctrl_interface=DIR=")) && - (!strstr(pbuf, "ctrl_interface=/"))) { - char *iptr = sptr + strlen("ctrl_interface="); - int ilen = 0; - int mlen = strlen(ifc); - int nwrite; - if (strncmp(ifc, iptr, mlen) != 0) { - ALOGE("ctrl_interface != %s", ifc); - while (((ilen + (iptr - pbuf)) < nread) && (iptr[ilen] != '\n')) - ilen++; - mlen = ((ilen >= mlen) ? ilen : mlen) + 1; - memmove(iptr + mlen, iptr + ilen + 1, nread - (iptr + ilen + 1 - pbuf)); - memset(iptr, '\n', mlen); - memcpy(iptr, ifc, strlen(ifc)); - destfd = TEMP_FAILURE_RETRY(open(config_file, O_RDWR, 0660)); - if (destfd < 0) { - ALOGE("Cannot update \"%s\": %s", config_file, strerror(errno)); - free(pbuf); - return -1; - } - TEMP_FAILURE_RETRY(write(destfd, pbuf, nread + mlen - ilen -1)); - close(destfd); - } - } - } - free(pbuf); - return ret; -} - int ensure_config_file_exists(const char *config_file) { char buf[2048]; @@ -429,14 +351,7 @@ int ensure_config_file_exists(const char *config_file) ALOGE("Cannot set RW to \"%s\": %s", config_file, strerror(errno)); return -1; } - /* return if we were able to update control interface properly */ - if (update_ctrl_interface(config_file) >=0) { - return 0; - } else { - /* This handles the scenario where the file had bad data - * for some reason. We continue and recreate the file. - */ - } + return 0; } else if (errno != ENOENT) { ALOGE("Cannot access \"%s\": %s", config_file, strerror(errno)); return -1; @@ -483,7 +398,7 @@ int ensure_config_file_exists(const char *config_file) unlink(config_file); return -1; } - return update_ctrl_interface(config_file); + return 0; } int wifi_start_supplicant(int p2p_supported)