* Begin wiring into system DevicePolicyManager requirements
* Semi-real implementations of isSupported() & isActive()
* Added new API (placeholder) updatePolicies()
* Updated existing unit tests as needed
Bug: 2387961
* scrub all external strings to keep them compliant for IMAP protocol
* move Build.MODEL to x-android-device-model
* send x-android-mobile-net-operator
* send AGUID
* unit tests for above
* retrieve providers from VendorPolicyLoader
Bug: 2332183
Moved Eas.ACCOUNT_MANAGER_TYPE to Email.EXCHANGE_ACCOUNT_MANAGER_TYPE.
This constant is not related to the exchange protocol, and referred in
a lot of different places. Moving it out of the package will make it a lot
simpler when removing exchange dependency.
What should be working:
* Events sync down from server and appear in calendar
* Recurrences and exceptions appear in calendar
* Changed events on server should be reflected in calendar
* Deletions on server should be reflected in calendar
* Push of new/changed/deleted events should work
* Changes on device are NOT synced back to server
* New, single events on device are synced back to server
(no time zone, attendee, or recurrence support)
* Checkbox for syncing calendar added to setup flow
* System sync glue in manifest, etc.
* Bugs are to be expected
* A few unit tests; needs more
Change-Id: I7ca262eaba562ccb9d1af5b0cd948c6bac30e5dd
- Dynamically switch to the alternate exchange strings to substitute overlays.
- Added the mechanism to load the "vendor policy", which tells you when the
alternate strings should be used.
Bug: 2382710
Merge commit '08d92ebf4722e45216ee225775a3b86f9ceecc0d'
* commit '08d92ebf4722e45216ee225775a3b86f9ceecc0d':
Trim the mime type portion of Content-Type.
* AccountSetupExchange defaultly tries using EAS AutoDiscover, which isn't
appropriate in the unit test setting
* Add an Intent extra to disable AutoDiscover and use it in unit tests
Bug: 2382368
Change-Id: I3d4e8d7194b02da44ad583da0cf2fe60ffb19311
* Add IMAP ID command to all login sequences
* Send generic information for now
* Explicitly catch & discard parsing errors, since we really don't
care if the command succeeds or not.
* Unit tests
Bug: 2332183
* Upgrade accounts table to add security column
* Read/Write new column
* Backup/Restore new column
* Unit tests for all of the above
* First cut at defining bitfields (non-binding, just putting down ideas)
Bug: 2387961
* Followup to 85d765f4
* Workaround for (HTC bug: 2275383) & (Moto bug: 2226582)
* Restores mSyncKey as null instead of empty string, which is how
a new account is initialized. Bug: 2385980
* Cleanup synchronized logic in backup & restore
* Minor cleanups & improved comments
Cherry-picked from master d612717340
* Followup to 5e91cccd
* Workaround for (HTC bug: 2275383) & (Moto bug: 2226582)
* Restores mSyncKey as null instead of empty string, which is how
a new account is initialized. Bug: 2385980
* Cleanup synchronized logic in backup & restore
* Minor cleanups & improved comments
* Workaround for (HTC bug 2275383) & (Moto bug 2226582)
* Adds checkpoints for backing up and restoring accounts
* Uses legacy Account / prefs to back up accounts - this is because
some of this code will be reused for legacy account migration
* Unit tests of Account & LegacyConversions
* Unit tests of backup & restore
* Not done: testing of EAS/Account Manager interface (this will require
deeper dependency injection, to avoid the embedded calls to the Account
Manager and other system services.)
Cherry-picked from master 5e91cccd4b
* Workaround for (HTC bug 2275383) & (Moto bug 2226582)
* Adds checkpoints for backing up and restoring accounts
* Uses legacy Account / prefs to back up accounts - this is because
some of this code will be reused for legacy account migration
* Unit tests of Account & LegacyConversions
* Unit tests of backup & restore
* Not done: testing of EAS/Account Manager interface (this will require
deeper dependency injection, to avoid the embedded calls to the Account
Manager and other system services.)
* Addresses #2287439 incompletely
* The most likely reason for a reply/forward to get stuck in the Outbox
is that the referenced message has been deleted from the client, with
the deletion occuring BEFORE the message gets sent (currently, the two
are completely independent)
* This change causes deletes NOT to be sent to the server if the message
to be deleted is referenced by an outgoing message
Change-Id: Iad3777282385bea82276f363d6f95ba8b07cc01c
* Addresses #2226426
* Recognize the case in which there is no EmailProvider Account corresponding
to an AccountManager account (the case being addressed is that of the
EmailProvider database being deleted due to corruption
* In this case, delete the AccountManager account so that the two are in
sync
* Refactor and add unit test for account reconciliation
Change-Id: I356b8bfaa0846f85223cc15994b750df207a63ea
* Addresses #2287439 incompletely
* The most likely reason for a reply/forward to get stuck in the Outbox
is that the referenced message has been deleted from the client, with
the deletion occuring BEFORE the message gets sent (currently, the two
are completely independent)
* This change causes deletes NOT to be sent to the server if the message
to be deleted is referenced by an outgoing message
Change-Id: I146f63ab345c07e684790e1d7d1fc08870468bbf
* Addresses #2226426
* If the user deletes Email data, or if data corruption causes
EmailProvider.db to be deleted, we will be in an inconsistent
state with any existing Exchange accounts, since the AccountManager
will still know about them, contacts (and eventually calendar) items will
continue to exist, etc.
* Run an integrity check when the provider is created, deleting any
orphaned EmailProvider.db or EmailProviderBody.db
* Catch SQLiteException's in the Provider and do an integrity check
if any is caught
Change-Id: I47d523b90a6b8f71ba8e13fba4b04846b3da1b1d
Case #1:
* Fixes#2184702
* Messages can be in the base Messages table, but also in
Message_Deletes and Message_Updates; the latter two were not
being purged of deleted messages.
* This CL deletes from all three tables when a Mailbox is deleted
* Also run a check for orphaned deletes/updates when the email
provider's db is first opened
* Unit test updated to check for proper deletion
* Unit test for the provider check for orphans
Case #2:
* Fixes#2184708
* Messages in Outbox/Drafts can get modified or deleted, but the
rows added to the updates/delete tables never get removed because
the boxes don't sync
* Added code to SyncManager.ping (which gets notifications of these
changes) to delete these rows
Change-Id: Ib53e441136b0da1e88bc220150d631999058a8f0
* For each attachment we add, check the DB for an existing attachment
with similar metadata (name, mime type, content id, etc.)
* Skip adding them if already held
* Unit tests
Originally fixed in 5b0a12c199 / CL I036f39c6
Fixes bug http://b/2084704
* For each attachment we add, check the DB for an existing attachment
with similar metadata (name, mime type, content id, etc.)
* Skip adding them if already held
* Unit tests
Fixes bug http://b/2084704
Some IMAP servers return NIL if you BODY.PEEK[TEXT] a messsage with
no body, instead of the more canonical {0}CRLF. Instead of messing with the
parser to deal with that, it makes more sense not to try and fetch empty
bodies. So there are three changes:
* Don't fetch parts when size = 0
* Don't append "null" when there is null body text
* Slight change to attachment handling so size is reported >0
* Unit tests on some of the related lower-level protocol stuff
Bug http://b/issue?id=2160387
Change-Id: Ifb8fb0ed5ce7297908e1ae8d5a02dda5975c4a3c
* MessageCompose now adds message-id to new messages (it was previously
done on its behalf by MimeMessage).
* LegacyConversions.updateMessageFields() now handles missing message-id
without error.
* Unit tests for the LegacyConversions change
These two issues were combining with a failure of comcast's SMTP server
to insert message-id headers, to prevent delivery of a message between
any two comcast accounts using this client.
Bug # http://b/issue?id=2161478
* Add AttachmentProvider.deleteAllMailboxAttachmentFiles
* Call it when server deletes a mailbox
* Confirmed (no change) all message deletes call deleteAllAttachmentFiles
* Unit tests of course :)
Bug # 2069004
Change-Id: I99731e6489fdca4cc9cebdff5fcf9c09d12b7b3a
* Add "Accept all certificates" modes to incoming/outgoing secure choices
* Change URI scheme slightly to make "trust" a flag, not part of the
protocol.
* Change Stores to know about new URI scheme
* Slightly rework Transport API to make "trust" an independent flag
* Adapt HostAuth to handle new Uri scheme
* Remove the old ambiguous "optional" code, which was allowing
some unsigned certificates, but was *also* allowing TLS to
optionally start (though not SSL, despite the UI strings.)
* Add a few unit tests to EmailContent
* Add logging and a bunch of comments to TrustManagerFactory, and a bit
of simple cleanup to make it more readable.
* Add missing conversion of SSLException->CertificateValidationException
in TLS so we get the correct certificate errors from TLS too.
* Re-enable TLS for mac.com accounts (which had a certificate problem)
Fixes bug http://b/2119755, http://b/1374780, and probably a raft of
earlier and/or external bugs about certificate problems.
Change-Id: Iaf99a8da3eaadaa4cdeec224737838b5d6813e55
* Create logic to detect upsyncable messages in Sent
* Note: Drafts is now local only for IMAP - no sync, either way
* Rewrite MessageController.processPendingAppend for Provider world
* Write provider message -> legacy message converter
* Fixed bug in IMAP APPEND (it was not picking the right UID for the
uploaded message.)
* Better handling of server internaldate
* Add constants for new X-Android-Body-Quoted-Part header
* Add EmailContent routines to get each of the 5 parts of the body
* Remove "Load more" from unsynced message lists
* Add toString to MimeHeader for debug support
Bug # 2097471
TODO (next CL): Upload attachments records too
Change-Id: I209182f5adc6b6696919f559e3cbbdd58b3eed3a
* Add new introText column in the Body database
* Reply/Forward put the appropriate String into this new column
* Rfc822Output uses this when required when streaming the message
Change-Id: I34602fdb3f91692c46fc8bc31ba0e6f680d445a0
* Get rid of old Account.getxxxFolderName() calls.
* Clean up any call sites to them
* Properly rename the existing special folder name identifiers
* Use a hash table in MessagingController to improve identification
of special folders for IMAP accounts
* Fix a bug in Controller, which was creating new server-side folders
using localized names.
* Fix a bunch of code in Controller that was using mContext, instead of
using mProviderContext to support testability.
* Fix broken unit tests in ControllerProviderOpsTests
Fixes bug 1904373
* Write unit test to replicate failure(s) in POP3 use of parseInt. All
calls to parseInt must be guarded by try/catch NumberFormatException.
* Fix the failures
Bug # 2115586
* Check for existing accounts with matching servername + username
* Show a dialog and block account creation
* Triggers in three cases:
* After input of an auto-setup account (e.g. Gmail or AOL)
* After input of manual setup (incoming) parameters
* After changing incoming parameters of *any* existing account
* Made some notes in EmailContent regarding fields in HostAuth that we
are not actually using.
* Added HostAuth unit tests
Primarily fixes bug # 1964449
Bonus fix for bug # 1594408
Change-Id: I49310faf6654280582e0ab3d3e40f2701bfcd21d
* SmartForward and SmartReply are EAS commands that automatically
include the original message and, if a forward, all original
attachments, regardless of whether they've been downloaded to
the device
* Both commands improve battery life by sending less data; greatly
so for SmartForward if there are attachments
Change-Id: I12432cd5275a3b54e9a80d5cd59da437c4a086cc
* Move creation of final reply/forward text (i.e. new text plus
the original) to Rfc822Output, where it belongs.
* Prepares the way for use of SmartForward/SmartReply in
Exchange and replying w/ multipart/alternative in SMTP
* Moved test from MessageCompose to new Rfc822OutputTests, and note
that new tests should be added (this is not a regression; there
were never enough tests here)
Change-Id: Ibefb842f47cc9223714856d99b8d4f55b55f49e3
* Define new message-loaded state "FLAG_LOADED_DELETED" (used only for
POP3, which needs to write sentinel messages that are not displayed.)
* Also renamed the other flags to make the naming more consistent.
* Tweak MessageList query generation to inhibit display of deleted
message sentinels, and MessagingController won't try to resync them.
* Clean up implementation of Controller.deleteMessage()
* Add support for move to trash to MessagingController. This operates
in three primary modes:
* POP3 local delete (no server-side interaction)
* POP3 server delete
* IMAP server delete (and copy to IMAP trash mailbox)
* Add missing implementation in provider to delete all of the attachments
for a given message
* Fix progress reporting in activities (the test for error vs. progress
was inverted, which caused progress indicators to keep spinning
after errors.)
* Fix broken account settings UI (POP3 delete policy was not persisting)
Addresses bug 2097409
TODO delete from trash / empty trash
Change-Id: I00188e6dc2093823106e009f35b68c760227c9e6
* Fixes 2048663, 2025029, and 2100131
* Add "Trust Certificates" checkbox in EAS account creation
* Use custom ClientConnectionManager for HttpClient with registry
for plain, ssl, and tssl (trusted ssl) connection
* Use a ConnectionPool for HttpClient connections
* Remove "Domain" checkbox in EAS account creation
* Remove tests related to the "Domain" field
* TODO Write a test for valid usernames (requires a bit of research)
<name>, <email address>, <domain>/<name, and <domain>\<name> are all
valid, but there might be others
Change-Id: I4a0338df5960bfd3d679a88aaf22d1c49f49992b
* Set reply/forward flag and sourceKey as appropriate in MessageCompose
* Update provider tests accordingly
Change-Id: I7f49d80a735314a1a38f09fbf1f234257c41af8c
* Also create a bogus account if none exists to prevent setup failure
* Fixes#2087413 (Email large tests failing with Unknown URI)
* Fixes#2097361 (Duplicate email address when replying...)
Change-Id: I9ca2ac5f98db43e9009c22421c69956440356e34
* Use concrete declarations, not the old sample code
* Remove unused "sample" code
* Create ExchangeSender.java
* Strip out the unused (old sample code) parts of ExchangeStore.java
* Unit test to make sure EAS is being offered
* Fix "account leak" in AccountSettingsTests
This was triggered by donut bug # 2092944 but the solution is
different because we support EAS here.
* Add reply columns to Body
* Remove a bunch of unused columns from Message
* Update SQL tables, content read/write, etc.
* Small tweaks to app code that was not-really-using the old columns.
* Update existing unit tests for new/changed columns
* Disable TagsTests to solve a tests failure (prexisting, not caused by
this CL)
Change-Id: Ief493796dfe219669755170d76786f91570cbb9b
It was broken by CL 22378.
The bug was in the situation when "==" (two padding chars) were at
the end, the reading did not stop after the first '=',
and thus one more char of output was generated.
Add more unit-test for base64 decoding.
* Add \FLAGGED support to IMAP (writeback)
* Add code in Controller to kick MessagingController
* Rewrite pending commands system to scan through provider's updated
messages table and react
* Fix a unit test that I broke
* Cleaned out some of the old PendingCommand support
Addresses the 2nd half (upsync) of bug 1904385
TODO:
Can I add a unit test for IMAP flag writer?
Change-Id: I5a96a695d4f35fca1395506f165b86d9fb19b543
- fix bug 2080075, reply to message without text body.
- workaround bug 2077496 by temporarilly disabling the address adapter.
- unit test for MessageCompose.buildBodyText()
- use precompiled regex
* Refactor the sync adapters to separate out parsing from commit
* Use ContactsProvider to save the SyncKey for contacts
* Fixes#2072664 and #2072456
Change-Id: I1e85c498496e83d9523489636a75f366f7fbd106
* Finish IMAP/POP sections of Controller.sendMessage
* Rewrite MessagingController.sendPendingMessagesSynchronous
* Add deleteAllAttachmentFiles to AttachmentProvider, and unit test
* Rework sendMessage callbacks and integrate into MessageList UI
* Send pending from UI
TODO:
* Find other places from which to call deleteAllAttachmentFiles
* Message, etc. could be added, if this had a use case
* Unit test added for both Account and Mailbox cases
* Eclipse changed some parens around; it won't happen again
* Handle messages >25k
* When structure is available (e.g. IMAP) pull in the entire body
and the list of attachments
* When structure is not available (e.g. POP) pull in a large chunk of
the body to try and capture the message body at least.
* Implement loadAttachment for IMAP/POP to demand download large items
* Tested with IMAP & POP messages
INCOMPLETE (file bugs):
* implement logic for the old loadMessageForView calls that comes from
MessageView (when you open a message that's partially-loaded)
* Resolve handling of mimetype when attachment info is read (currently
we're assuming base64 in a couple of places)
* delete account => delete attachments
* delete attachment => delete file
* create account => clear existing attachments for acct id
* Reset DB version to "1"
* Added field and support code (save, restore, & parcel)
* Added forgotten mProtocolVersion to parcelable code
* Added unit test for parceling
Also, fixed race condition in SyncManager that was underlocking the
wake locks during tests.
- plus unit tests.
- and some attachment refactoring.
- move PROJECTION_ID up to EmailContent.
- add index on messageKey to Attachments and Body tables.
- add missing Columns.ID field in EmailContent.
* Change Sender definition (remove old Message from API) and update
any existing calls through that API
* Rewrite SMTPSender to use provider messages
* Add attachments to RFC822Output
* Minor bugfixes in RFC822Output
* Unit tests
IMAP messages up to about 25k will be downloaded properly.
* Move Store->Provider message rewrite code to a separate utility.
* Add code to descend a Store message and write provider attachments.
* Unit test basic IMAP attachment handler
TODO:
* handle large IMAP messages.
* unit test for POP
* unit test for large IMAP messages
* Remove all use of Strings in favor of the parser's static final int's
* Strings remain in Tags for debugging output only
* Renamed lots of classes to be more consistent
* Centralized logging behavior in Eas class
* Found and fixed some bugs in the process:
- Account deletion wasn't removing HostAuth's correctly in the trigger
- Adding a second EAS account was trashing the first one
- Fixed looping sync behavior caused by Exchange 2003 bug
* Triggers added for insert/delete/update of Message
* update of Mailbox will never set unreadCount
* Removed old test for unread counts and replaced with on
that tests trigger operation.
* Remove Account.updateUnreadCount (deprecated)
* Modify to work with ContactsProvider2
* Modify to work with system AccountManager
* Modify to work with system SyncManager (for triggering user-change syncs)
* Sync server->client for adds/deletes implemented (CP2 doesn't handle delete yet)
* Sync server->client changes handled efficiently (only write changes)
* Some fields still not handled
* Rewrote most of the CPO code to handle server->client changes
* Sync client->server works for supported fields
* Change service API to allow caller to supply complete target path/file
* Also allow caller to supply the final content_uri
* In MessageView, use full integration with EAS service API and
attachments content provider to enable:
* Save: Only works on SD card
* View: Works w/o SD card using content provider & intents
* Thumbnail previews
* Rewrite internals to use EmailProvider instead of raw db access
* Minor changes to APIs as necessary (and scattered changes to follow)
* Convert unit tests and check them
No change in functionality. Just getting a test infrastructure in place
before rewriting to use new EmailProvider. Provides tests for:
* get type (raw & thumb)
* open file (raw)
* open file (thumb)
* query
* resolveAttachmentIdToContentUri
* Moved logic into Controller:
* toggling read/unread
* toggling favorite status
* some new unit tests
* load attachment
* Completed logic for EAS to save attachments and MessageView to
begin and complete that process.
NOTE: Until EAS has a mode for saving the attachment locally (and I
rewrite the attachmentprovider to handle the new database) I am
implementing "view" attachment to just call "save". This means that
attachments "viewed" will be dropped onto the SD card, instead of
cached and flushed.
TODO: Controller is not properly working in its own thread, yet, so
we are not properly preventing ANR's yet.
* Numerous classes modified to deal with this change
* Fixes bugs 1993292 and 1994671
* Renamed various setter and getter methods to reflect the underlying
field names
* Renamed syncFrequency to syncInterval in Account and Mailbox
* Convenience method added to AccountSettings to save only user settings
* Calls to content.update(context, content.toContentValues()), which save
all fields, should be double-checked for correctness, making sure that
content has current data and will not conflict with other threads that
might modify that data
* Ran all unit tests to confirm proper function
NOTE: The logic to enforce single default account no longer works,
because that logic is in Account.save() and does not run via
Account.update(). I have patched out a small section of the relevant unit
test and will file a bug to come back for this fix.
* Remove all references to Account.mIsDefault, which was not the right
way to find the default account (it is lazy initialized)
* Change Account.getDefaultAccount to getDefaultAccountId, which is more
efficient and suitable in most uses.
* Wrote unit tests for provider default account handling
This should resolve bug 1983390 as well as a few other issues with default
account management.