Prefer default Internet network for upstream tethering.

Rather than use the crufty config.xml list of upstream transport types,
use ConnectivityService's notion of the default network for the upstream.
In cases where a DUN network is required and the default network is
currently a mobile network, look for a DUN network (code in Tethering
is currently responsible for requesting one).

Test: as follows
    - built, flashed, booted
    - runtest frameworks-net
    - tethered via mobile, joined captive portal network, maintained
      laptop access via mobile until captive passed (then used wifi)
    - disabled client mode wifi, disabled mobile data, plugged in
      ethernet adapter, observed connectivity via ethernet
Bug: 32163131
Bug: 62648872
Bug: 63282480
Bug: 109786760
Bug: 110118584
Bug: 110260419
Change-Id: I925b75994e31df8046f3ef9916a2457b4210485e
This commit is contained in:
Erik Kline
2018-06-14 17:36:40 +09:00
parent 6adee26d73
commit 359d4c6d61

View File

@@ -925,6 +925,10 @@ public class ConnectivityService extends IConnectivityManager.Stub
public boolean isTetheringSupported() {
return ConnectivityService.this.isTetheringSupported();
}
@Override
public NetworkRequest getDefaultNetworkRequest() {
return mDefaultRequest;
}
};
return new Tethering(mContext, mNetd, mStatsService, mPolicyManager,
IoThread.get().getLooper(), new MockableSystemProperties(),
@@ -942,7 +946,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
private NetworkRequest createDefaultInternetRequestForTransport(
int transportType, NetworkRequest.Type type) {
NetworkCapabilities netCap = new NetworkCapabilities();
final NetworkCapabilities netCap = new NetworkCapabilities();
netCap.addCapability(NET_CAPABILITY_INTERNET);
netCap.addCapability(NET_CAPABILITY_NOT_RESTRICTED);
if (transportType > -1) {