Commit Graph

894 Commits

Author SHA1 Message Date
Andy Stadler 02a0edb60d Allow spaces in passwords DO NOT MERGE
* Separate/identical fixes for incoming, outgoing, exchange
* Unit tests
* Some protocols will fail anyway (e.g. POP3)

Bug: 2981433
Backport from: I82984e5912fc7fcb88e747815d0fe33cb36605e7

Change-Id: I49d5c13137e4f78b6fa0f9ce288c1a78ff028f88
2010-09-27 13:31:04 -07:00
Andrew Stadler fb4333b3a5 Allow spaces in passwords
* Separate/identical fixes for incoming, outgoing, exchange
* Unit tests
* Some protocols will fail anyway (e.g. POP3)

TODO: Some sort of warning (master only - won't backport that)
Bug: 2981433

Change-Id: I82984e5912fc7fcb88e747815d0fe33cb36605e7
2010-09-27 10:04:03 -07:00
Makoto Onuki d25d87c7ba Fix NPE with use of getFirstRowXxx
Make sure not to cast null into a primitive type.
(i.e. If null isn't expected as a return value, make sure to set a non-null
default value.)

Bug 3032143

Change-Id: I9a344d765c75a66f529ad8d99b00b2b919139f9c
2010-09-24 16:59:51 -07:00
Marc Blank 224442906b Merge "Handle EAS type 1 folders (user-created)" 2010-09-24 16:54:57 -07:00
Marc Blank 23f8d3be7d Handle EAS type 1 folders (user-created)
* If a type 1 folder has an mail folder as a parent (at any level),
  it is also a mail folder (and therefore, we should have it in our
  folder list)
* Before rejecting type 1 folders, look for parents and accept those
  that are mail folders
* Add unit test to verify logic

Bug: 2978410
Change-Id: I44cda1d1c1fd7f3976af53a1672736201cc995ff
2010-09-24 12:46:08 -07:00
Makoto Onuki 4209ea36b0 Make ThrottlingCursorLoader smarter
Now the class initially uses smaller timeout, and expand it when detecting
multiple changes in a short period.

This CL makes the UI look more responsive especially on the message list +
message view mode.  e.g. Starring on the message view will quickly be
reflected to the message list.

Bug 3024799
Bug 3027832

Change-Id: Ie2d44c3769d43e3fd0f54ee526556eb3bad5e288
2010-09-22 18:01:01 -07:00
Andrew Stadler 0813c7051f resolved conflicts for merge of 0d9ed341 to master
Change-Id: I198f760ef1734cf4a64c875236a2352859dc1a72
2010-09-22 14:37:44 -07:00
Andy Stadler 16657c9c20 Merge "Fix test failures" into gingerbread 2010-09-22 13:18:52 -07:00
Andy Stadler 6278dcdeaf Fix test failures
Methods were used by tests only and being stripped by PG.

Bug: 2894378
Change-Id: Ieb1dd0daa8bd380c66a7b1e6151c5e5b22cbe38c
2010-09-22 12:06:41 -07:00
Marc Blank d46952e7b0 DO NOT MERGE: Test validity of port numbers in account setup
Bug: 1712475
Change-Id: Iced4875379a804b5072e4df0af25db7bf9473131
2010-09-21 17:46:15 -07:00
Makoto Onuki 0be6c7c5cf Merge "DO NOT MERGE: Fix handling IOException in ImapStore" into gingerbread 2010-09-21 10:24:48 -07:00
Makoto Onuki 32517753ea Merge "DO NOT MERGE: Handle multiple IMAP SEARCH results." into gingerbread 2010-09-21 10:24:44 -07:00
Makoto Onuki 75c6a611aa Merge "DO NOT MERGE: Test for interaction between ImapStore and vendor policy." into gingerbread 2010-09-21 10:24:40 -07:00
Makoto Onuki 7fbdc44c58 Merge "DO NOT MERGE: Extract MockVendorPolicy, add standard mechanism to inject it." into gingerbread 2010-09-21 10:24:36 -07:00
Makoto Onuki 415b27fbd3 Merge "DO NOT MERGE: Follow-up to the new IMAP parser." into gingerbread 2010-09-21 10:24:18 -07:00
Marc Blank ef70c9872b Merge "DO NOT MERGE: Send intro text with SmartForward" into gingerbread 2010-09-20 19:18:58 -07:00
Marc Blank 9afbf947de DO NOT MERGE: Send intro text with SmartForward
* We need to include the intro text (--Original Message--, etc.) to
  SmartForwards, and somehow this got in a past updat
* Add unit test for forwarding
* Fix unit test for reply so that it works localized

Backport of I8d92f00d37a434840ec3eb237f3901cd5dc7ad09

Bug: 2477988
Bug: 2685784
Change-Id: I2b6654413a8eb5ca900f958f49ec9eee5161a365
2010-09-20 18:51:32 -07:00
Marc Blank 6512458784 DO NOT MERGE: Make sure signature is added to reply/forward
* Add this to processSourceMessage in the reply/forward cases
* Add unit tests for reply and forward case

Backport of I6be8383fe5f217a4bda8e669cb69f439bc8e96b6

Bug: 2734321
Change-Id: Ia59e8c4e2f9663f2a10cff066eddeff80bc06cef
2010-09-20 18:48:07 -07:00
Makoto Onuki f255081a85 DO NOT MERGE: Fix handling IOException in ImapStore
- mConnection.destroyResponses() should be protected with
if (mConnection != null).
When we get an IOException, we close the connection and null it out in
ioExceptionHandler().  So mConnection can be null at any point after
where ioExceptionHandler() first appears.

- ioExceptionHandler should close its parent ImapFolder only if the argument
connection is mConnection.
Methods like exists() may pass an ImapConnection which is not mConnection
to ioExceptionHandler.  In which case we don't have to close the ImapFolder.

Bug 2898211

Backport of I8f9f45d91f596bb8da1a1575593e652d66deb643

Change-Id: I070458b5535540aba69ad7eee88bd2af8ad5f7b1
2010-09-20 16:45:48 -07:00
Makoto Onuki 29f0638f4d DO NOT MERGE: Handle multiple IMAP SEARCH results.
Apparently IMAP servers may return multiple SEARCH responses for a
single SEARCH command, and we need to handle all of them.

Before the IMAP rework there was 3 methods that issued the SEARCH command.
Two of them ware doing it right, but the other wasn't, which was what
I copied from, unfortunately!

In case you're wondering, originally the test for this method was done through
upper methods, e.g. getMessage().

Bug 2911647

Backport of Ia50072944d5b01c1e59541c3a966067b13910cc4

Change-Id: Iab5d3fa21e403f2e1043990112154fbb72322b02
2010-09-20 16:45:48 -07:00
Makoto Onuki 8aa79ba695 DO NOT MERGE: Test for interaction between ImapStore and vendor policy.
Backport of I092b3a0f2f40d9aa19f2f61066362099c8b3f50b

Change-Id: I492f975e66d67aae62024804a294e796f23d2aad
2010-09-20 16:45:48 -07:00
Makoto Onuki 618f1d8ac5 DO NOT MERGE: Extract MockVendorPolicy, add standard mechanism to inject it.
One thing that bothers me regarding the new ImapStore is that there is no
tests to verify if the way how getImapId() uses a vendor policy hasn't changed.
This part is hard to test with a real vendor policy, and it can easily be
overlooked even if it's broken.

This CL offers ImapStoreUnitTests a way to test the interaction between
getImapId() and a vendor policy.

Also fixed a bug in VendorPolicyLoaderTest where it assumed the test apk
package name is "com.android.email.tests", but it may actually be
"com.google.android.email.tests" now.  (Broken since the test makefile
used inherit-package.)

Backport of I8feb616ea28cb5cae5b4fba57e363771014ac599

Change-Id: I59536bc9a0e5c09c23eab21cdfb2f8283ef01a42
2010-09-20 16:45:48 -07:00
Makoto Onuki 57ab324a11 DO NOT MERGE: Follow-up to the new IMAP parser.
- Replace string literals in ImapStore with constants.
- Simplifies ImapStore.en/decodeFolderName
- Mix cases in the test data to test for case-insensitivity

Backport of I88424357227bcf78528df5e6a1c4ba45d54cc65b

Change-Id: I254fe82324f6ff530e40ca0cff7073f670cf9aa3
2010-09-20 16:45:48 -07:00
Makoto Onuki ff0712cb1e DO NOT MERGE: New IMAP parser to fix long-lasting problems.
- Almost completely re-wrote ImapResponseParser layer
- We no longer use simple ArrayList and String to represent
imap response.  We have classes for that.  (Type safe!)
These classes are also NPE-free.
(which isn't necessarily a good thing, though)
- A lot of clean-ups and fixes in ImapStore.
- More tests for ImapStore.

Now ImapResponseParser moved to com.android.email.mail.store.imap.parser,
but inside, it's 99% new code.

This CL introduces many new classes, but most of them are small classes
to represent the IMAP response.

Problems that this CL fixes includes:
- Special characters in OK response
- Handling BYE response
- Case sensitivity
- ClassCast/ArrayIndexOutOfBound/NumberFormatException
- Handling NIL/literals at any position

Bug 2480227
Bug 2244049
Bug 2138981
Bug 1351896
Bug 2591435
Bug 2173061
Bug 2370627
Bug 2524881
Bug 2525902
Bug 2538076

Backport of I7116f57fba079b8a5ef8d5439a9b3d9a9af8e6ed

Change-Id: I38b6da7b82110181dc78a2c63c6837c57afa81ae
2010-09-20 16:45:48 -07:00
Makoto Onuki 9d1b9fc784 DO NOT MERGE: Two new tests for the bottom half of ImapFolder.append().
They cover the cases:
- when OK response doesn't have APPENDUID.
- when APPEND fails.

Backport of I13a0fb8aaf2e1cbb5a1f055c9ce56e2891373ea0

Change-Id: Ifb5f8c07a8d956b0f4cc019eac7712ef22b0fa73
2010-09-20 16:45:47 -07:00
Makoto Onuki 286eafcf5f DO NOT MERGE: More tests for IMAP, clean up, and a few bug fixes.
- A few new tests in ImapStoreUnitTests.
- Added TODOs to ImapStoreUnitTests (for mainly NO response handling)
- Renamed ImapStore.releaseConnection to poolConnection.
- Fixed a bug in getConnection where it'd return a closed connection.
- Now getConnection() hanles BYE response for NOOP correctly and treat the
connection as closed.

Backport of I48e5b89049338f7d4f1ac77cd7ac7243945a9575

Change-Id: I529c6667a1e60c67285b7050b2b1e4b67eccc104
2010-09-20 16:45:47 -07:00
Makoto Onuki cd0b60e97a DO NOT MERGE: More test for ImapStore/ImapFolder.
- Also, fixed a potential crash in getMessages().
It could happen when a client is gettign a message list while
another client is removing messages.

Backport of I04b1de6bc384cffb7a5286bcec0a349a3d62a623

Change-Id: I227ecbf5bd68c999ba0ab8cd50ef798ef4ef35e4
2010-09-20 16:45:47 -07:00
Makoto Onuki a599ee773d DO NOT MERGE: Tests for IMAP FETCH
Adding regression test for the new IMAP parser.

Backport of Iac7f5c022e44ca5f06f735e145af15cc459eb61f

Change-Id: Ic84172b6793a9837c2fc4a894fee141da3d19f1d
2010-09-20 16:45:47 -07:00
Makoto Onuki 18d331898f Merge "DO NOT MERGE: Relax MIME date parser." into gingerbread 2010-09-20 16:44:06 -07:00
Makoto Onuki 090489b395 Merge "DO NOT MERGE: Fix flaky tests" into gingerbread 2010-09-20 16:43:48 -07:00
Andy Stadler be2ef97220 DO NOT MERGE Send local IP address with EHLO instead of "localhost".
Bug 1515345

Backport of: I181c9f0d79fbdf62f7df77f72a1ec9653797b6dd

Change-Id: If9da2d9f717814bff6a3aa7e6f1a0a44a49f34d6
2010-09-20 16:21:32 -07:00
Makoto Onuki a780e12db2 DO NOT MERGE: Relax MIME date parser.
Make the date parser accept invalid dates like
"Thu, 10 Dec 09 15:08:08 GMT-0700" which was observed in an email from eBay.

Per RFC, timezone must be either obs-zone (e.g. "GMT") or +/- with 4 digits.
The GMT+/-digits format is not permitted.

Bug 2367124

Backport of I59968274160aeadea70223208b463ee692660056

Change-Id: I3c80eee28d1dcf4c0c211f773a50de0f0839e4ad
2010-09-20 15:50:52 -07:00
Makoto Onuki a8a68b827d DO NOT MERGE: Fix flaky tests
Follow up to I3bf7d340.  Make sure temp directory is set before running tests.

Turned out Application.onCreate doesn't seem to be guaranteed to be run
before unit tests.

Without this, some tests may fail saying: "TempDirectory not set.
Application hasn't started??", if onCreate runs too late.

Backport of Ic5aee939a2c21f9579a643d0729dd0e9ba81022e

Change-Id: I7526e3205fc78a5eb79f0786b831c4f642cbda70
2010-09-20 15:50:49 -07:00
Makoto Onuki 7040017624 DO NOT MERGE: Add static method to get temp dir in Email.
I need to be able to get the temp dir from anywhere without Context
for the new IMAP parser.

Backport of I3bf7d34059399a8253c0760ebc392804ea434412

Change-Id: Idf7f8dffe9d6dd040d1b2311d053d4fc292ba18e
2010-09-20 14:06:50 -07:00
Marc Blank 74444e73c2 Remove GAL lookup dependency on running ExchangeService
Change-Id: I4ff4017bcbb29862e07fde63e2ac01e3552ccd83
2010-09-15 17:57:03 -07:00
Makoto Onuki 261d6c3f0c Notify only account cursors when resetting new msg count
- Resetting the new message count is now correctly done on a BG thread.
- Added special content provider URI to reset the count.
  (/resetNewMessageCount)
- This URI only supports update, which will notify only account
  cursors.
- Fixed a problem that an insert with MAILBOX_ID/MESSAGE_ID/ACCOUNT_ID
  triggers two notifications.

- This CL changes how we use notification URIs, but unfortunately
  no tests for this part.  It turned out MockContentResolver doesn't
  support the notification mechanism, which made it very hard
  to write tests.

Bug 2911646

Change-Id: I35b30a7e6bf2d57510486c7ed19b9f263d8c9b58
2010-09-15 10:53:17 -07:00
Makoto Onuki 5b0c2c7f34 Fix tests broken by I2bf5de4e (Clean-ups for EmailProvider)
My previous CL broke some tests.
- make sure to set 0 to unreadCount when adding a new row
- when updating messageCount in the tests, directly manipulate
  the DB.  (the provider no longer allows this)

Change-Id: Ib569349707007badf4f23600fbca37110c78fa6d
2010-09-10 14:37:01 -07:00
Makoto Onuki 7183724276 Don't check flagLoaded for outbox message list
We found a case where messages in outbox have flagLoaded=FLAG_LOADED_UNLOADED,
where it should be FLAG_LOADED_COMPLETE.  Haven't found the root problem, but
remove the flagLoaded test to mitigate the problem.

Also moved the buildMailboxIdSelection call to a worker thread.
(this method issues some queries.)

Bug 2984285

Change-Id: I2a5be300fb3da703698512262cc38bea75d0f7ba
2010-09-10 11:12:46 -07:00
Makoto Onuki b1ea9c3c12 Add quick contact badge to MessageView.
- Added "quick contact badge" to MessageView
- Removed PresenceUpdater, and added new implementation based
  on Loader, which is much simpler.
- Changed some text color, so they're visible now.

Bug 2988625

Change-Id: I688a3217178ee8fd0b7245c0ab36a633687ea525
2010-09-09 13:57:31 -07:00
Makoto Onuki 76a73d104d Merge "Cleanups for unbundling" 2010-09-09 11:24:29 -07:00
Makoto Onuki 697f98aea5 Cleanups for unbundling
* android.security is hidden.  Use java.security.MessageDigest instead.
* Remove android-common from makefile (we no longer use it)
* Add LOCAL_SDK_VERSION to makefile and comment it out

Change-Id: I7f9a021387d5c4e47ade1adb0bb75bec82ba0dd8
2010-09-09 10:46:52 -07:00
Andrew Stadler 4c3a8ede01 Quick fixes for account setup unit tests
Some of these broke in 8bcb572ccf
which changed the [Next] button to an ActionBar menu item.

However, the entirety of AccountSettingsXLTests needed to be disabled
because the PreferenceActivity is very different on phone or XL sized
devices, and the tests infrastructure will need to be refactored to deal
with that (on another day.)

Change-Id: I9adbfc9b8da6179e4c4e82d29bb872ee05619a41
2010-09-09 09:28:38 -07:00
Makoto Onuki 09ea19f184 Merge "Rewrite testGetFirstRowLong/Int" 2010-09-07 14:32:11 -07:00
Marc Blank e7b9e4ab94 Add snippets to messages
* Add 'snippet' column in Message table and handle upgrades to the
  new schema
* Generate a snippet from either HTML or plain-text message body,
  removing tags, extraneous whitespace, and other superfluous text
  along the way.  Store the snippet in the Message table
* Clean up MessagesAdapter to use the pre-existing list projection
  and constants
* Write unit tests for snippet creation
* The UI in this CL is always single-line, ellipsized

TODO: Handle two-line subject if portrait and XL

Change-Id: I84a2cbe10957975942edad6eb1255a726924a78a
2010-09-03 23:23:19 -07:00
Makoto Onuki 4cdae2b1b8 Rewrite testGetFirstRowLong/Int
They were overly-complicated, and even crashed with some framework changes.

Bug 2949312

Change-Id: Icf50bdf2333a32f3b79791f840c58ee0c58ead7f
2010-09-03 16:37:45 -07:00
Makoto Onuki 767f9fe2eb Implement batch move.
* UI is still temporary
* In this version, we check if the selected messages can be moved *after*
  you click "Move", rather than disabling the button beforehand.

Change-Id: Ief2864d2a513001847844963b2b0cb6b714e8667
2010-09-03 15:39:04 -07:00
Marc Blank 213c52dd64 Fix issues with handling FREQ=YEARLY in RRULEs
* Turns out that we weren't handling one of the cases for YEARLY
  RRULE; that in which the date is specified as a day of week plus
  week of month
* Also, we weren't always sending the INTERVAL properly in a few
  cases
* Fix these issues and add a unit test that confirms the fixes
* Also removed an unused argument in recurrenceParser in
  CalendarSyncAdapter

Bug: 2718948

Change-Id: If9146d484218e7d6bd9f5c2305d0e6a216aeed49
2010-09-02 18:17:42 -07:00
Andrew Stadler bf2a53ef5e Merge "Direct access to edit specific account settings" 2010-09-01 21:20:41 -07:00
Andrew Stadler 9c65c146f3 Direct access to edit specific account settings
* Finish implementation of AccountSettingsXL.actionSettings()
* Point account manager entry point at it now
* Remove old AccountSettings activity
* Move AccountSettingsTests over to AccountSettingsXLTests and minor
  cleanups so it works in fragmentized activity.

Change-Id: I5f979a3a9a29dcbbe5a63833b184e6c0313652d5
2010-09-01 21:17:53 -07:00
Makoto Onuki a25aa613f7 Open MessageComponse when draft in All Starred is selected
Also removed a silly unnecessary code in Mailbox.isRefreshable.

Bug 2968445

Change-Id: I75187e5abf1c3e67c8b9ead38c7f749fc8b6cfb0
2010-09-01 18:27:12 -07:00
Makoto Onuki 11aea1efe4 "Move to" multiple messages
Now Controller.moveMessage supports moving multiple messages.

Change-Id: I5d9715cd94e55cf14254b4d4d731524be9d014a8
2010-09-01 15:18:06 -07:00
Makoto Onuki daec902cae Merge "Fully implement "refresh" action bar button" 2010-08-31 17:20:48 -07:00
Makoto Onuki e357f58791 Fully implement "refresh" action bar button
* Now it'll refresh mailbox list (left pane) as well.
(With the minimal interval of 30 seconds)

* Always refresh inbox.
(also with the minimal interval of 10 seconds)

* Also make sure the "auto-refresh" won't refresh
non-refreshable mailboxes. (drafts, etc)

Bug 2929889
Bug 2930018

Change-Id: I09452d40aad6008a721cfbc3f491617224d7048f
2010-08-31 16:49:12 -07:00
Marc Blank 70047f73d3 Merge "Change EAS User-Agent to a constant String" 2010-08-31 16:31:11 -07:00
Makoto Onuki 086aac2386 MailboxFinder should ignore callback for non-target account
There were two cases where MailboxFinder responded to updateMailboxListCallback
when it shoulnd't.
- Callbacks for non-target accounts
- Callbacks arrived after the operation is finished

Make sure these callbacks are properly ignored.
Also, make sure startLookup() can't be called more than once.

Change-Id: I823c11ab5f96df4eb84594c08d3325d12319f708
2010-08-31 10:20:02 -07:00
Marc Blank 03e3449c6b Change EAS User-Agent to a constant String
Change-Id: Ie1efcbc1666bd9bc759aca8134eba21cb9e2467b
2010-08-31 10:10:11 -07:00
Marc Blank 61911d4ff7 Fix another inconsistent set of PolicySet values
* EAS can send both "simple password" and a non-zero number of
  required complex characters; we're supposed to ignore the
  complex character requirement in this case
* Force complex characters to zero if password is "simple"
* Update constructor test to check the fix

Bug: 2903349
Change-Id: I3d42bd3c8f3667d8f3027da9e91e0dd18722d9bf
2010-08-30 20:18:16 -07:00
Marc Blank 64b64cca01 Rename SyncManager to ExchangeService
* Updated comments and checked for 100-columns

Change-Id: I4ab5aaa9425714f8e035e1952db3fec63d498ae1
2010-08-27 12:15:56 -07:00
Makoto Onuki 25144e2b79 Fix testAccountIsEasAccount
Bug 2953763

Change-Id: Iad1bf94e676c1fb41335e8bd7f3297af0033b0f5
2010-08-26 15:08:57 -07:00
Marc Blank b53b150105 IMAP implementation of "move to folder"
* Clean up Controller.deleteMessage to work with new EmailContent
  utility methods, and move out of the UI thread
* Add unit test for Controller.moveMessage

Change-Id: Ic49e2ecc7ef2252dd4d51f4c3b313b936fda78b6
2010-08-26 10:43:28 -07:00
Marc Blank 62d19789b7 Merge "Fix attachmentExists (recognize mContentBytes)" 2010-08-25 22:35:28 -07:00
Marc Blank 4dcb1c5fda Fix attachmentExists (recognize mContentBytes)
* Add unit test for attachmentExists

Bug: 2937856
Change-Id: I020f58740618c084676bbf1cdfad3795edb07688
2010-08-25 22:34:22 -07:00
Marc Blank 818214e31f Fix failing account backup/restore unit tests
* We can't run the AccountManager functionality of account backup
  and restore in the unit tests, because IsolatedContext doesn't
  mock the AccountManager; this leads to various NPE's when the
  test is run
* These problems started, by the way, when we added POP/IMAP
  account integration with AccountManager
* Since the AccountManager side of account backup/restore isn't
  tested, we'll skip that part of the process when running unit
  tests

Bug: 2873546

Change-Id: I94673913e66722ac70f3c49c51465122e98bf3d9
2010-08-24 17:50:55 -07:00
Makoto Onuki 5247ab8cae Make isEasAccount always work.
isEasAccount now uses getProtocol(), so it works even if the hostauth
hasn't been restored yet.

Bug 2929896

Change-Id: Iee902c18ef59680d8a7d4622230489ec7946f38c
2010-08-24 14:27:10 -07:00
Marc Blank bf37f67e6d Merge "Add utilities to retrieve Mailbox and Account from a message id" 2010-08-24 12:23:34 -07:00
Makoto Onuki 7fd307212f Restore list scroll position when necessary.
Bug 2769052.

Change-Id: I09b04311ad2a5bd0d41d37f78dddc500414323c1
2010-08-24 11:20:00 -07:00
Marc Blank c184f36c2d Revert "Convert Controller to a full service"
This reverts commit 0e6d972641.

Change-Id: I005fc34152396806468edef919a3620961ddb4fe
2010-08-24 10:27:58 -07:00
Marc Blank bca4e6e70b Add utilities to retrieve Mailbox and Account from a message id
Change-Id: Ice727f82b5c284617b831f19e2667078cd3da5dc
2010-08-24 09:24:21 -07:00
Makoto Onuki 1abbc55a45 Merge "Temporarily disabling crashing test." 2010-08-23 12:39:09 -07:00
Makoto Onuki d1a05e1cc3 Fix occasional fails of MailboxFinderTest.
Some of the tests run code on the UI thread but check the result
on the test thread, without synchronization, which is wrong.

Mark the fields volatile to fix it.

Change-Id: I917493f10fc9a15da57cfbc1e65e8d8e2cffd850
2010-08-23 12:38:23 -07:00
Marc Blank f19f9cf4d3 Simplify AttachmentDownloadService; add unit tests
* Changed our queue from a TreeMap to a TreeSet that uses an easily
  testable comparator
* Remove the ugly bit twiddling priority computation
* Test DownloadSet (the logic behind queue ordering, addition,
  removal, query, etc.)

Change-Id: Ia8427900b8f39a243a5407349775802d0a4fad4f
2010-08-23 11:42:40 -07:00
Makoto Onuki 8852708238 Temporarily disabling crashing test.
The problem is that this test creates a partial account which will be
used by the activity, but the account is picked up by MailService too
(which is probably not intentional), which crashes because the account
is not properly constructed.  (empty address)

Bug 2938323

Change-Id: Ie9ba19ebf72431d086014c1dc191a0c71769dea4
2010-08-20 16:15:47 -07:00
Marc Blank 0e6d972641 Convert Controller to a full service
Change-Id: I2078fd047ff46f85936c8bf798a5edd3678bb5b4
2010-08-20 13:34:09 -07:00
Makoto Onuki f52afae942 Make sure RefreshManager's callbacks are called on UI thread.
Fixed the bug where callbacks for sendPendingMessagesForAllAccounts
are called on a worker threaed.

Change-Id: I28f1424cf67e15abf37c09b68050d1385f9ac3ee
2010-08-18 14:49:46 -07:00
Makoto Onuki 21efedb67f Rework/cleanup of "refresh".
Added RefreshManager, which is responsible for getting refresh requests
from UI and keeping track of what is being refreshed.

Conceptually it's a part of Controller, but extracted for easier testing.

- Now sendPendingMessagesForAllAccounts() is owned by RefreshManager
  rather than Controller.
- Also updateMailboxRefreshTime/mailboxRequiresRefresh have been moved
  in from the Email class.
- Now MessagingException implements a method to return an error message
  for the UI.

The refresh button on 2-pane doesn't work as intended yet, because the
spec is a bit too complicated (as described in the TODO in
MessageListXLFragmentManager.onRefhres()).

This change touches many file mostly because it cleans up a lot
of code duplication.

Change-Id: I058ab745ccff10f6e574f6ec4569c84ac4a3e10e
2010-08-18 11:06:45 -07:00
Marc Blank 75153d3122 Fix broken unit test
Bug: 2900294
Change-Id: I61e002061b1d743327a84e64925e64cb6228b879
2010-08-16 23:31:23 -07:00
Makoto Onuki 2866a0a8d7 Merge "Properly unregister mock controllers" 2010-08-13 15:45:52 -07:00
Makoto Onuki 130686327a Merge "Reworking MessageListFragment." 2010-08-13 15:40:28 -07:00
Makoto Onuki 4be3bc1ec8 Properly unregister mock controllers
Some tests create mock controllers.  They register themselves to
MessagingController when instantiated, but never unregister.

Added a cleanup method, and call it for each instance.

(I was hoping it would spped up unit tests, but it didn't.  Still
it's a nice thing to do.)

Change-Id: Ia90f0380aef388d22f7cfcf6e9203e05444b3285
2010-08-13 15:28:23 -07:00
Andrew Stadler 9382eb9ff2 am a30631da: Clear password related policies in PolicySet when p/w not required
Merge commit 'a30631da1cae25be3f75137133297e30cef2db9c' into gingerbread

* commit 'a30631da1cae25be3f75137133297e30cef2db9c':
  Clear password related policies in PolicySet when p/w not required
2010-08-12 15:15:59 -07:00
Makoto Onuki 187d033484 Reworking MessageListFragment.
- Now MessageListFragment uses loaders to load data.

- Now that we use Loader's auto-requery with throttling,
  removed the throttling timer from MessagesAdapter.

- Simplified footer mode.  (now only "no footer" or "load more")

- Removed saving/restoring list state code.
  These method don't really look like working, or at least
  not always working.  Now that UI's lifecycle is changing,
  we'd better redo it from scratch.

- Removed MessageListUnitTests.
  It only has tests for onSaveInstanceState/restore of the fragment,
  which I virtually disabled.

And minor clean-ups
- Moved the code to save/restore selected state from the fragment
  to Adapter.

Bug 2911766
Bug 2897500

Change-Id: I16c7aefecc5409c57fc5fc8c59b5c80d9b7fc164
2010-08-12 15:06:37 -07:00
Andrew Stadler a30631da1c Clear password related policies in PolicySet when p/w not required
Merge from master of c263810b08

Bug: 2883736
Change-Id: Iec4ed0e320d67aee8a89092ac650c0960540057b
2010-08-12 14:56:32 -07:00
Makoto Onuki 367ebd7fa5 Handle multiple IMAP SEARCH results.
Apparently IMAP servers may return multiple SEARCH responses for a
single SEARCH command, and we need to handle all of them.

Before the IMAP rework there was 3 methods that issued the SEARCH command.
Two of them ware doing it right, but the other wasn't, which was what
I copied from, unfortunately!

In case you're wondering, originally the test for this method was done through
upper methods, e.g. getMessage().

Bug 2911647

Change-Id: Ia50072944d5b01c1e59541c3a966067b13910cc4
2010-08-12 11:10:00 -07:00
Andrew Stadler 641ae45358 Fragmentize Exchange setup
Change-Id: Ib331d9a7f7be7acbfe355d6a03d9ae07af0cc627
2010-08-11 16:07:26 -07:00
Makoto Onuki 41502f6ea8 Merge "Fix handling IOException in ImapStore" 2010-08-11 14:44:47 -07:00
Makoto Onuki c14ff6ea45 Fix handling IOException in ImapStore
- mConnection.destroyResponses() should be protected with
  if (mConnection != null).
  When we get an IOException, we close the connection and null it out in
  ioExceptionHandler().  So mConnection can be null at any point after
  where ioExceptionHandler() first appears.

- ioExceptionHandler should close its parent ImapFolder only if the argument
  connection is mConnection.
  Methods like exists() may pass an ImapConnection which is not mConnection
  to ioExceptionHandler.  In which case we don't have to close the ImapFolder.

Bug 2898211

Change-Id: I8f9f45d91f596bb8da1a1575593e652d66deb643
2010-08-11 14:44:09 -07:00
Makoto Onuki 6d8bfa67c4 Make AccountBackupRestore/"delete account" robust.
Fix for crashes caused by an incomplete account
which typically a crashed unit test leaves behind.

- "Delete account" now works for incomplete accounts
- AccountBackupRestore won't crash.

Change-Id: Ie235aa15cf9b970fd184c60f14406aa7353c6f00
2010-08-10 13:49:56 -07:00
Andrew Stadler 71cc035c55 Fragmentize AccountSettings
This is phase 1, which simply replaces the phone UX with a fragment-based
equivalent.  A subsequent CL will convert it to a large-format multi-pane
version.

Also fix a latent bug in the signatures of the Incoming & Outgoing
settings, both in the reflection code and in the proguard flags.

Change-Id: I86e857af8b9573c0d6070bb21053ce65bb7fe8a0
2010-08-09 10:36:50 -07:00
Marc Blank c263810b08 Clear password related policies in PolicySet when p/w not required
Bug: 2883736
Change-Id: I2c9c573aea9a4fef1699ff6339e8ef628d7f2269
2010-08-07 17:27:16 -07:00
Makoto Onuki 36bdeeb0e1 Add getFirstRowInt.
It's the int version of getFirstRowLong.

Because getFirstRowLong returns a Long as opposed to a long, and the return
value can be null, it's a pain to cast to Integer.  So added this variant.

Change-Id: I2a3190e49db480e6d594be4b1fcef9a71e56cb2f
2010-08-06 11:00:44 -07:00
Makoto Onuki 94506fdaf6 Small fixes/clean-ups.
- Fixed account selector default account look-up
- Renamed MessageListFragment.onRestoreInstanceState
  to loadState.
  (Activity.onRestoreInstanceState is called after onStart,
  but this one is called in onCreate, so it wasn't a good
  idea to use the same name.)
- Changed mailbox cursur requery timeout to 3 seconds
- Added some TODOs.

Change-Id: Ia2242cd9f74936d24756b800eacd126958eed330
2010-08-06 10:11:36 -07:00
Marc Blank b91eea0119 resolved conflicts for merge of fbf501fe to master
Change-Id: Ic68cbf2de1877ab06744287f57c1c33c4e0e573a
2010-08-04 10:28:40 -07:00
Makoto Onuki 907774e763 Merge "Aadd special boxes to mailbox list." 2010-08-03 17:21:14 -07:00
Makoto Onuki 833fe73b99 Aadd special boxes to mailbox list.
Change-Id: I36616f53555346ca7fbb6f3426a0c3196d7bacbc
2010-08-03 17:06:04 -07:00
Marc Blank 92861b5c2b Fix tests that broke due to DST changes in African countries
* In particular, "Africa/Casablanca" has DST in 2010 now, so it can't
  be used as a test for non-DST time zones

Bug: 2882900
Change-Id: I3026ae4816fc068bd6c783fa3ca879666e796fc9
2010-08-03 11:32:58 -07:00
Marc Blank 4e619a2d50 am 2b2b3448: Handle inactivity timeout > maximum allowed properly
Merge commit '2b2b3448ec200f3d649e5f57309908d28ce3bfc7' into gingerbread

* commit '2b2b3448ec200f3d649e5f57309908d28ce3bfc7':
  Handle inactivity timeout > maximum allowed properly
2010-08-02 20:41:55 -07:00
Marc Blank 2b2b3448ec Handle inactivity timeout > maximum allowed properly
* In a recent change, we mistakenly removed the logic for handling
  too-long inactivity timeouts; we should just fall back to the maximum
  since this is stricter than what we're being asked to enforce
* Restore this logic and update the unit test
* The regression was caused by change Ida5663a9, to wit:
  Backport: Handle "Allow non-provisionable devices" properly

Bug: 2886746
Change-Id: I99cf9a37441b80477cc1c2c7ec2a78f8a14a83da
2010-08-02 19:39:09 -07:00
Dmitri Plotnikov 5ab18497f6 Adding support for a full-contact (entities) query.
Change-Id: Ib1cdd998dcc4f60124dbc37a42fd61ee0f6802fd
2010-08-02 18:19:25 -07:00
Makoto Onuki d0c2178063 Merge "Add the messageCount column to the mailbox table." 2010-08-02 16:01:32 -07:00
Makoto Onuki 574854b528 Add the messageCount column to the mailbox table.
- Use trrigers to keep them up-to-date.
- Batch-update them upon upgrade.

- Motivation:
  On the mailbox list, we show the number of messages in trash/drafts.
  We currently do this with count(*) on the fly, which is okay
  because MailboxList is really shown right now.
  However, on the 2 pane, it's always shown and constantly refreshed,
  so the use of count(*) can be a huge penalty.

  It also make the code significantly simpler.

Change-Id: I26efa238d5183df43420a65925876248ef6c6cb6
2010-07-30 17:37:28 -07:00
Makoto Onuki 20bf78222b Merge "Fix failing tests." 2010-07-30 16:06:36 -07:00
Makoto Onuki b6c1ad0f01 Rename MessageViewFragment2
Change-Id: I28e23c0ff18211db999396c5ba1ad9ef898d4515
2010-07-30 15:41:40 -07:00
Makoto Onuki 206d4e842d Split up MessageViewFragment like we did to MessageView.
Break MessageViewFragment up into two fragments, MessageViewFragment, which
is used to show regular messages, and MessageFileViewFragment, which shows
EML messages.  (And their base class, MessageViewFragmentBase.)

MessageViewFragmentBase's javadoc has a class diagram.

MessageViewFragment is actually named MessageViewFragment2 at this point
so that GIT correctly finds out the rename from MessageViewFragment to
MessageViewFragmentBase.  I'll rename it back in a following CL.

Also added very basic unit tests for MessageView and MessageFileView.
At this point, they just make sure the activities really open and show
messages without exceptions.

I feel like the current naming schema for the activities/fragments is
kinda confusing.  Let me know if you come up with better names.

Change-Id: Iff948f4b68cfdb7c1e68f225927b0ce58d34766b
2010-07-30 15:38:53 -07:00
Makoto Onuki 2d5b4f25f9 Fix failing tests.
Bug 2844798
Bug 2882894

Change-Id: I683c67ddc7ce7c22f06e4b39df330d3850513862
2010-07-30 10:34:00 -07:00
Makoto Onuki b8f31d5490 Helper to create isolated context for provider tests.
The logic came from ProviderTestCase2, but it can be used with other
kind of test cases, such as InstrumentationTestCase.

Extracted from an existing class.  We'll need it for new activity tests.

Change-Id: I5741f01d4749fd397704cef330082470f6051bcf
2010-07-29 17:22:58 -07:00
Makoto Onuki ec15f2356e Extract the mailbox lookup logic into an independent class
This new class MailboxFinder is responsible for looking for a mailbox
by an account id and a mailbox type.

If a mailbox is not found on the first try, it'll tell Controller
to refresh the mailbox list, and try again later.

This will be used by MessageListXL.

Change-Id: I4adc3db025fb271c254aa2b58b3b753281dc7398
2010-07-28 16:36:34 -07:00
Makoto Onuki 4de80f22ae Merge "Move isSecurityHold/clearAccountHoldFlags to Account" 2010-07-28 13:44:42 -07:00
Makoto Onuki ae8fc30b41 Fix "disk I/O error" in LocalStoreUnitTests
The problem was that we didn't close the LocalStores created in these
testDbUpgradeXxx tests.

Also,
- Make sure to close databases.
- Make sure to close cursors.
- Cleard up warnings (unnecessary casts, etc.)

Bug 2859264

Change-Id: Ifaddbb6cf07794a7b5978564ea8fbb3cbf75b978
2010-07-28 13:07:33 -07:00
Makoto Onuki bcf32320e2 Move isSecurityHold/clearAccountHoldFlags to Account
- Added unit tests
- I see the "open a cursor, move to the first row, read a column" pattern over
  and over.  Added a utility method for this.  (Let's try not to bloat the
  binary by copying code around!)
- Added helper classes for database related tests
- Removed code dup

Change-Id: I380959215cc1661b252158f0f6e35369b499cdf8
2010-07-28 11:12:38 -07:00
Marc Blank e6cc662abc Use AccountManager for POP/IMAP; refactor setup classes
There are two major, interrelated parts to this CL:

1) Clean up the activities to reduce the use of Intents to pass
   information between activities; instead, we use a common
   SetupData structure that automatically saved/restored as necessary
   during the setup flow.  A fair amount of code and inconsistent
   use of Bundle extras has been eliminated in the process.

   * Create SetupData structure, setters/getters, and initialization
     methods to simplify the preservation of state during setup flow
   * Remove all state/flow extras from Intents; Intents now only
     specify the Activity to be started, which should greatly simplify
     the transition to Fragments.
   * Remove all state/flow fields from Activities
   * Modify existing setup activity unit tests and confirm tests pass

2) Create AccountManager accounts for POP/IMAP email accounts to
   provide consistency in user experience.  Also, internal flows are
   now identical as between account types.

   * Move account reconciliation from SyncManager to MailService, so
     that reconciliation is consistent between email and exchange
     accounts; move unit tests as appropriate
   * Add a "Sync Email" setting for POP/IMAP/EAS
   * Change MailService to respect the "Sync Email" setting in
     Settings -> Accounts & sync
   * Create PopImapSyncAdapterService to handle manual POP/IMAP sync as
     requested by SyncManager; add EmailSyncAdapterService to perform
     the same function for EAS
   * Use new PopImapAuthenticatorService to add AccountManager accounts
     for POP/IMAP accounts; setup appropriate stanzas in AndroidManifest
     and add related xml files
   * Update AccountSettings to use SetupData

Miscellaneous other changes:

   * Only allow valid port numbers in incoming/outgoing setup

Bug: 1712475

Change-Id: Ibdac52fb2c5578b86bf3992ddb1acd10f162391a
2010-07-21 19:01:41 -07:00
Makoto Onuki a0b88dc1c8 Merge "Adding more test to MessageOrderManager" 2010-07-15 11:07:12 -07:00
Makoto Onuki 638c67f4db Adding more test to MessageOrderManager
Added a case where all the message in the message list is removed.

Change-Id: Iedc2dbdf391978bd67d3bcdc260590d98cc9ef7d
2010-07-15 11:06:19 -07:00
Marc Blank cd0f12fda8 resolved conflicts for merge of 84f7d07d to master
Change-Id: I62abe3b8aa31a1b551d0396e184b648c305033ec
2010-07-14 23:12:20 -07:00
Marc Blank 1585d313f1 am 8b36acb1: Backport: Handle "Allow non-provisionable devices" properly
Merge commit '8b36acb10d555b59ec0497f6c71426af823c7931' into gingerbread

* commit '8b36acb10d555b59ec0497f6c71426af823c7931':
  Backport: Handle "Allow non-provisionable devices" properly
2010-07-14 22:56:28 -07:00
Marc Blank 8b36acb10d Backport: Handle "Allow non-provisionable devices" properly
* Backport from master branch
* Send policy key of "0" when validating; this gets us the policies
  even if "Allow..." is enabled (currently, we simply don't see the
  policies)
* If we don't support all of the policies, send back the response
  code indicating support for partial support.  If we get a positive
  response back, then we're good to go - the server allows devices
  with partial support.  Otherwise, we fail as we always have - with
  the toast indicating that the device doesn't support required
  policies
* Remove PolicySet.isSupported() and ensure proper field ranges
  within the constructor
* Update tests as appropriate

Bug: 2759782
Change-Id: Ida5663a9b35c75ecc61a5f442be0bd60b433cb73
2010-07-14 22:47:47 -07:00
Marc Blank 7a1a203786 am e43b11ba: Handle correction of rejected Ping heartbeat
Merge commit 'e43b11ba3e9be9380b7c43cde3117c6de28f28bd' into gingerbread

* commit 'e43b11ba3e9be9380b7c43cde3117c6de28f28bd':
  Handle correction of rejected Ping heartbeat
2010-07-14 22:33:34 -07:00
Marc Blank ec29471c73 Make sure signature is added to reply/forward
* Add this to processSourceMessage in the reply/forward cases
* Add unit tests for reply and forward case

Bug: 2734321
Change-Id: I6be8383fe5f217a4bda8e669cb69f439bc8e96b6
2010-07-14 12:43:37 -07:00
Marc Blank e43b11ba3e Handle correction of rejected Ping heartbeat
* Handle status 5 for Ping command (heartbeat of out range)
* Write unit test for heartbeat reset

Bug: 2834195
Change-Id: Ic7952a4b296cf15c6ba895d6579fe7956b171e5b
2010-07-13 18:06:24 -07:00
Makoto Onuki de0a1c33c9 Extract MessageListTask and make it self-contained.
Introducing MessageOrderManager which maintains a message list for
MessageView.  It's used to tell if there is newer/older messages
in a mailbox, and the id of them.

Also, slightly related to this, moved mWaitForLoadMessageId to
ControllerResults where it should belong.

Change-Id: I84e32180c7e84a317f2204bb10ad7245ec022dca
2010-07-13 11:26:01 -07:00
Makoto Onuki e60d3648fd Extract presence check logic into its own class.
Change-Id: I12e449ce7f1d10ed4737581e35367eae84a7f29e
2010-07-13 11:19:04 -07:00
Makoto Onuki 7f247d1cd3 Disable MessageViewTests
- These tests will probably not make sense with the upcoming UI change.
- Moved testAttachmentWritePermissions to UtilityUnitTests.
  It's a test for createUniqueFile, which is now owned by Utility.
- Removed Long.MIN_VALUE hack from MessageView.
  New tests should have something better.

Change-Id: I9a09e5e8080a165b010607d1fa3112bcaaab4f90
2010-07-12 16:14:29 -07:00
Marc Blank 6fe5199154 Merge "New calendar sync adapter tests" 2010-07-10 15:38:58 -07:00
Marc Blank f115d31ae8 New calendar sync adapter tests
* Created MockProvider that can be used for testing the results of
  ContentProviderOperation's for Calendar/Contacts (we can't use these
  within our mock contexts because we can't instantiate the provider
  classes within the Email package)
