summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2018-09-18 14:34:05 -0700
committerRoshan Pius <rpius@google.com>2018-12-03 08:20:32 -0800
commitf89adbf3e7b2d56b8806ce2bd797dc9b2aec3526 (patch)
treef6b82ed96ec2c92e32cc7ab67da874afa2005853 /service
parent6d37c0e7b156dc26b177858111eee2f33dad9582 (diff)
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)
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiBackupDataV1Parser.java29
1 files changed, 11 insertions, 18 deletions
diff --git a/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java b/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java
index 9a6cf36db..9b27cf434 100644
--- a/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java
+++ b/service/java/com/android/server/wifi/WifiBackupDataV1Parser.java
@@ -167,8 +167,7 @@ class WifiBackupDataV1Parser implements WifiBackupDataParser {
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 @@ class WifiBackupDataV1Parser implements WifiBackupDataParser {
}
/**
- * 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 @@ class WifiBackupDataV1Parser implements WifiBackupDataParser {
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 @@ class WifiBackupDataV1Parser implements WifiBackupDataParser {
* @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);