From 4cf4059cd99aafc33de0f8315b00345062baea95 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Tue, 7 Mar 2017 11:17:08 -0800 Subject: [PATCH] wifi: Fetch the gscan bucket idx from request We can't rely on the ordering of these buckets to populate their indexes. So, send them explicitly from the caller. Bug: 35989680 Test: Compiles Change-Id: Ife09440935eb3526636c27bfdd40c37c69c7ade2 --- wifi/1.0/default/hidl_struct_util.cpp | 5 ++++- wifi/1.0/types.hal | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/wifi/1.0/default/hidl_struct_util.cpp b/wifi/1.0/default/hidl_struct_util.cpp index 485ae7ea81..5917efc6b2 100644 --- a/wifi/1.0/default/hidl_struct_util.cpp +++ b/wifi/1.0/default/hidl_struct_util.cpp @@ -354,7 +354,10 @@ bool convertHidlGscanParamsToLegacy( hidl_scan_params.buckets[bucket_idx]; legacy_hal::wifi_scan_bucket_spec& legacy_bucket_spec = legacy_scan_params->buckets[bucket_idx]; - legacy_bucket_spec.bucket = bucket_idx; + if (hidl_bucket_spec.bucketIdx >= MAX_BUCKETS) { + return false; + } + legacy_bucket_spec.bucket = hidl_bucket_spec.bucketIdx; legacy_bucket_spec.band = convertHidlWifiBandToLegacy(hidl_bucket_spec.band); legacy_bucket_spec.period = hidl_bucket_spec.periodInMs; diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal index 83e6660430..d90d5be742 100644 --- a/wifi/1.0/types.hal +++ b/wifi/1.0/types.hal @@ -319,6 +319,11 @@ enum StaScanLimits : uint32_t { * scan requests. */ struct StaBackgroundScanBucketParameters { + /** + * Bucket index. This index is used to report results in + * |StaScanData.bucketsScanned|. + */ + uint32_t bucketIdx; /** * Bands to scan or |BAND_UNSPECIFIED| if frequencies list must be used * instead.