summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2013-02-12 22:38:11 -0800
committerSteve Kondik <shade@chemlab.org>2013-02-12 22:38:11 -0800
commit6c8bc31ebe68911a97c450e123e08f3881cd80ce (patch)
tree9486f51f5f4f23a6c0fc2ba856cba832438d38c3
parent4ab7bb48a4a0d4cecd4e3f5de6d88075a7b20f48 (diff)
parenta7c17deb32fe28230b77b0dff17bb113088a5c16 (diff)
downloadhardware_libhardware_legacy-6c8bc31ebe68911a97c450e123e08f3881cd80ce.tar.gz
hardware_libhardware_legacy-6c8bc31ebe68911a97c450e123e08f3881cd80ce.tar.bz2
hardware_libhardware_legacy-6c8bc31ebe68911a97c450e123e08f3881cd80ce.zip
Merge tag 'android-4.2.2_r1' of https://android.googlesource.com/platform/hardware/libhardware_legacy into 1.1
Android 4.2.2 release 1
-rw-r--r--audio/AudioPolicyManagerBase.cpp29
-rw-r--r--include/hardware_legacy/AudioPolicyManagerBase.h1
-rw-r--r--include/hardware_legacy/wifi.h2
-rw-r--r--wifi/wifi.c11
4 files changed, 35 insertions, 8 deletions
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp
index a73a5b9..722bbd3 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);
}
@@ -345,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
@@ -704,8 +707,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;
}
}
}
@@ -1667,7 +1671,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) {
@@ -1677,7 +1681,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) {
@@ -1697,6 +1701,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);
@@ -3095,6 +3100,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 47ee3c3..16c3b16 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; //
diff --git a/include/hardware_legacy/wifi.h b/include/hardware_legacy/wifi.h
index 01d73e4..1233730 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 b21bfb4..b51dab0 100644
--- a/wifi/wifi.c
+++ b/wifi/wifi.c
@@ -888,11 +888,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) {
@@ -909,6 +917,7 @@ int wifi_stop_supplicant()
}
usleep(100000);
}
+ ALOGE("Failed to stop supplicant");
return -1;
}