Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86ccb6ce authored by Makoto Onuki's avatar Makoto Onuki
Browse files

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
parent d25f3189
Loading
Loading
Loading
Loading
+56 −5
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.RawContacts;
import android.util.Log;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;

@@ -83,11 +82,35 @@ public abstract class AccountType {
     */
    private HashMap<String, DataKind> mMimeKinds = Maps.newHashMap();

    protected boolean mIsInitialized;

    protected static class DefinitionException extends Exception {
        public DefinitionException(String message) {
            super(message);
        }

        public DefinitionException(String message, Exception inner) {
            super(message, inner);
        }
    }

    /**
     * Whether this account type was able to be fully initialized.  This may be false if
     * (for example) the package name associated with the account type could not be found.
     */
    public boolean isInitialized() {
    public final boolean isInitialized() {
        return mIsInitialized;
    }

    /**
     * @return Whether this type is an "embedded" type.  i.e. any of {@link FallbackAccountType},
     * {@link GoogleAccountType} or {@link ExternalAccountType}.
     *
     * If an embedded type cannot be initialized (i.e. if {@link #isInitialized()} returns
     * {@code false}) it's considered critical, and the application will crash.  On the other
     * hand if it's not an embedded type, we just skip loading the type.
     */
    public boolean isEmbedded() {
        return true;
    }

@@ -274,10 +297,10 @@ public abstract class AccountType {
    /**
     * Add given {@link DataKind} to list of those provided by this source.
     */
    public DataKind addKind(DataKind kind) {
    public DataKind addKind(DataKind kind) throws DefinitionException {
        if (mMimeKinds.get(kind.mimeType) != null) {
            // TODO Make it exception.
            Log.w(TAG, "mime type '" + kind.mimeType + "' is already registered");
            throw new DefinitionException(
                    "mime type '" + kind.mimeType + "' is already registered");
        }

        kind.resPackageName = this.resPackageName;
@@ -337,6 +360,16 @@ public abstract class AccountType {
        public int hashCode() {
            return rawValue;
        }

        @Override
        public String toString() {
            return this.getClass().getSimpleName()
                    + " rawValue=" + rawValue
                    + " labelRes=" + labelRes
                    + " secondary=" + secondary
                    + " specificMax=" + specificMax
                    + " customColumn=" + customColumn;
        }
    }

    public static class EventEditType extends EditType {
@@ -354,6 +387,11 @@ public abstract class AccountType {
            mYearOptional = yearOptional;
            return this;
        }

        @Override
        public String toString() {
            return super.toString() + " mYearOptional=" + mYearOptional;
        }
    }

    /**
@@ -403,6 +441,19 @@ public abstract class AccountType {
        public boolean isMultiLine() {
            return (inputType & EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) != 0;
        }


        @Override
        public String toString() {
            return this.getClass().getSimpleName() + ":"
                    + " column=" + column
                    + " titleRes=" + titleRes
                    + " inputType=" + inputType
                    + " minLines=" + minLines
                    + " optional=" + optional
                    + " shortForm=" + shortForm
                    + " longForm=" + longForm;
        }
    }

    /**
+6 −1
Original line number Diff line number Diff line
@@ -411,7 +411,12 @@ class AccountTypeManagerImpl extends AccountTypeManager
                    Log.d(TAG, "Registering external account type=" + type
                            + ", packageName=" + auth.packageName);
                    accountType = new ExternalAccountType(mContext, auth.packageName, false);
                }
                if (!accountType.isInitialized()) {
                    if (accountType.isEmbedded()) {
                        throw new IllegalStateException("Problem initializing embedded type "
                                + accountType.getClass().getCanonicalName());
                    } else {
                        // Skip external account types that couldn't be initialized.
                        continue;
                    }
+49 −51
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.contacts.model;

import com.android.contacts.R;
import com.android.contacts.model.AccountType.DefinitionException;
import com.android.contacts.util.DateUtils;
import com.google.android.collect.Lists;
import com.google.android.collect.Maps;
@@ -107,16 +108,6 @@ public abstract class BaseAccountType extends AccountType {
        static final int GROUP_MEMBERSHIP = 999;
    }

    protected static class DefinitionException extends Exception {
        public DefinitionException(String message) {
            super(message);
        }

        public DefinitionException(String message, Exception inner) {
            super(message, inner);
        }
    }

    public BaseAccountType() {
        this.accountType = null;
        this.dataSet = null;
@@ -148,11 +139,12 @@ public abstract class BaseAccountType extends AccountType {
        return new EditType(type, Relation.getTypeLabelResource(type));
    }

    protected DataKind addDataKindStructuredName(Context context) {
    protected DataKind addDataKindStructuredName(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(StructuredName.CONTENT_ITEM_TYPE,
                R.string.nameLabelsGroup, -1, true, R.layout.structured_name_editor_view));
        kind.actionHeader = new SimpleInflater(R.string.nameLabelsGroup);
        kind.actionBody = new SimpleInflater(Nickname.NAME);
        kind.typeOverallMax = 1;

        kind.fieldList = Lists.newArrayList();
        kind.fieldList.add(new EditField(StructuredName.DISPLAY_NAME,
@@ -177,11 +169,12 @@ public abstract class BaseAccountType extends AccountType {
        return kind;
    }

    protected DataKind addDataKindDisplayName(Context context) {
    protected DataKind addDataKindDisplayName(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(DataKind.PSEUDO_MIME_TYPE_DISPLAY_NAME,
                R.string.nameLabelsGroup, -1, true, R.layout.text_fields_editor_view));
        kind.actionHeader = new SimpleInflater(R.string.nameLabelsGroup);
        kind.actionBody = new SimpleInflater(Nickname.NAME);
        kind.typeOverallMax = 1;

        kind.fieldList = Lists.newArrayList();
        kind.fieldList.add(new EditField(StructuredName.DISPLAY_NAME,
@@ -217,11 +210,12 @@ public abstract class BaseAccountType extends AccountType {
        return kind;
    }

    protected DataKind addDataKindPhoneticName(Context context) {
    protected DataKind addDataKindPhoneticName(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(DataKind.PSEUDO_MIME_TYPE_PHONETIC_NAME,
                R.string.name_phonetic, -1, true, R.layout.phonetic_name_editor_view));
        kind.actionHeader = new SimpleInflater(R.string.nameLabelsGroup);
        kind.actionBody = new SimpleInflater(Nickname.NAME);
        kind.typeOverallMax = 1;

        kind.fieldList = Lists.newArrayList();
        kind.fieldList.add(new EditField(DataKind.PSEUDO_COLUMN_PHONETIC_NAME,
@@ -236,7 +230,7 @@ public abstract class BaseAccountType extends AccountType {
        return kind;
    }

    protected DataKind addDataKindNickname(Context context) {
    protected DataKind addDataKindNickname(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(Nickname.CONTENT_ITEM_TYPE,
                    R.string.nicknameLabelsGroup, 115, true, R.layout.text_fields_editor_view));
        kind.typeOverallMax = 1;
@@ -252,7 +246,7 @@ public abstract class BaseAccountType extends AccountType {
        return kind;
    }

    protected DataKind addDataKindPhone(Context context) {
    protected DataKind addDataKindPhone(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(Phone.CONTENT_ITEM_TYPE, R.string.phoneLabelsGroup,
                10, true, R.layout.text_fields_editor_view));
        kind.iconAltRes = R.drawable.ic_text_holo_light;
@@ -262,8 +256,8 @@ public abstract class BaseAccountType extends AccountType {
        kind.actionBody = new SimpleInflater(Phone.NUMBER);
        kind.typeColumn = Phone.TYPE;
        kind.typeList = Lists.newArrayList();
        kind.typeList.add(buildPhoneType(Phone.TYPE_HOME));
        kind.typeList.add(buildPhoneType(Phone.TYPE_MOBILE));
        kind.typeList.add(buildPhoneType(Phone.TYPE_HOME));
        kind.typeList.add(buildPhoneType(Phone.TYPE_WORK));
        kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_WORK).setSecondary(true));
        kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_HOME).setSecondary(true));
@@ -282,8 +276,7 @@ public abstract class BaseAccountType extends AccountType {
        kind.typeList.add(buildPhoneType(Phone.TYPE_TTY_TDD).setSecondary(true));
        kind.typeList.add(buildPhoneType(Phone.TYPE_WORK_MOBILE).setSecondary(true));
        kind.typeList.add(buildPhoneType(Phone.TYPE_WORK_PAGER).setSecondary(true));
        kind.typeList.add(buildPhoneType(Phone.TYPE_ASSISTANT).setSecondary(true).setCustomColumn(
                Phone.LABEL));
        kind.typeList.add(buildPhoneType(Phone.TYPE_ASSISTANT).setSecondary(true));
        kind.typeList.add(buildPhoneType(Phone.TYPE_MMS).setSecondary(true));

        kind.fieldList = Lists.newArrayList();
@@ -292,7 +285,7 @@ public abstract class BaseAccountType extends AccountType {
        return kind;
    }

    protected DataKind addDataKindEmail(Context context) {
    protected DataKind addDataKindEmail(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(Email.CONTENT_ITEM_TYPE, R.string.emailLabelsGroup,
                15, true, R.layout.text_fields_editor_view));
        kind.actionHeader = new EmailActionInflater();
@@ -312,7 +305,7 @@ public abstract class BaseAccountType extends AccountType {
        return kind;
    }

    protected DataKind addDataKindStructuredPostal(Context context) {
    protected DataKind addDataKindStructuredPostal(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(StructuredPostal.CONTENT_ITEM_TYPE,
                R.string.postalLabelsGroup, 25, true, R.layout.text_fields_editor_view));
        kind.actionHeader = new PostalActionInflater();
@@ -333,7 +326,7 @@ public abstract class BaseAccountType extends AccountType {
        return kind;
    }

    protected DataKind addDataKindIm(Context context) {
    protected DataKind addDataKindIm(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(Im.CONTENT_ITEM_TYPE, R.string.imLabelsGroup, 20, true,
                    R.layout.text_fields_editor_view));
        kind.actionHeader = new ImActionInflater();
@@ -364,7 +357,7 @@ public abstract class BaseAccountType extends AccountType {
        return kind;
    }

    protected DataKind addDataKindOrganization(Context context) {
    protected DataKind addDataKindOrganization(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(Organization.CONTENT_ITEM_TYPE,
                    R.string.organizationLabelsGroup, 5, true,
                    R.layout.text_fields_editor_view));
@@ -381,14 +374,15 @@ public abstract class BaseAccountType extends AccountType {
        return kind;
    }

    protected DataKind addDataKindPhoto(Context context) {
    protected DataKind addDataKindPhoto(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(Photo.CONTENT_ITEM_TYPE, -1, -1, true, -1));
        kind.typeOverallMax = 1;
        kind.fieldList = Lists.newArrayList();
        kind.fieldList.add(new EditField(Photo.PHOTO, -1, -1));
        return kind;
    }

    protected DataKind addDataKindNote(Context context) {
    protected DataKind addDataKindNote(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(Note.CONTENT_ITEM_TYPE,
                    R.string.label_notes, 110, true, R.layout.text_fields_editor_view));
        kind.typeOverallMax = 1;
@@ -400,7 +394,7 @@ public abstract class BaseAccountType extends AccountType {
        return kind;
    }

    protected DataKind addDataKindWebsite(Context context) {
    protected DataKind addDataKindWebsite(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(Website.CONTENT_ITEM_TYPE,
                R.string.websiteLabelsGroup, 120, true, R.layout.text_fields_editor_view));
        kind.actionHeader = new SimpleInflater(R.string.websiteLabelsGroup);
@@ -414,7 +408,7 @@ public abstract class BaseAccountType extends AccountType {
        return kind;
    }

    protected DataKind addDataKindSipAddress(Context context) {
    protected DataKind addDataKindSipAddress(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(SipAddress.CONTENT_ITEM_TYPE,
                    R.string.label_sip_address, 130, true, R.layout.text_fields_editor_view));

@@ -428,7 +422,7 @@ public abstract class BaseAccountType extends AccountType {
        return kind;
    }

    protected DataKind addDataKindGroupMembership(Context context) {
    protected DataKind addDataKindGroupMembership(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(GroupMembership.CONTENT_ITEM_TYPE,
                R.string.groupsLabel, 999, true, -1));

@@ -496,6 +490,13 @@ public abstract class BaseAccountType extends AccountType {
                return null;
            }
        }

        @Override
        public String toString() {
            return this.getClass().getSimpleName()
                    + " mStringRes=" + mStringRes
                    + " mColumnName" + mColumnName;
        }
    }

    public static abstract class CommonInflater implements StringInflater {
@@ -535,6 +536,11 @@ public abstract class BaseAccountType extends AccountType {
            final String label = values.getAsString(getLabelColumn());
            return getTypeLabel(context.getResources(), type, label);
        }

        @Override
        public String toString() {
            return this.getClass().getSimpleName();
        }
    }

    public static class PhoneActionInflater extends CommonInflater {
@@ -801,15 +807,14 @@ public abstract class BaseAccountType extends AccountType {
            kind.actionBody = actionBody;
            kind.fieldList = Lists.newArrayList();

            // Get more information from the tag...
            // A pseudo data kind doesn't have corresponding tag the XML, so we skip this.
            if (!isPseudo) {
                kind.typeOverallMax = getAttr(attrs, Attr.MAX_OCCURRENCE, -1);

            // Handle "types".
            // If a kind has the type column, contacts.xml must have at least one type definition.
            // Otherwise, it mustn't have a type definition.
            //
            // If it's a pseudo data kind (== data kind that doesn't have the corresponding
            // DataKind tag in the XML), we just skip this process.
            if (!isPseudo) {
                // Process "Type" tags.
                // If a kind has the type column, contacts.xml must have at least one type
                // definition.  Otherwise, it mustn't have a type definition.
                if (kind.typeColumn != null) {
                    // Parse and add types.
                    kind.typeList = Lists.newArrayList();
@@ -957,7 +962,6 @@ public abstract class BaseAccountType extends AccountType {
            throwIfList(ks);
            kinds.add(ks);


            // Note about setLongForm/setShortForm below.
            // We need to set this only when the type supports display name. (=supportsDisplayName)
            // Otherwise (i.e. Exchange) we don't set these flags, but instead make some fields
@@ -988,6 +992,7 @@ public abstract class BaseAccountType extends AccountType {
                    R.string.nameLabelsGroup, Weight.NONE, R.layout.text_fields_editor_view,
                    new SimpleInflater(R.string.nameLabelsGroup),
                    new SimpleInflater(Nickname.NAME));
            kd.typeOverallMax = 1;
            kinds.add(kd);

            kd.fieldList.add(new EditField(StructuredName.DISPLAY_NAME,
@@ -1023,25 +1028,18 @@ public abstract class BaseAccountType extends AccountType {
                    R.string.name_phonetic, Weight.NONE, R.layout.phonetic_name_editor_view,
                    new SimpleInflater(R.string.nameLabelsGroup),
                    new SimpleInflater(Nickname.NAME));
            kp.typeOverallMax = 1;
            kinds.add(kp);

            // We may want to change the order depending on displayOrderPrimary too.
            kp.fieldList.add(new EditField(DataKind.PSEUDO_COLUMN_PHONETIC_NAME,
                    R.string.name_phonetic, FLAGS_PHONETIC).setShortForm(true));
            if (!displayOrderPrimary) {
            kp.fieldList.add(new EditField(StructuredName.PHONETIC_FAMILY_NAME,
                    R.string.name_phonetic_family, FLAGS_PHONETIC).setLongForm(true));
            kp.fieldList.add(new EditField(StructuredName.PHONETIC_MIDDLE_NAME,
                    R.string.name_phonetic_middle, FLAGS_PHONETIC).setLongForm(true));
            kp.fieldList.add(new EditField(StructuredName.PHONETIC_GIVEN_NAME,
                    R.string.name_phonetic_given, FLAGS_PHONETIC).setLongForm(true));
            } else {
                kp.fieldList.add(new EditField(StructuredName.PHONETIC_GIVEN_NAME,
                        R.string.name_phonetic_given, FLAGS_PHONETIC).setLongForm(true));
                kp.fieldList.add(new EditField(StructuredName.PHONETIC_MIDDLE_NAME,
                        R.string.name_phonetic_middle, FLAGS_PHONETIC).setLongForm(true));
                kp.fieldList.add(new EditField(StructuredName.PHONETIC_FAMILY_NAME,
                        R.string.name_phonetic_family, FLAGS_PHONETIC).setLongForm(true));
            }
            return kinds;
        }
    }
+40 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import com.android.contacts.R;
import com.android.contacts.model.AccountType.EditField;
import com.android.contacts.model.AccountType.EditType;
import com.android.contacts.model.AccountType.StringInflater;
import com.google.common.collect.Iterators;

import android.content.ContentValues;
import android.provider.ContactsContract.Data;
@@ -95,4 +96,43 @@ public final class DataKind {
        this.typeOverallMax = -1;
        this.editorLayoutResourceId = editorLayoutResourceId;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("DataKind:");
        sb.append(" resPackageName=").append(resPackageName);
        sb.append(" mimeType=").append(mimeType);
        sb.append(" titleRes=").append(titleRes);
        sb.append(" iconAltRes=").append(iconAltRes);
        sb.append(" iconAltDescriptionRes=").append(iconAltDescriptionRes);
        sb.append(" weight=").append(weight);
        sb.append(" editable=").append(editable);
        sb.append(" actionHeader=").append(actionHeader);
        sb.append(" actionAltHeader=").append(actionAltHeader);
        sb.append(" actionBody=").append(actionBody);
        sb.append(" actionBodySocial=").append(actionBodySocial);
        sb.append(" typeColumn=").append(typeColumn);
        sb.append(" typeOverallMax=").append(typeOverallMax);
        sb.append(" typeList=").append(toString(typeList));
        sb.append(" fieldList=").append(toString(fieldList));
        sb.append(" defaultValues=").append(defaultValues);
        sb.append(" editorLayoutResourceId=").append(editorLayoutResourceId);
        sb.append(" dateFormatWithoutYear=").append(toString(dateFormatWithoutYear));
        sb.append(" dateFormatWithYear=").append(toString(dateFormatWithYear));

        return sb.toString();
    }

    public static String toString(SimpleDateFormat format) {
        return format == null ? "(null)" : format.toPattern();
    }

    public static String toString(Iterable<?> list) {
        if (list == null) {
            return "(null)";
        } else {
            return Iterators.toString(list.iterator());
        }
    }
}
 No newline at end of file
+36 −27
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.contacts.model;

import com.android.contacts.R;
import com.android.contacts.model.AccountType.DefinitionException;
import com.android.contacts.util.DateUtils;
import com.google.android.collect.Lists;

@@ -33,10 +34,12 @@ import android.provider.ContactsContract.CommonDataKinds.Photo;
import android.provider.ContactsContract.CommonDataKinds.StructuredName;
import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
import android.provider.ContactsContract.CommonDataKinds.Website;
import android.util.Log;

import java.util.Locale;

public class ExchangeAccountType extends BaseAccountType {
    private static final String TAG = "ExchangeAccountType";

    public static final String ACCOUNT_TYPE = "com.android.exchange";

@@ -45,6 +48,7 @@ public class ExchangeAccountType extends BaseAccountType {
        this.resPackageName = null;
        this.summaryResPackageName = resPackageName;

        try {
            addDataKindStructuredName(context);
            addDataKindDisplayName(context);
            addDataKindPhoneticName(context);
@@ -59,10 +63,15 @@ public class ExchangeAccountType extends BaseAccountType {
            addDataKindEvent(context);
            addDataKindWebsite(context);
            addDataKindGroupMembership(context);

            mIsInitialized = true;
        } catch (DefinitionException e) {
            Log.e(TAG, "Problem building account type", e);
        }
    }

    @Override
    protected DataKind addDataKindStructuredName(Context context) {
    protected DataKind addDataKindStructuredName(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(StructuredName.CONTENT_ITEM_TYPE,
                R.string.nameLabelsGroup, -1, true, R.layout.structured_name_editor_view));
        kind.actionHeader = new SimpleInflater(R.string.nameLabelsGroup);
@@ -91,7 +100,7 @@ public class ExchangeAccountType extends BaseAccountType {
    }

    @Override
    protected DataKind addDataKindDisplayName(Context context) {
    protected DataKind addDataKindDisplayName(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(DataKind.PSEUDO_MIME_TYPE_DISPLAY_NAME,
                R.string.nameLabelsGroup, -1, true, R.layout.text_fields_editor_view));

@@ -124,7 +133,7 @@ public class ExchangeAccountType extends BaseAccountType {
    }

    @Override
    protected DataKind addDataKindPhoneticName(Context context) {
    protected DataKind addDataKindPhoneticName(Context context) throws DefinitionException {
        DataKind kind = addKind(new DataKind(DataKind.PSEUDO_MIME_TYPE_PHONETIC_NAME,
                R.string.name_phonetic, -1, true, R.layout.phonetic_name_editor_view));
        kind.actionHeader = new SimpleInflater(R.string.nameLabelsGroup);
@@ -142,7 +151,7 @@ public class ExchangeAccountType extends BaseAccountType {
    }

    @Override
    protected DataKind addDataKindNickname(Context context) {
    protected DataKind addDataKindNickname(Context context) throws DefinitionException {
        final DataKind kind = super.addDataKindNickname(context);

        kind.typeOverallMax = 1;
@@ -155,7 +164,7 @@ public class ExchangeAccountType extends BaseAccountType {
    }

    @Override
    protected DataKind addDataKindPhone(Context context) {
    protected DataKind addDataKindPhone(Context context) throws DefinitionException {
        final DataKind kind = super.addDataKindPhone(context);

        kind.typeColumn = Phone.TYPE;
@@ -185,7 +194,7 @@ public class ExchangeAccountType extends BaseAccountType {
    }

    @Override
    protected DataKind addDataKindEmail(Context context) {
    protected DataKind addDataKindEmail(Context context) throws DefinitionException {
        final DataKind kind = super.addDataKindEmail(context);

        kind.typeOverallMax = 3;
@@ -197,7 +206,7 @@ public class ExchangeAccountType extends BaseAccountType {
    }

    @Override
    protected DataKind addDataKindStructuredPostal(Context context) {
    protected DataKind addDataKindStructuredPostal(Context context) throws DefinitionException {
        final DataKind kind = super.addDataKindStructuredPostal(context);

        final boolean useJapaneseOrder =
@@ -237,7 +246,7 @@ public class ExchangeAccountType extends BaseAccountType {
    }

    @Override
    protected DataKind addDataKindIm(Context context) {
    protected DataKind addDataKindIm(Context context) throws DefinitionException {
        final DataKind kind = super.addDataKindIm(context);

        // Types are not supported for IM. There can be 3 IMs, but OWA only shows only the first
@@ -253,7 +262,7 @@ public class ExchangeAccountType extends BaseAccountType {
    }

    @Override
    protected DataKind addDataKindOrganization(Context context) {
    protected DataKind addDataKindOrganization(Context context) throws DefinitionException {
        final DataKind kind = super.addDataKindOrganization(context);

        kind.typeOverallMax = 1;
@@ -268,7 +277,7 @@ public class ExchangeAccountType extends BaseAccountType {
    }

    @Override
    protected DataKind addDataKindPhoto(Context context) {
    protected DataKind addDataKindPhoto(Context context) throws DefinitionException {
        final DataKind kind = super.addDataKindPhoto(context);

        kind.typeOverallMax = 1;
@@ -280,7 +289,7 @@ public class ExchangeAccountType extends BaseAccountType {
    }

    @Override
    protected DataKind addDataKindNote(Context context) {
    protected DataKind addDataKindNote(Context context) throws DefinitionException {
        final DataKind kind = super.addDataKindNote(context);

        kind.fieldList = Lists.newArrayList();
@@ -289,7 +298,7 @@ public class ExchangeAccountType extends BaseAccountType {
        return kind;
    }

    protected DataKind addDataKindEvent(Context context) {
    protected DataKind addDataKindEvent(Context context) throws DefinitionException {
        DataKind kind = addKind(
                new DataKind(Event.CONTENT_ITEM_TYPE, R.string.eventLabelsGroup, 150, true,
                R.layout.event_field_editor_view));
@@ -311,7 +320,7 @@ public class ExchangeAccountType extends BaseAccountType {
    }

    @Override
    protected DataKind addDataKindWebsite(Context context) {
    protected DataKind addDataKindWebsite(Context context) throws DefinitionException {
        final DataKind kind = super.addDataKindWebsite(context);

        kind.typeOverallMax = 1;
Loading