Commit Graph

2763 Commits

Author SHA1 Message Date
Makoto Onuki
ee6d0d47f5 DO NOT MERGE: Implement destroy() for all ImapElement classes.
- This is to make sure we're not touching any ImapResponse that's
already been destroyed.

- I didn't add "is it already destroyed?" check to them
(except for ImapTempFileLiteral), because it can be costly.
Just let NPE be thrown.

Backport of Idc7b88c4844727922841cbad8a106bf781181d45

Change-Id: I9932e78a49784e4218e939a12ebcb9a497c4eb57
2010-09-20 16:45:48 -07:00
Makoto Onuki
6275e8b144 DO NOT MERGE: Always destroy ImapResponses.
Unfortunately it's hard to write tests for this change, but at least
all tests pass with Idc7b88c4.

Backport of If0335a848dfcc23aecea22c21b2cce73dac7ff6f

Change-Id: I6cb3525bc3c67bbf2fb101488bf95edbead5d299
2010-09-20 16:45:48 -07:00
Makoto Onuki
565f58b9aa DO NOT MERGE: Add TODOs to ImapStore.
Backport of I5a9f246eb81cfca6008f82e8c2ffff8b7f28ba1d

Change-Id: I1422e8ae35e2ba560d1227669b9f720b937033a7
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
80202a9599 DO NOT MERGE: Clean up ImapStore and related classes.
- Introduce Fetchable
- Made static some methods/nested classes in ImapStore
- Removed ImapBodyPart
- Fixed lien breaks

Backport of Iec1aff2771faa28717753d6e2d9db96d940233a9

Change-Id: Ia97257c40a6edbe0abc4937068e9cd20e6c558d8
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
Andy Stadler
d711bab919 DO NOT MERGE Fix debug logging controls
* Assign "enable exchange parser logging" from Eas.PARSER_LOG instead
  of from EAS.USER_LOG.
* Reorder setup to assign listeners last;  This avoids unnecessary calls
  to Email.updateLoggingFlags() during setup.

Note:  The bug exists as far back as eclair, but the fix will need to be
made in a different file in earlier versions (pre DebugFragment)

Bug: 3003813
Backport from: I5d8f66747a86139dd593ac16ea421ab1e33b8795

Change-Id: Ifd427d697347894d0f584ae04142434c30724e92
2010-09-20 16:03:31 -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
e4cfdfd059 DO NOT MERGE: Simplify MessageRetrievalListener.
Main motivation: not to make the new IMAP parser too complecated.

- Removed messageRetrieved.
Motivation:
- It's not easy to call messageRetrieved() at the proper timing
from the new IMAP parser, and this method wasn't used anyway.

- Renamed messageFinished to messageRetrieved.
And removed the "number" and "ofTotal" arguments.
Motivation:
- They weren't used.  Also there was inconsistency about
what to pass as "numebr".  (i.e. 0-based or 1-based?)  There was
even a bug that caused passing a wrong number.

Backport of If92dbfe681b78a0eea8125188ede63a8f00dcf49

Change-Id: Icdea45e0a9ac567b1cdfb44e975e60bb11815472
2010-09-20 14:07:13 -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
Makoto Onuki
550aa6163f DO NOT MERGE: Clean up member variables.
- Fix misnomered fields.  (e.g. static mMember -> static sMember)
- Reduce visibility.  (e.g. mark as private)
- Mark final / static if possible.

Note it's on master.

There's a lot more cleanup oppotunities in the activities, but they're going
to go through a major overhaul, so I didn't bother.

Backport of b3f7dd0169

Change-Id: Ic33f9518f23805716e2aec0ab42edb92107e066c
2010-09-20 14:03:29 -07:00
Marc Blank
316447925e am 75cfe25d: Increase EmailServiceProxy timeout for validation attempts
Merge commit '75cfe25d3b97f83d8711260a5ed9bd82fa3cc7da' into gingerbread

