Follow up to EditSchema parser

- Now AccountType.addKind() throws DefinitionException instead of just logging.

- Now the test contacts.xml (= test_basic_contacts.xml) defines "event" and
"relationship" DataKinds too.  BUA should be able to copy this file.

- Added another xml, contacts_fallback.xml, to the test apk.
This defines what's equivalent to the fallback type.  Unittests load this file
directly and compares the result to the fallback account type.

- Cleaned up existing account definitions in order to make sure
contacts_fallback.xml is really identical to the fallback type. This includes:

** Now structured name, display name, phonetic name, and phone DataKinds
all have 'kind.typeOverallMax = 1'.

** The "assistant" phone type is no longer a custom column.  It's only used for
the fallback type and I don't think it's too critical.

- Also, NameKindBuilder no longer re-order phonetic fields, because no
other account types do this.  In the previous CL I did it because I thought
that'd be more "correct", but on the second thought it's probably not a good
idea to make too many non-critical changes at this point.

Bug 5381810

Change-Id: Ie6a4eb3b876ab22a3dcdb6a9c278e387f8166125
diff --git a/tests/res/xml/contacts_fallback.xml b/tests/res/xml/contacts_fallback.xml
new file mode 100644
index 0000000..ae262eb
--- /dev/null
+++ b/tests/res/xml/contacts_fallback.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright (c) 2011, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<!--
+    contacts.xml to build "fallback account type" equivalent.
+    This is directly used in ExternalAccountTypeTest to test the parser.  There's no sync adapter
+    that actually defined with this definition.
+-->
+
+<ContactsAccountType
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    >
+    <EditSchema
+        >
+        <DataKind kind="name"
+            maxOccurs="1"
+            supportsDisplayName="true"
+            supportsPrefix="true"
+            supportsMiddleName="true"
+            supportsSuffix="true"
+            supportsPhoneticFamilyName="true"
+            supportsPhoneticMiddleName="true"
+            supportsPhoneticGivenName="true"
+            >
+        </DataKind>
+        <DataKind kind="photo" maxOccurs="1" />
+        <DataKind kind="phone" >
+            <Type type="mobile" />
+            <Type type="home" />
+            <Type type="work" />
+            <Type type="fax_work" />
+            <Type type="fax_home" />
+            <Type type="pager" />
+            <Type type="other" />
+            <Type type="custom"/>
+            <Type type="callback" />
+            <Type type="car" />
+            <Type type="company_main" />
+            <Type type="isdn" />
+            <Type type="main" />
+            <Type type="other_fax" />
+            <Type type="radio" />
+            <Type type="telex" />
+            <Type type="tty_tdd" />
+            <Type type="work_mobile"/>
+            <Type type="work_pager" />
+            <Type type="assistant" />
+            <Type type="mms" />
+        </DataKind>
+        <DataKind kind="email" >
+            <Type type="home" />
+            <Type type="work" />
+            <Type type="other" />
+            <Type type="mobile" />
+            <Type type="custom" />
+        </DataKind>
+        <DataKind kind="nickname" maxOccurs="1" />
+        <DataKind kind="im" >
+            <Type type="aim" />
+            <Type type="msn" />
+            <Type type="yahoo" />
+            <Type type="skype" />
+            <Type type="qq" />
+            <Type type="google_talk" />
+            <Type type="icq" />
+            <Type type="jabber" />
+            <Type type="custom" />
+        </DataKind>
+        <DataKind kind="postal" needsStructured="false" >
+            <Type type="home" />
+            <Type type="work" />
+            <Type type="other" />
+            <Type type="custom" />
+        </DataKind>
+        <DataKind kind="organization" maxOccurs="1" />
+        <DataKind kind="website" />
+        <DataKind kind="sip_address" maxOccurs="1" />
+        <DataKind kind="note" maxOccurs="1" />
+    </EditSchema>
+</ContactsAccountType>
diff --git a/tests/res/xml/test_basic_contacts.xml b/tests/res/xml/test_basic_contacts.xml
index ad82706..0047204 100644
--- a/tests/res/xml/test_basic_contacts.xml
+++ b/tests/res/xml/test_basic_contacts.xml
@@ -17,10 +17,6 @@
  */
 -->
 
-<!--
-    contacts.xml to build "fallback account type" equivalent.
--->
-
 <ContactsAccountType
     xmlns:android="http://schemas.android.com/apk/res/android"
     >
@@ -98,8 +94,8 @@
         <DataKind kind="phone" >
             <!-- Note: Google type doesn't have obsolete ones -->
             <Type type="mobile" />
-            <Type type="work" />
             <Type type="home" />
+            <Type type="work" />
             <Type type="fax_work" />
             <Type type="fax_home" />
             <Type type="pager" />
@@ -139,9 +135,9 @@
         <!--
             Email
         -->
-        <!-- Fallback/ Google definition.  -->
+        <!-- Fallback/Google definition.  -->
         <DataKind kind="email" >
-            <!-- Note: Google type doesn't support some of these. -->
+            <!-- Note: Google type doesn't have obsolete ones -->
             <Type type="home" />
             <Type type="work" />
             <Type type="other" />
@@ -248,17 +244,13 @@
 
         <!--
             Event
-
-            The parser should be able to handle it, but not tested.
         -->
-        <!-- Google definition.
         <DataKind kind="event" dateWithTime="false">
             <Type type="birthday" maxOccurs="1" yearOptional="true" />
             <Type type="anniversary" />
             <Type type="other" />
             <Type type="custom" />
         </DataKind>
-        -->
 
         <!--
             Exchange definition.  dateWithTime is needed only for Exchange.
@@ -268,11 +260,9 @@
         -->
 
         <!--
-            Relationship.
-
-            The parser should be able to handle it, but not tested.
-
-        <DataKind kind="relation" >
+            Relationship
+        -->
+        <DataKind kind="relationship" >
             <Type type="assistant" />
             <Type type="brother" />
             <Type type="child" />
@@ -289,8 +279,5 @@
             <Type type="spouse" />
             <Type type="custom" />
         </DataKind>
-        -->
-
     </EditSchema>
-
 </ContactsAccountType>