WifiNetworkFactory: Use the latest cached scan results

Before starting scans for processing a network request, fetch the latest
cached scan results to speed up the matching process. The cached scan
results are filtered out to remove scan results that are older than 20
seconds.

As long as there was a previous scan in the last 20 seconds, there are 2
benefits with this change:
a) There is currently a delay of 2-3 seconds after the request
where the user sees a blank screen when platform is performing
the first scan. This can be avoided and we can present the user with
matches immediately when the request is received.
b) If the request is for a specific bssid and there is an approved match
in the cached scan results, then we can bypass the UI and trigger connection.

Also, renames "PreviouslyApproved" -> "Approved" in test name to ensure
the test names fit in one line :)

Bug: 134712530
Test: atest com.android.server.wifi
Test: Manually verified with CtsVerifier tests that the UI does not
start out with a blank page (because the matched networks are already
found by using the cached results).

Change-Id: I7a788777aabd11562077be88fcc4c9cd45e5b9ab
Merged-In: I7a788777aabd11562077be88fcc4c9cd45e5b9ab
(cherry-picked from 0ab35f26f0da8885a5d249a678187993da425447)
2 files changed
tree: 0e8aff9479404eedb78d7b13adbe802db2082da8
  1. service/
  2. PREUPLOAD.cfg