* commit '75cfe25d3b97f83d8711260a5ed9bd82fa3cc7da':
  Increase EmailServiceProxy timeout for validation attempts
2010-09-20 12:52:17 -07:00
Marc Blank
2e7a84ff26 DO NOT MERGE: Fix error upsyncing exceptions to all-day events
* Backport of I471e487ec1f7ce11cccdde86f8d8bd8435edd27d (master)

Bug: 2893712
Change-Id: Iaada0969f77a8e41a66426f58ca2886529d3fd8f
2010-09-20 12:04:20 -07:00
Marc Blank
90f1198f67 Merge "DO NOT MERGE: Fix repeating notifications for synced messages" into gingerbread 2010-09-20 12:03:50 -07:00
Marc Blank
a6f694635f DO NOT MERGE: Fix repeating notifications for synced messages
* Existing code reloads long POP/IMAP messages at every sync
* If the server is POP3, or the IMAP message is unread, this
  will lead to redundant notifications of new message arrival
* The fix avoids repeated message reload
* Backport of I8dc22966282655c8645362d672a083a1c37f554c (master)

Bug: 2892705
Change-Id: I1ce7de0dc25abc8ace544849dc3d437fcd1459f0
2010-09-20 11:37:39 -07:00
Marc Blank
4e03d94ccc DO NOT MERGE: Set HAS_ATTENDEE_DATA to 0 for exceptions
Bug: 2891708
Change-Id: I4eb26a6fe7be13dda34ba39a766a03c901276b73
2010-09-20 11:12:29 -07:00
Marc Blank
75cfe25d3b Increase EmailServiceProxy timeout for validation attempts
* Use 90 seconds (instead of 45 seconds)

Bug: 3008626
Change-Id: I31258a5fbcca1f489c8bf6fb2ed8f3dcad5d2e26
2010-09-20 10:34:30 -07:00
Eric Fischer
9beb1e7a4b Import revised translations. DO NOT MERGE
Change-Id: If206c1e4ac1bf333dfcd4f0b65243f80d127c0d2
2010-08-27 17:17:11 -07:00
Andrew Stadler
b47d1a8a1a am 126c9216: Block oversize attachments from being sent
Merge commit '126c9216b13d915b24a057b5b50bb8ea9826ba7e' into gingerbread

* commit '126c9216b13d915b24a057b5b50bb8ea9826ba7e':
  Block oversize attachments from being sent
2010-08-26 15:24:16 -07:00
Andrew Stadler
126c9216b1 Block oversize attachments from being sent
* Attachments that come in with a file:// URI do not support the complete
  set of OpenableColumns columns.  To handle this better:
  1. Obtain the openable values in two separate queries, in case one or
      the other is supported (but not both).
  2. If the size is not reported but it is a file:// URI, attempt to
     measure it directly.
  3. If the size cannot be obtained, do not upload the attachment

Bug: 2948965
Change-Id: Ic5160d39efd65eaca40ceba0dd93c3b035d2871e
2010-08-25 16:46:00 -07:00
Jean-Baptiste Queru
456208a6d9 merge -s ours from froyo-release so that upgrading to gingerbread is a git fast-forward
Change-Id: I9fcbbe3ac77b81576578ce4be87a51a8f198627f
2010-08-23 19:09:06 -07:00
Andrew Stadler
97b8f590e1 Clear password related policies in PolicySet when p/w not required
Merge from master of c263810b08

Bug: 2883736
Change-Id: Iec4ed0e320d67aee8a89092ac650c0960540057b
2010-08-17 23:55:30 -07:00
Marc Blank
e87a3ae24c Release held mailboxes after policy refresh
* When a sync fails due to a provisioning error (on initial sync
  or after policies are refreshed on the server), sync mailboxes go
  into a "hold" state until the security error is resolved.  Meanwhile,
  the account mailbox handles provisioning.  If this is NOT successful,
  we put a hold on the account and go through the UI steps of setting
  up security on the device.  When this is done, we release the hold on
  the account, which releases the hold on the mailboxes.
