Move captive portal detection to another thread

isCaptivePortal() could take up to a minute. Resolving the
server's IP addresses could hit the DNS timeout, and attempting
connections to each of the server's several IP addresses
(currently one IPv4 and IPv6) could each take SOCKET_TIMEOUT_MS.
During this time this StateMachine will be unresponsive. Thus,
move detection to another thread.

Test: - runtest frameworks-net
      - run cts -m CtsNetTestCases
        -t android.net.cts.ConnectivityManagerTest
      - manual test(VALIDATION_SUCCESS, VALIDATION_FAILED,
        NETWORK_CAPTIVE_PORTAL_FOUND, bad network reported)
Bug: 113916551

Change-Id: I5ac39dc826acd26c64adaaa0b27a76cd7c7fd843
1 file changed