Update the bssid, L2Key and GroupHint information upon L2 roaming completes.
Bug: 131797393
Test: atest FrameworksWifiTests
Merged-In: Ic5ad351a3d56cedc4ec9bfce7279f8687ad0b51b
Change-Id: I17f055c02f80e8a30d5b7218a1710def6e043554
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index 5a9e308..8cc828f 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -57,6 +57,7 @@
import android.net.ip.IIpClient;
import android.net.ip.IpClientCallbacks;
import android.net.ip.IpClientManager;
+import android.net.shared.Layer2Information;
import android.net.shared.ProvisioningConfiguration;
import android.net.shared.ProvisioningConfiguration.ScanResultInfo;
import android.net.wifi.INetworkRequestMatchCallback;
@@ -2901,7 +2902,7 @@
mWifiInfo.setBSSID(null);
mWifiInfo.setSSID(null);
}
- updateL2KeyAndGroupHint();
+ updateLayer2Information();
// SSID might have been updated, so call updateCapabilities
updateCapabilities();
@@ -2936,13 +2937,16 @@
}
/**
- * Tells IpClient what L2Key and GroupHint to use for IpMemoryStore.
+ * Tells IpClient what BSSID, L2Key and GroupHint to use for IpMemoryStore.
*/
- private void updateL2KeyAndGroupHint() {
+ private void updateLayer2Information() {
if (mIpClient != null) {
Pair<String, String> p = mWifiScoreCard.getL2KeyAndGroupHint(mWifiInfo);
if (!p.equals(mLastL2KeyAndGroupHint)) {
- if (mIpClient.setL2KeyAndGroupHint(p.first, p.second)) {
+ final Layer2Information l2Information = new Layer2Information(
+ p.first, p.second,
+ mLastBssid != null ? MacAddress.fromString(mLastBssid) : null);
+ if (mIpClient.updateLayer2Information(l2Information)) {
mLastL2KeyAndGroupHint = p;
} else {
mLastL2KeyAndGroupHint = null;
@@ -3000,7 +3004,7 @@
registerDisconnected();
mLastNetworkId = WifiConfiguration.INVALID_NETWORK_ID;
mWifiScoreCard.resetConnectionState();
- updateL2KeyAndGroupHint();
+ updateLayer2Information();
}
void handlePreDhcpSetup() {
@@ -5369,7 +5373,8 @@
new ScanResultInfo.InformationElement(ie.getId(), ie.getBytes());
ies.add(scanResultInfoIe);
}
- scanResultInfo = new ProvisioningConfiguration.ScanResultInfo(scanResult.SSID, ies);
+ scanResultInfo = new ProvisioningConfiguration.ScanResultInfo(scanResult.SSID,
+ scanResult.BSSID, ies);
}
if (!isUsingStaticIp) {
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
index 6fbf389..33812ae 100644
--- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
@@ -39,6 +39,7 @@
import android.hardware.wifi.supplicant.V1_0.ISupplicantStaIfaceCallback;
import android.net.ConnectivityManager;
import android.net.DhcpResults;
+import android.net.Layer2InformationParcelable;
import android.net.LinkProperties;
import android.net.MacAddress;
import android.net.Network;
@@ -2993,7 +2994,12 @@
connect();
mLooper.dispatchAll();
verify(mWifiScoreCard).noteIpConfiguration(any());
- verify(mIpClient).setL2KeyAndGroupHint(eq("Wad"), eq("Gab"));
+ ArgumentCaptor<Layer2InformationParcelable> captor =
+ ArgumentCaptor.forClass(Layer2InformationParcelable.class);
+ verify(mIpClient).updateLayer2Information(captor.capture());
+ final Layer2InformationParcelable info = captor.getValue();
+ assertEquals(info.l2Key, "Wad");
+ assertEquals(info.groupHint, "Gab");
}
/**