summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRebecca Silberstein <silberst@google.com>2016-04-12 21:05:00 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-04-12 21:05:00 +0000
commit49db6a0f9104fea99013fa6cfe6fcf2bdc7aa661 (patch)
tree89a93f725e82ebbf9f30282431add464ec007ac9
parentfdbf9d334419ff5aff35bf56f7cf46d01998861b (diff)
parenteaea4b75c2ecfd192d5dcefcf67bb851bf031f5e (diff)
Merge "WifiConfigStore: read requirePMF config variable" into nyc-dev
-rw-r--r--service/java/com/android/server/wifi/WifiConfigStore.java11
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java5
2 files changed, 14 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigStore.java b/service/java/com/android/server/wifi/WifiConfigStore.java
index d50ddfe47..8b4535ebf 100644
--- a/service/java/com/android/server/wifi/WifiConfigStore.java
+++ b/service/java/com/android/server/wifi/WifiConfigStore.java
@@ -16,7 +16,6 @@
package com.android.server.wifi;
-import android.app.backup.BackupManager;
import android.net.IpConfiguration.IpAssignment;
import android.net.IpConfiguration.ProxySettings;
import android.net.wifi.WifiConfiguration;
@@ -27,7 +26,6 @@ import android.net.wifi.WpsInfo;
import android.net.wifi.WpsResult;
import android.os.FileObserver;
import android.os.Process;
-import android.os.SystemClock;
import android.security.Credentials;
import android.security.KeyChain;
import android.security.KeyStore;
@@ -371,6 +369,15 @@ public class WifiConfigStore {
}
}
+ value = mWifiNative.getNetworkVariable(netId, WifiConfiguration.pmfVarName);
+ config.requirePMF = false;
+ if (!TextUtils.isEmpty(value)) {
+ try {
+ config.requirePMF = Integer.parseInt(value) != 0;
+ } catch (NumberFormatException ignore) {
+ }
+ }
+
value = mWifiNative.getNetworkVariable(netId, WifiConfiguration.wepTxKeyIdxVarName);
config.wepTxKeyIndex = -1;
if (!TextUtils.isEmpty(value)) {
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index 3de14f8ae..59cbd48b9 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -455,6 +455,8 @@ public class WifiConfigManagerTest {
(Map<String, String>) anyObject())).thenReturn(true);
when(mWifiNative.getNetworkVariable(network, WifiConfiguration.ssidVarName))
.thenReturn(encodeConfigSSID(CONFIGS.get(network)));
+ when(mWifiNative.getNetworkVariable(network, WifiConfiguration.pmfVarName))
+ .thenReturn("");
// Store a network configuration.
mWifiConfigManager.saveNetwork(CONFIGS.get(network), CONFIGS.get(network).creatorUid);
@@ -471,6 +473,9 @@ public class WifiConfigManagerTest {
verify(mWifiNative).setNetworkExtra(network, WifiConfigStore.ID_STRING_VAR_NAME,
metadata);
+ // Verify that an attempt to read back the requirePMF variable was made.
+ verify(mWifiNative).getNetworkVariable(network, WifiConfiguration.pmfVarName);
+
// Verify that no wpa_supplicant variables were read or written for any other network
// configurations.
verify(mWifiNative, never()).setNetworkExtra(intThat(not(network)), anyString(),