Hack to force ConnectivityService to maintain 2 Wifi connections

File a NetworkRequest for a NetworkCapability that can
only be matched by the second connection, and mark the
connection's NetworkAgent with the same NetworkCapability,
thus forcing ConnectivityService to keep the second
connection around.

When the second connection is no longer needed, rescind
the NetworkRequest. This will cause the second connection
to go into lingering mode (as it no longer matches any
NetworkRequest), then disconnect once the linger period
completes.

Note: This will be reverted before Android S release and
replaced with an officially supported solution in
ConnectivityService.

Bug: 160346062
Bug: 177373513
Test: manual
Change-Id: I952920307a6c4a91e2d035f7a46d8a52f786e6e1
4 files changed