Remove WifiNative.getFrameworkNetworkId
Bug: 67111314
Test: compile, run ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: Iac8ba2c61ace15553fc4cdf3a75665f1ddafacc4
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index ee3c26a..7384a78 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -1587,17 +1587,6 @@
}
/**
- * Get the framework network ID corresponding to the provided supplicant network ID for the
- * network configured in wpa_supplicant.
- *
- * @param supplicantNetworkId network ID in wpa_supplicant for the network.
- * @return Corresponding framework network ID if found, -1 if network not found.
- */
- public int getFrameworkNetworkId(int supplicantNetworkId) {
- return supplicantNetworkId;
- }
-
- /**
* Remove all the networks.
*
* @return {@code true} if it succeeds, {@code false} otherwise
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 2a0d3ea..b46a285 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -1287,20 +1287,6 @@
}
/**
- * Helper method to lookup the framework network ID of the network currently configured in
- * wpa_supplicant using the provided supplicant network ID. This is needed for translating the
- * networkID received from all {@link WifiMonitor} events.
- *
- * @param supplicantNetworkId Network ID of network in wpa_supplicant.
- * @return Corresponding Internal configured network ID
- * TODO(b/31080843): This is ugly! We need to hide this translation of networkId's. This will
- * be handled once we move all of this connection logic to wificond.
- */
- private int lookupFrameworkNetworkId(int supplicantNetworkId) {
- return mWifiNative.getFrameworkNetworkId(supplicantNetworkId);
- }
-
- /**
* Initiates connection to a network specified by the user/app. This method checks if the
* requesting app holds the NETWORK_SETTINGS permission.
*
@@ -3235,7 +3221,7 @@
}
// Network id and SSID are only valid when we start connecting
if (SupplicantState.isConnecting(state)) {
- mWifiInfo.setNetworkId(lookupFrameworkNetworkId(stateChangeResult.networkId));
+ mWifiInfo.setNetworkId(stateChangeResult.networkId);
mWifiInfo.setBSSID(stateChangeResult.BSSID);
mWifiInfo.setSSID(stateChangeResult.wifiSsid);
} else {
@@ -5099,8 +5085,7 @@
mBackupManagerProxy.notifyDataChanged();
break;
case WifiMonitor.SUP_REQUEST_IDENTITY:
- int supplicantNetworkId = message.arg2;
- netId = lookupFrameworkNetworkId(supplicantNetworkId);
+ netId = message.arg2;
boolean identitySent = false;
// For SIM & AKA/AKA' EAP method Only, get identity from ICC
if (targetWificonfiguration != null
@@ -5110,7 +5095,7 @@
TelephonyUtil.getSimIdentity(getTelephonyManager(),
targetWificonfiguration);
if (identity != null) {
- mWifiNative.simIdentityResponse(supplicantNetworkId, identity);
+ mWifiNative.simIdentityResponse(netId, identity);
identitySent = true;
} else {
Log.e(TAG, "Unable to retrieve identity from Telephony");
@@ -5402,7 +5387,7 @@
return NOT_HANDLED;
case WifiMonitor.NETWORK_CONNECTION_EVENT:
if (mVerboseLoggingEnabled) log("Network connection established");
- mLastNetworkId = lookupFrameworkNetworkId(message.arg1);
+ mLastNetworkId = message.arg1;
mWifiConfigManager.clearRecentFailureReason(mLastNetworkId);
mLastBssid = (String) message.obj;
reasonCode = message.arg2;
@@ -5891,7 +5876,7 @@
return NOT_HANDLED;
case WifiMonitor.NETWORK_CONNECTION_EVENT:
mWifiInfo.setBSSID((String) message.obj);
- mLastNetworkId = lookupFrameworkNetworkId(message.arg1);
+ mLastNetworkId = message.arg1;
mWifiInfo.setNetworkId(mLastNetworkId);
if(!mLastBssid.equals(message.obj)) {
mLastBssid = (String) message.obj;
@@ -6263,7 +6248,7 @@
if (mVerboseLoggingEnabled) {
log("roaming and Network connection established");
}
- mLastNetworkId = lookupFrameworkNetworkId(message.arg1);
+ mLastNetworkId = message.arg1;
mLastBssid = (String) message.obj;
mWifiInfo.setBSSID(mLastBssid);
mWifiInfo.setNetworkId(mLastNetworkId);
@@ -7102,7 +7087,7 @@
void handleGsmAuthRequest(SimAuthRequestData requestData) {
if (targetWificonfiguration == null
|| targetWificonfiguration.networkId
- == lookupFrameworkNetworkId(requestData.networkId)) {
+ == requestData.networkId) {
logd("id matches targetWifiConfiguration");
} else {
logd("id does not match targetWifiConfiguration");
@@ -7123,7 +7108,7 @@
void handle3GAuthRequest(SimAuthRequestData requestData) {
if (targetWificonfiguration == null
|| targetWificonfiguration.networkId
- == lookupFrameworkNetworkId(requestData.networkId)) {
+ == requestData.networkId) {
logd("id matches targetWifiConfiguration");
} else {
logd("id does not match targetWifiConfiguration");
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
index 7e2a17b..418bb75 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
@@ -418,7 +418,6 @@
when(mWifiNative.getInterfaceName()).thenReturn(WIFI_IFACE_NAME);
when(mWifiNative.enableSupplicant()).thenReturn(true);
when(mWifiNative.disableSupplicant()).thenReturn(true);
- when(mWifiNative.getFrameworkNetworkId(anyInt())).thenReturn(0);
when(mWifiNative.initializeVendorHal(any(WifiNative.VendorHalDeathEventHandler.class)))
.thenReturn(true);
when(mWifiNative.registerWificondDeathHandler(any())).thenReturn(true);
@@ -2116,8 +2115,6 @@
.thenReturn(new NetworkUpdateResult(WPS_FRAMEWORK_NETWORK_ID));
when(mWifiConfigManager.enableNetwork(eq(WPS_FRAMEWORK_NETWORK_ID), anyBoolean(), anyInt()))
.thenReturn(true);
- when(mWifiNative.getFrameworkNetworkId(eq(WPS_FRAMEWORK_NETWORK_ID))).thenReturn(
- WPS_FRAMEWORK_NETWORK_ID);
when(mWifiConfigManager.getConfiguredNetwork(eq(WPS_FRAMEWORK_NETWORK_ID))).thenReturn(
config);
}