Fix and deflake ConnectivityManagerTest

 - Migrate the test to JUnit4, as JUnit3 cannot use assumeTrue
 - Skip IPv4 keepalive tests on networks that do not have native IPv4.
 - Refactor usage of adoptShellPermissionIdentity to use try / finally
   or runAsShellPermissionIdentity: test failures could lead to
   permission failures in other tests due to mismatched adopt/drop.
 - Fix ensureWifiConnected to support the "wifi enabled but not fully
   connected" case.

Bug: 150949391
Test: atest CtsNetTestCasesLatestSdk:ConnectivityManagerTest \
      --rerun-until-failure 50
Original-Change: https://android-review.googlesource.com/1310419
Merged-In: I7459753b1068e1760a95337760db58d1df213fad
Change-Id: I7459753b1068e1760a95337760db58d1df213fad
1 file changed
tree: c88fbb3a0f9eb7f33367c69c171ccf2d2977a2e5
  1. tests/