* Wrote some unit tests for MockProvider
* Use MockProvider to test addEvent, in particular how a user's attendee
  status is stored, depending on whether the event is new or updated

Change-Id: I97f02d125eb7347726261e12ce70aadc539be1d4
2010-07-09 10:24:58 -07:00
Marc Blank 5fcbdcf59f Merge "Send intro text with SmartForward" 2010-07-09 09:40:46 -07:00
Marc Blank 80ee607a7c Send intro text with SmartForward
* We need to include the intro text (--Original Message--, etc.) to
  SmartForwards, and somehow this got in a past updat
* Add unit test for forwarding
* Fix unit test for reply so that it works localized

Bug: 2477988
Bug: 2685784
Change-Id: I8d92f00d37a434840ec3eb237f3901cd5dc7ad09
2010-07-09 09:39:58 -07:00
Marc Blank 5b02ecf87c Fix SmartReply/SmartForward in EAS 2.5
* We inadvertently broke this with a recent update that uses Uri
  encoding for ItemId and CollectionId in SmartForward/Reply commands.
  We need to allow colon (:) however for EAS 2.5; otherwise, sends
  fail with HTTP 500
* Update unit test

Bug: 2821684
Change-Id: Ia6bdd2169513d1c13a8174dd599477a35df950f2
2010-07-07 14:42:31 -07:00
Makoto Onuki 57f4d0222b Adding 2 utility methods for testing
expectThrowable() and waitUntil().

