WifiManager#getCurrentNetwork: return null if not L3 connected

According to the API contract of Network, Wifi should not
expose a Network object before it is L3 connected.

Previously, getCurrentNetwork returned a non-null Network
object after L2ConnectedState. Changed to only return a
Network object in ConnectedState/RoamingState. Return null in
all other states.

Note that getCurrentNetwork was marked as @Nullable and
did return null when Wifi was disconnected, so callers should
be able to handle this change in behavior.

Bug: 150188453
Test: connect to network using SUW
Test: connect/disconnect to network using Settings
Test: atest ClientModeImplTest
Change-Id: Ib65664b7925176bc34287d37bcd1ba1085c351a4
Merged-In: Ib65664b7925176bc34287d37bcd1ba1085c351a4
(dirty cherry-pick from master)
3 files changed