Do not trigger scan for reconnect() when wifi is connected

According to the document of WifiManager.reconnect(), we only
try to connect when wifi is disconnected.
This CL adds the handling of CMD_RECONNECT in WifiStateMachine
for L2ConnectedState to avoid unnecessary scans and connection
attempts.
This also adds the handling of CMD_RECONNECT for WpsRunningState,
which just logs and ignores this command because in WpsRunningSate
we are attempting to connect and when we leave and head to disconnected
state, we will trigger a scan anyway.

Bug: 65839442
Test: compile, unit tests
Test:
1. Write a simple cts test case WifiManagerTest#testWifiReconnect
    only calling WifiManager.reconnect()
2. Make sure wifi is connected
3. Run cts test using:
cts-tradefed run cts -m CtsNetTestCases -t
    android.net.wifi.cts.WifiManagerTest#testWifiReconnect
4. Grab bugreport
5. Verify the following log appears:
"Ignore CMD_RECONNECT request because wifi is already connected"

Change-Id: I7aa7842653aa4eaf8d70946dc8e120d3814ffc09
2 files changed