Change-Id: I8e3af97ed02254ef2fdc72afadea1911ed23e4ab
2010-07-02 15:30:23 -07:00
Makoto Onuki a0f1dd0a5c Merge "Cleaning up MessageView" 2010-07-02 13:31:26 -07:00
Makoto Onuki 44b5242edd Cleaning up MessageView
- Removed dead code/dead comment.
- Moved static utility methods to Utility.
- Renamed some methods.
- Changed the timing to call super methods.

Also:
- Internationalized formatSize()
- Added unit tests for createUniqueFile() and formatSize()
- createUniqueFile now uses File.createNewFile() instead of exists().

Change-Id: Ibc30e15b029ed5088954bd6fc9032e25dddf176e
2010-07-02 13:26:05 -07:00
Marc Blank 42ff939e3a Prevent MailService from potential looping due to EAS accounts
* The code assumed that all accounts used the scheduler in MailService
  whereas only those using MessagingController do so (i.e. EAS does
  not)
* Change setupSyncReportsLocked to set the syncInterval for accounts
  that don't use MessagingController to Account.CHECK_INTERVAL_NEVER
* Add unit test for the changed code

Change-Id: I74a3dae21d9ec16f9903bdf2a1c28092ae89cc50
2010-07-02 11:47:03 -07:00
Makoto Onuki 4e366b9995 Merge "Always use the mime-type "message/rfc822" for eml files." 2010-06-29 12:37:27 -07:00
Marc Blank 5bd2faee5e Preliminary GAL/Contacts integration for EAS
Change-Id: I9997ac96f83f427c71caf12d591ba6069bedf935
2010-06-29 11:49:04 -07:00
Makoto Onuki 1d0be30871 Always use the mime-type "message/rfc822" for eml files.
Bug 2795919

Change-Id: Ie20fccdad34d7d17d7444af25d3e57033a45de5a
2010-06-29 10:40:31 -07:00
Marc Blank 51f5b2f3fa Fix problem with unencoded data in URI sent to EAS
* We need to encode the itemId and collectionId for SmartForward and
  SmartReply
* Add unit test for the fix
* Small change + test to EasSyncService usage of URI encoding to use
  a non-deprecated method

Bug: 2787725
Change-Id: I428b308b56cc359b8cdd9e42bc3f42c65b6797dc
2010-06-28 21:25:53 -07:00
Marc Blank 8d8f86e899 Cleanup and speed up isMessagingController
* Use the new Account.getProtocol() method to determine whether an
  Account "isMessagingController" (i.e. uses the legacy controller)
* Cache the result of this test, so that it's only done once per
  Account
* Add unit test

Change-Id: I6a0ec789a84bdf30b55156e6337a627fb4e81a08
2010-06-28 10:21:45 -07:00
Marc Blank 663b57daa7 Fix GAL search in EAS 12.1
* We weren't sending the proper protocol version to GAL search, which
  causes errors when using 12.1
* The simple fix is to send the agreed upon protocol version, instead
  of the default (which is 2.5)
* Replace parsing of protocol version with lookup

Bug: 2793588
Change-Id: Ib2a255d8467004ce985d2d688b37066e1e09d78a
2010-06-23 16:48:46 -07:00
Marc Blank 9b4988de43 Implement support for new security policies
* Minimum complex characters
* Password history (i.e. disallow re-use of past n passwords)
* Password expiration
* Password expiration is NOT yet supported in the framework; there
  is a TODO in this CL and a trivial change will be needed when
  support arrives; for now, we report this as unsupported
* The two implemented policies are testable

Change-Id: I477adbc000577c57d1ab1788378c97a60018c10c
2010-06-23 14:51:59 -07:00
Marc Blank 391ae25c43 Handle viewing of attachments that are, themselves, emails
* Add intent filter for application/eml and message/rfc822 mime types,
  launching MessageView with a Uri
* Modify loadMessageTask to handle the Uri by parsing the attachment's
  input stream with Pop3Message.parse(), and then creating an
  EmailProvider message in a special Mailbox created to hold
  "attachment" messages
* Delete all "attachment" messages after the parent message is closed
* Add unit tests

Change-Id: I20276ee006b9f05b889f3c808d3dc407cde26d49
2010-06-22 18:39:18 -07:00
Andrew Stadler e4ecb50091 Convert AccountFolderList to use a Fragment
* Introduce AccountFolderListFragment and its layout
* Extract all list-related UI into it
* Fix leaking cursor in AccountsAdapter and add unit test

Change-Id: Ica566847d97927b736f515d434c6691c82343290
2010-06-18 15:32:10 -07:00
Marc Blank 1d6dab2956 Handle "Allow non-provisionable devices" properly
* Send policy key of "0" when validating; this gets us the policies
  even if "Allow..." is enabled (currently, we simply don't see the
  policies)
* If we don't support all of the policies, send back the response
  code indicating support for partial support.  If we get a positive
  response back, then we're good to go - the server allows devices
  with partial support.  Otherwise, we fail as we always have - with
  the toast indicating that the device doesn't support required
  policies
* Remove PolicySet.isSupported() and ensure proper field ranges
  within the constructor
* Update tests as appropriate

Bug: 2759782
Change-Id: I5f354a0e2d81844aff75d8a8a6de3b97f0020c1f
2010-06-16 13:14:36 -07:00
Marc Blank ca6647a679 Merge "Add tests for CalendarSyncAdapter" 2010-06-16 10:53:43 -07:00
Makoto Onuki 34f29c8a74 Test for interaction between ImapStore and vendor policy.
Change-Id: I092b3a0f2f40d9aa19f2f61066362099c8b3f50b
2010-06-15 13:44:31 -07:00
Makoto Onuki 601187db42 Introducing MessageListFragment.
- Extracted MessageListFragment out of the MessageList activity.
- This is basically pure extraction, with the following conceptual change.
  - Now the MessageList activity doesn't know the mailbox id or
    the account id.  If it needs these ids, it needs to ask the fragment.
  - MessageListFragment.LoadMessagesTask tries to determine the account ID
    if it's unknown.

