diff --git a/build/res/xml/services.xml b/build/res/xml/services.xml index 6a21354cd..9af2ae611 100644 --- a/build/res/xml/services.xml +++ b/build/res/xml/services.xml @@ -84,6 +84,7 @@ email:syncChanges="true" email:inferPrefix="imap" email:offerLoadMore="true" + email:requiresSetup="true" /> + diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index 336308552..883b50ae7 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -2840,12 +2840,13 @@ outer: } if (projectionColumns.contains( UIProvider.AccountColumns.SettingsColumns.SETUP_INTENT_URI)) { - // Use this if needed + // Set the setup intent if needed + // TODO We should clarify/document the trash/setup relationship long trashId = Mailbox.findMailboxOfType(context, accountId, Mailbox.TYPE_TRASH); if (trashId == Mailbox.NO_MAILBOX) { - // STOPSHIP Don't hard-code this for imap - String protocol = Account.getProtocol(context, Long.parseLong(id)); - if (protocol.equals("gImap")) { + EmailServiceInfo info = EmailServiceUtils.getServiceInfoForAccount(context, + accountId); + if (info != null && info.requiresSetup) { values.put(UIProvider.AccountColumns.SettingsColumns.SETUP_INTENT_URI, getExternalUriString("setup", id)); } diff --git a/src/com/android/email/service/EmailServiceUtils.java b/src/com/android/email/service/EmailServiceUtils.java index 7cd0ba9a3..86c5fe956 100644 --- a/src/com/android/email/service/EmailServiceUtils.java +++ b/src/com/android/email/service/EmailServiceUtils.java @@ -177,6 +177,7 @@ public class EmailServiceUtils { public String inferPrefix; public boolean requiresAccountUpdate; public boolean offerLoadMore; + public boolean requiresSetup; public String toString() { StringBuilder sb = new StringBuilder("Protocol: "); @@ -211,6 +212,11 @@ public class EmailServiceUtils { } } + public static EmailServiceInfo getServiceInfoForAccount(Context context, long accountId) { + String protocol = Account.getProtocol(context, accountId); + return getServiceInfo(context, protocol); + } + public static EmailServiceInfo getServiceInfo(Context context, String protocol) { if (sServiceList.isEmpty()) { findServices(context); @@ -529,6 +535,8 @@ public class EmailServiceUtils { info.inferPrefix = ta.getString(R.styleable.EmailServiceInfo_inferPrefix); info.offerLoadMore = ta.getBoolean(R.styleable.EmailServiceInfo_offerLoadMore, false); + info.requiresSetup = + ta.getBoolean(R.styleable.EmailServiceInfo_requiresSetup, false); // Must have either "class" (local) or "intent" (remote) if (klass != null) {