summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-04-24 21:58:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-04-24 21:58:09 +0000
commitd04a29f8721e70ac1ae4e1aa82d18baa53bd8f97 (patch)
tree0fc435621249fc7a84d2e178fa748f107e3cfdde /service
parenta7a78153b4fa396c3e735444cdef3bba87aeb4f7 (diff)
parent924467b1e35f0ad560207d1eb652e6e575f5fc22 (diff)
Merge "Update the l2 and group hint identifiers for wifi network" into qt-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java21
-rw-r--r--service/java/com/android/server/wifi/WifiScoreCard.java16
2 files changed, 37 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index 2ae6b4ed5..e7de1ca4f 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -2896,6 +2896,7 @@ public class ClientModeImpl extends StateMachine {
mWifiInfo.setBSSID(null);
mWifiInfo.setSSID(null);
}
+ updateL2KeyAndGroupHint();
// SSID might have been updated, so call updateCapabilities
updateCapabilities();
@@ -2930,6 +2931,25 @@ public class ClientModeImpl extends StateMachine {
}
/**
+ * Tells IpClient what L2Key and GroupHint to use for IpMemoryStore.
+ */
+ private void updateL2KeyAndGroupHint() {
+ if (mIpClient != null) {
+ Pair<String, String> p = mWifiScoreCard.getL2KeyAndGroupHint(mWifiInfo);
+ if (!p.equals(mLastL2KeyAndGroupHint)) {
+ try {
+ mIpClient.setL2KeyAndGroupHint(p.first, p.second);
+ mLastL2KeyAndGroupHint = p;
+ } catch (RemoteException e) {
+ loge("Failed setL2KeyAndGroupHint");
+ mLastL2KeyAndGroupHint = null;
+ }
+ }
+ }
+ }
+ private @Nullable Pair<String, String> mLastL2KeyAndGroupHint = null;
+
+ /**
* Resets the Wi-Fi Connections by clearing any state, resetting any sockets
* using the interface, stopping DHCP & disabling interface
*/
@@ -2980,6 +3000,7 @@ public class ClientModeImpl extends StateMachine {
registerDisconnected();
mLastNetworkId = WifiConfiguration.INVALID_NETWORK_ID;
mWifiScoreCard.resetConnectionState();
+ updateL2KeyAndGroupHint();
}
void handlePreDhcpSetup() {
diff --git a/service/java/com/android/server/wifi/WifiScoreCard.java b/service/java/com/android/server/wifi/WifiScoreCard.java
index 850a20643..973c06dc9 100644
--- a/service/java/com/android/server/wifi/WifiScoreCard.java
+++ b/service/java/com/android/server/wifi/WifiScoreCard.java
@@ -155,6 +155,18 @@ public class WifiScoreCard {
}
/**
+ * Gets the L2Key and GroupHint associated with the connection.
+ */
+ public @NonNull Pair<String, String> getL2KeyAndGroupHint(ExtendedWifiInfo wifiInfo) {
+ PerBssid perBssid = lookupBssid(wifiInfo.getSSID(), wifiInfo.getBSSID());
+ if (perBssid == mDummyPerBssid) {
+ return new Pair<>(null, null);
+ }
+ final long groupIdHash = computeHashLong(perBssid.ssid, mDummyPerBssid.bssid);
+ return new Pair<>(perBssid.l2Key, groupHintFromLong(groupIdHash));
+ }
+
+ /**
* Resets the connection state
*/
public void resetConnectionState() {
@@ -611,6 +623,10 @@ public class WifiScoreCard {
return "W" + Long.toHexString(hash);
}
+ private static String groupHintFromLong(long hash) {
+ return "G" + Long.toHexString(hash);
+ }
+
@VisibleForTesting
PerBssid fetchByBssid(MacAddress mac) {
return mApForBssid.get(mac);