Revert part of 79eb7ba87b am: fd99009c52
Change-Id: Idcdfbe614f49183d38801ce4d1dd4b16de1d73b8
This commit is contained in:
@@ -32,7 +32,6 @@ import android.net.NetworkAgentConfig;
|
|||||||
import android.net.NetworkCapabilities;
|
import android.net.NetworkCapabilities;
|
||||||
import android.net.NetworkFactory;
|
import android.net.NetworkFactory;
|
||||||
import android.net.NetworkRequest;
|
import android.net.NetworkRequest;
|
||||||
import android.net.NetworkScore;
|
|
||||||
import android.net.NetworkSpecifier;
|
import android.net.NetworkSpecifier;
|
||||||
import android.net.StringNetworkSpecifier;
|
import android.net.StringNetworkSpecifier;
|
||||||
import android.net.ip.IIpClient;
|
import android.net.ip.IIpClient;
|
||||||
@@ -66,9 +65,6 @@ public class EthernetNetworkFactory extends NetworkFactory {
|
|||||||
|
|
||||||
private final static int NETWORK_SCORE = 70;
|
private final static int NETWORK_SCORE = 70;
|
||||||
private static final String NETWORK_TYPE = "Ethernet";
|
private static final String NETWORK_TYPE = "Ethernet";
|
||||||
private final static NetworkScore NULL_SCORE = new NetworkScore.Builder()
|
|
||||||
.setRange(NetworkScore.RANGE_CLOSE)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
private final ConcurrentHashMap<String, NetworkInterfaceState> mTrackingInterfaces =
|
private final ConcurrentHashMap<String, NetworkInterfaceState> mTrackingInterfaces =
|
||||||
new ConcurrentHashMap<>();
|
new ConcurrentHashMap<>();
|
||||||
@@ -420,23 +416,23 @@ public class EthernetNetworkFactory extends NetworkFactory {
|
|||||||
* This function is called with the purpose of assigning and updating the network score of
|
* This function is called with the purpose of assigning and updating the network score of
|
||||||
* the member NetworkAgent.
|
* the member NetworkAgent.
|
||||||
*/
|
*/
|
||||||
private NetworkScore getNetworkScore() {
|
private int getNetworkScore() {
|
||||||
// never set the network score below 0.
|
// never set the network score below 0.
|
||||||
if (!mLinkUp) {
|
if (!mLinkUp) {
|
||||||
return NULL_SCORE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] transportTypes = mCapabilities.getTransportTypes();
|
int[] transportTypes = mCapabilities.getTransportTypes();
|
||||||
if (transportTypes.length < 1) {
|
if (transportTypes.length < 1) {
|
||||||
Log.w(TAG, "Network interface '" + mLinkProperties.getInterfaceName() + "' has no "
|
Log.w(TAG, "Network interface '" + mLinkProperties.getInterfaceName() + "' has no "
|
||||||
+ "transport type associated with it. Score set to zero");
|
+ "transport type associated with it. Score set to zero");
|
||||||
return NULL_SCORE;
|
return 0;
|
||||||
}
|
}
|
||||||
TransportInfo transportInfo = sTransports.get(transportTypes[0], /* if dne */ null);
|
TransportInfo transportInfo = sTransports.get(transportTypes[0], /* if dne */ null);
|
||||||
if (transportInfo != null) {
|
if (transportInfo != null) {
|
||||||
return new NetworkScore.Builder().setLegacyScore(transportInfo.mScore).build();
|
return transportInfo.mScore;
|
||||||
}
|
}
|
||||||
return NULL_SCORE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void start() {
|
private void start() {
|
||||||
@@ -467,7 +463,6 @@ public class EthernetNetworkFactory extends NetworkFactory {
|
|||||||
mLinkProperties = linkProperties;
|
mLinkProperties = linkProperties;
|
||||||
|
|
||||||
// Create our NetworkAgent.
|
// Create our NetworkAgent.
|
||||||
// STOPSHIP : use the new constructor for NetworkAgent that takes a NetworkScore
|
|
||||||
final NetworkAgentConfig config = new NetworkAgentConfig.Builder()
|
final NetworkAgentConfig config = new NetworkAgentConfig.Builder()
|
||||||
.setLegacyType(mLegacyType)
|
.setLegacyType(mLegacyType)
|
||||||
.setLegacyTypeName(NETWORK_TYPE)
|
.setLegacyTypeName(NETWORK_TYPE)
|
||||||
|
|||||||
Reference in New Issue
Block a user