Most code in MessageListFragment is directly copied from MessageList
with minimal changes (e.g. pass mActivity instead of 'this' as a Context).
There's a few cleaning up oppotunities.  I'll work on them later in a separate
CL.

Change-Id: Ie004cc49b429f2cd8f9de73df5abb94f3054ea0a
2010-06-14 10:20:29 -07:00
Marc Blank 1a3b2f7de2 Add tests for CalendarSyncAdapter
* Test for creation of a typical event
* Test for creation of an event with redacted attendees
* More to come

Change-Id: Ica117cd20a9e270ffe49efed75607e92b4d8ac90
2010-06-11 16:31:15 -07:00
Makoto Onuki 36d3dfaeac Extract MockVendorPolicy, add standard mechanism to inject it.
One thing that bothers me regarding the new ImapStore is that there is no
tests to verify if the way how getImapId() uses a vendor policy hasn't changed.
This part is hard to test with a real vendor policy, and it can easily be
overlooked even if it's broken.

This CL offers ImapStoreUnitTests a way to test the interaction between
getImapId() and a vendor policy.

Also fixed a bug in VendorPolicyLoaderTest where it assumed the test apk
package name is "com.android.email.tests", but it may actually be
"com.google.android.email.tests" now.  (Broken since the test makefile
used inherit-package.)

Change-Id: I8feb616ea28cb5cae5b4fba57e363771014ac599
2010-06-11 15:11:15 -07:00
Makoto Onuki 851f3219e2 Renaming MessageListAdapter to MessagesAdapter
in line with MailboxesAdapter.

Change-Id: I4ed387db2f5ce1f9bad282521c62eeec0c697db4
2010-06-09 14:43:43 -07:00
Makoto Onuki 0fb092b389 Fix for failing SecurityPolicyTests.
This fixes the following exception.

java.lang.UnsupportedOperationException
        at android.test.mock.MockContext.getApplicationContext(MockContext.java:82)

Bug 2725552

Change-Id: Iaca177defe5f5e836211c58270379da056fa64e0
2010-06-07 16:14:53 -07:00
Makoto Onuki 0a892ae04f Extract MessageListAdapter.
Change-Id: I0e441b7fff925c7703ab88ab54240c5b42d045c4
2010-06-02 16:37:47 -07:00
Makoto Onuki bf58053406 Follow-up to the new IMAP parser.
- Replace string literals in ImapStore with constants.
- Simplifies ImapStore.en/decodeFolderName
- Mix cases in the test data to test for case-insensitivity

