WifiNetworkFactory: Trigger connection immediately if pre-approved

If a network is pre-approved for an app (either by the user or via
CompanionDeviceManager), we currently issue a scan to ensure that the
network is around if there is no fresh cached results. This causes us
to bring up the UI (since we don't want to scan on behalf of the apps
without UI attribution).  Instead, if the network requested was already
pre-approved, directly trigger a connection. This will ensure that the
platform does not need to trigger a scan for finding the requested
network. So, there is no need to bring up the UI for apps triggering
connection to networks which have been pre-approved

Bug: 155218555
Test: atest com.android.server.wifi
Test: act.py -c wifi_manager_cross.config -tb dut-name -tc
WifiNetworkRequestTest

Change-Id: If1baf014bf8b5e8cbfa326660b9a401486d7bab6
2 files changed