Restoring support for external contacts account type XML
Change-Id: I3333fcc16312d8d593396f61019ada83f26c5f8d
diff --git a/src/com/android/contacts/model/ExternalAccountType.java b/src/com/android/contacts/model/ExternalAccountType.java
index 7393c51..ee6f603 100644
--- a/src/com/android/contacts/model/ExternalAccountType.java
+++ b/src/com/android/contacts/model/ExternalAccountType.java
@@ -76,7 +76,8 @@
private static final String METADATA_CONTACTS = "android.provider.CONTACTS_STRUCTURE";
private interface InflateTags {
- final String CONTACTS_SOURCE = "BaseAccountType";
+ final String CONTACTS_SOURCE_LEGACY = "ContactsSource";
+ final String CONTACTS_ACCOUNT_TYPE = "ContactsAccountType";
final String CONTACTS_DATA_KIND = "ContactsDataKind";
}
@@ -129,9 +130,11 @@
throw new IllegalStateException("No start tag found");
}
- if (!InflateTags.CONTACTS_SOURCE.equals(parser.getName())) {
+ String rootTag = parser.getName();
+ if (!InflateTags.CONTACTS_ACCOUNT_TYPE.equals(rootTag) &&
+ !InflateTags.CONTACTS_SOURCE_LEGACY.equals(rootTag)) {
throw new IllegalStateException("Top level element must be "
- + InflateTags.CONTACTS_SOURCE);
+ + InflateTags.CONTACTS_ACCOUNT_TYPE + ", not " + rootTag);
}
// Parse all children kinds
@@ -139,7 +142,7 @@
while (((type = parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth)
&& type != XmlPullParser.END_DOCUMENT) {
if (type == XmlPullParser.END_TAG
- || !InflateTags.CONTACTS_DATA_KIND.equals(parser.getName())) {
+ || !InflateTags.CONTACTS_DATA_KIND.equals(rootTag)) {
continue;
}