Change-Id: I88424357227bcf78528df5e6a1c4ba45d54cc65b
2010-06-01 10:50:15 -07:00
Makoto Onuki 7e5ba0e1ea New IMAP parser to fix long-lasting problems.
- Almost completely re-wrote ImapResponseParser layer
- We no longer use simple ArrayList and String to represent
  imap response.  We have classes for that.  (Type safe!)
  These classes are also NPE-free.
  (which isn't necessarily a good thing, though)
- A lot of clean-ups and fixes in ImapStore.
- More tests for ImapStore.

Now ImapResponseParser moved to com.android.email.mail.store.imap.parser,
but inside, it's 99% new code.

This CL introduces many new classes, but most of them are small classes
to represent the IMAP response.

Problems that this CL fixes includes:
- Special characters in OK response
- Handling BYE response
- Case sensitivity
- ClassCast/ArrayIndexOutOfBound/NumberFormatException
- Handling NIL/literals at any position

Bug 2480227
Bug 2244049
Bug 2138981
Bug 1351896
Bug 2591435
Bug 2173061
Bug 2370627
Bug 2524881
Bug 2525902
Bug 2538076

Change-Id: I7116f57fba079b8a5ef8d5439a9b3d9a9af8e6ed
2010-05-28 15:59:09 -07:00
Marc Blank 637abf9852 Merge "Split UtilityUnitTests into medium and small test classes" 2010-05-28 13:29:36 -07:00
Marc Blank 654cc1f68f Split UtilityUnitTests into medium and small test classes
Change-Id: I382bb2bd94ba4d800e907f9c439b4e03f1f20ea4
2010-05-28 13:29:09 -07:00
Andrew Stadler 50adf5369c Merge "Refactor AccountsAdapter into its own class." 2010-05-28 13:26:46 -07:00
Andrew Stadler f3c285d4a3 Refactor AccountsAdapter into its own class.
* Extract AccountAdapter from AccountFolderList
* Use callback instead of hardcoded launch of MailboxList
* Unit tests

Change-Id: Icafce1ef73a99fb61985c649620440656f9b51a3
2010-05-28 12:54:56 -07:00
Marc Blank 9d387ff0bb Fix validation use of FolderSync
* To avoid having to use a mock deviceId with FolderSync in validation, we now
  simply use the real deviceId with the correct SyncKey ("0" for a new account,
  or the actual sync key if the account already exists)
* Rework utility code that finds existing accounts
* Write unit test for findExistingAccount

Bug: 2589243
Change-Id: Ia532b2e209aec3aa01ca06617b4da78c3d986b32
2010-05-28 10:48:17 -07:00
Marc Blank 838beeb621 am 719d29bd: am 4c8adbc4: am 027a6ddf: Merge "Fix bugs related to TZ handling for all-day events" into froyo 2010-05-25 13:12:34 -07:00
Marc Blank 719d29bdcd am 4c8adbc4: am 027a6ddf: Merge "Fix bugs related to TZ handling for all-day events" into froyo
Merge commit '4c8adbc4aa81308e57ae129e9587ec50483af6a8' into kraken

* commit '4c8adbc4aa81308e57ae129e9587ec50483af6a8':
  Fix bugs related to TZ handling for all-day events
2010-05-25 13:10:35 -07:00
Marc Blank 4c8adbc4aa am 027a6ddf: Merge "Fix bugs related to TZ handling for all-day events" into froyo
Merge commit '027a6ddfaa7228854cb3c4238434f87fc69078b6' into froyo-plus-aosp

* commit '027a6ddfaa7228854cb3c4238434f87fc69078b6':
  Fix bugs related to TZ handling for all-day events
2010-05-25 13:09:05 -07:00
Marc Blank 3e065170f3 Fix bugs related to TZ handling for all-day events
* In bug 2703075, all-day events from time zones at GMT or later
  appear a day early; this is because the time was calculated from
  the GMT date/time of the event rather than the local date/time of
  the event; this CL correctly changes this to use local date/time
* In bug 2707966, device-edited all-day events disappear in Outlook
  and OWA after upsync; this is due to the fact that we store all-day
  events in UTC on device, whereas we need to upload all-day events
  using the original (local) time zone.  In this CL, we save away
  the original time zone and use it on upsync
* In our decoding of Exchange time zone information, we default to
  local time when we can't find a time zone that matches the bias
  and DST information; we should really default to a time zone with
  the same bias, if one exists; we do that in this CL.
* Add/modify unit tests

Bug: 2703075
Change-Id: Id80c481ecc0eae980b2e91dae7f105f924cfca28
2010-05-25 11:46:44 -07:00
Makoto Onuki 32f8a49e01 Two new tests for the bottom half of ImapFolder.append().
They cover the cases:
- when OK response doesn't have APPENDUID.
- when APPEND fails.

Change-Id: I13a0fb8aaf2e1cbb5a1f055c9ce56e2891373ea0
2010-05-20 18:23:16 -07:00
Makoto Onuki cbe4ae9291 More tests for IMAP, clean up, and a few bug fixes.
- A few new tests in ImapStoreUnitTests.
- Added TODOs to ImapStoreUnitTests (for mainly NO response handling)
- Renamed ImapStore.releaseConnection to poolConnection.
- Fixed a bug in getConnection where it'd return a closed connection.
- Now getConnection() hanles BYE response for NOOP correctly and treat the
  connection as closed.

Change-Id: I48e5b89049338f7d4f1ac77cd7ac7243945a9575
2010-05-19 13:13:18 -07:00
Makoto Onuki 2552b7b705 More test for ImapStore/ImapFolder.
- Also, fixed a potential crash in getMessages().
  It could happen when a client is gettign a message list while
  another client is removing messages.

Change-Id: I04b1de6bc384cffb7a5286bcec0a349a3d62a623
2010-05-18 17:14:30 -07:00
Makoto Onuki 7d3519151a Tests for IMAP FETCH
Adding regression test for the new IMAP parser.

Change-Id: Iac7f5c022e44ca5f06f735e145af15cc459eb61f
2010-05-18 10:48:11 -07:00
Makoto Onuki 128fb393e8 Relax MIME date parser.
Make the date parser accept invalid dates like
"Thu, 10 Dec 09 15:08:08 GMT-0700" which was observed in an email from eBay.

Per RFC, timezone must be either obs-zone (e.g. "GMT") or +/- with 4 digits.
The GMT+/-digits format is not permitted.

Bug 2367124

Change-Id: I59968274160aeadea70223208b463ee692660056
2010-05-17 14:14:08 -07:00
Makoto Onuki 0a8030562a Fix flaky tests
Follow up to I3bf7d340.  Make sure temp directory is set before running tests.

Turned out Application.onCreate doesn't seem to be guaranteed to be run
before unit tests.

Without this, some tests may fail saying: "TempDirectory not set.
Application hasn't started??", if onCreate runs too late.

Change-Id: Ic5aee939a2c21f9579a643d0729dd0e9ba81022e
2010-05-17 14:07:34 -07:00
Makoto Onuki 9c9e757917 Add static method to get temp dir in Email.
I need to be able to get the temp dir from anywhere without Context
for the new IMAP parser.

Change-Id: I3bf7d34059399a8253c0760ebc392804ea434412
2010-05-13 18:27:34 -07:00
Makoto Onuki 31fa0172cf am d93f323f: am 29491840: Merge "Cleanup: Add @Override" into froyo-plus-aosp 2010-05-10 11:34:28 -07:00
Makoto Onuki d93f323faa am 29491840: Merge "Cleanup: Add @Override" into froyo-plus-aosp
Merge commit '29491840e62a3a21a9b8e4a0889450d2d0875255' into kraken

* commit '29491840e62a3a21a9b8e4a0889450d2d0875255':
  Cleanup: Add @Override
2010-05-10 11:30:36 -07:00
Makoto Onuki 29491840e6 Merge "Cleanup: Add @Override" into froyo-plus-aosp 2010-05-10 11:29:51 -07:00
Marc Blank 4880ab8641 am bf60edcc: am a25b1b03: am 85a63c3c: Fix issues with exception downloads 2010-05-10 09:53:54 -07:00
Marc Blank bf60edcc96 am a25b1b03: am 85a63c3c: Fix issues with exception downloads
Merge commit 'a25b1b03626c6c27c877671f1b6622b4ab022bbc' into kraken

* commit 'a25b1b03626c6c27c877671f1b6622b4ab022bbc':
  Fix issues with exception downloads
2010-05-10 09:49:54 -07:00
Marc Blank a25b1b0362 am 85a63c3c: Fix issues with exception downloads
Merge commit '85a63c3c2f2d00210e9f7957f3d217b7fd028dad' into froyo-plus-aosp

* commit '85a63c3c2f2d00210e9f7957f3d217b7fd028dad':
  Fix issues with exception downloads
2010-05-10 09:43:40 -07:00
Marc Blank 85a63c3c2f Fix issues with exception downloads
* It turns out that, in addition to other requirements of the
  CalendarProvider, there is another - that the ORIGINAL_INSTANCE_TIME
  also be set with hour, minute, and second as zero (in UTC)
* Change setTimes() to properly modify ORIGINAL_INSTANCE_TIME
* Also, there was a regression due to an incorrect validity test
  for events; this regression caused all exception downsyncs to fail
* Changed isValidEventValues() to be correct for both exceptions
  and original events
* Update tests for setTimes and isValidEventValues()
* This CL also fixes 2658988

Bug: 2664229
Change-Id: I9c8aea08e606ff58e5be37ca81a2d86a181c46f6
2010-05-07 15:47:57 -07:00
Makoto Onuki 165e8bfe7a Cleanup: Add @Override
(Note it's for froyo-plus-asop)

Change-Id: Ic4211c08586e33c44d5d6267c0c9d37f8c7cdc85
2010-05-07 15:28:26 -07:00
Makoto Onuki c563ce1b80 am b8970dab: am e46ac1a6: Cleanup imports. 2010-05-07 15:20:47 -07:00
Makoto Onuki b8970dabb6 am e46ac1a6: Cleanup imports.
Merge commit 'e46ac1a61f32bd762a879457b1850087a1ad3a8c' into kraken

* commit 'e46ac1a61f32bd762a879457b1850087a1ad3a8c':
  Cleanup imports.
2010-05-07 15:17:35 -07:00
Makoto Onuki e46ac1a61f Cleanup imports.
(Note it's for froyo-plus-asop)

Change-Id: Ia5b771cd41099ab486ba2e556b441fc7c0affe5f
2010-05-07 14:33:44 -07:00
Marc Blank a32e063036 am ab4daabd: am 8f255dde: Merge "Add checks for Event validity before commit" into froyo
Merge commit 'ab4daabd5ec99da549407ce87d46e24be261c4a6' into kraken

* commit 'ab4daabd5ec99da549407ce87d46e24be261c4a6':
  Add checks for Event validity before commit
2010-05-06 12:43:16 -07:00
Marc Blank 33f07963eb Add checks for Event validity before commit
* Enforce CalendarProvider2's requirements for valid Events
* Add unit tests for the new code
* Backport of change I42ad7acb from master
Bug: 2658149

Change-Id: I8151d035247a7dbb1fda3eae163b24ccfe055299
2010-05-06 08:28:34 -07:00
Marc Blank bc1a4753b1 Add checks for Event validity before committing
* Enforce CalendarProvider2's requirements for valid Events
* Add unit tests for the new code

Bug: 2658149
Change-Id: I42ad7acbcee3b6b831f805c59436017a32651f3a
2010-05-05 18:16:16 -07:00
Andrew Stadler b0c37bd8c0 am 1e037acd: am 7cdd6899: am a7628f3b: Merge "Better handling for untyped attachments" into froyo 2010-05-03 09:36:28 -07:00
Andrew Stadler 1e037acda7 am 7cdd6899: am a7628f3b: Merge "Better handling for untyped attachments" into froyo
Merge commit '7cdd6899fbe820af852974cd0b7025b72bfe242a' into kraken

* commit '7cdd6899fbe820af852974cd0b7025b72bfe242a':
  Better handling for untyped attachments
2010-05-03 09:34:02 -07:00
Andrew Stadler 80ebde2897 Better handling for untyped attachments
* IMAP/POP rely on sender to set mime type of attachments
* Which doesn't always work, because senders don't always provide it
* Remap using filename extensions, when needed
* This is applied as late as possible - in the MessageView, and in
  the content provider getType().  No changes to how we write databases,
  and no change to existing attachment rows.

Bug: 2356638
Change-Id: Ie69e3fd12f406aac803583f9d1299a8af4fba010
2010-04-30 15:01:10 -07:00
Marc Blank 34d94723b6 am 25fa6124: am 44ae6d2f: am f2d43c39: Merge "Update unit tests for invitation creation" into froyo 2010-04-29 20:33:10 -07:00
Marc Blank 25fa612444 am 44ae6d2f: am f2d43c39: Merge "Update unit tests for invitation creation" into froyo
Merge commit '44ae6d2fa2e79de533ceb1fdf50c578a4ed84a3f' into kraken

* commit '44ae6d2fa2e79de533ceb1fdf50c578a4ed84a3f':
  Update unit tests for invitation creation
2010-04-29 20:30:11 -07:00
Marc Blank 9294d8c030 Update unit tests for invitation creation
* Tests changed/added for exception/recurrence changes in CL50201

Bug: 2640878
Change-Id: I97e5557c198aa686d1705158f2c9087c1683590e
2010-04-29 11:03:37 -07:00
Marc Blank 52ab04a805 am ad7060ae: am f1fa44bd: am 2f1ce56f: Merge "Fix upload/download of attendee status" into froyo 2010-04-26 10:11:52 -07:00
Marc Blank ad7060ae18 am f1fa44bd: am 2f1ce56f: Merge "Fix upload/download of attendee status" into froyo
Merge commit 'f1fa44bdc064a6c01813c5380839b90bd0290d46' into kraken

* commit 'f1fa44bdc064a6c01813c5380839b90bd0290d46':
  Fix upload/download of attendee status
2010-04-23 17:27:10 -07:00
Marc Blank 8a19af3739 Fix upload/download of attendee status
* It turns out that the UI uses selfAttendeeStatus and the attendee's status
  from the Attendees table in confusing and undocumented ways
* selfAttendeeStatus is used in the UI, but only in certain cases. Generally speaking,
  the Attendees table status is definitive.  However, when the user sets his status
  from the UI, this data is reflected in the event's selfAttendeeStatus, since for EAS,
  the user is always the owner of his calendar
* On downsync,  we'll put the user's busy status into the Attendees table
* On upsync, we'll send busy status based on the user's attendee status in the
  Attendees table
* We'll use selfAttendeeStatus only to determine whether the user has manually changed
  his status via the UI (as before)

Bug: 2615586
Change-Id: I3a82474cfd07cbf5aa595e5214807cb55005cefa
2010-04-23 09:07:53 -07:00
Makoto Onuki 92db71e440 Merge "Send local IP address with EHLO instead of "localhost"." 2010-04-22 14:23:46 -07:00
Makoto Onuki 3844bbcaaf am 2ca8d734: am 6cfa8001: Merge "Fix failing unit tests" into froyo
Merge commit '2ca8d7347db3975746ad87347de57fd5800bf5d4' into kraken

* commit '2ca8d7347db3975746ad87347de57fd5800bf5d4':
  Fix failing unit tests
2010-04-22 13:24:40 -07:00
Marc Blank 0acd7e9c77 am d764ce7e: am 1880ad6a: Send correct busy status information in upsyncs to EAS
Merge commit 'd764ce7e4442b0027a891582cbdd728487a49f97' into kraken

* commit 'd764ce7e4442b0027a891582cbdd728487a49f97':
  Send correct busy status information in upsyncs to EAS
2010-04-22 13:23:55 -07:00
Makoto Onuki f4dac9f266 Send local IP address with EHLO instead of "localhost".
Bug 1515345

Change-Id: I181c9f0d79fbdf62f7df77f72a1ec9653797b6dd
2010-04-22 11:23:08 -07:00
Makoto Onuki 6cfa8001a8 Merge "Fix failing unit tests" into froyo 2010-04-22 09:51:21 -07:00
Makoto Onuki 25d55ed266 Fix failing unit tests
Bug 2614782

Change-Id: I7ed7bf61a567429017f64d9049577ec076331bb2
2010-04-22 09:18:42 -07:00
Marc Blank 1880ad6a83 Send correct busy status information in upsyncs to EAS
* Fix unit test that was failing

Bug: 2615382
Change-Id: I54c7bdd982d57528f55ce4f4c6804c9f532293fb
2010-04-21 18:25:16 -07:00
Marc Blank fc08120213 am a0c71419: am 21c04fe3: Merge "Further harden getListOrNull" into froyo
Merge commit 'a0c71419cedaa0f84d12da61e415642b79cc0a9c' into kraken

* commit 'a0c71419cedaa0f84d12da61e415642b79cc0a9c':
  Further harden getListOrNull
2010-04-21 08:18:04 -07:00
Marc Blank 07fb9f8bea Further harden getListOrNull
* Add a bounds check
* Add a test for ImapList

Bug: 2611022
Change-Id: I3ad88fbc8d3145298731ab19ef7ff68d4011bb00
2010-04-20 19:31:29 -07:00
Marc Blank 5ff98ba1ec am 825999f8: am 095eee41: Set selfAttendeeStatus and busyStatus properly on downsync/upsync
Merge commit '825999f815979519d8d80334a8c1ce0223a89ef2' into kraken

* commit '825999f815979519d8d80334a8c1ce0223a89ef2':
  Set selfAttendeeStatus and busyStatus properly on downsync/upsync
2010-04-16 13:55:04 -07:00
Marc Blank 095eee4156 Set selfAttendeeStatus and busyStatus properly on downsync/upsync
* Set selfAttendeeStatus on download from busy status
* Set busyStatus on upload from selfAttendeeStatus

Bug: 2587076

Change-Id: I34eaa0d3861bcec0cbfd51761b31965e44f5162b
2010-04-16 13:39:51 -07:00
Marc Blank ce2e1260bc am b8ef8a2c: am a97d8501: Merge "Properly decode a uid from the globalObjId in invites" into froyo
Merge commit 'b8ef8a2c1d18421a7d537dbc8d1ea88ffca95898' into kraken

* commit 'b8ef8a2c1d18421a7d537dbc8d1ea88ffca95898':
  Properly decode a uid from the globalObjId in invites
2010-04-15 13:48:03 -07:00
Marc Blank a97d85014f Merge "Properly decode a uid from the globalObjId in invites" into froyo 2010-04-15 13:41:04 -07:00
Marc Blank 7e30b2e22f Properly decode a uid from the globalObjId in invites
* Meeting invitations in EAS include a globalObjId.  It turns out
  that this id is EITHER the actual uid (if Exchange created it)
  or a wrapper for the actual uid (if some other client created it)
* To find out which case we're dealing with, we have to look at
  the base64 decoded string for the magic "vCal-Uid" substring
* If it's there, we pull the real uid out of the decoded string
* Otherwise, we build a hex strong from the decoded bytes
* Write unit test for this process

Bug: 2598201
Change-Id: I1cc40af6d1e45be44c19465eb8a4c31851ec8157
2010-04-15 13:12:40 -07:00
Makoto Onuki 6f83fe6317 am ad383ff1: am d2a0d233: Use consistent device-id even the device is wiped.
Merge commit 'ad383ff1231319c6ded4077b0d1415bf77bec70b' into kraken

* commit 'ad383ff1231319c6ded4077b0d1415bf77bec70b':
  Use consistent device-id even the device is wiped.
2010-04-14 22:22:18 -07:00
Makoto Onuki d2a0d23380 Use consistent device-id even the device is wiped.
Use hash of device id (TelephonyManager.getDeviceId()) instead of a random
value.

Bug 2596537

Change-Id: I22303f7287ee6e9edccec349d03f14adbd33f6f7
2010-04-14 21:39:18 -07:00
Makoto Onuki cda014c16e am 8dffa087: am 162b0171: Change account colors to what aren\'t used in Calendar.
Merge commit '8dffa087db44e27e5f0e5672b19fdb6975e614a7' into kraken

* commit '8dffa087db44e27e5f0e5672b19fdb6975e614a7':
  Change account colors to what aren't used in Calendar.
2010-04-14 16:30:27 -07:00
Makoto Onuki 162b017140 Change account colors to what aren't used in Calendar.
Bug 2535090

Change-Id: I252e04afa402303d226a56f1d7852f50dc26e2ec
2010-04-14 15:18:12 -07:00
Makoto Onuki 040f0e3c48 am 77275817: am 0f3d3601: Merge "Show device id on the exchange setting screen." into froyo
Merge commit '772758177e3dd4fcb1c9d534afec3007b59c8bf7' into kraken

* commit '772758177e3dd4fcb1c9d534afec3007b59c8bf7':
  Show device id on the exchange setting screen.
2010-04-13 17:32:00 -07:00
Makoto Onuki 12b4bc9e80 Show device id on the exchange setting screen.
I've attached a screenshot on the referenced bug.

Also fixed a bug in SyncManager.getDeviceId() where sDeviceId cache wasn't
working.

Bug 2591124

Change-Id: I4b58517c095a96d47fb57179d70091b2c7af5249
2010-04-13 17:10:26 -07:00
Andrew Stadler ead786d9b5 am ef01261a: am 9cc6f46b: Merge "Try TOP even on POP servers that fail to report CAPA" into froyo
Merge commit 'ef01261a8909ea3fe3e40b06cc537e0032d47898' into kraken

* commit 'ef01261a8909ea3fe3e40b06cc537e0032d47898':
  Try TOP even on POP servers that fail to report CAPA
2010-04-12 11:33:04 -07:00
Andrew Stadler 645fc28301 Try TOP even on POP servers that fail to report CAPA
* Ignore the results of CAPA and always try TOP
* If TOP returns -ERR simply fall back to (bad old slow) RETR
* Unit tests for positive & failure cases

Bug: 2588432
Change-Id: Ife4b551217de1025e14efc46074f16ef4ae99c6f
2010-04-12 10:56:55 -07:00
Andrew Stadler 5f95d68288 am 3839dc98: Merge "Improve MIME & SMTP compliance on outbound messages" into froyo
Merge commit '3839dc981f15bb7da5e7500ee175485dc85a6f6a' into kraken

* commit '3839dc981f15bb7da5e7500ee175485dc85a6f6a':
  Improve MIME & SMTP compliance on outbound messages
2010-04-08 10:03:11 -07:00
Andrew Stadler 6bcccf6284 Improve MIME & SMTP compliance on outbound messages
* Write MIME-Version: 1.0 in all outbound messages, not just those
  with multiparts.  This is required by RFC 2045.
* Unit tests

Bug: 1678296
Change-Id: Icf37d93b8b0150f490791792499865a60744adea
2010-04-07 21:46:15 -07:00
Makoto Onuki e2a076fdfd am af672452: Added a test for IMAP APPEND
Merge commit 'af6724527e564d35dd27ac35e24dbced554792e5' into kraken

* commit 'af6724527e564d35dd27ac35e24dbced554792e5':
  Added a test for IMAP APPEND
2010-04-06 14:43:22 -07:00
Makoto Onuki af6724527e Added a test for IMAP APPEND
It's a preliminary change for IMAP bug fixes.

Also,
- Fixed a potential bug in ImapFolder.setFlags where it'd throw
  StringIndexOutOfBoundsException if flags is empty.

- Added a generic flag to proguard.flags so that now all methods with
  the "ForTest" sufix are automatically preserved.
  Turned out it wasn't needed for this CL, but it should come in handy
  someday.

Bug 2538076
Change-Id: I49a08afc196c7b7f1f30477dfc38ac5381045d84
2010-04-06 14:33:43 -07:00
Andrew Stadler dc0753373e DO NOT MERGE. Handle STARTTLS when last line in EHLO response.
When receiving the EHLO response from the SMTP server, the multiline
answer has "-" prefix in all lines except the last line, where the
prefix is a blank. This is according to RFC 2821 section 4.2.1. This has
also been reported as issue 2309 at code.google.com.

Bug: 1744768

Change-Id: I3feccabed30767d2fa5b06352cd7d1c803e8d59c
2010-04-06 10:50:11 -07:00
Andrew Stadler a843d40ba1 Improve handling of unsupported security policies
* If the server asks for more than we can support, don't throw
  and error from PolicySet creation.  Let isSupported() do that.
* Overlong password lengths cannot be supported and isSupported is false.
* Overlong timeouts & max wipes can be reduced to supported
  amount (this actually increases security) and isSupported is true.
* Clean up an obsolete comment
* Unit tests

Bug: 2567804
Change-Id: I2d664a7f2a315b9f9bdcb867fe2cd98f74de6f66
2010-04-02 22:05:12 -07:00
Marc Blank 78021cbbf8 Don't add "Invitation: " to meeting invitations
* Turns out that most other clients omit this.
* This has the pleasing effect of fixing the referenced bug
* Update unit tests

Bug: 2561821
Change-Id: I39f7db7e05be590373cd5f3d9b23c7ee21bde4f7
2010-04-01 14:42:10 -07:00
Marc Blank cf274512ed Fix conversion of UNTIL date in RRULEs to EAS calendar dates
* Because we were sending these in the wrong format, upsynced changes
  were failing, with the result that both the original event and
  the "new" event (from the UNTIL date forward) remained in the calendar
* Fix is to send the proper format; unit test updated to reflect the
  change
* Also, we only send the date of an UNTIL, rather than the to-the-minute
  time; it turns out that EAS expects to see only a day for UNTIL.

Bug: 2561818
Change-Id: Ic4eacbe96c713d58c637386ceab2cf22ebe3c2d4
2010-04-01 10:13:00 -07:00
Marc Blank 1c48450c02 Fix the VCALENDAR we send with all day events
* We need to send date only (without time) in the VCALENDAR file for
  all-day events
* Add unit test for this case

Bug: 2561789
Change-Id: I33a43c7a248059c97482ca147a23af083744118a
2010-04-01 10:10:41 -07:00
Marc Blank 700b373007 Send CANCEL method with meeting cancellations
* We should be sending CANCEL as the method with cancellations
* Fix this and update unit test

Bug: 2527606
Change-Id: I2b982e4bfd1dbc57660cf578702edf49584d2957
2010-03-31 17:44:23 -07:00
Marc Blank a6e1f8d456 Add message text for invitation replies
* Updated unit test to make sure there's message text

Bug: 2548714
Change-Id: I70e05b72539ff9ba7d582a51421e5345aa6151e4
2010-03-29 12:07:09 -07:00
Makoto Onuki a942858f0d Properly handle old style (<= 1.6) account shortcuts.
A desktop shortcut to an account created on donut or before points at
com.android.email/.activity.FolderMessageList, which we've already removed.

- Added a dummy FolderMessageList to receive it and redirect to MessageList.
- Removed FolderMessageListUnitTests, which was left unremoved.

Bug 2535335

Change-Id: Ie5ffa158882633a4929c4c47a3d9625fd1626863
2010-03-26 11:02:18 -07:00
Marc Blank 802a7d69b5 Format cleanup for CalendarUtilities
Change-Id: I6633435cbe0ee55f58da76658d2ccb12f421e326
2010-03-25 17:43:24 -07:00
Marc Blank 82b2453b97 Clean up EAS -> TimeZone determination code
* Use one minute before/after for transition checking, instead of the
  sloppier early version
* Add tests for additional known time zones
* Change most methods in CalendarUtilities to package private (for use
  with unit tests)
* Clean up a little bad formatting

Change-Id: I9e5be5e1c859f2294adf06874459f7db15fb8c22
2010-03-25 17:26:30 -07:00
Marc Blank eba33f8b5a Don't send bare line feeds to EAS 2.5
* EAS 2.5 doesn't like seeing bare LF's in Calendar location
  and description, and Events including them won't sync back to
  the server
* Create a utility to replace bare LF's with CRLF and write
  unit test for the utility
* Fix the bug by using this utility

Bug: 2542220
Change-Id: I2c72d23f15e3a922ebe3585e063abe9fa9e2366f
2010-03-25 17:16:46 -07:00
Makoto Onuki fe61f358ab Moved fromUtf8 from TestUtils to Utility.
And cleaned up SimpleIcsWriter.toString().

Change-Id: I383d91256c48be5263c695c8e8dd151d0e95d0a6
2010-03-24 12:07:32 -07:00
Makoto Onuki 95492af7a1 Merge "Show a calendar invitation icon on message list." 2010-03-23 10:50:37 -07:00
Makoto Onuki 79b006a08b Merge "Fix failing unit tests." 2010-03-22 15:56:10 -07:00
Makoto Onuki 0fdcac8028 Fix failing unit tests.
Bug 2534698
Bug 2534665

Change-Id: If07fc7113b517059bee937d019d464e9c1bc600f
2010-03-22 15:01:33 -07:00
Makoto Onuki 20c067c67c Show a calendar invitation icon on message list.
Bug 2522928

Change-Id: Ib29c7ee187cb0d864849b83693906b0a3b490734
2010-03-22 13:46:35 -07:00
Marc Blank d5822018fb Clean up VCALENDAR/TIME_ZONE_INFORMATION code
* Fix the transition times so that they occur at the hour
* Remove an unused variable
* Fix a reference to Calendar.HOUR that should have been
  Calendar.HOUR_OF_DAY
* Confirm that unit tests work properly

Change-Id: I3eaf31d160e97b5f3ba59c83878359085aea960d
2010-03-22 11:28:40 -07:00
Marc Blank aec526f141 Add unit test for VCALENDAR generation from TimeZone
* Sanity check runs through every TimeZone and makes sure that there
  are no exceptions thrown
* Also, that we find at least 10x as many TimeZone's with RRULEs as
  those without (empirical)

Change-Id: I2f266ac9d2a839f053bb5fda10a5b77dc8dd2c04
2010-03-20 18:48:55 -07:00
Marc Blank 39ea302126 Send appropriate ics message for cancellations
* We were sending cancellations with a request for reply, which is
  incorrect
* Send the correct dats in the ics attachment
* Update unit test to reflect this

Bug: 2527606
Change-Id: I4cea0bb8f1c29a3cad8d09fd6a4750f7ab067229
2010-03-19 10:17:25 -07:00
Jim Shuma f7da371234 Merge "Add "vibrate when silent" mode to notifications" 2010-03-18 16:30:33 -07:00
Jim Shuma 9e2ddca59d Add "vibrate when silent" mode to notifications
* Add "vibrate when silent" choice in UI
* Add storage for it in Email's provider.  Existing accounts default to
  their current settings (always vibrate / never vibrate).
* Respect new mode when notifications are posted
* Updated existing unit tests

Bug: 2457183
Change-Id: I5c933ac39dbef8b2028255f330e0b084a445421a
2010-03-18 13:57:25 -07:00
Andrew Stadler aadee36a34 Merge "Eliminate duplication in Yahoo! sent mailbox" 2010-03-18 10:18:30 -07:00
Andrew Stadler c4fcd852ba Eliminate duplication in Yahoo! sent mailbox
* Yahoo! is not supporting search by UID so I can't identify the new
  the UID after I upload.  This inability to correlate the local and
  remote messages means that we wind up syncing the same message back
  down, in a loop, which spawns more messages.
* Yahoo! has partial support for UIDPLUS, and reports the new UID when
  I append (upload) messages.
* Modify IMAP parser to parse response lists
* When APPENDUID is reported, use it (and skip the search)
* Modify the few other existing users of response lists to use the
  parsed versions instead.  Provided a couple of lightweight utilities
  to make it easier to work with ImapList.
* Unit tests for most of it.
* Optimization: share a static date/time parser for all IMAP connections

Bug: 2448220
Change-Id: Ic10fc1a195ccf4671a498188cc8b17848c8d9df7
2010-03-18 10:11:08 -07:00
Andrew Stadler 6d55bb08fd Merge "Fix cases of attachments with no name" 2010-03-17 18:16:33 -07:00
Andrew Stadler 7d738cb7e8 Fix cases of attachments with no name
* Most clients send name= in the content-type, but a few clients
  send only filename= in content-disposition.
* There was code to handle both cases, but due to two typos, it didn't
  work.
* Most easily reproduced by sending from hotmail/live web client.

Bug: 2366961
Change-Id: I1d9a00b9b5fd1094cfb8566c3248d94286a8ae91
2010-03-17 17:59:09 -07:00
Makoto Onuki a29495c03c Merge "Add a flag to dump email messages." 2010-03-17 15:46:00 -07:00
Makoto Onuki dfeb1184eb Add a flag to dump email messages.
It's useful to debug MIME related problems.

- New MimeStreamParser.LOG_MESSAGE flag
- Cleaned up LoggingInputStream, which now supports all InputStream methods
  (e.g. close, available, etc.) properly.
- LoggingInputStream now dumps non-printable ascii chars as '\xXX'.

Change-Id: I4391e125abd418defc1dc21e4f35cf6ef8448acb
2010-03-17 15:44:56 -07:00
Marc Blank 0ed690bfb4 Send meeting invite mail as multipart/alternative
* Turns out that Exchange 2003 requires the ics attachment to be in a
  multipart/alternative, rather than a multipart/mixed MIME message
* Exchange 2007 accepts both types
* Therefore, we change our output for this particular situation, i.e.
  a single attachment that is an ics file, to multipart/alternative
* Rename FLAG_SUPPRESS_CONTENT_DISPOSITION to FLAG_ICS_ALTERNATIVE_PART
  and make this flag do double duty - 1) suppress the Content-Disposition
  header (also required by Exchange) and 2) send the message as
  multipart/alternative
* Add unit tests for Rfc822Output to check that mime parts are composed
  properly

Bug: 2516394
Change-Id: I60e26f57b8ecaf01d0340e7828533334e0e7d45a
2010-03-17 09:59:24 -07:00
Makoto Onuki 88a94bca19 Exchange calendar: fixes for the ICS writer.
- Now SimpleIcsWriter does the UTF-8 conversion, and folds lines according
  to the number of bytes in UTF-8.
- It now escapes special chars in TEXT values.  You can safely put , ; \ or
  line breaks. in summary, location, and description.
- Quotes all CN.  (leftover from Ibb8f155a)
- Replace "s in CN with 's (rather than removing them)

Bug 2508283
Bug 2515768

Change-Id: Ibdced53ee32bba950608d63f507b11b24eaad7b0
2010-03-16 13:05:34 -07:00
Marc Blank bf916efe95 Improve message text for invites w/ recurrences
* Add the (recurring) text when the invite is for a recurring
  meeting
* Add a test for message text creation

Bug: 2515474
Change-Id: Ifefbc2ba1ac444175180cb7a58f4ec554d9674a3
2010-03-16 08:45:59 -07:00
Marc Blank befa974de8 Fix utility that retrieves tokens from RRULEs
* The utility wasn't handling commas properly, causing the referenced
  bug
* Fixed the utility and updated the relevant test case

Bug: 2515488
Change-Id: Id229e50fcaaed1a0142db301eedaaba9209bed13
2010-03-15 14:04:19 -07:00
Makoto Onuki fc3fc5d26c ICS Writer: Quote common name.
Quote common name (CN) in ATTENDEE per RFC 5545.

Bug 2510783

Change-Id: Ibb8f155a43cbe43886b903472489563242cb6771
2010-03-15 12:23:47 -07:00
Makoto Onuki 20225d5760 Explicitly send ICS files in UTF-8.
- In memory attachments are now stored as byte[], not String.
  We can store any type of contents now.
- Added blob content_bytes to the Attachment table.
  The content field is now deprecated and not used.
- Explicitly convert ICS files to UTF-8.

- Added Utility.to/fromUtf8().

Bug 2509287
Change-Id: I3785a365a9a34039ec12ba82bd857dcdbc4de92d
2010-03-15 10:51:58 -07:00
Marc Blank 82e51e0631 Send email related to event exceptions
* We weren't sending out appropriate emails for exceptions and other
  event updates
* Write exception specific ics file code in CalendarUtilities (in
  the existing ics file creator)
* Send appropriate Update: subject for updated events/exceptions
* Compose simple message text consisting of:
  When: <time>
  Where: <location>
* Prepend message text for exceptions to indicate that the message
  relates to a particular instance of the event:
  This event has been canceled for: <date>
  The details of this event have been changed for: <date>
* New strings were added in CL#44141
* Updated CalendarUtilities tests

Bug: 2501270
Change-Id: I920de8120bc56d5bd565cbde26ff4807be41579f
2010-03-12 11:12:23 -08:00
Marc Blank ff556f7b5f Fix #2508283 (Improper wrapping of long text in ics attachments)
* Ignore CR and change LF into backslash + n
* Write unit test for handling of CRLF's
* Rename mLineCount to mColumnCount, which is more appropriate

Bug: 2508283
Change-Id: I8b2081aa474cb07b6cb09383ff6ac58a1dab1bba
2010-03-11 16:28:52 -08:00
Andrew Stadler 319155a061 Merge "Follow-up to MimeMessage efficiency improvements." 2010-03-11 11:58:36 -08:00
Andrew Stadler dfd53b0e82 Follow-up to MimeMessage efficiency improvements.
I missed a case where message-id should not be set locally, which is
the case where the Mime parser clears all headers *and* does not find
a message-id.  The parsed MimeMessage should accurately reflect this.

In the old code, the local id was created at construction time and then
immediately discarded by the parser (calling headers.clear()).

In the new code, I was generating a message-id any time I couldn't find
one.  Now, when explicitly cleared or removed, I set a boolean to inhibit
automatic generation of a new one.

I also missed the fact that a missing message-id no longer throws an
exception, it simply returns null, and so I changed the code that was
catching that exception to simply check for null.

(Note:  Clearly, modeling of legacy behavior is becoming annoying here;
It would be better to do away with all of the automatic logic, and simply
generate message-id locally when appropriate:  On locally-generated
messages.  I don't want to touch this for the current release, but I left
a note in the code to this effect.)

Bug: 2504774
Change-Id: Ibfcbd2363c7ae39ee6d44e4c3295f88258cb4945
2010-03-10 16:42:49 -08:00
Makoto Onuki 69ade70f2d Log recent network activities when IMAP parser crashes.
Added DiscourseLogger, which stores last N (currently 64) lines of IMAP
commands sent to the server and responses received from the server.

We dump it to logcat when the IMAP parser crashes, that is, a) getting a
RuntimeException in ImapFolder.fetch() or b) getting a Runtime/IOException
in ImapResponseParser.

