summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2020-01-13 23:10:04 +0900
committerLorenzo Colitti <lorenzo@google.com>2020-01-13 23:24:02 +0900
commit25f93af88bb47f63014525ed4331e4268f142f6d (patch)
tree0a300927a138dc85c5f43c92aea57a4e6a0b381c
parenta2064ac828a788b51452d5d6be2ce49df8202754 (diff)
Stop using NetworkAgentConfig in wifi.
The code default-constructs a NetworkAgentConfig object, but never actually uses it except to pass it to the NetworkAgent constructor. Passing a default-constructed NetworkAgentConfig is equivalent to not specifying any NetworkAgentConfig at all. It results in passing null to ConnectivityService#registerNetworkAgent. This then just calls new NetworkAgentConfig(null), which is equivalent to returning a default-constructed NetworkAgentConfig. Bug: 138306002 Test: builds, boots, wifi works, telephony works Test: atest FrameworksWifiTests Change-Id: I2bcecd366211848a237e7eb467b4f3354fb96457
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java10
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java19
2 files changed, 12 insertions, 17 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index ecbc8dfdb..259ec2fe1 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -47,7 +47,6 @@ import android.net.MatchAllNetworkSpecifier;
import android.net.NattKeepalivePacketData;
import android.net.Network;
import android.net.NetworkAgent;
-import android.net.NetworkAgentConfig;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.net.NetworkInfo.DetailedState;
@@ -430,9 +429,6 @@ public class ClientModeImpl extends StateMachine {
// Used to filter out requests we couldn't possibly satisfy.
private final NetworkCapabilities mNetworkCapabilitiesFilter = new NetworkCapabilities();
- // Provide packet filter capabilities to ConnectivityService.
- private final NetworkAgentConfig mNetworkAgentConfig = new NetworkAgentConfig();
-
private final ExternalCallbackTracker<IActionListener> mProcessingActionListeners;
private final ExternalCallbackTracker<ITxPacketCountListener> mProcessingTxPacketCountListeners;
@@ -4183,8 +4179,8 @@ public class ClientModeImpl extends StateMachine {
private class WifiNetworkAgent extends NetworkAgent {
WifiNetworkAgent(Looper l, Context c, String tag, NetworkInfo ni,
- NetworkCapabilities nc, LinkProperties lp, int score, NetworkAgentConfig config) {
- super(l, c, tag, ni, nc, lp, score, config);
+ NetworkCapabilities nc, LinkProperties lp, int score) {
+ super(l, c, tag, ni, nc, lp, score);
}
private int mLastNetworkStatus = -1; // To detect when the status really changes
@@ -4336,7 +4332,7 @@ public class ClientModeImpl extends StateMachine {
final NetworkCapabilities nc = getCapabilities(getCurrentWifiConfiguration());
synchronized (mNetworkAgentLock) {
mNetworkAgent = new WifiNetworkAgent(getHandler().getLooper(), mContext,
- "WifiNetworkAgent", mNetworkInfo, nc, mLinkProperties, 60, mNetworkAgentConfig);
+ "WifiNetworkAgent", mNetworkInfo, nc, mLinkProperties, 60);
}
// We must clear the config BSSID, as the wifi chipset may decide to roam
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
index b33cc929a..8761a5a76 100644
--- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
@@ -44,7 +44,6 @@ import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.MacAddress;
import android.net.NetworkAgent;
-import android.net.NetworkAgentConfig;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.net.NetworkSpecifier;
@@ -2448,7 +2447,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),
- anyInt(), any(NetworkAgentConfig.class), anyInt());
+ anyInt(), eq(null) /* config */, anyInt());
registerAsyncChannel((x) -> {
mNetworkAgentAsyncChannel = x;
@@ -2545,7 +2544,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),
- anyInt(), any(NetworkAgentConfig.class), anyInt());
+ anyInt(), eq(null) /* config */, anyInt());
ArrayList<Integer> thresholdsArray = new ArrayList<>();
thresholdsArray.add(RSSI_THRESHOLD_MAX);
@@ -3139,7 +3138,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),
- anyInt(), any(NetworkAgentConfig.class), anyInt());
+ anyInt(), eq(null) /* config */, anyInt());
Message message = new Message();
message.what = NetworkAgent.CMD_REPORT_NETWORK_STATUS;
@@ -3356,7 +3355,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),
- anyInt(), any(NetworkAgentConfig.class), anyInt());
+ anyInt(), eq(null) /* config */, anyInt());
WifiConfiguration currentNetwork = new WifiConfiguration();
currentNetwork.networkId = FRAMEWORK_NETWORK_ID;
@@ -3394,7 +3393,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),
- anyInt(), any(NetworkAgentConfig.class), anyInt());
+ anyInt(), eq(null) /* config */, anyInt());
WifiConfiguration currentNetwork = new WifiConfiguration();
currentNetwork.networkId = FRAMEWORK_NETWORK_ID;
@@ -3429,7 +3428,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),
- anyInt(), any(NetworkAgentConfig.class), anyInt());
+ anyInt(), eq(null) /* config */, anyInt());
WifiConfiguration currentNetwork = new WifiConfiguration();
currentNetwork.networkId = FRAMEWORK_NETWORK_ID;
@@ -3466,7 +3465,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),
- anyInt(), any(NetworkAgentConfig.class), anyInt());
+ anyInt(), eq(null) /* config */, anyInt());
when(mWifiConfigManager.getLastSelectedNetwork()).thenReturn(FRAMEWORK_NETWORK_ID + 1);
@@ -3499,7 +3498,7 @@ public class ClientModeImplTest extends WifiBaseTest {
ArgumentCaptor.forClass(NetworkCapabilities.class);
verify(mConnectivityManager).registerNetworkAgent(any(Messenger.class),
any(NetworkInfo.class), any(LinkProperties.class),
- networkCapabilitiesCaptor.capture(), anyInt(), any(NetworkAgentConfig.class),
+ networkCapabilitiesCaptor.capture(), anyInt(), eq(null) /* config */,
anyInt());
NetworkCapabilities networkCapabilities = networkCapabilitiesCaptor.getValue();
@@ -3532,7 +3531,7 @@ public class ClientModeImplTest extends WifiBaseTest {
ArgumentCaptor.forClass(NetworkCapabilities.class);
verify(mConnectivityManager).registerNetworkAgent(any(Messenger.class),
any(NetworkInfo.class), any(LinkProperties.class),
- networkCapabilitiesCaptor.capture(), anyInt(), any(NetworkAgentConfig.class),
+ networkCapabilitiesCaptor.capture(), anyInt(), eq(null) /* config */,
anyInt());
NetworkCapabilities networkCapabilities = networkCapabilitiesCaptor.getValue();