WifiBackupRestore: Ignore configKey mismatch in backup data

WifiConfiguration.configKey() is not part of the SDK. So, we can't
enforce that all Android devices return the same config key for a given
WifiConfiguration. The configKey validation in the parser for backup
data was just meant to be a failsafe. So, it should be safe to ignore
the check.

Bug: 115441410
Test: Unit tests
Change-Id: Ibe50e9525abc4f7a3e5a440ba2760a166246e91d
(cherry-picked from 234096a8f72046630787a7936fca161243b68edd)
diff --git a/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java b/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java
index 9a6cf36..9b27cf4 100644
--- a/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java
+++ b/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java
@@ -167,8 +167,7 @@
                 in, WifiBackupRestore.XML_TAG_SECTION_HEADER_WIFI_CONFIGURATION,
                 networkTagDepth);
         int configTagDepth = networkTagDepth + 1;
-        configuration = parseWifiConfigurationFromXmlAndValidateConfigKey(in, configTagDepth,
-                minorVersion);
+        configuration = parseWifiConfigurationFromXml(in, configTagDepth, minorVersion);
         if (configuration == null) {
             return null;
         }
@@ -182,12 +181,12 @@
     }
 
     /**
-     * Helper method to parse the WifiConfiguration object and validate the configKey parsed.
+     * Helper method to parse the WifiConfiguration object.
      */
-    private WifiConfiguration parseWifiConfigurationFromXmlAndValidateConfigKey(XmlPullParser in,
+    private WifiConfiguration parseWifiConfigurationFromXml(XmlPullParser in,
             int outerTagDepth, int minorVersion) throws XmlPullParserException, IOException {
         Pair<String, WifiConfiguration> parsedConfig =
-                parseWifiConfigurationFromXml(in, outerTagDepth, minorVersion);
+                parseWifiConfigurationFromXmlInternal(in, outerTagDepth, minorVersion);
         if (parsedConfig == null || parsedConfig.first == null || parsedConfig.second == null) {
             return null;
         }
@@ -195,17 +194,10 @@
         WifiConfiguration configuration = parsedConfig.second;
         String configKeyCalculated = configuration.configKey();
         if (!configKeyParsed.equals(configKeyCalculated)) {
-            String configKeyMismatchLog =
-                    "Configuration key does not match. Retrieved: " + configKeyParsed
-                            + ", Calculated: " + configKeyCalculated;
-            if (configuration.shared) {
-                Log.e(TAG, configKeyMismatchLog);
-                return null;
-            } else {
-                // ConfigKey mismatches are expected for private networks because the
-                // UID is not preserved across backup/restore.
-                Log.w(TAG, configKeyMismatchLog);
-            }
+            // configKey is not part of the SDK. So, we can't expect this to be the same
+            // across OEM's. Just log a warning & continue.
+            Log.w(TAG, "Configuration key does not match. Retrieved: " + configKeyParsed
+                    + ", Calculated: " + configKeyCalculated);
         }
         return configuration;
     }
@@ -269,8 +261,9 @@
      * @param minorVersion  minor version number parsed from incoming data.
      * @return Pair<Config key, WifiConfiguration object> if parsing is successful, null otherwise.
      */
-    private static Pair<String, WifiConfiguration> parseWifiConfigurationFromXml(XmlPullParser in,
-            int outerTagDepth, int minorVersion) throws XmlPullParserException, IOException {
+    private static Pair<String, WifiConfiguration> parseWifiConfigurationFromXmlInternal(
+            XmlPullParser in, int outerTagDepth, int minorVersion)
+            throws XmlPullParserException, IOException {
         WifiConfiguration configuration = new WifiConfiguration();
         String configKeyInData = null;
         Set<String> supportedTags = getSupportedWifiConfigurationTags(minorVersion);