summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java7
-rw-r--r--service/java/com/android/server/wifi/WifiScoreReport.java10
-rw-r--r--service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java8
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java20
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java20
-rw-r--r--tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java10
6 files changed, 28 insertions, 47 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index a1cdbf771..04f805b6e 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -54,7 +54,6 @@ import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.net.NetworkInfo.DetailedState;
import android.net.NetworkProvider;
-import android.net.NetworkScore;
import android.net.SocketKeepalive;
import android.net.StaticIpConfiguration;
import android.net.TcpKeepalivePacketData;
@@ -4395,7 +4394,7 @@ public class ClientModeImpl extends StateMachine {
private class WifiNetworkAgent extends NetworkAgent {
WifiNetworkAgent(Context c, Looper l, String tag, NetworkCapabilities nc, LinkProperties lp,
- NetworkScore score, NetworkAgentConfig config, NetworkProvider provider) {
+ int score, NetworkAgentConfig config, NetworkProvider provider) {
super(c, l, tag, nc, lp, score, config, provider);
register();
}
@@ -4573,11 +4572,9 @@ public class ClientModeImpl extends StateMachine {
.setPartialConnectivityAcceptable(config.noInternetAccessExpected)
.build();
final NetworkCapabilities nc = getCapabilities(getCurrentWifiConfiguration());
- // STOPSHIP (b/148055573) : use a real NetworkScore when it's done
- final NetworkScore ns = mWifiScoreReport.getNetworkScoreForLegacyInt(60);
synchronized (mNetworkAgentLock) {
mNetworkAgent = new WifiNetworkAgent(mContext, getHandler().getLooper(),
- "WifiNetworkAgent", nc, mLinkProperties, ns, naConfig,
+ "WifiNetworkAgent", nc, mLinkProperties, 60, naConfig,
mNetworkFactory.getProvider());
}
mWifiScoreReport.setNetworkAgent(mNetworkAgent);
diff --git a/service/java/com/android/server/wifi/WifiScoreReport.java b/service/java/com/android/server/wifi/WifiScoreReport.java
index 306088a90..200499b34 100644
--- a/service/java/com/android/server/wifi/WifiScoreReport.java
+++ b/service/java/com/android/server/wifi/WifiScoreReport.java
@@ -18,7 +18,6 @@ package com.android.server.wifi;
import android.net.Network;
import android.net.NetworkAgent;
-import android.net.NetworkScore;
import android.net.wifi.IScoreChangeCallback;
import android.net.wifi.IWifiConnectedNetworkScorer;
import android.net.wifi.WifiInfo;
@@ -89,7 +88,7 @@ public class WifiScoreReport {
return;
}
if (mNetworkAgent != null) {
- mNetworkAgent.sendNetworkScore(getNetworkScoreForLegacyInt(score));
+ mNetworkAgent.sendNetworkScore(score);
}
long millis = mClock.getWallClockMillis();
@@ -273,11 +272,6 @@ public class WifiScoreReport {
mVerboseLoggingEnabled = enable;
}
- NetworkScore getNetworkScoreForLegacyInt(int legacyScore) {
- // STOPSHIP (b/148055573) : use a real NetworkScore when it's done
- return new NetworkScore.Builder().setLegacyScore(legacyScore).build();
- }
-
/**
* Calculate wifi network score based on updated link layer stats and send the score to
* the WifiNetworkAgent.
@@ -351,7 +345,7 @@ public class WifiScoreReport {
//report score
if (score != mWifiInfo.getScore()) {
if (mNetworkAgent != null) {
- mNetworkAgent.sendNetworkScore(getNetworkScoreForLegacyInt(score));
+ mNetworkAgent.sendNetworkScore(score);
}
}
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java b/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java
index c6c58c40b..0bbd2193e 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java
@@ -34,7 +34,6 @@ import android.net.NetworkCapabilities;
import android.net.NetworkFactory;
import android.net.NetworkProvider;
import android.net.NetworkRequest;
-import android.net.NetworkScore;
import android.net.NetworkSpecifier;
import android.net.RouteInfo;
import android.net.wifi.aware.TlvBufferUtils;
@@ -645,13 +644,10 @@ public class WifiAwareDataPathStateManager {
.setLegacyType(ConnectivityManager.TYPE_NONE)
.setLegacyTypeName(NETWORK_TAG)
.build();
- final NetworkScore ns = new NetworkScore.Builder()
- .setLegacyScore(NETWORK_FACTORY_SCORE_AVAIL)
- .build();
nnri.networkAgent = new WifiAwareNetworkAgent(mLooper, mContext,
AGENT_TAG_PREFIX + nnri.ndpId,
- networkCapabilities, linkProperties, ns,
+ networkCapabilities, linkProperties, NETWORK_FACTORY_SCORE_AVAIL,
naConfig, mNetworkFactory.getProvider(), nnri);
nnri.startValidationTimestamp = mClock.getElapsedSinceBootMillis();
handleAddressValidation(nnri, linkProperties, ndpId, networkSpecifier.isOutOfBand());
@@ -1023,7 +1019,7 @@ public class WifiAwareDataPathStateManager {
private AwareNetworkRequestInformation mAwareNetworkRequestInfo;
WifiAwareNetworkAgent(Looper looper, Context context, String logTag,
- NetworkCapabilities nc, LinkProperties lp, NetworkScore score,
+ NetworkCapabilities nc, LinkProperties lp, int score,
NetworkAgentConfig config, NetworkProvider provider,
AwareNetworkRequestInformation anri) {
super(context, looper, logTag, nc, lp, score, config, provider);
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
index 737980f2f..0a354103d 100644
--- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
@@ -525,7 +525,7 @@ public class ClientModeImplTest extends WifiBaseTest {
mIpClientCallback.onQuit();
return null;
}).when(mIpClient).shutdown();
- when(mConnectivityManager.registerNetworkAgent(any(), any(), any(), any(), any(), any(),
+ when(mConnectivityManager.registerNetworkAgent(any(), any(), any(), any(), anyInt(), any(),
anyInt())).thenReturn(mock(Network.class));
List<SubscriptionInfo> subList = new ArrayList<>() {{
add(mock(SubscriptionInfo.class));
@@ -2415,7 +2415,7 @@ public class ClientModeImplTest extends WifiBaseTest {
ArgumentCaptor.forClass(NetworkAgentConfig.class);
verify(mConnectivityManager).registerNetworkAgent(messengerCaptor.capture(),
any(NetworkInfo.class), any(LinkProperties.class), any(NetworkCapabilities.class),
- any(), configCaptor.capture(), anyInt());
+ anyInt(), configCaptor.capture(), anyInt());
registerAsyncChannel((x) -> {
mNetworkAgentAsyncChannel = x;
@@ -2519,7 +2519,7 @@ public class ClientModeImplTest extends WifiBaseTest {
ArgumentCaptor<Messenger> messengerCaptor = ArgumentCaptor.forClass(Messenger.class);
verify(mConnectivityManager).registerNetworkAgent(messengerCaptor.capture(),
any(NetworkInfo.class), any(LinkProperties.class), any(NetworkCapabilities.class),
- any(), any(NetworkAgentConfig.class), anyInt());
+ anyInt(), any(NetworkAgentConfig.class), anyInt());
ArrayList<Integer> thresholdsArray = new ArrayList<>();
thresholdsArray.add(RSSI_THRESHOLD_MAX);
@@ -3145,7 +3145,7 @@ public class ClientModeImplTest extends WifiBaseTest {
ArgumentCaptor<Messenger> messengerCaptor = ArgumentCaptor.forClass(Messenger.class);
verify(mConnectivityManager).registerNetworkAgent(messengerCaptor.capture(),
any(NetworkInfo.class), any(LinkProperties.class), any(NetworkCapabilities.class),
- any(), any(NetworkAgentConfig.class), anyInt());
+ anyInt(), any(NetworkAgentConfig.class), anyInt());
Message message = new Message();
message.what = NetworkAgent.CMD_REPORT_NETWORK_STATUS;
@@ -3372,7 +3372,7 @@ public class ClientModeImplTest extends WifiBaseTest {
ArgumentCaptor<Messenger> messengerCaptor = ArgumentCaptor.forClass(Messenger.class);
verify(mConnectivityManager).registerNetworkAgent(messengerCaptor.capture(),
any(NetworkInfo.class), any(LinkProperties.class), any(NetworkCapabilities.class),
- any(), any(NetworkAgentConfig.class), anyInt());
+ anyInt(), any(NetworkAgentConfig.class), anyInt());
WifiConfiguration currentNetwork = new WifiConfiguration();
currentNetwork.networkId = FRAMEWORK_NETWORK_ID;
@@ -3410,7 +3410,7 @@ public class ClientModeImplTest extends WifiBaseTest {
ArgumentCaptor<Messenger> messengerCaptor = ArgumentCaptor.forClass(Messenger.class);
verify(mConnectivityManager).registerNetworkAgent(messengerCaptor.capture(),
any(NetworkInfo.class), any(LinkProperties.class), any(NetworkCapabilities.class),
- any(), any(NetworkAgentConfig.class), anyInt());
+ anyInt(), any(NetworkAgentConfig.class), anyInt());
WifiConfiguration currentNetwork = new WifiConfiguration();
currentNetwork.networkId = FRAMEWORK_NETWORK_ID;
@@ -3445,7 +3445,7 @@ public class ClientModeImplTest extends WifiBaseTest {
ArgumentCaptor<Messenger> messengerCaptor = ArgumentCaptor.forClass(Messenger.class);
verify(mConnectivityManager).registerNetworkAgent(messengerCaptor.capture(),
any(NetworkInfo.class), any(LinkProperties.class), any(NetworkCapabilities.class),
- any(), any(NetworkAgentConfig.class), anyInt());
+ anyInt(), any(NetworkAgentConfig.class), anyInt());
WifiConfiguration currentNetwork = new WifiConfiguration();
currentNetwork.networkId = FRAMEWORK_NETWORK_ID;
@@ -3482,7 +3482,7 @@ public class ClientModeImplTest extends WifiBaseTest {
ArgumentCaptor<Messenger> messengerCaptor = ArgumentCaptor.forClass(Messenger.class);
verify(mConnectivityManager).registerNetworkAgent(messengerCaptor.capture(),
any(NetworkInfo.class), any(LinkProperties.class), any(NetworkCapabilities.class),
- any(), any(NetworkAgentConfig.class), anyInt());
+ anyInt(), any(NetworkAgentConfig.class), anyInt());
when(mWifiConfigManager.getLastSelectedNetwork()).thenReturn(FRAMEWORK_NETWORK_ID + 1);
@@ -3515,7 +3515,7 @@ public class ClientModeImplTest extends WifiBaseTest {
ArgumentCaptor.forClass(NetworkCapabilities.class);
verify(mConnectivityManager).registerNetworkAgent(any(Messenger.class),
any(NetworkInfo.class), any(LinkProperties.class),
- networkCapabilitiesCaptor.capture(), any(), any(NetworkAgentConfig.class),
+ networkCapabilitiesCaptor.capture(), anyInt(), any(NetworkAgentConfig.class),
anyInt());
NetworkCapabilities networkCapabilities = networkCapabilitiesCaptor.getValue();
@@ -3541,7 +3541,7 @@ public class ClientModeImplTest extends WifiBaseTest {
ArgumentCaptor.forClass(NetworkCapabilities.class);
verify(mConnectivityManager).registerNetworkAgent(any(Messenger.class),
any(NetworkInfo.class), any(LinkProperties.class),
- networkCapabilitiesCaptor.capture(), any(), any(NetworkAgentConfig.class),
+ networkCapabilitiesCaptor.capture(), anyInt(), any(NetworkAgentConfig.class),
anyInt());
NetworkCapabilities networkCapabilities = networkCapabilitiesCaptor.getValue();
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
index 33dbcd1ca..d83f76c4a 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java
@@ -29,7 +29,6 @@ import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.atMost;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
@@ -45,7 +44,6 @@ import android.net.Network;
import android.net.NetworkAgent;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
-import android.net.NetworkScore;
import android.net.wifi.IScoreChangeCallback;
import android.net.wifi.IWifiConnectedNetworkScorer;
import android.net.wifi.WifiConfiguration;
@@ -188,7 +186,7 @@ public class WifiScoreReportTest extends WifiBaseTest {
when(mContext.getResources()).thenReturn(mResources);
final ConnectivityManager cm = mock(ConnectivityManager.class);
when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(cm);
- when(cm.registerNetworkAgent(any(), any(), any(), any(), any(), any(), anyInt()))
+ when(cm.registerNetworkAgent(any(), any(), any(), any(), anyInt(), any(), anyInt()))
.thenReturn(mock(Network.class));
mNetworkAgent = spy(new TestNetworkAgent(mContext));
mClock = new FakeClock();
@@ -219,7 +217,7 @@ public class WifiScoreReportTest extends WifiBaseTest {
public void calculateAndReportScoreSucceeds() throws Exception {
mWifiInfo.setRssi(-77);
mWifiScoreReport.calculateAndReportScore();
- verify(mNetworkAgent).sendNetworkScore(any());
+ verify(mNetworkAgent).sendNetworkScore(anyInt());
verify(mWifiMetrics).incrementWifiScoreCount(anyInt());
}
@@ -233,7 +231,7 @@ public class WifiScoreReportTest extends WifiBaseTest {
public void calculateAndReportScoreDoesNotReportWhenRssiIsNotValid() throws Exception {
mWifiInfo.setRssi(WifiInfo.INVALID_RSSI);
mWifiScoreReport.calculateAndReportScore();
- verify(mNetworkAgent, never()).sendNetworkScore(any());
+ verify(mNetworkAgent, never()).sendNetworkScore(anyInt());
verify(mWifiMetrics, never()).incrementWifiScoreCount(anyInt());
}
@@ -293,8 +291,7 @@ public class WifiScoreReportTest extends WifiBaseTest {
}
int score = mWifiInfo.getScore();
assertTrue(score < ConnectedScore.WIFI_TRANSITION_SCORE);
- final NetworkScore ns = new NetworkScore.Builder().setLegacyScore(score).build();
- verify(mNetworkAgent, atLeast(1)).sendNetworkScore(eq(ns));
+ verify(mNetworkAgent, atLeast(1)).sendNetworkScore(score);
}
/**
@@ -311,8 +308,7 @@ public class WifiScoreReportTest extends WifiBaseTest {
oops += ":" + mWifiInfo.getScore();
}
int score = mWifiInfo.getScore();
- final NetworkScore ns = new NetworkScore.Builder().setLegacyScore(score).build();
- verify(mNetworkAgent, atLeast(1)).sendNetworkScore(eq(ns));
+ verify(mNetworkAgent, atLeast(1)).sendNetworkScore(score);
assertTrue(oops, score < ConnectedScore.WIFI_TRANSITION_SCORE);
}
@@ -667,16 +663,14 @@ public class WifiScoreReportTest extends WifiBaseTest {
scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId + 10, 49);
assertEquals(mWifiScoreReport.getScore(), ConnectedScore.WIFI_MAX_SCORE);
- final NetworkScore ns3 = new NetworkScore.Builder().setLegacyScore(49).build();
scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, 49);
mLooper.dispatchAll();
- verify(mNetworkAgent).sendNetworkScore(eq(ns3));
+ verify(mNetworkAgent).sendNetworkScore(49);
assertEquals(mWifiScoreReport.getScore(), 49);
- final NetworkScore ns4 = new NetworkScore.Builder().setLegacyScore(59).build();
scorerImpl.mScoreChangeCallback.onScoreChange(scorerImpl.mSessionId, 59);
mLooper.dispatchAll();
- verify(mNetworkAgent).sendNetworkScore(eq(ns4));
+ verify(mNetworkAgent).sendNetworkScore(59);
assertEquals(mWifiScoreReport.getScore(), 59);
}
diff --git a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
index 8dafc7674..671d77645 100644
--- a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
@@ -509,7 +509,7 @@ public class WifiAwareDataPathStateManagerTest extends WifiBaseTest {
first = false;
}
inOrder.verify(mMockCm).registerNetworkAgent(messengerCaptor.capture(), any(), any(),
- netCapCaptor.capture(), any(), any(), anyInt());
+ netCapCaptor.capture(), anyInt(), any(), anyInt());
agentMessengers[i] = messengerCaptor.getValue();
inOrderM.verify(mAwareMetricsMock).recordNdpStatus(eq(NanStatusType.SUCCESS),
eq(false), anyLong());
@@ -634,7 +634,7 @@ public class WifiAwareDataPathStateManagerTest extends WifiBaseTest {
inOrder.verify(mMockNetdWrapper).setInterfaceUp(anyString());
inOrder.verify(mMockNetdWrapper).enableIpv6(anyString());
inOrder.verify(mMockCm).registerNetworkAgent(agentMessengerCaptor.capture(), any(), any(),
- netCapCaptor.capture(), any(), any(), anyInt());
+ netCapCaptor.capture(), anyInt(), any(), anyInt());
inOrderM.verify(mAwareMetricsMock).recordNdpStatus(eq(NanStatusType.SUCCESS),
eq(true), anyLong());
inOrderM.verify(mAwareMetricsMock).recordNdpCreation(anyInt(), any());
@@ -752,7 +752,7 @@ public class WifiAwareDataPathStateManagerTest extends WifiBaseTest {
inOrder.verify(mMockNetdWrapper).setInterfaceUp(anyString());
inOrder.verify(mMockNetdWrapper).enableIpv6(anyString());
inOrder.verify(mMockCm).registerNetworkAgent(any(), any(), any(),
- netCapCaptor.capture(), any(), any(), anyInt());
+ netCapCaptor.capture(), anyInt(), any(), anyInt());
inOrderM.verify(mAwareMetricsMock).recordNdpStatus(eq(NanStatusType.SUCCESS),
eq(true), anyLong());
inOrderM.verify(mAwareMetricsMock).recordNdpCreation(anyInt(), any());
@@ -1339,7 +1339,7 @@ public class WifiAwareDataPathStateManagerTest extends WifiBaseTest {
inOrder.verify(mMockNetworkInterface).configureAgentProperties(any(), any(), anyInt(),
any(), any());
inOrder.verify(mMockCm).registerNetworkAgent(messengerCaptor.capture(), any(), any(),
- netCapCaptor.capture(), any(), any(), anyInt());
+ netCapCaptor.capture(), anyInt(), any(), anyInt());
inOrder.verify(mMockNetworkInterface).isAddressUsable(any());
boolean timedout = false;
@@ -1482,7 +1482,7 @@ public class WifiAwareDataPathStateManagerTest extends WifiBaseTest {
inOrder.verify(mMockNetdWrapper).setInterfaceUp(anyString());
inOrder.verify(mMockNetdWrapper).enableIpv6(anyString());
inOrder.verify(mMockCm).registerNetworkAgent(messengerCaptor.capture(), any(),
- any(), netCapCaptor.capture(), any(), any(), anyInt());
+ any(), netCapCaptor.capture(), anyInt(), any(), anyInt());
inOrderM.verify(mAwareMetricsMock).recordNdpStatus(eq(NanStatusType.SUCCESS),
eq(useDirect), anyLong());
inOrderM.verify(mAwareMetricsMock).recordNdpCreation(anyInt(), any());