Bug 2480227

Change-Id: I6b5a728a7df106627ec29bb3c7c04a97a99b444b
2010-03-10 13:08:09 -08:00
Andrew Stadler 44552da606 Reduce memory overhead in Message and MimeMessage
Message and MimeMessage were creating a lot of unnecessary sub-objects
even when not needed, so do a bunch of lazy initialization.  This should
raise the bar on the size of gigantic inboxes giving us trouble.

* Specific optimizations:
  * Replace date formatter with a shared static
  * lazy create mHeader (ArrayList)
  * lazy create mFlags (HashSet)
  * optimize MimeHeader fields class
  * lazy create local message-ID (expensive-to-make uuid String)
  * make message-id string less expensive to create
* Other cleanups:
  * add some override annotations
  * privatize some members
  * update a fragile test (not a deep fix, it's still fragile)

Side effect, should be faster too.

Bug: 2357564
Bug: 2093422
Change-Id: I8a873879d402e2662339d5398ad0b15da6e580e9
2010-03-09 20:30:47 -08:00
Makoto Onuki 94c6f4f84f Fix failing EmailSyncAdapterTests.
Bug 2497978

Change-Id: If57099958b5e92e24f922e16f4b8d5fcc96ae163
2010-03-09 14:03:45 -08:00
Makoto Onuki 62c76bcb23 Merge "Fix AccountSetupExchangeTests.testLoadFields()" 2010-03-09 13:37:19 -08:00
Makoto Onuki f3f15c12c9 Fix AccountSetupExchangeTests.testLoadFields()
This test has been failing since I60974b85, which is obviously correct,
so I modified the test.

Bug 2488770

Change-Id: I5a2eea19d9f3c3647b7c88a1e0db9297727b8e66
2010-03-08 15:28:38 -08:00
Andrew Stadler fd249f61dd More work on account migration
* Split account copy loop to do POP3 accounts first, then IMAP
* After upgrading accounts, upgrade folders
* Upgrade messages in those folders
* Preserve attachments on outgoing messages (e.g. drafts)
* Enable composer and start syncing after upgrade
* Fix latent bug in LocalStore (which was not used in Eclair)
* Add tests for upgrade workers in LegacyConversions

Bug: 2065528
2010-03-08 13:53:01 -08:00
Makoto Onuki c133e6f185 Fix for Account.isValidId() crash when getting -1.
Bug 2493026
2010-03-05 15:06:12 -08:00
Mihai Preda 989552c107 Move parseDateTimeToMillis() to com.android.email.Utility. 2010-03-04 12:45:37 +01:00
Andrew Stadler a3cfdd2f3c Merge "Continuing work on account migration" 2010-03-03 22:33:59 -08:00
Andrew Stadler 9f73249031 Continuing work on account migration
* Prune all folders, messages & attachments that won't migrate
* Clean up SSL/TLS values for better connection results & security
* Move account setup lookup code to AccountSettingsUtils to share it
* Cleanup config/auto-rotation settings to prevent relaunch of
  auto-discover or account check (from exchange).
* A couple of other very small fixes

Bug: 2065528
2010-03-03 22:19:41 -08:00
Makoto Onuki 652be6fb3d MessageList: Go to Welcome if account not found.
If the account specified with an Intent doesn't exist, show the Welcome
activity instead, which will navigate the user to the appropriate activity.
(e.g. account list if there're more than one account)

Bug 2479609
2010-03-03 17:07:29 -08:00
Makoto Onuki 678ab2c780 Merge "Store UUID instead of _id in desktop shortcuts." 2010-03-03 15:46:37 -08:00
Makoto Onuki e37881aac5 Store UUID instead of _id in desktop shortcuts.
- Because AccountBackupRestore won't preserve _id.
- Now MessageList accepts both Donut(1.6)-style URIs and Eclair(2.0-2.1)-style
  URIs.

Bug 2479609
2010-03-03 15:41:10 -08:00
Marc Blank 6c8b1ec088 More unit tests related to meeting-related emails
* Included is a (nearly complete) VCALENDAR parser that is
  used to verify the contents of the ics attachments we create
* Added a test for meeting invitation
* More to come (always)

Change-Id: I31eeac66eb635f443c85aacf56e67a943cc3d53b
2010-03-03 15:20:26 -08:00
Marc Blank 4577f71f76 Refine meeting invitation emails; include VTIMEZONE
* VTIMEZONE blocks must be sent in our ics files for meeting
  invitations that are recurring, as the originator's time zone
  is critical in making attendee's calendars accurate
* Created a utility to convert TimeZone to VTIMEZONE data; the
  utility successfully generates data (including recurrence rules)
  for the entire tzinfo database (the source of TimeZone).
* Updated our ics files to include VTIMEZONE when appropriate and
  send DTSTART/DTEND in local time in that case
* Wrote some unit tests, but more are needed

Change-Id: Iccbdd00cd3b2be2da058b344ebacd17ed6fb0e3d
2010-03-02 11:38:01 -08:00
Makoto Onuki 726a9fcef3 Ignore FETCH responses that don't have UID.
We've observed that the secure.emailsrvr.com email server returns an excess
FETCH response for a UID FETCH command.  Excess responses don't have the
UID field, even though we request, which led the response parser to crash.

This patch fixes it by making the parser ignore response lines that don't
have UID.

Bug: 2441065
2010-03-01 16:00:05 -08:00
Makoto Onuki c18f8f615f Enable calendar sync for Exchange accounts when upgrading.
On the first boot after upgrade from Eclair, enable calendar sync for all the
existing Exchange accounts, if any, and show notification.

Note on this version, nothing happens when you click on the "Calendar added"
notification.  We're waiting for an API (action or something) to launch
calendar.

Bug 2428718
2010-02-26 13:28:59 -08:00
Andrew Stadler cb95fbe135 Send CAPABILITY to all IMAP servers
* Send CAPABILITY to all servers, not just when we check TLS
* Feed capabilities into IMAP ID generation
* Unit tests updated

Bug: 2332183
2010-02-25 22:48:11 -08:00
Makoto Onuki 5bdff23a56 Merge "Refactored out Account related methods into a new base class." 2010-02-25 09:26:49 -08:00
Makoto Onuki 5570bc1570 Refactored out Account related methods into a new base class.
These will be useful for other tests too, and I'm planning to use some.
2010-02-24 17:34:50 -08:00
Marc Blank 89be77eaea Send replies to exchange meeting requests
* When the user selects accept/decline/tentative in MessageView, we now send
  an email to the organizer, with an iCalendar attachment indicating the reply
* Added a unit test for the reply case, but more tests to be added to handle
  other circumstances

Change-Id: Iff799d88a92b6546735bf4965b22febf3a82b56f
2010-02-24 15:13:57 -08:00
Marc Blank d12bb138b0 Merge "Fix bugs in SimpleIcsWriter" 2010-02-23 14:26:41 -08:00
Marc Blank 1f4b1b3bd1 Fix bugs in SimpleIcsWriter
* Guilty of failing to run the unit tests
* Fix the (obvious) issues

Change-Id: If12e02facce768ca2d410320bea68a2ca2c116c6
2010-02-23 14:25:18 -08:00
Makoto Onuki 353bdbc15a Merge "Remove LOCAL_SDK_VERSION. We haven't finished unbundling." 2010-02-23 12:28:26 -08:00
Makoto Onuki 94de6cdf29 Remove LOCAL_SDK_VERSION. We haven't finished unbundling. 2010-02-23 12:19:55 -08:00
Marc Blank 3b97e1769a Merge "Fix #2443881 (Don't display User name field for EAS account)" 2010-02-23 11:40:15 -08:00
Marc Blank 18d7222359 Send meeting invitations for new/updated Exchange events
* Wrote utility to create an ics file (iCalendar) based on a
  CalendarProvider Event.  This is a good first pass, but we need
  to consider whether to include alarms, etc.
* Use aforementioned utility and new convenience method to send
  meeting invitations to attendees of newly created meetings (events)
  when they are uploaded to the server via the CalendarSyncAdapter
* Overall, attempted to modify existing provider and rfc822 output
  code as little as possible.  Rfc822Output is actually very limited
  in its capabilities and should be made more robust in future

Change-Id: Ie20b9137df56dc414de6737d05fa40ec9cdf47e0
2010-02-23 11:37:18 -08:00
Andrew Stadler 5afa187791 Create a PackedString utility class
* We can use this for meeting request information which will start out with
  one or two pieces of information, but might grow in the future.
* Binary compatible with Address.pack() format, so we can eventually
  combine code.
2010-02-22 22:34:45 -08:00
Andrew Stadler db8ef02fea Remove ProGuard from tests, too.
Follow-up to:  58fbf8c1af
2010-02-22 21:06:59 -08:00
Andy Stadler 35e5885e9e Merge "First part of Exchange meeting request/reply implementation" 2010-02-22 12:59:05 -08:00
Andrew Stadler 3aaba9eb87 First part of Exchange meeting request/reply implementation
* Added two columns to Attachment in EmailProvider
  content: content that is written directly as an attachment
  suppressDisposition: to suppress the content-disposition header
  All meeting invitation emails use these two columns; the first
  for ics attachment data (which is quite small, rarely over 1k),
  and the second to indicate NOT sending the content-disposition
  header; without this, Exchange will consider the ics as an
  attachment rather than an iMIP style message (rfc2447)
* Modified tests to include these columns; added upgrade code for
  new database version
* New columns and code are designed to be usable outside Exchange,
  although there are no other clients of the code at this point.
* Modified Rfc822Output to use the content field, if present, in
  lieu of retrieving attachment data via URL; added support for
  suppressing the Content-Disposition header
2010-02-22 12:57:33 -08:00
Makoto Onuki 988981a9ad Follow up to I07496942.
- Now that reconcileAccountsWithAccountManager() is static, we don't need to
  instantiate SyncManager.

- Don't need to set mResolver.  reconcileAccountsWithAccountManager() doesn't
  use it.
2010-02-22 11:09:08 -08:00
Marc Blank 5b46171b83 Fix #2443881 (Don't display User name field for EAS account)
* Make the field and label GONE for EAS accounts
* Enable the "Done" button at all times for EAS accounts
* Add test case for this, and clean up bad formatting in tests

Bug: 2443881
Change-Id: Ic80b001e443fa37b7cfeb810b1f31edf22b065b9
2010-02-20 15:05:39 -08:00
Andrew Stadler de7d21c10a Fix various problems with SyncManagerAccountTests
1.  Destructive of existing user accounts in device
2.  Can get confused (miscounting) due to existing user accounts
3.  Cleaned up use of context and mock context
4.  Disallow account backup and account security updates when testing
5.  Make account manager removeAccount() calls blocking, so the test
    does not proceed until the accounts are really deleted.

Bug: 2454870
2010-02-19 15:50:04 -08:00
Makoto Onuki d6d843a10b Don't use hardcoded package name.
Bug 2454892
2010-02-18 16:49:49 -08:00
Makoto Onuki 62a7b7fe76 Apply proguard to email.
Redoing I10a82fd8fdc16febcd880bfcf519843d5562f8e6 with more flags to keep test
only methods.
2010-02-18 16:47:19 -08:00
Makoto Onuki 4f1b4191d1 Revert "Enable Proguard."
This reverts commit c237ae8c85.

Reason: We need more flags for unit tests
2010-02-18 14:41:56 -08:00
Ying Wang c237ae8c85 Enable Proguard. 2010-02-17 19:08:10 -08:00
Mihai Preda 1575e7860d MessageCompose: fix delete quoted on reply/forward for EAS.
Also fix display of quoted html text for a draft (Exchange 2007).

Bug 2363249
Bug 2444496
2010-02-17 15:28:25 +01:00
Andrew Stadler af55e3e436 Respond to loss of device admin status
If the user revokes device admin status, reset our internal state and
the state of any accounts that might have been depending on it.  This
halts syncing immediately and rewinds the security/provisioning state
of any such accounts to a known state (as if the account had just been
created.)

Bug: 2387961
2010-02-16 14:33:08 -08:00
Marc Blank 70859ecb4e Merge "Add meetingInfo column to Message; use for meeting invites" 2010-02-16 10:19:29 -08:00
Marc Blank 4006e5fc22 Add meetingInfo column to Message; use for meeting invites
* Added a meetingInfo column to the Message database
* When a meeting invite is received, the start time is stored here
  in ms from start of epoch.  Note that this field is defined to be
  a String, for extensibility
* Update ProviderTests

Change-Id: If44892d27ccc5ebdc1f8667befafb8b8a27a2cf4
2010-02-16 10:18:33 -08:00
Makoto Onuki 83457b0235 Preparing for renaming package.
- Made tests use the new package-name-free constructor of ActivityInstrumentationTestCase2.

Bug 2226160
2010-02-16 09:16:15 -08:00
Marc Blank d0377b8bb3 Merge "Add support for Exchange 2003 provisioning" 2010-02-15 19:47:42 -08:00
Marc Blank ea0aa9343e Add support for Exchange 2003 provisioning
* Provisioning for Exchange 2003 and Exchange 2007 now supported
* Added end-to-end test of Exchange 2003 provisioning parser

Change-Id: I1f86f2909351a8220b963551cd33fecdf59a7e26
2010-02-15 19:46:40 -08:00
Marc Blank cf7581c51c Add support for UNTIL in recurrences
Change-Id: I983e1bcb209e794b462ec43efaccefe95bf9bd9d
2010-02-15 13:48:57 -08:00
Satoshi Kataoka c1cea617cc Merge "Add Signature to Email Composer" 2010-02-13 18:44:36 -08:00
Marc Blank 672ffc0000 Merge "Handle calendar sync state changes by observing Calendars; cleanup" 2010-02-13 13:00:21 -08:00
Marc Blank 694257cb7e Handle calendar sync state changes by observing Calendars; cleanup
* Use a content observer to detect changes in Calendars; we use this to
  determine whether or not sync has been turned off.  If sync is turned
  off, all events will be deleted, so we need to reset the sync key
* Make sure that all code working on Contacts also now works on Calendar
  (push, etc.)
* Remove some old crufty logging and out-of-date comments
* Addresses 2433061

Bug: 2433061
Change-Id: I6299168903fcce9bf820b72b5f6bb157d9169653
2010-02-13 12:58:56 -08:00
satok 2a41aa538f Add Signature to Email Composer
Bug: 1323618

- Add signature to the message
- Set selection just after the message
- Add tests for signature
2010-02-14 00:41:48 +09:00
Doug Zongker ba714999f2 finish replacing Email's base64 implementation with android-common
Change-Id: I19adbbb884311d70073e9f7a961aa6808ac0dfb4
2010-02-11 14:47:04 -08:00
Marc Blank a8d44824c3 Fix #2438451 (NPE's in Exchange tests)
Bug: 2438451
Change-Id: I8b861a859ae827fdfd3a0a13becfc1a3737cea4c
2010-02-11 10:57:20 -08:00
Makoto Onuki 961ee151fc Adding more tests for MimeMessage.
Added 2 tests to make sure the parse won't crash with invalid header.

Bug: 2258519
2010-02-10 11:32:05 -08:00
Marc Blank 673169fac9 Release security holds based on flags; implement remote wipe
* When the UI indicates that security policies for a particular
  account are now in force and releases the security hold (a bit
  in the Account flags), we release any syncs that had been
  waiting due to security errors
* Clean up code related to sync holds
* Add unit test for sync hold release
* Add support for server-directed remote wipe

Change-Id: I6209f75e4b57c850ae1ac27f407630c9c740514f
2010-02-10 09:30:00 -08:00
Andrew Stadler 2a5eeea921 Adding security hold flag to accounts
* Add hold flag to Account flags
* Add code to set it (when EAS reports policy failure)
* Add code to clear it when we see changes from the device admin side
* unit tests

This should be sufficient to restart sync of an account which is on hold
due to security policy requirements.  Note, this is considered a "retry",
and if the account still does not meet requirements for some reason, it
is expected that EAS sync will call policiesRequired() again.
2010-02-08 17:42:42 -08:00
Andrew Stadler 3d2b3b3b35 Logic to move phone into security-admin mode
* Create notification to display when syncs fail due to security
* Create psuedo-activity (no UI) to manage device admin state transitions
* Clean up and flesh out SecurityPolicy APIs'
* Add placeholders in EasSyncService showing how to react when policies
    are not met and sync cannot continue.

Note:  There are some STOPSHIP todo's at the top of SecurityPolicy.java.
These should explain any code that you might think is "missing".
2010-02-05 11:10:39 -08:00
Marc Blank 7c6c1fd519 Merge "Build proper TimeZoneInformation strings for upsync; fix bugs" 2010-02-03 14:42:23 -08:00
Marc Blank 6f3013b787 Build proper TimeZoneInformation strings for upsync; fix bugs
* Create full TZI strings for upload of events (previously, we
  omitted DST information)
* Add documentation to some unit tests
* Put in correct logic for determining if upload needed
* Fix problem w/ parsing empty tags

Change-Id: I268ce8a2db30b3cfdf0e44f6a78befd6bd933243
2010-02-03 14:41:45 -08:00
Makoto Onuki 91237e9dcb Adding script for building Email app without exchange.
remove-exchange-support.sh makes it possible to build the email app without
exchange support.

This script:
- removes all packages under com.android.exchange.
- removes all lines surrounded by EXCHANGE-REMOVE-SECTION-START and
  EXCHANGE-REMOVE-SECTION-END

And the resulting source should still build and run fine.

Bug: 2369784
2010-02-03 11:39:46 -08:00
Andrew Stadler 8bb0ee3b92 Fix auto-discover / account verification logic
New behavior:
 * There are two primary paths through this activity:
 *   Edit existing:
 *     Load existing values from account into fields
 *     When user clicks 'next':
 *       Confirm not a duplicate account
 *       Try new values (check settings)
 *       If new values are OK:
 *         Write new values (save to provider)
 *         finish() (pop to previous)
 *
 *   Creating New:
 *     Try Auto-discover to get details from server
 *     If Auto-discover reports an authentication failure:
 *       finish() (pop to previous, to re-enter username & password)
 *     If Auto-discover succeeds:
 *       write server's account details into account
 *     Load values from account into fields
 *     Confirm not a duplicate account
 *     Try new values (check settings)
 *     If new values are OK:
 *       Write new values (save to provider)
 *       Proceed to options screen
 *       finish() (removes self from back stack)
* Added unit test for new loadFields method

Bug: 2412300
2010-02-03 10:38:27 -08:00
Makoto Onuki 049509d10e Merge "Move Eas.ACCOUNT_MANAGER_TYPE out of the package." 2010-02-02 13:34:04 -08:00
Andrew Stadler 0434fef1f6 Fix crash in VendorPolicyLoader
* Create unit test to reproduce crash
* Fix handling of empty bundle (the default return value)
* Clean up some exception handling in the policy module loader, which
  reduces some unneeded logging.

Bug: 2413388
2010-02-02 10:41:56 -08:00
Marc Blank cfbbb99c67 Merge "Handle upsync of multiple BYDAY values; add some unit tests" 2010-02-01 17:00:35 -08:00
Andrew Stadler d62860821c Additional SecurityPolicy functionality
* 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
2010-02-01 16:48:16 -08:00
Marc Blank a825939459 Handle upsync of multiple BYDAY values; add some unit tests
Change-Id: If3be28df41ed88cb83edca2f6ea6ca1f734f506f
2010-02-01 16:44:16 -08:00
Andrew Stadler ecb1af8041 Finish up IMAP ID implementation
* 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
2010-02-01 15:53:46 -08:00
Makoto Onuki faed6178b1 Move Eas.ACCOUNT_MANAGER_TYPE out of the package.
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.
2010-02-01 15:38:15 -08:00
Marc Blank f3fcb8929e Implement Exchange calendar sync support
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
2010-01-28 09:18:48 -08:00
Makoto Onuki f98ffb6f44 Merge "Add "vendor policy" loader, and alternate exchange descriptive text." 2010-01-27 18:09:05 -08:00
Makoto Onuki f613489663 Add "vendor policy" loader, and alternate exchange descriptive text.
- 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
2010-01-27 17:40:56 -08:00
The Android Open Source Project d423fb996f am 08d92ebf: merge from open-source master
Merge commit '08d92ebf4722e45216ee225775a3b86f9ceecc0d'

* commit '08d92ebf4722e45216ee225775a3b86f9ceecc0d':
  Trim the mime type portion of Content-Type.
2010-01-27 16:29:17 -08:00
Marc Blank 46199c65a3 Fix #2382368 (NPE in AccountSetupExchangeTests)
* 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
2010-01-27 13:57:20 -08:00
Andrew Stadler 345fb8b737 Add utilities for processing account security policies
* Add security sync key & signature columns
* Add utilities for easy read/write of security columns
* Write aggregator for multiple accounts
* Simple API's for exchange security (very preliminary)
* Unit tests of above

Bug: 2387961
2010-01-26 17:24:15 -08:00
Andrew Stadler 468371917e IMAP ID
* 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
2010-01-25 18:40:45 -08:00
The Android Open Source Project 08d92ebf47 merge from open-source master 2010-01-21 13:19:17 -08:00
Andrew Stadler fc8d943a82 Add security column to Account
* 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
2010-01-21 11:48:02 -08:00
Patrick Horn 2517a3dfd1 Trim the mime type portion of Content-Type.
Fixes parsing of Content-Type headers like "text/plain ; charset=iso-8859-1"
Added unit tests for whitespace and the charset parameter
2010-01-21 11:46:20 -08:00
Andrew Stadler 346a0cc1e0 Backup/Restore accounts - bugfix - DO NOT MERGE
* 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
2010-01-20 17:24:33 -08:00
Andrew Stadler d612717340 Backup/Restore accounts - bugfix
* 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
2010-01-20 16:52:12 -08:00
Andrew Stadler 85d765f41c Quick backup/restore of accounts DO NOT MERGE
* 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
2010-01-20 11:05:02 -08:00
Andrew Stadler 5e91cccd4b Quick backup/restore of accounts
* 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.)
2010-01-20 01:36:01 -08:00
Marc Blank 2cb9c55f3b Add new tests for Email sync parsing
Change-Id: Ib3be60b5f439f79f62f62eff607673e34c75506d
2010-01-07 20:27:39 -08:00
Mihai Preda e2ddc55ed0 MessageView: fix rename next/prev in landscape.
Bug 2353633.
2010-01-06 18:09:38 +01:00
Marc Blank 608ca667b2 Don't delete referenced messages from the Exchange server DO NOT MERGE
* 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
2009-12-16 12:01:08 -08:00
Android (Google) Code Review e312c12b74 Merge change I356b8bfa into eclair-mr2
* changes:
  Deal with mismatch between our accounts and AccountManager accounts
2009-12-11 09:05:16 -08:00
Marc Blank 423680653a Deal with mismatch between our accounts and AccountManager accounts
* 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
2009-12-11 09:04:26 -08:00
Android (Google) Code Review 3c1334ae1f Merge change I915b13a6 into eclair-mr2
* changes:
  Fix MessageListUnitTests
2009-12-09 17:44:48 -08:00
Android (Google) Code Review 7a4b1c72f6 Merge change I146f63ab into eclair-mr2
* changes:
  Don't delete referenced messages from the Exchange server
2009-12-07 21:31:42 -08:00
Marc Blank c29e435eb3 Don't delete referenced messages from the Exchange server
* 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
2009-12-07 21:30:59 -08:00
Marc Blank 0e1595c177 Handle unexpected deletion of EmailProvider database
* 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
2009-12-07 21:12:57 -08:00
satok 3d00377b35 Fix MessageListUnitTests
This is supperement of change,33265

* Move custom cursor to inner static class
* Change public to /* package */
* Move PROJECTION to a package
2009-12-08 13:36:32 +09:00
satok 4cb25d93a2 Save the state of checkboxes when orientation is changed
BUG: 2239516

* Add tests for save/restore Instance State
2009-12-01 15:41:10 +09:00
Jean-Baptiste Queru 56e48981f0 eclair snapshot 2009-11-12 18:46:09 -08:00
Android (Google) Code Review 9abd1bf9da Merge change I21052e28 into eclair-mr2
* changes:
  Controller: modify the test for "attachment already loaded".
2009-10-29 09:34:43 -04:00
Mihai Preda 6bb7c7248a MessageView: disable reply&forward for Trash messages.
Bug 2170118
2009-10-29 14:11:10 +01:00
Mihai Preda 9ef6f645f5 Controller: modify the test for "attachment already loaded".
Bug 2192510.

update unit test.
2009-10-22 19:27:59 +02:00
Marc Blank ef83299b99 Clear out orphaned messages in updates/deletes tables
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
2009-10-15 10:58:00 -07:00
Andrew Stadler 53123c2f91 DO NOT MERGE. Prevent duplication of POP3 attachments
* 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
2009-10-14 12:41:05 -07:00
Andrew Stadler 5b0a12c199 Prevent duplication of POP3 attachments
* 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
2009-10-14 08:20:59 -07:00
Andrew Stadler dfee3ff278 Fix a crash when you scroll MessageList to junk @ bottom
* Add missing reference to spam/junk folder icon
* Unit tests for Utility.FolderProperties.getIconIds()

Fixes http://b/issue?id=2173907
2009-10-07 16:30:41 -07:00
Andrew Stadler b6756688b1 Handle IMAP empty bodies more safely
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
2009-10-07 11:42:27 -07:00
Andrew Stadler eb7752bf69 Fix back-to-back message-id bugs
* 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
2009-10-06 14:20:09 -07:00
Andrew Stadler 71754d3f94 Delete attachments when necessary, don't leak disk space
* 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
2009-09-30 23:32:30 -07:00
Andrew Stadler e4a7cc440f Re-enable modernized version of "optional" SSL/TLS
* 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
2009-09-29 15:28:43 -07:00
Andrew Stadler c41c47fa07 Enable message upload
* 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
2009-09-25 14:54:32 -07:00
Marc Blank 5fc57eccef Fix reply/forward for both SMTP and EAS; fixes #2138725
* 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
2009-09-23 07:31:01 -07:00
Andrew Stadler 0d00889f83 Cleanup Provider Message in preparation for upload
* Remove mServerIntId and its special logic
* Add mServerTimeStamp
* Add column dynamically so we don't lose accounts

Bug # 2097471
2009-09-22 18:31:10 -07:00
Andrew Stadler fa52e6c956 Clean out old mailbox names logic and fix a couple of bugs.
* 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
2009-09-21 14:44:30 -07:00
Android (Google) Code Review 71bba443f2 Merge change 26224 into eclair
* changes:
  Fix broken test after changes to Rfc822Output
2009-09-21 16:16:51 -04:00
Marc Blank e470332456 Fix broken test after changes to Rfc822Output
Change-Id: Ibb1ab79cf2cce1e5ad66d3a45656e575dbabbc6d
2009-09-21 13:16:16 -07:00
Andrew Stadler ad4ec0590d Fix broken MessageView tests
I'm surprised these were working at all.
2009-09-21 12:59:25 -07:00
Andrew Stadler 092d35c98d Fix NumberFormatException in POP3 message sync
* 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
2009-09-16 12:20:38 -07:00
Andrew Stadler da8836a76c Give warnings if dupe account created:
* 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
2009-09-15 16:33:44 -07:00
Android (Google) Code Review c21d326ef0 Merge change 25145 into eclair
* changes:
  Disable testResolveInlineImage
2009-09-15 19:03:06 -04:00
Andrew Stadler 1761234fc6 Disable testResolveInlineImage
This test depends on LocalStore and is thus deprecated.

It very much needs to be be rewritten and reestablished.

Bug # 2121424
2009-09-15 15:55:23 -07:00
Marc Blank 2d5691cac1 Support bcc in Exchange (Fixes #2117849)
* Must send the bcc header for EAS

Change-Id: I38d119beed334c6bb23a09b87375804f8c03ea76
2009-09-15 15:18:46 -07:00
Marc Blank 1d98989222 Implement SmartReply/SmartForward for EAS; fixes #2098779
* 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
2009-09-14 15:47:38 -07:00
Marc Blank f2dded3a2f Reimplement reply/forward to use mTextReply/mHtmlReply
* 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
2009-09-13 22:28:38 -07:00
Marc Blank 411334d4e5 Fix broken test cases
Change-Id: Ib2d019662d358a20b4d62992529bfdf398e4661b
2009-09-11 23:00:39 -07:00
Andrew Stadler 6c21942ec4 Implement move-to-trash for IMAP and POP3.
* 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
2009-09-10 12:44:05 -07:00
Marc Blank cef2344e70 Rework EAS account creation & ssl operation
* 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
2009-09-09 10:32:06 -07:00
Marc Blank e256983193 Add sourceKey to Body table; add flags for reply/forward in Message
* Set reply/forward flag and sourceKey as appropriate in MessageCompose
* Update provider tests accordingly

Change-Id: I7f49d80a735314a1a38f09fbf1f234257c41af8c
2009-09-08 16:42:53 -07:00
Marc Blank 5b1ec90761 Fix more broken large Email tests (#2087413)
Change-Id: Iacff02d7bb025f6c4d6de9ca8dfa96c6cbb78d67
2009-09-06 13:58:38 -07:00
Marc Blank 6e7ea8cfe6 Fix problem with case of attachment name in EAS
* Fixes #2102752

Change-Id: I9cc05a8fc02344f1f673c5ccb4e6aed0f9602350
2009-09-05 22:13:55 -07:00
Marc Blank b8d0c55a05 Fix reply all behavior to prevent duplicates, etc.
* 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
2009-09-04 20:39:02 -07:00
satok 4bb52e36b1 Fix the foldername of outbox
BUG: 2077596

* fixed the array of special_mailbox_display_names
* added unit tests
2009-09-03 09:47:00 +09:00
Andrew Stadler fe5ed7b4b5 DO NOT MERGE Remove test code
Bug # 2092944
2009-09-02 15:20:32 -07:00
Andrew Stadler 91a5cd517f Clean up handling of Exchange setup option
* 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.
2009-09-02 09:45:28 -07:00
Andrew Stadler 936babc145 Bulk change of columns, LAST TIME.
* 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
2009-09-01 23:19:12 -07:00
Marc Blank 2ebf7d97ec Fix 2085862; add email address to test Account
Change-Id: I1980935207a96daa0b34bf78931e47b8374c84cc
2009-08-31 11:50:30 -07:00
Mihai Preda 0967b74a62 am 629e18ad: Fix base64 decoder. BUG 2081740.
Merge commit '629e18ad866917523599ed059898f4d986e49e26' into eclair

* commit '629e18ad866917523599ed059898f4d986e49e26':
  Fix base64 decoder. BUG 2081740.
2009-08-27 15:16:39 -07:00
Mihai Preda 629e18ad86 Fix base64 decoder. BUG 2081740.
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.
2009-08-27 22:24:30 +02:00
Andrew Stadler 423206653f Sync "read" and "favorite" back to server.
* 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
2009-08-26 23:12:02 -07:00
Mihai Preda ea0fea2558 MessageCompose: bug 2080075 & 2077496.
- 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
2009-08-26 21:49:31 +02:00
Marc Blank aa69a17477 Add initial support for uploading new Contacts to Exchange server
* 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
2009-08-24 18:45:14 -07:00
Andrew Stadler 4b41bae270 Enable IMAP/POP sending and EAS resend
* 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
2009-08-20 11:09:39 -07:00
Marc Blank c0c9c33322 Add URI's that atomically add a value to a particular field (Account or Mailbox)
* 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
2009-08-20 10:27:10 -07:00
Mihai Preda 44144d0301 MessageCompose: initial save attachments and load them back.
- load attachments for EditDraft.
- save attachments when save message.
- unit test for restoreAccountsWithMessageId()
2009-08-20 15:52:50 +02:00
Andrew Stadler 0d10783635 Finish loading large IMAP/POP messages
* 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
2009-08-19 16:09:13 -07:00
Andrew Stadler 4a8c70c09b Add "num new messages" field to Account
* 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.
2009-08-18 12:14:15 -07:00
Marc Blank cc8d74bd03 Add support for syncing the favorite flag to server (EAS 12.0 and up)
* Add test for date formatting
2009-08-17 22:48:12 -07:00
Mihai Preda 9627d014e1 MessageCompose: update body on save.
- 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.
2009-08-17 13:43:56 +02:00
Andrew Stadler c640cbbaf3 Update SMTP to send from provider messages, and attachments
* 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
2009-08-13 09:31:57 -07:00
Mihai Preda fb7974f5bf Fix SQL for DELETE_ORPHAN_BODIES and DELETE_BODY.
and add unit tests.
2009-08-12 12:57:09 +02:00
Andrew Stadler 3f1ac4da94 Add code to handle IMAP/POP attachments.
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
2009-08-11 15:08:14 -07:00
Mihai Preda 2917e895c7 MessageCompose:
- set displayName for composed messages (from To:)
- set FLAG_LOADED
- do the save & send in an AsyncTask
- some clean-up
2009-08-03 13:04:21 +02:00
Marc Blank f00dccd321 Massive reworking of EAS serialization; much smaller and faster now
* 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
2009-08-01 17:55:15 -07:00
Marc Blank 758a532fce Use providers to update the unreadCount of Mailboxes
* 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)
2009-07-30 16:03:31 -07:00
Marc Blank 948c36f47a Reimplement EAS contacts sync to work w/ new system facilities
* 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
2009-07-30 09:22:40 -07:00
Mihai Preda 3e79032dd1 Fix MessageCompose tests.
BUG 2017612.
2009-07-28 16:27:04 +02:00
Mihai Preda ff683a5b98 Remove mOldMessage from MessageView.
And add Address.unpackFirst() (used in MessageView) + test.
2009-07-28 13:49:40 +02:00
Andrew Stadler a98de7e55e Finish Attachment support for EAS accounts.
* 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
2009-07-27 19:52:21 -07:00
Andrew Stadler 3d25a519ab Convert AttachmentProvider to use new Provider db.
* 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
2009-07-27 15:52:42 -07:00
Andrew Stadler 301ac18bb7 Create tests and improve docs on AttachmentProvider
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
2009-07-27 11:20:15 -07:00
Android (Google) Code Review c7ccb68ba4 Merge change 8253
* changes:
  Modified to display unread count correctly.
2009-07-24 14:46:52 -07:00
satok 41f775bbc7 Modified to display unread count correctly. 2009-07-25 06:42:34 +09:00
Marc Blank b8a781f220 Load EAS attachments internally with new API ; re-sync after account changes
* Fix bugs #1993689 and #1997842
* Update test for attachment name creation
2009-07-24 12:36:52 -07:00
Mihai Preda 21ace307e0 Clean-up in MessageCompose, using EmailContent.Message.
Difficulties:
re-enable EmailHtmlUtil.resolveInlineImage() and
MessageCompose.loadAttachments() that operate on MIME parts.
2009-07-24 18:50:09 +02:00
Marc Blank 7375d950e4 Move to single EmailContent file; fix bug #1998157 2009-07-23 16:24:48 -07:00
Andrew Stadler 6ae38e4a39 Moving message operations into Controller, and load attachments.
* 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.
2009-07-23 09:51:01 -07:00
Marc Blank 531ae9d25f Fix bug #1997284 re: single default account
* Fixed the bug and uncommented the relevant tests in ProviderTests
2009-07-22 16:35:12 -07:00
Andrew Stadler 9e2c6bd5f2 Remove saveOrUpdate from EmailContent to prevent stale writes
* 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.
2009-07-22 15:13:30 -07:00
Andrew Stadler 54c1f2bf9a Improvements to default account handling
* 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.
2009-07-21 16:44:16 -07:00
Marc Blank 53093871c4 Changes to EAS: attachments, HTML text, and sending mail (without atts)
* Added HTML support for Exchange 2007 and later
* Modified MessageView to show HTML parts of body (if present)
* Replace some unused convenience methods in Body to be ones that are more
  useful (i.e. retrive body for a given message id)
* Made EAS sending operational
* Updated SyncManager to recognize the creation of new messages and check
  for work to be done (i.e. starting Outbox sync)
* Modified MessageView to remove EmailContent.X references
* Also changed the pattern EmailContent.getContent(cursor, class) to the better
  new ClassName().restore(cursor)
* Add a test of the utility to determine mime type from file name (since
  EAS doesn't provide this with attachment header information)
* Fixed bug in ProviderTestUtils in which the base (EmailContent) fields weren't
  being checked for equality in the various subclass equality testers.  Fixed a
  bug in saving emails that was caught by fixing this bug.
2009-07-18 23:31:39 -07:00
Andrew Stadler 4119218e2f Add support for get-attachments-by-message-id
* clean up provider URI's in this area
* minor bugfix in EmailContent, and add auto-writeback of messageId into
    saved attachments
* clean up existing attachment unit tests
* add new tests
2009-07-16 16:03:40 -07:00
Marc Blank 976f92908d Add support for attachments in EmailProvider and (preliminary) EAS
* EmailProvider now saves Attachment records atomically with Message (and Body,
  of course) if an ArrayList is stored in mAttachments
* Update EAS code to support attachment discovery
* Update EAS code to support attachment download via service API (preliminary)
* Add test for atomic attachment save
* Add test for unique file creation (external)
2009-07-16 00:01:57 -07:00
Mihai Preda c6893ddf0f First steps towards using the new EmailContent.Message in MessageCompose. 2009-07-15 13:13:45 -07:00
Andrew Stadler ded3c915d8 Add folders to AccountFolderList
* Scan folders and write into child cursors
* Clicking a folder takes you to MessageList
* Remove most links to FolderMessageList (nearly dead!)
* Repair 1-account startup behavior (takes you directly to inbox)
* Cleanup a few basic things like context menus & refresh

TODO: Magic mailbox section at the top
TODO: As always, better linkage to sync engine(s)
TODO: Menus, context menus, etc.
TODO: Proper handling of expandable list - accounts should stay open?
2009-07-10 16:46:51 -07:00
Mihai Preda e8d58c01ec Implement efficient Address pack/unpack and unit-test it.
Also unit-test legacy pack/unpack.
2009-07-08 12:07:58 -07:00
Andrew Stadler 7c3cca80a0 Reenable delete-message UI and write delete-from-provider.
* Longpress delete in MessageList
* Delete or Menu-Delete in MessageView
* Add deleteMessage() to Controller
* Unit tests for the new code in Controller
2009-07-06 13:58:30 -07:00
Andrew Stadler 28448e782b Extract utilities from provider tests for use elsewhere. 2009-07-06 10:49:38 -07:00
Andrew Stadler 45f9dd22e1 Fix bug in GroupMessagingListener and add unit tests 2009-07-02 14:29:02 -07:00
Andrew Stadler ddc871d9ed Fixed a few EmailProvider omissions; added tests
* EmailProvider query wasn't handling queries for deleted messages
* EmailProvider wasn't catching exceptions on some 'drop table' ops
* Added tests of synced messages (delete and update)
2009-06-29 23:08:40 -07:00
Takaoka G. Tadashi 2ed5063274 am 4f23ebd3: Fixed Pop3Store to be able to delete message in Inbox.
Merge commit '4f23ebd3dcca596533a33e6faedb446a814d32e3'

* commit '4f23ebd3dcca596533a33e6faedb446a814d32e3':
  Fixed Pop3Store to be able to delete message in Inbox.
2009-06-29 20:20:23 -07:00
Takaoka G. Tadashi 4f23ebd3dc Fixed Pop3Store to be able to delete message in Inbox.
When delete policy is DELETE_POLICY_ON_DELETE, PENDING_COMMAND_TRASH
will be invoked. But in POP3 account, because of 1) Inbox is
OpenMode.READ_ONLY, 2) getMessage(uid) just after open() is not work
correctly, 3) remote Inbox folder is not closed after deleting message,
PENDING_COMMAND_TRASH does not work.  And also the fat that some POP3
server use UID with '-' prevents PENDING_COMMAND_TRASH to recognize
the message is remote message.

