Update Ethernet code for the NetworkFactory serial number.
See aosp/708790
Bug: 18637384
Bug: 29030667
Test: manual
cts
runtest framework-net
atest frameworks/opt/net/ethernet/tests
Change-Id: I5caa4cb89ca1441f3c84b5675ceede6ecacfd132
This commit is contained in:
committed by
Aaron Huang
parent
54816c5fe2
commit
91456a8c7a
@@ -157,7 +157,7 @@ public class EthernetNetworkFactory extends NetworkFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NetworkInterfaceState iface = new NetworkInterfaceState(
|
NetworkInterfaceState iface = new NetworkInterfaceState(
|
||||||
ifaceName, hwAddress, mHandler, mContext, capabilities);
|
ifaceName, hwAddress, mHandler, mContext, capabilities, this);
|
||||||
iface.setIpConfig(ipConfiguration);
|
iface.setIpConfig(ipConfiguration);
|
||||||
mTrackingInterfaces.put(ifaceName, iface);
|
mTrackingInterfaces.put(ifaceName, iface);
|
||||||
|
|
||||||
@@ -248,6 +248,7 @@ public class EthernetNetworkFactory extends NetworkFactory {
|
|||||||
private final Handler mHandler;
|
private final Handler mHandler;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final NetworkInfo mNetworkInfo;
|
private final NetworkInfo mNetworkInfo;
|
||||||
|
private final NetworkFactory mNetworkFactory;
|
||||||
|
|
||||||
private static String sTcpBufferSizes = null; // Lazy initialized.
|
private static String sTcpBufferSizes = null; // Lazy initialized.
|
||||||
|
|
||||||
@@ -356,13 +357,15 @@ public class EthernetNetworkFactory extends NetworkFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NetworkInterfaceState(String ifaceName, String hwAddress, Handler handler, Context context,
|
NetworkInterfaceState(String ifaceName, String hwAddress, Handler handler, Context context,
|
||||||
@NonNull NetworkCapabilities capabilities) {
|
@NonNull NetworkCapabilities capabilities, NetworkFactory networkFactory) {
|
||||||
name = ifaceName;
|
name = ifaceName;
|
||||||
mCapabilities = checkNotNull(capabilities);
|
mCapabilities = checkNotNull(capabilities);
|
||||||
mHandler = handler;
|
mHandler = handler;
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
mNetworkFactory = networkFactory;
|
||||||
int legacyType = ConnectivityManager.TYPE_NONE;
|
int legacyType = ConnectivityManager.TYPE_NONE;
|
||||||
int[] transportTypes = mCapabilities.getTransportTypes();
|
int[] transportTypes = mCapabilities.getTransportTypes();
|
||||||
|
|
||||||
if (transportTypes.length > 0) {
|
if (transportTypes.length > 0) {
|
||||||
legacyType = getLegacyType(transportTypes[0]);
|
legacyType = getLegacyType(transportTypes[0]);
|
||||||
} else {
|
} else {
|
||||||
@@ -471,7 +474,7 @@ public class EthernetNetworkFactory extends NetworkFactory {
|
|||||||
// Create our NetworkAgent.
|
// Create our NetworkAgent.
|
||||||
mNetworkAgent = new NetworkAgent(mHandler.getLooper(), mContext,
|
mNetworkAgent = new NetworkAgent(mHandler.getLooper(), mContext,
|
||||||
NETWORK_TYPE, mNetworkInfo, mCapabilities, mLinkProperties,
|
NETWORK_TYPE, mNetworkInfo, mCapabilities, mLinkProperties,
|
||||||
getNetworkScore()) {
|
getNetworkScore(), mNetworkFactory.getSerialNumber()) {
|
||||||
public void unwanted() {
|
public void unwanted() {
|
||||||
if (this == mNetworkAgent) {
|
if (this == mNetworkAgent) {
|
||||||
stop();
|
stop();
|
||||||
|
|||||||
Reference in New Issue
Block a user