summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2019-12-27 22:19:39 -0800
committerEtan Cohen <etancohen@google.com>2020-01-08 12:48:13 -0800
commit8ada790fa4f48bbd5acd7ac89571b21ed06f6975 (patch)
treecb33654cba2faf8af69db0de2f9d8740eca18331 /service
parent7f0d3862863b6a6d4cc7a4f76a0d2bf9d2874921 (diff)
Saved network auto-join: serialize
Serialize the auto-join configuration for saved networks to both config store (local saved/restore) as well as backup/restore. Bug: 139199957 Test: atest com.android.server.wifi Change-Id: I68d4365f68a9226e5b0abf743fc6b910c340803b
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiBackupDataV1Parser.java16
-rw-r--r--service/java/com/android/server/wifi/util/XmlUtil.java5
2 files changed, 18 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java b/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java
index 2916c59a4..efdac96ed 100644
--- a/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java
+++ b/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java
@@ -93,7 +93,7 @@ class WifiBackupDataV1Parser implements WifiBackupDataParser {
private static final String TAG = "WifiBackupDataV1Parser";
- private static final int HIGHEST_SUPPORTED_MINOR_VERSION = 1;
+ private static final int HIGHEST_SUPPORTED_MINOR_VERSION = 2;
// List of tags supported for <WifiConfiguration> section in minor version 0
private static final Set<String> WIFI_CONFIGURATION_MINOR_V0_SUPPORTED_TAGS =
@@ -121,8 +121,15 @@ class WifiBackupDataV1Parser implements WifiBackupDataParser {
add(WifiConfigurationXmlUtil.XML_TAG_METERED_OVERRIDE);
}};
+ // List of tags supported for <WifiConfiguration> section in minor version 1
+ private static final Set<String> WIFI_CONFIGURATION_MINOR_V2_SUPPORTED_TAGS =
+ new HashSet<String>() {{
+ addAll(WIFI_CONFIGURATION_MINOR_V1_SUPPORTED_TAGS);
+ add(WifiConfigurationXmlUtil.XML_TAG_IS_AUTO_JOIN);
+ }};
+
// List of tags supported for <IpConfiguration> section in minor version 0 & 1
- private static final Set<String> IP_CONFIGURATION_MINOR_V0_V1_SUPPORTED_TAGS =
+ private static final Set<String> IP_CONFIGURATION_MINOR_V0_V1_V2_SUPPORTED_TAGS =
new HashSet<String>(Arrays.asList(new String[] {
IpConfigurationXmlUtil.XML_TAG_IP_ASSIGNMENT,
IpConfigurationXmlUtil.XML_TAG_LINK_ADDRESS,
@@ -372,6 +379,8 @@ class WifiBackupDataV1Parser implements WifiBackupDataParser {
return WIFI_CONFIGURATION_MINOR_V0_SUPPORTED_TAGS;
case 1:
return WIFI_CONFIGURATION_MINOR_V1_SUPPORTED_TAGS;
+ case 2:
+ return WIFI_CONFIGURATION_MINOR_V2_SUPPORTED_TAGS;
default:
Log.e(TAG, "Invalid minorVersion: " + minorVersion);
return Collections.<String>emptySet();
@@ -598,7 +607,8 @@ class WifiBackupDataV1Parser implements WifiBackupDataParser {
switch (minorVersion) {
case 0:
case 1:
- return IP_CONFIGURATION_MINOR_V0_V1_SUPPORTED_TAGS;
+ case 2:
+ return IP_CONFIGURATION_MINOR_V0_V1_V2_SUPPORTED_TAGS;
default:
Log.e(TAG, "Invalid minorVersion: " + minorVersion);
return Collections.<String>emptySet();
diff --git a/service/java/com/android/server/wifi/util/XmlUtil.java b/service/java/com/android/server/wifi/util/XmlUtil.java
index 65d82f1b6..4e0912126 100644
--- a/service/java/com/android/server/wifi/util/XmlUtil.java
+++ b/service/java/com/android/server/wifi/util/XmlUtil.java
@@ -357,6 +357,7 @@ public class XmlUtil {
public static final String XML_TAG_MAC_RANDOMIZATION_SETTING = "MacRandomizationSetting";
public static final String XML_TAG_SAE_PASSWORD_ID_KEY = "SaePasswordId";
public static final String XML_TAG_CARRIER_ID = "CarrierId";
+ public static final String XML_TAG_IS_AUTO_JOIN = "AutoJoinEnabled";
/**
* Write WepKeys to the XML stream.
@@ -458,6 +459,7 @@ public class XmlUtil {
out, XML_TAG_ALLOWED_SUITE_B_CIPHERS,
configuration.allowedSuiteBCiphers.toByteArray());
XmlUtil.writeNextValue(out, XML_TAG_SHARED, configuration.shared);
+ XmlUtil.writeNextValue(out, XML_TAG_IS_AUTO_JOIN, configuration.allowAutojoin);
}
/**
@@ -714,6 +716,9 @@ public class XmlUtil {
case XML_TAG_CARRIER_ID:
configuration.carrierId = (int) value;
break;
+ case XML_TAG_IS_AUTO_JOIN:
+ configuration.allowAutojoin = (boolean) value;
+ break;
default:
Log.w(TAG, "Ignoring unknown value name found: " + valueName[0]);
break;