Internal Bug: 1651709
2009-06-26 10:36:27 +09:00
Andrew Stadler 7143d969dd Add unit tests for Provider and fix bugs that were found
Uses a mock provider to avoid touching production databases.
Includes utilities for creating accounts, mailboxes, and messages.
Tests basic object creation & readback, object deletion, and some
forms of hierarchical deletion.  Has many TODO notes for additional
tests to be written.

In EmailContent, found & fixed a few fields that weren't being written to
the database properly.
2009-06-25 00:02:29 -07:00
Mihai Preda ed0e683d86 Don't drop invalid addresses while editing & check that all addresses are valid before send.
BUG: 1542391
add unit tests.
2009-06-24 15:44:08 -07:00
Mihai Preda 6c5460886f am a4926736: Review Email tests annotations (small/medium/large) and change some annotations based on time.
Merge commit 'a492673609111fe8c41ae152d62547b267346502'

* commit 'a492673609111fe8c41ae152d62547b267346502':
  Review Email tests annotations (small/medium/large) and change some annotations based on time.
2009-06-18 13:12:45 -07:00
Mihai Preda a492673609 Review Email tests annotations (small/medium/large) and change some annotations based on time.
Fix an NPE appearing when running the test suite.

BUG: 1566281, 1910409.
2009-06-18 12:16:28 -07:00
Marc Blank a290f503f1 Refactored EmailStore, EmailContent, EmailProvider
EmailStore goes away, replaced by EmailContent
All database activity is moved to EmailProvider
2009-06-15 14:49:11 -07:00
The Android Open Source Project a244abdad0 Do not merge. Merge commit '14f3e16' into donut 2009-06-15 00:08:40 -07:00
Mihai Preda 0dff228dc7 AI 149714: Download inline images for viewing if necessary and don't
delete attachment cache files if these are inline images.
  The purpose of original logic of loadAttachmnet() is to keep
  at most one attachment cache, probably to limit the size of
  cached file.  But it also purges all inline images.
  Integrates CL 149551 from DocomoEmail.
  BUG=1884385,1860250

