From 2cae13a872ae25ec37e0302ae9e9ca0e24c61686 Mon Sep 17 00:00:00 2001 From: Amarnath Hullur Subramanyam Date: Wed, 25 Mar 2015 12:40:33 -0700 Subject: Preallocating max buffer size for scan_result in wifi_cached_scan_results Android framework should provide a buffer to the wifihal which needs to be filled with scan_result. This commit will ensure that would happen by passing a fixed max buffer size as part of each wifi_cached_scan_results. Change-Id: I005dd39f26be62694c46369e16d5f7f89f64021d --- include/hardware_legacy/gscan.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/hardware_legacy/gscan.h b/include/hardware_legacy/gscan.h index 3d7d5da..b9b0f61 100644 --- a/include/hardware_legacy/gscan.h +++ b/include/hardware_legacy/gscan.h @@ -23,6 +23,7 @@ const unsigned MAX_SIGNIFICANT_CHANGE_APS = 64; const unsigned MAX_PNO_SSID = 64; const unsigned MAX_HOTLIST_SSID = 8; const unsigned MAX_BLACKLIST_BSSID = 16; +const unsigned MAX_AP_CACHE_PER_SCAN = 32; wifi_error wifi_get_valid_channels(wifi_interface_handle handle, int band, int max_channels, wifi_channel *channels, int *num_channels); @@ -120,7 +121,7 @@ typedef struct { // an exponential backoff bucket and the scan period will grow exponentially // as per formula: actual_period(N) = period ^ (N/(step_count+1)) // to a maximum period of max_period - int exponent; // for exponential back off bucket: multiplier: new_period = old_period * exponent + int exponent; // for exponential back off bucket: multiplier: new_period=old_period*exponent int step_count; // for exponential back off bucket, number of scans performed at a given // period and until the exponent is applied @@ -154,10 +155,11 @@ typedef enum { /* Get the GSCAN cached scan results */ typedef struct { - int scan_id; // a unique identifier for the scan unit - int flags; // a bitmask with additional information about scan - int num_results; // number of bssids retrieved by the scan - wifi_scan_result *results; // scan results - one for each bssid + int scan_id; // a unique identifier for the scan unit + int flags; // a bitmask with additional + // information about scan + int num_results; // number of bssids retrieved by the scan + wifi_scan_result results[MAX_AP_CACHE_PER_SCAN]; // scan results - one for each bssid } wifi_cached_scan_results; wifi_error wifi_get_cached_gscan_results(wifi_interface_handle iface, byte flush, -- cgit v1.1