From 745e7fd4e09db2b47371338ee54c54255e286473 Mon Sep 17 00:00:00 2001 From: Irfan Sheriff Date: Sat, 3 Nov 2012 23:21:39 -0700 Subject: Fix stop supplicant api Bug: 7227463 Change-Id: I4576e223c69dd67bd714fefecf0a1047770362fd --- include/hardware_legacy/wifi.h | 2 +- wifi/wifi.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/hardware_legacy/wifi.h b/include/hardware_legacy/wifi.h index 4d051e7..be6a83e 100644 --- a/include/hardware_legacy/wifi.h +++ b/include/hardware_legacy/wifi.h @@ -55,7 +55,7 @@ int wifi_start_supplicant(int p2pSupported); * * @return 0 on success, < 0 on failure. */ -int wifi_stop_supplicant(); +int wifi_stop_supplicant(int p2pSupported); /** * Open a connection to supplicant on interface diff --git a/wifi/wifi.c b/wifi/wifi.c index d62b30f..b905897 100644 --- a/wifi/wifi.c +++ b/wifi/wifi.c @@ -604,11 +604,19 @@ int wifi_start_supplicant(int p2p_supported) return -1; } -int wifi_stop_supplicant() +int wifi_stop_supplicant(int p2p_supported) { char supp_status[PROPERTY_VALUE_MAX] = {'\0'}; int count = 50; /* wait at most 5 seconds for completion */ + if (p2p_supported) { + strcpy(supplicant_name, P2P_SUPPLICANT_NAME); + strcpy(supplicant_prop_name, P2P_PROP_NAME); + } else { + strcpy(supplicant_name, SUPPLICANT_NAME); + strcpy(supplicant_prop_name, SUPP_PROP_NAME); + } + /* Check whether supplicant already stopped */ if (property_get(supplicant_prop_name, supp_status, NULL) && strcmp(supp_status, "stopped") == 0) { @@ -625,6 +633,7 @@ int wifi_stop_supplicant() } usleep(100000); } + ALOGE("Failed to stop supplicant"); return -1; } -- cgit v1.1 From e912bfd79880ea5faac0fbcdb4e696125e151e18 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 31 Oct 2012 10:50:12 -0700 Subject: audio policy: direct output fix - DO NOT MERGE merge "Close a newly opened direct output if its parameters are invalid" from master Change-Id: I27ac015217480a854d25273ab9498949971b411a --- audio/AudioPolicyManagerBase.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index b4f4778..5d87399 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -1672,6 +1672,7 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device, ((profile->mFormats[0] == 0) && (profile->mChannelMasks.size() < 2))) { ALOGW("checkOutputsForDevice() direct output missing param"); + mpClientInterface->closeOutput(output); output = 0; } else { addOutput(output, desc); -- cgit v1.1 From da06cb6142faa3e09cbf7226ca9c75e45661095b Mon Sep 17 00:00:00 2001 From: John Grossman Date: Mon, 29 Oct 2012 18:42:43 -0700 Subject: audio policy: fix dynamic parameter - DO NOT MERGE merge from master: "Fix a parse error in checkOutputForDevice Fix a small parsing error in parsing the supported formats and sample rates of a stream out with dynamic values for these parameters. The channel mask parser was properly skipping the "=" in the setting string, but formats and sample rates were not (cauing the first reported format and sample rate to end up being skipped)" Change-Id: Id227a44f6b5fc0c223f2ce74f94ebb6abc5fa77d Signed-off-by: John Grossman --- audio/AudioPolicyManagerBase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index 5d87399..a082239 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -1642,7 +1642,7 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device, reply.string()); value = strpbrk((char *)reply.string(), "="); if (value != NULL) { - loadSamplingRates(value, profile); + loadSamplingRates(value + 1, profile); } } if (profile->mFormats[0] == 0) { @@ -1652,7 +1652,7 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device, reply.string()); value = strpbrk((char *)reply.string(), "="); if (value != NULL) { - loadFormats(value, profile); + loadFormats(value + 1, profile); } } if (profile->mChannelMasks[0] == 0) { -- cgit v1.1 From fe43d163d6646a175934f0752fa05e3e53e89da4 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Tue, 30 Oct 2012 16:14:04 -0700 Subject: audio policy: fix volume problem - DO NOT MERGE merge from master: "audio policy: fix volume change when disabling SCO commit 76e97d39 introduced a regression by having setDeviceConnectionState() force a device change on duplicated outputs even if the selected device is 0. This also forces a device 0 for the two outputs it is duplicated to, which may override a valid device selection on those outputs and apply default volumes. Bug 7429869." Change-Id: I37dd66343c54eb27e420089edbda04444fa1e2c6 --- audio/AudioPolicyManagerBase.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index a082239..19fff57 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -169,9 +169,12 @@ status_t AudioPolicyManagerBase::setDeviceConnectionState(audio_devices_t device updateDevicesAndOutputs(); for (size_t i = 0; i < mOutputs.size(); i++) { + // do not force device change on duplicated output because if device is 0, it will + // also force a device 0 for the two outputs it is duplicated to which may override + // a valid device selection on those outputs. setOutputDevice(mOutputs.keyAt(i), getNewDevice(mOutputs.keyAt(i), true /*fromCache*/), - true, + !mOutputs.valueAt(i)->isDuplicated(), 0); } -- cgit v1.1 From a7c17deb32fe28230b77b0dff17bb113088a5c16 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Wed, 7 Nov 2012 12:09:54 -0800 Subject: audio policy: notification delay - DO NOT MERGE merge from master: "audio policy: fix notification start delay The mechanism delaying notifications in case of muliple active outputs with long latencies must take into account recently paused audio tracks. Bug 7400428." Change-Id: I4ac9dfac81336e33f475b4f28df82713707d0c46 --- audio/AudioPolicyManagerBase.cpp | 19 ++++++++++++++++--- include/hardware_legacy/AudioPolicyManagerBase.h | 1 + 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index 19fff57..134fb3b 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -348,7 +348,7 @@ void AudioPolicyManagerBase::setPhoneState(int state) for (size_t i = 0; i < mOutputs.size(); i++) { AudioOutputDescriptor *desc = mOutputs.valueAt(i); //take the biggest latency for all outputs - if (delayMs < desc->mLatency*2) { + if (delayMs < (int)desc->mLatency*2) { delayMs = desc->mLatency*2; } //mute STRATEGY_MEDIA on all outputs @@ -702,8 +702,9 @@ status_t AudioPolicyManagerBase::startOutput(audio_io_handle_t output, } // wait for audio on other active outputs to be presented when starting // a notification so that audio focus effect can propagate. - if (shouldWait && (desc->refCount() != 0) && (waitMs < desc->latency())) { - waitMs = desc->latency(); + uint32_t latency = desc->latency(); + if (shouldWait && desc->isActive(latency * 2) && (waitMs < latency)) { + waitMs = latency; } } } @@ -3065,6 +3066,18 @@ audio_devices_t AudioPolicyManagerBase::AudioOutputDescriptor::supportedDevices( } } +bool AudioPolicyManagerBase::AudioOutputDescriptor::isActive(uint32_t inPastMs) const +{ + nsecs_t sysTime = systemTime(); + for (int i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) { + if (mRefCount[i] != 0 || + ns2ms(sysTime - mStopTime[i]) < inPastMs) { + return true; + } + } + return false; +} + status_t AudioPolicyManagerBase::AudioOutputDescriptor::dump(int fd) { const size_t SIZE = 256; diff --git a/include/hardware_legacy/AudioPolicyManagerBase.h b/include/hardware_legacy/AudioPolicyManagerBase.h index 451fe8a..b175670 100644 --- a/include/hardware_legacy/AudioPolicyManagerBase.h +++ b/include/hardware_legacy/AudioPolicyManagerBase.h @@ -250,6 +250,7 @@ protected: audio_devices_t supportedDevices(); uint32_t latency(); bool sharesHwModuleWith(const AudioOutputDescriptor *outputDesc); + bool isActive(uint32_t inPastMs) const; audio_io_handle_t mId; // output handle uint32_t mSamplingRate; // -- cgit v1.1