WifiScanningService: Cache only results of full single scans
Change the single scan results caching logic inside WifiScanner:
1. Only cache scan results if they were for full scans. We've expanded
the meaning of "full scans" to include both 2g + 5g and 2g + 5g + dfs.
2. Filter out any scan results from the cache if they're over 3 minutes
old.
The motivation of this CL is to solve these problems:
1. Do not overwrite full scan results requested by an external app (ex.
Settings) with results from a partial scan
(ex. from WifiConnectivityManager).
This avoids the race condition where the settings app performs
a scan and gets a partial list of results back because it was ovewritten
by an internal partial scan request in between.
2. Scan results retrieved by apps will not contain stale scan
results. In N, wpa_supplicant evicted any scan results which were older
than 3 minutes from the cache. So, this CL restores that behavior.
Bug: 38212080
Test: Verified that both the settings and wifi wake is working properly
with the fix.
Test: Will send for full regression tests (b/62711875).
Test: New unit tests to verify that the partial scan results don't
override the cache.
Test: Modified existing unit tests to account for the change in
behavior. The broadcast (and cache) is now only updated on full scans.
Some of the tests were modified to produce full scan results, while the
other tests expectations were modified for partial scan results.
Change-Id: I4d6fb994d50995434f76218386272aa2562476fe
3 files changed