Optimize ignore connection to same network

When WifiService send "CONNECT_NETWORK" msg,the netId is -1.
ClientModeImpl receives it and sometimes transitions to
disconnect state during ObtainingIpState. But does not disconnect the
the wpa_supplicant's connection. This may cause state difference between
ClientModeImpl and wpa_supplicant.
So when ClientModeImpl receives the msg, get the real netId and
if the netId is the same network,ignore connection.

Refactored ClientModeImpl's handling of connect, save, forget to avoid
duplicate handling of CONNECT_NETWORK in multiple states in
StateMachine.

Bug: 141161989
Test: atest com.android.server.wifi.ClientModeImplTest
Test: Verified that we can connect to different network even when we're
in middle of DHCP.

Change-Id: I605c939bfd662d6c596ba13e104c02e2cd773ca7
3 files changed
tree: d1c9fa61c62a358de6a4ea608dc5de32402c3684
  1. service/
  2. PREUPLOAD.cfg