Force reconnect in connectToWifi

There is no guarantee that Wifi will automatically reconnect after
enabling, especially in cases where no internet access was detected on
the access point the last time it was connected.

Use WifiManager#reconnect to force wifi to reconnect to the access
point. The API is deprecated for general use, but system apps are
documented as exempted from the deprecation.

See https://r.android.com/c/platform/cts/+/1295308

Bug: 138253466
Test: atest --rerun-until-failure 200 android.jobscheduler.cts.ConnectivityConstraintTest
Change-Id: I9e38419d6097538634a42af9572d79c774723f6d
1 file changed