Add TetherConfigParcel to improve startTetheringWithConfiguration

In order to support extensibility, update the interface between
netd to take a configuration parcel, instead of fixed
parameters.

Bug: 145777247
Test: atest FrameworksNetTests
Test: build, flash, on/off tethering
Change-Id: I3dbccc46ce4ddccfb6d518de240e4604b7f95eed
This commit is contained in:
Chiachang Wang
2019-12-10 10:07:12 +08:00
parent 932dda858a
commit afd43e48c6

View File

@@ -57,6 +57,7 @@ import android.net.NetworkPolicyManager;
import android.net.NetworkStats;
import android.net.NetworkUtils;
import android.net.RouteInfo;
import android.net.TetherConfigParcel;
import android.net.TetherStatsParcel;
import android.net.UidRange;
import android.net.UidRangeParcel;
@@ -1016,7 +1017,10 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
// an odd number of addrs will fail
try {
mNetdService.tetherStartWithConfiguration(usingLegacyDnsProxy, dhcpRange);
final TetherConfigParcel config = new TetherConfigParcel();
config.usingLegacyDnsProxy = usingLegacyDnsProxy;
config.dhcpRanges = dhcpRange;
mNetdService.tetherStartWithConfiguration(config);
} catch (RemoteException | ServiceSpecificException e) {
throw new IllegalStateException(e);
}