summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Paul Stewart <pstew@google.com> 2016-05-20 08:14:30 -0700
committer Paul Stewart <pstew@google.com> 2016-05-20 08:22:53 -0700
commit45e6fec2cfdb148b48100e65d9e7e207b8cdcf64 (patch)
treecaec2a2cc156d60be485a377d3fe28a38d77bcc2
parentc21f84dddbe8144bb3d392b3b91c6df5f48aed42 (diff)
Don't remove existing EAP configurations
When merging backed-up configurations with the current supplicant configuration, we read both configurations into a instance of WifiNetworkSettings. No EAP configurations should be restored as per b/25725016, however existing EAP configurations that already reside in wpa_supplicant.conf (presumably configured in SUW) should not be removed in the process. This CL adds a parameter to the "readNetworks" method to allow it to select whether or not EAP configurations should be read in. It is used to allow the "restoreWifiSupplicant" method to copy in EAP configurations from the existing wpa_supplicant.conf, but not out of the backup data. BUG: 28873992 Change-Id: I8b3e0c1a6629b3f1ca5055b1b2190e6b3ca4c033
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
index 029a1259cd1b..f8fb1e579446 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
@@ -329,7 +329,8 @@ public class SettingsBackupAgent extends BackupAgentHelper {
final HashSet<Network> mKnownNetworks = new HashSet<Network>();
final ArrayList<Network> mNetworks = new ArrayList<Network>(8);
- public void readNetworks(BufferedReader in, List<WifiConfiguration> whitelist) {
+ public void readNetworks(BufferedReader in, List<WifiConfiguration> whitelist,
+ boolean acceptEapNetworks) {
try {
String line;
while (in.ready()) {
@@ -348,7 +349,7 @@ public class SettingsBackupAgent extends BackupAgentHelper {
}
}
// Don't propagate EAP network definitions
- if (net.isEap) {
+ if (net.isEap && !acceptEapNetworks) {
if (DEBUG_BACKUP) {
Log.v(TAG, "Skipping EAP network " + net.ssid + " / " + net.key_mgmt);
}
@@ -1176,7 +1177,7 @@ public class SettingsBackupAgent extends BackupAgentHelper {
WifiNetworkSettings fromFile = new WifiNetworkSettings();
br = new BufferedReader(new FileReader(file));
- fromFile.readNetworks(br, configs);
+ fromFile.readNetworks(br, configs, false);
// Write the parsed networks into a packed byte array
if (fromFile.mKnownNetworks.size() > 0) {
@@ -1204,7 +1205,7 @@ public class SettingsBackupAgent extends BackupAgentHelper {
if (supplicantFile.exists()) {
// Retain the existing APs; we'll append the restored ones to them
BufferedReader in = new BufferedReader(new FileReader(FILE_WIFI_SUPPLICANT));
- supplicantImage.readNetworks(in, null);
+ supplicantImage.readNetworks(in, null, true);
in.close();
supplicantFile.delete();
@@ -1215,7 +1216,7 @@ public class SettingsBackupAgent extends BackupAgentHelper {
char[] restoredAsBytes = new char[size];
for (int i = 0; i < size; i++) restoredAsBytes[i] = (char) bytes[i];
BufferedReader in = new BufferedReader(new CharArrayReader(restoredAsBytes));
- supplicantImage.readNetworks(in, null);
+ supplicantImage.readNetworks(in, null, false);
if (DEBUG_BACKUP) {
Log.v(TAG, "Final AP list:");
@@ -1371,4 +1372,4 @@ public class SettingsBackupAgent extends BackupAgentHelper {
}
return WifiManager.WIFI_STATE_UNKNOWN;
}
-} \ No newline at end of file
+}