From d44fca25d34d80d98c242423c3a5504a325553ab Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Fri, 31 Mar 2017 10:08:04 -0700 Subject: XmlUtil: Restore networks with CURRENT status as ENABLED When the device reboots while connected to a network, they might have their status saved as CURRENT in the xml store file. When this is being restored, we need to set this network status as ENABLED (since it is not connected at the point of restore). Bug: 35811529 Test: Unit tests Change-Id: I282f56a1c5c3e78b98fb23913772636be68e0f20 --- .../src/com/android/server/wifi/util/XmlUtilTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') 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 d61809882..0942b8328 100644 --- a/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java +++ b/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java @@ -211,6 +211,21 @@ public class XmlUtilTest { serializeDeserializeWifiConfigurationForConfigStore(configuration); } + /** + * Verify that a WifiConfiguration with status as CURRENT when serializing + * is deserialized as ENABLED. + */ + @Test + public void testCurrentStatusConfigurationSerializeDeserializeForConfigStore() + throws IOException, XmlPullParserException { + WifiConfiguration configuration = WifiConfigurationTestUtil.createEapNetwork(); + configuration.status = WifiConfiguration.Status.CURRENT; + byte[] xmlData = serializeWifiConfigurationForConfigStore(configuration); + Pair deserializedConfiguration = + deserializeWifiConfiguration(xmlData); + assertEquals(WifiConfiguration.Status.ENABLED, deserializedConfiguration.second.status); + } + /** * Verify that an enabled network selection status object is serialized & deserialized * correctly. -- cgit v1.2.3