diff options
-rw-r--r-- | audio/AudioPolicyManagerBase.cpp | 18 | ||||
-rw-r--r-- | include/hardware_legacy/AudioPolicyManagerBase.h | 1 | ||||
-rw-r--r-- | include/hardware_legacy/gscan.h | 10 | ||||
-rw-r--r-- | include/hardware_legacy/wifi_hal.h | 12 | ||||
-rw-r--r-- | uevent/uevent.c | 1 | ||||
-rw-r--r-- | wifi/wifi.c | 14 |
6 files changed, 33 insertions, 23 deletions
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index 74070fd..85b0084 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -2854,7 +2854,22 @@ uint32_t AudioPolicyManagerBase::setOutputDevice(audio_io_handle_t output, if (device != AUDIO_DEVICE_NONE) { outputDesc->mDevice = device; + + // Force routing if previously asked for this output + if (outputDesc->mForceRouting) { + ALOGV("Force routing to current device as previous device was null for this output"); + force = true; + + // Request consumed. Reset mForceRouting to false + outputDesc->mForceRouting = false; + } } + else { + // Device is null and does not reflect the routing. Save the necessity to force + // re-routing upon next attempt to select a non-null device for this output + outputDesc->mForceRouting = true; + } + muteWaitMs = checkDeviceMuteStrategies(outputDesc, prevDevice, delayMs); // Do not change the routing if: @@ -3475,7 +3490,8 @@ AudioPolicyManagerBase::AudioOutputDescriptor::AudioOutputDescriptor( : 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) + mOutput1(0), mOutput2(0), mProfile(profile), mDirectOpenCount(0), + mForceRouting(false) { // clear usage count for all stream types for (int i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) { diff --git a/include/hardware_legacy/AudioPolicyManagerBase.h b/include/hardware_legacy/AudioPolicyManagerBase.h index 531a737..cf03f78 100644 --- a/include/hardware_legacy/AudioPolicyManagerBase.h +++ b/include/hardware_legacy/AudioPolicyManagerBase.h @@ -287,6 +287,7 @@ protected: bool mStrategyMutedByDevice[NUM_STRATEGIES]; // strategies muted because of incompatible // device selection. See checkDeviceMuteStrategies() uint32_t mDirectOpenCount; // number of clients using this output (direct outputs only) + bool mForceRouting; // Next routing for this output will be forced as current device routed is null }; // descriptor for audio inputs. Used to maintain current configuration of each opened audio input diff --git a/include/hardware_legacy/gscan.h b/include/hardware_legacy/gscan.h index 5d62dd9..c3cd8e5 100644 --- a/include/hardware_legacy/gscan.h +++ b/include/hardware_legacy/gscan.h @@ -16,11 +16,11 @@ typedef enum { WIFI_BAND_ABG_WITH_DFS = 7, // 2.4 GHz + 5 GHz with DFS } wifi_band; -const unsigned MAX_CHANNELS = 16; -const unsigned MAX_BUCKETS = 16; -const unsigned MAX_HOTLIST_APS = 128; -const unsigned MAX_SIGNIFICANT_CHANGE_APS = 64; -const unsigned MAX_PNO_SSID = 128; +#define MAX_CHANNELS 16 +#define MAX_BUCKETS 16 +#define MAX_HOTLIST_APS 128 +#define MAX_SIGNIFICANT_CHANGE_APS 64 +#define MAX_PNO_SSID 128; wifi_error wifi_get_valid_channels(wifi_interface_handle handle, int band, int max_channels, wifi_channel *channels, int *num_channels); diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h index be4e985..f4afb99 100644 --- a/include/hardware_legacy/wifi_hal.h +++ b/include/hardware_legacy/wifi_hal.h @@ -17,6 +17,10 @@ #ifndef __WIFI_HAL_H__ #define __WIFI_HAL_H__ +#ifdef __cplusplus +extern "C" +{ +#endif #include <stdint.h> typedef enum { @@ -47,10 +51,8 @@ typedef byte oui[3]; typedef int64_t wifi_timestamp; // In microseconds (us) typedef int64_t wifi_timespan; // In nanoseconds (ns) -struct wifi_info; -typedef wifi_info *wifi_handle; -struct wifi_interface_info; -typedef wifi_interface_info *wifi_interface_handle; +typedef struct wifi_info *wifi_handle; +typedef struct wifi_interface_info *wifi_interface_handle; /* Initialize/Cleanup */ @@ -131,5 +133,7 @@ wifi_error wifi_set_nodfs_flag(wifi_interface_handle handle, u32 nodfs); #include "wifi_config.h" #include "wifi_nan.h" +#ifdef __cplusplus +} #endif diff --git a/uevent/uevent.c b/uevent/uevent.c index b9e3557..e40aa2e 100644 --- a/uevent/uevent.c +++ b/uevent/uevent.c @@ -16,6 +16,7 @@ #include <hardware_legacy/uevent.h> +#include <malloc.h> #include <string.h> #include <unistd.h> #include <poll.h> diff --git a/wifi/wifi.c b/wifi/wifi.c index 87be8d8..3e99715 100644 --- a/wifi/wifi.c +++ b/wifi/wifi.c @@ -34,10 +34,9 @@ #include "cutils/misc.h" #include "cutils/properties.h" #include "private/android_filesystem_config.h" -#ifdef HAVE_LIBC_SYSTEM_PROPERTIES + #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ #include <sys/_system_properties.h> -#endif extern int do_dhcp(); extern int ifc_init(); @@ -405,10 +404,8 @@ int wifi_start_supplicant(int p2p_supported) { char supp_status[PROPERTY_VALUE_MAX] = {'\0'}; int count = 200; /* wait at most 20 seconds for completion */ -#ifdef HAVE_LIBC_SYSTEM_PROPERTIES const prop_info *pi; unsigned serial = 0, i; -#endif if (p2p_supported) { strcpy(supplicant_name, P2P_SUPPLICANT_NAME); @@ -447,7 +444,6 @@ int wifi_start_supplicant(int p2p_supported) /* Reset sockets used for exiting from hung state */ exit_sockets[0] = exit_sockets[1] = -1; -#ifdef HAVE_LIBC_SYSTEM_PROPERTIES /* * Get a reference to the status property, so we can distinguish * the case where it goes stopped => running => stopped (i.e., @@ -459,14 +455,12 @@ int wifi_start_supplicant(int p2p_supported) if (pi != NULL) { serial = __system_property_serial(pi); } -#endif property_get("wifi.interface", primary_iface, WIFI_TEST_INTERFACE); property_set("ctl.start", supplicant_name); sched_yield(); while (count-- > 0) { -#ifdef HAVE_LIBC_SYSTEM_PROPERTIES if (pi == NULL) { pi = __system_property_find(supplicant_prop_name); } @@ -483,12 +477,6 @@ int wifi_start_supplicant(int p2p_supported) } } } -#else - if (property_get(supplicant_prop_name, supp_status, NULL)) { - if (strcmp(supp_status, "running") == 0) - return 0; - } -#endif usleep(100000); } return -1; |