* If provisioning IS successful, however, a refresh of the existing
  settings would be an example, we do NOT release the adapters, and
  this is the bug we're seeing.
* This CL simply causes any held mailboxes in a successfully provisioned
  to be released from the hold

Bug: 2865623
Change-Id: I59e780e9bd4ea908182b786dfd0e5851f5bf5f3b
2010-08-17 23:55:16 -07:00
Marc Blank
81fbc1e1b9 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-17 23:54:59 -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
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
Eric Fischer
f2f268a59e Import revised translations. DO NOT MERGE
Change-Id: I8d00ab574f8644ea3b2056e4d8310f453a8b8337
2010-08-04 10:42:51 -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
Marc Blank
4f12c25ed9 am 05b0bb56: Release held mailboxes after policy refresh
Merge commit '05b0bb56254d9ed924dff4c09ad227eec611a695' into gingerbread

* commit '05b0bb56254d9ed924dff4c09ad227eec611a695':
  Release held mailboxes after policy refresh
2010-07-28 18:31:22 -07:00
Marc Blank
05b0bb5625 Release held mailboxes after policy refresh
* When a sync fails due to a provisioning error (on initial sync
  or after policies are refreshed on the server), sync mailboxes go
  into a "hold" state until the security error is resolved.  Meanwhile,
  the account mailbox handles provisioning.  If this is NOT successful,
  we put a hold on the account and go through the UI steps of setting
  up security on the device.  When this is done, we release the hold on
  the account, which releases the hold on the mailboxes.
* If provisioning IS successful, however, a refresh of the existing
  settings would be an example, we do NOT release the adapters, and
  this is the bug we're seeing.
* This CL simply causes any held mailboxes in a successfully provisioned
  to be released from the hold

Bug: 2865623
Change-Id: I59e780e9bd4ea908182b786dfd0e5851f5bf5f3b
2010-07-23 15:10:24 -07:00
Marc Blank
6c4a49bc3f 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-22 22:39:18 -07:00
Marc Blank
34b5bea163 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-22 22:38:45 -07:00
The Android Open Source Project
c257cfe6d3 add meta-files about 3rd party projects
Change-Id: Ie43ae55f890a79547ce2e3faed74150b50fc43fa
2010-07-16 11:41:38 -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
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
Andy Stadler
3b811ae4c6 resolved conflicts for merge of fb060de6 to gingerbread
Change-Id: I6ef4bda535650829f994b595d9cb5b57a8775aa5
2010-06-30 16:27:26 -07:00
Andrew Stadler
eb2f7bbcb4 Explicitly verify certificate hostname on SSL connections
When connecting to an IMAP, POP3, or SMTP server using SSL, perform
an explicit test of the certificate's host name against the server's
host name.  Refuse connection if they do not match.

Bug: 2807409
Change-Id: Ib223170f1a5d57323a88037ad30fec15c6bbce20
2010-06-30 13:28:19 -07:00
Marc Blank
17cc6a7b81 Fix regression in Exchange calendar attendee response
* During the fix of a previous late-Froyo issue, a change was made that
  appeared superficially correct, but was semantically incorrect.  This
  changed the sense of the test for whether a reply email was required
  and caused the referenced bug.
* The trivial fix is to replace the test with the (older) proper one

Bug: 2764551

Change-Id: I7c72366252cf0607aee31ee0d76aca96a7d5fc2b
2010-06-30 13:27:14 -07:00
Andrew Stadler
fb060de65d Explicitly verify certificate hostname on SSL connections
When connecting to an IMAP, POP3, or SMTP server using SSL, perform
an explicit test of the certificate's host name against the server's
host name.  Refuse connection if they do not match.

Bug: 2807409
Change-Id: Ib223170f1a5d57323a88037ad30fec15c6bbce20
2010-06-30 12:39:12 -07:00