Cleanup of services.xml

* Document service attributes
* Turn magic numbers into enums
* Remove unused attribute

Change-Id: I463c64c5c9f589946dc9e27b4f630170ac46bafc
This commit is contained in:
Marc Blank 2012-06-21 11:23:52 -07:00
parent 43b0f13200
commit 8ef319cc3f
3 changed files with 66 additions and 18 deletions

View File

@ -36,16 +36,31 @@
<attr name="defaultLocalDeletes" format="integer"/>
<attr name="offerPrefix" format="boolean"/>
<attr name="usesSmtp" format="boolean"/>
<attr name="offerPush" format="boolean"/>
<attr name="syncChanges" format="boolean"/>
<attr name="syncContacts" format="boolean"/>
<attr name="syncCalendar" format="boolean"/>
<attr name="usesAutodiscover" format="boolean"/>
<attr name="offerLookback" format="boolean"/>
<attr name="defaultLookback" format="integer"/>
<attr name="defaultLookback">
<enum name="auto" value="-2"/>
<enum name="days1" value="1"/>
<enum name="days3" value="2"/>
<enum name="weeks1" value="3"/>
<enum name="weeks2" value="4"/>
<enum name="months1" value="5"/>
<enum name="all" value="6"/>
</attr>
<attr name="offerAttachmentPreload" format="boolean"/>
<attr name="syncIntervalStrings" format="reference"/>
<attr name="syncIntervals" format="reference"/>
<attr name="defaultSyncInterval" format="integer"/>
<attr name="defaultSyncInterval">
<enum name="push" value="-2"/>
<enum name="never" value="-1"/>
<enum name="mins5" value="5"/>
<enum name="mins10" value="10"/>
<enum name="mins15" value="15"/>
<enum name="mins30" value="30"/>
<enum name="mins60" value="60"/>
</attr>
</declare-styleable>
</resources>

View File

@ -14,6 +14,39 @@
limitations under the License.
-->
<!--
Email services (protocols) are defined here. For the present, these are baked into the Email
apk; the goal is for remote services to register themselves into this file.
The required attributes are as follows (except that EITHER serviceClass or intent is required):
protocol: the unique name used to identify the protocol
name: the name of the account type option presented to users during account setup
accountType: the AccountManager type of accounts created using this service
serviceClass: a class implementing IEmailService (or null, if the service is remote)
intent: the intent used to connect to a remote IEmailService
port: the (default) port used when creating accounts using this service
portSsl: as above, when SSL is selected
syncIntervalStrings: a reference to an array of sync interval options
syncIntervals: a reference to an array of values corresponding to syncIntervalStrings
defaultSyncInterval: the default sync interval, selected from enums defined in attrs.xml
The following optional attributes default to "false":
offerTls: whether a TLS option (e.g. STARTTLS) is offered for this service
offerCerts: whether or not certificate authentication is an option for this service
usesSmtp: whether SMTP is used as the outgoing protocol for this service
offerPrefix: whether a "prefix" is offered to the user (for IMAP)
offerLocalDeletes: whether an option to delete locally is offered
syncChanges: whether non-deletion changes to messages sync back to the server
offerAttachmentPreload: whether to offer attachment preloading (pre-caching)
usesAutodiscover: whether to attempt using the "autodiscover" API when creating
an account
offerLookback: whether a sync "lookback" is offered (rather than the POP/IMAP
legacy "25 most recent messages synced")
defaultLookback: if "lookback" is offered, an enum of possible lookbacks
syncCalendar: whether this service is capable of syncing a calendar (offering a checkbox)
syncContacts: whether this service is capable of syncing contacts (offering a checkbox)
-->
<emailservices xmlns:email="http://schemas.android.com/apk/res/com.android.email">
<emailservice
email:protocol="pop3"
@ -22,27 +55,29 @@
email:serviceClass="com.android.email.service.ImapService"
email:port="110"
email:portSsl="995"
email:syncIntervalStrings="@array/account_settings_check_frequency_entries"
email:syncIntervals="@array/account_settings_check_frequency_values"
email:defaultSyncInterval="mins15"
email:offerTls="true"
email:usesSmtp="true"
email:offerLocalDeletes="true"
email:syncIntervalStrings="@array/account_settings_check_frequency_entries"
email:syncIntervals="@array/account_settings_check_frequency_values"
email:defaultSyncInterval="15"
/>
<emailservice
email:protocol="imap"
email:name="IMAP"
email:accountType="com.android.email"
email:serviceClass="com.android.email.service.Pop3Service"
email:offerAttachmentPreload="true"
email:port="143"
email:portSsl="993"
email:offerTls="true"
email:usesSmtp="true"
email:offerPrefix="true"
email:syncIntervalStrings="@array/account_settings_check_frequency_entries"
email:syncIntervals="@array/account_settings_check_frequency_values"
email:defaultSyncInterval="15"
email:defaultSyncInterval="mins15"
email:offerTls="true"
email:usesSmtp="true"
email:offerAttachmentPreload="true"
email:offerPrefix="true"
email:syncChanges="true"
/>
<emailservice
@ -52,17 +87,17 @@
email:intent="com.android.email.EXCHANGE_INTENT"
email:port="80"
email:portSsl="443"
email:defaultSsl="true"
email:offerCerts="true"
email:syncIntervalStrings="@array/account_settings_check_frequency_entries_push"
email:syncIntervals="@array/account_settings_check_frequency_values_push"
email:defaultSyncInterval="-2"
email:defaultSyncInterval="push"
email:defaultSsl="true"
email:offerCerts="true"
email:syncChanges="true"
email:usesAutodiscover="true"
email:offerAttachmentPreload="true"
email:offerPush="true"
email:offerLookback="true"
email:defaultLookback="-2"
email:defaultLookback="auto"
email:syncContacts="true"
email:syncCalendar="true"
/>

View File

@ -144,7 +144,6 @@ public class EmailServiceUtils {
public int defaultLocalDeletes;
public boolean offerPrefix;
public boolean usesAutodiscover;
public boolean offerPush;
public boolean offerLookback;
public int defaultLookback;
public boolean syncChanges;
@ -233,7 +232,6 @@ public class EmailServiceUtils {
info.usesSmtp = ta.getBoolean(R.styleable.EmailServiceInfo_usesSmtp, false);
info.usesAutodiscover =
ta.getBoolean(R.styleable.EmailServiceInfo_usesAutodiscover, false);
info.offerPush = ta.getBoolean(R.styleable.EmailServiceInfo_offerPush, false);
info.offerLookback =
ta.getBoolean(R.styleable.EmailServiceInfo_offerLookback, false);
info.defaultLookback =