Automated import of CL 149714
2009-06-10 10:48:32 -07:00
Andrew Stadler d2b0efa2f5 Cleanup broken unit tests from previous submit. This now works:
What works:
* All unit tests
* Editing existing accounts
* Create new accounts
* Checking account settings against server
* Mail sync using accounts
* Viewing mailboxes

What breaks (in approx order of planned fixes)
* Viewing messages
* Composing messages
* Some details of account editing
* Import of existing accounts
2009-06-09 14:46:30 -07:00
Andrew Stadler c0033f24a2 Convert remainder of app to use provider-based accounts
What works:
* Unit tests, except for com.android.email.activity.setup.*
* Editing existing accounts
* Create new accounts
* Checking account settings against server
* Mail sync using accounts
* Viewing mailboxes

What breaks (in approx order of planned fixes)
* Unit tests in com.android.email.activity.setup.*
* Viewing messages
* Composing messages
* Some details of account editing
* Import of existing accounts
2009-06-08 15:42:40 -07:00
Mihai Preda a9576bdad6 resolved conflicts for merge of 7403a54738 to donut 2009-06-08 20:52:12 +02:00
Mihai Preda 7403a54738 AI 149664: Move escapeChar from MessageView to EmailHtmlUtil.
Integrate CL 148437 from DocomoEmail.
  BUG=1860250

Automated import of CL 149664
2009-06-08 11:21:18 -07:00
Andrew Stadler a392e070bc Add android.permission.WRITE_EXTERNAL_STORAGE
Add unit test to verify writeable to sdcard.

Fixed bug http://b/issue?id=1883487
2009-06-04 15:16:43 -07:00
Mihai Preda 7330fe4953 Merge branch 'readonly-p4-donut' into donut 2009-06-04 11:40:35 -07:00
Mihai Preda 70798a7892 AI 149573: Display To: instead of From: in Drafts folder && Display unread message count for inbox, total message count everywhere else.
Integrates from imode email: 148948,149107,149247,149248,149249,149287.
  BUG=1591391,1842520,1860085,1459866,1860250

Automated import of CL 149573
2009-06-04 11:38:26 -07:00
Mihai Preda 438275b283 Merge branch 'readonly-p4-donut' into donut 2009-06-04 09:42:51 -07:00
Mihai Preda ca5089efb8 AI 149564: Escape special characters such as '<>&' in text/plain for display in WebView.
Integrate CL 144586,145919 from imode.
  Remove the Emoji escaping/workaround for WebView.
  Also integrate MimeHeader.java from CL 143064 from imode.
  BUG=1785319,1860250

Automated import of CL 149564
2009-06-04 09:39:24 -07:00
Mihai Preda d64d0e56de Merge branch 'readonly-p4-donut' into donut 2009-06-03 06:47:40 -07:00
Mihai Preda 7436601fae AI 149523: Correctly display inline images in Reply and Forward messages.
Integrates CL 148436, 148515, 148833 from imode email.
  BUG=1814789,1860250

Automated import of CL 149523
2009-06-03 06:44:47 -07:00
Mihai Preda fbde900c37 Merge branch 'readonly-p4-donut' into donut 2009-06-01 11:31:52 -07:00
Mihai Preda 5182d80674 AI 149442: Integrate CL#140625 (Fix attachment uri and content uri confusion) from imode to donut.
BUG=1598754,1860250

Automated import of CL 149442
2009-06-01 11:28:33 -07:00
Tadashi Takaoka 7b92d9a2a9 Merge branch 'readonly-p4-donut' into donut 2009-05-27 19:06:31 -07:00
Tadashi Takaoka a8884b9b72 AI 149328: Add extended header support to MimeMessage, MimeBodyPart, and LocalStore.
This extension is necessary to support some vendor specific
  extended header, such as X-NoRtn-Addr of i-mode.net mail.
  This change will update LocalStore database version to 24.
  And it should be consistent between donutburger Email and DocomoEmail.
  BUG=1741969

Automated import of CL 149328
2009-05-27 19:03:34 -07:00
Andrew Stadler b011a812e0 Fix the java.lang.StringIndexOutOfBoundsException that occurs when an SMTP server closes the connection early or returns an empty line.
Fix the same error in the Pop3 UIDL parser.
2009-05-22 11:48:14 -07:00