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
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
- 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
- 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
They cover the cases:
- when OK response doesn't have APPENDUID.
- when APPEND fails.
Backport of I13a0fb8aaf2e1cbb5a1f055c9ce56e2891373ea0
Change-Id: Ifb5f8c07a8d956b0f4cc019eac7712ef22b0fa73
- 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
- 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
Adding regression test for the new IMAP parser.
Backport of Iac7f5c022e44ca5f06f735e145af15cc459eb61f
Change-Id: Ic84172b6793a9837c2fc4a894fee141da3d19f1d
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
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
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
Merge commit 'a30631da1cae25be3f75137133297e30cef2db9c' into gingerbread
* commit 'a30631da1cae25be3f75137133297e30cef2db9c':
Clear password related policies in PolicySet when p/w not required
* 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
* 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
* Handle status 5 for Ping command (heartbeat of out range)
* Write unit test for heartbeat reset
Bug: 2834195
Change-Id: Ic7952a4b296cf15c6ba895d6579fe7956b171e5b
Merge commit '4c8adbc4aa81308e57ae129e9587ec50483af6a8' into kraken
* commit '4c8adbc4aa81308e57ae129e9587ec50483af6a8':
Fix bugs related to TZ handling for all-day events
Merge commit '027a6ddfaa7228854cb3c4238434f87fc69078b6' into froyo-plus-aosp
* commit '027a6ddfaa7228854cb3c4238434f87fc69078b6':
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
* 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
Merge commit 'ab4daabd5ec99da549407ce87d46e24be261c4a6' into kraken
* commit 'ab4daabd5ec99da549407ce87d46e24be261c4a6':
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
* 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
Merge commit '44ae6d2fa2e79de533ceb1fdf50c578a4ed84a3f' into kraken
* commit '44ae6d2fa2e79de533ceb1fdf50c578a4ed84a3f':
Update unit tests for invitation creation
Merge commit 'f1fa44bdc064a6c01813c5380839b90bd0290d46' into kraken
* commit 'f1fa44bdc064a6c01813c5380839b90bd0290d46':
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
Merge commit 'd764ce7e4442b0027a891582cbdd728487a49f97' into kraken
* commit 'd764ce7e4442b0027a891582cbdd728487a49f97':
Send correct busy status information in upsyncs to EAS
Merge commit '825999f815979519d8d80334a8c1ce0223a89ef2' into kraken
* commit '825999f815979519d8d80334a8c1ce0223a89ef2':
Set selfAttendeeStatus and busyStatus properly on downsync/upsync