WifiNetworkFactory: Stop scanning once user selects a network

Once the user selects one of the matched networks (or was pre-approved),
there is no need to continue scanning. Scanning while connecting could
lead to disruption in the connection (because the chip needs to go
off-channel when connecting/DHCP). Previously, we were cancelling
periodic scans only after the connection is established.

Also, reset |IsTimerSet| boolean when the corresponding timers fire.

Bug: 157603386
Test: atest com.android.server.wifi
Test: act.py -c wifi_manager_cross.config -tb dut-name -tc
WifiNetworkRequestTest
Test: Manually verified that scans are stopped after user selection.

Change-Id: I88af4e2d3f2331ba41bacea6fb6b9936e8db88a8
2 files changed