diff options
author | Peter Qiu <zqiu@google.com> | 2017-03-16 23:33:16 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-03-16 23:33:16 +0000 |
commit | 8166105ea7bd90c648bba229e2c30d93fa26af92 (patch) | |
tree | a28cfe6df9818e81352c8dbf91166a7e6e6f074a | |
parent | 1395be1e703ec394127466dd3ce0eff30236d62c (diff) | |
parent | 44104c69e83ee6ee07f0449cbf720dad53c0cdfb (diff) |
Merge changes from topic 'legacy passpoint indicator'
am: 44104c69e8
Change-Id: If64e7fb5147b90c0f0e88a73bfc3871720252645
5 files changed, 48 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/util/XmlUtil.java b/service/java/com/android/server/wifi/util/XmlUtil.java index 76b8a3292..42303b009 100644 --- a/service/java/com/android/server/wifi/util/XmlUtil.java +++ b/service/java/com/android/server/wifi/util/XmlUtil.java @@ -336,6 +336,8 @@ public class XmlUtil { public static final String XML_TAG_LAST_UPDATE_UID = "LastUpdateUid"; public static final String XML_TAG_LAST_UPDATE_NAME = "LastUpdateName"; public static final String XML_TAG_LAST_CONNECT_UID = "LastConnectUid"; + public static final String XML_TAG_IS_LEGACY_PASSPOINT_CONFIG = "IsLegacyPasspointConfig"; + public static final String XML_TAG_ROAMING_CONSORTIUM_OIS = "RoamingConsortiumOIs"; /** * Write WepKeys to the XML stream. @@ -448,6 +450,11 @@ public class XmlUtil { XmlUtil.writeNextValue(out, XML_TAG_LAST_UPDATE_UID, configuration.lastUpdateUid); XmlUtil.writeNextValue(out, XML_TAG_LAST_UPDATE_NAME, configuration.lastUpdateName); XmlUtil.writeNextValue(out, XML_TAG_LAST_CONNECT_UID, configuration.lastConnectUid); + XmlUtil.writeNextValue( + out, XML_TAG_IS_LEGACY_PASSPOINT_CONFIG, + configuration.isLegacyPasspointConfig); + XmlUtil.writeNextValue( + out, XML_TAG_ROAMING_CONSORTIUM_OIS, configuration.roamingConsortiumIds); } /** @@ -598,6 +605,12 @@ public class XmlUtil { case XML_TAG_LAST_CONNECT_UID: configuration.lastConnectUid = (int) value; break; + case XML_TAG_IS_LEGACY_PASSPOINT_CONFIG: + configuration.isLegacyPasspointConfig = (boolean) value; + break; + case XML_TAG_ROAMING_CONSORTIUM_OIS: + configuration.roamingConsortiumIds = (long[]) value; + break; default: throw new XmlPullParserException( "Unknown value name found: " + valueName[0]); @@ -949,6 +962,8 @@ public class XmlUtil { public static final String XML_TAG_CA_PATH = "CaPath"; public static final String XML_TAG_EAP_METHOD = "EapMethod"; public static final String XML_TAG_PHASE2_METHOD = "Phase2Method"; + public static final String XML_TAG_PLMN = "PLMN"; + public static final String XML_TAG_REALM = "Realm"; /** * Write the WifiEnterpriseConfig data elements from the provided config to the XML @@ -985,6 +1000,8 @@ public class XmlUtil { enterpriseConfig.getFieldValue(WifiEnterpriseConfig.CA_PATH_KEY)); XmlUtil.writeNextValue(out, XML_TAG_EAP_METHOD, enterpriseConfig.getEapMethod()); XmlUtil.writeNextValue(out, XML_TAG_PHASE2_METHOD, enterpriseConfig.getPhase2Method()); + XmlUtil.writeNextValue(out, XML_TAG_PLMN, enterpriseConfig.getPlmn()); + XmlUtil.writeNextValue(out, XML_TAG_REALM, enterpriseConfig.getRealm()); } /** @@ -1060,6 +1077,12 @@ public class XmlUtil { case XML_TAG_PHASE2_METHOD: enterpriseConfig.setPhase2Method((int) value); break; + case XML_TAG_PLMN: + enterpriseConfig.setPlmn((String) value); + break; + case XML_TAG_REALM: + enterpriseConfig.setRealm((String) value); + break; default: throw new XmlPullParserException( "Unknown value name found: " + valueName[0]); diff --git a/tests/wifitests/src/com/android/server/wifi/NetworkListStoreDataTest.java b/tests/wifitests/src/com/android/server/wifi/NetworkListStoreDataTest.java index 7532b7d31..01257c16e 100644 --- a/tests/wifitests/src/com/android/server/wifi/NetworkListStoreDataTest.java +++ b/tests/wifitests/src/com/android/server/wifi/NetworkListStoreDataTest.java @@ -83,6 +83,8 @@ public class NetworkListStoreDataTest { + "<int name=\"LastUpdateUid\" value=\"-1\" />\n" + "<null name=\"LastUpdateName\" />\n" + "<int name=\"LastConnectUid\" value=\"0\" />\n" + + "<boolean name=\"IsLegacyPasspointConfig\" value=\"false\" />\n" + + "<long-array name=\"RoamingConsortiumOIs\" num=\"0\" />\n" + "</WifiConfiguration>\n" + "<NetworkStatus>\n" + "<string name=\"SelectionStatus\">NETWORK_SELECTION_ENABLED</string>\n" @@ -131,6 +133,8 @@ public class NetworkListStoreDataTest { + "<int name=\"LastUpdateUid\" value=\"-1\" />\n" + "<null name=\"LastUpdateName\" />\n" + "<int name=\"LastConnectUid\" value=\"0\" />\n" + + "<boolean name=\"IsLegacyPasspointConfig\" value=\"false\" />\n" + + "<long-array name=\"RoamingConsortiumOIs\" num=\"0\" />\n" + "</WifiConfiguration>\n" + "<NetworkStatus>\n" + "<string name=\"SelectionStatus\">NETWORK_SELECTION_ENABLED</string>\n" @@ -158,6 +162,8 @@ public class NetworkListStoreDataTest { + "<string name=\"CaPath\"></string>\n" + "<int name=\"EapMethod\" value=\"2\" />\n" + "<int name=\"Phase2Method\" value=\"0\" />\n" + + "<string name=\"PLMN\"></string>\n" + + "<string name=\"Realm\"></string>\n" + "</WifiEnterpriseConfiguration>\n" + "</Network>\n"; diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java index 9b5af549f..47efed3c4 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java @@ -99,6 +99,8 @@ public class WifiConfigStoreTest { + "<int name=\"LastUpdateUid\" value=\"-1\" />\n" + "<null name=\"LastUpdateName\" />\n" + "<int name=\"LastConnectUid\" value=\"0\" />\n" + + "<boolean name=\"IsLegacyPasspointConfig\" value=\"false\" />\n" + + "<long-array name=\"RoamingConsortiumOIs\" num=\"0\" />\n" + "</WifiConfiguration>\n" + "<NetworkStatus>\n" + "<string name=\"SelectionStatus\">NETWORK_SELECTION_ENABLED</string>\n" diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java index 6b411dad5..917a64cc9 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java @@ -455,6 +455,7 @@ public class WifiConfigurationTestUtil { assertEquals(expected.lastUpdateName, actual.lastUpdateName); assertEquals(expected.lastConnectUid, actual.lastConnectUid); assertEquals(expected.updateTime, actual.updateTime); + assertEquals(expected.isLegacyPasspointConfig, actual.isLegacyPasspointConfig); assertNetworkSelectionStatusEqualForConfigStore( expected.getNetworkSelectionStatus(), actual.getNetworkSelectionStatus()); assertWifiEnterpriseConfigEqualForConfigStore( diff --git a/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java b/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java index fdb26e489..d61809882 100644 --- a/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java +++ b/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java @@ -396,6 +396,22 @@ public class XmlUtilTest { deserializeWifiEnterpriseConfig(xmlString.getBytes(StandardCharsets.UTF_8)); } + /** + * Verify that WifiConfiguration representation of a legacy Passpoint configuration is + * serialized & deserialized correctly. + * + *@throws Exception + */ + @Test + public void testLegacyPasspointConfigSerializeDeserialize() throws Exception { + WifiConfiguration config = WifiConfigurationTestUtil.createPasspointNetwork(); + config.isLegacyPasspointConfig = true; + config.roamingConsortiumIds = new long[] {0x12345678}; + config.enterpriseConfig.setPlmn("1234"); + config.enterpriseConfig.setRealm("test.com"); + serializeDeserializeWifiConfigurationForConfigStore(config); + } + private byte[] serializeWifiConfigurationForBackup(WifiConfiguration configuration) throws IOException, XmlPullParserException { final XmlSerializer out = new FastXmlSerializer(); |