* 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
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
* 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
* 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
- 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
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
- 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
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
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
- 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
* 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
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
* 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
* 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
* 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
* 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
* 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
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
* 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
* 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
* 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
isEasAccount now uses getProtocol(), so it works even if the hostauth
hasn't been restored yet.
Bug 2929896
Change-Id: Iee902c18ef59680d8a7d4622230489ec7946f38c
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
* 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
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
Fixed the bug where callbacks for sendPendingMessagesForAllAccounts
are called on a worker threaed.
Change-Id: I28f1424cf67e15abf37c09b68050d1385f9ac3ee
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
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
Merge commit 'a30631da1cae25be3f75137133297e30cef2db9c' into gingerbread
* commit 'a30631da1cae25be3f75137133297e30cef2db9c':
Clear password related policies in PolicySet when p/w not required
- 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
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
- 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
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
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
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
- 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
* 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
* 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
- 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
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
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
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
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
- 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
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
* 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
* Add this to processSourceMessage in the reply/forward cases
* Add unit tests for reply and forward case
Bug: 2734321
Change-Id: I6be8383fe5f217a4bda8e669cb69f439bc8e96b6
* Handle status 5 for Ping command (heartbeat of out range)
* Write unit test for heartbeat reset
Bug: 2834195
Change-Id: Ic7952a4b296cf15c6ba895d6579fe7956b171e5b
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
- 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
* 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
* 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
* 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
- 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
* 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
* 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
* 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
* 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
* 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
* 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
* Introduce AccountFolderListFragment and its layout
* Extract all list-related UI into it
* Fix leaking cursor in AccountsAdapter and add unit test
Change-Id: Ica566847d97927b736f515d434c6691c82343290
* 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
- 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
* Test for creation of a typical event
* Test for creation of an event with redacted attendees
* More to come
Change-Id: Ica117cd20a9e270ffe49efed75607e92b4d8ac90
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
This fixes the following exception.
java.lang.UnsupportedOperationException
at android.test.mock.MockContext.getApplicationContext(MockContext.java:82)
Bug 2725552
Change-Id: Iaca177defe5f5e836211c58270379da056fa64e0
- 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
- 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
* Extract AccountAdapter from AccountFolderList
* Use callback instead of hardcoded launch of MailboxList
* Unit tests
Change-Id: Icafce1ef73a99fb61985c649620440656f9b51a3
* 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
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
- 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
- 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
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
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
* 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
* Enforce CalendarProvider2's requirements for valid Events
* Add unit tests for the new code
Bug: 2658149
Change-Id: I42ad7acbcee3b6b831f805c59436017a32651f3a
* 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
* Set selfAttendeeStatus on download from busy status
* Set busyStatus on upload from selfAttendeeStatus
Bug: 2587076
Change-Id: I34eaa0d3861bcec0cbfd51761b31965e44f5162b
Merge commit 'b8ef8a2c1d18421a7d537dbc8d1ea88ffca95898' into kraken
* commit 'b8ef8a2c1d18421a7d537dbc8d1ea88ffca95898':
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
Merge commit 'ad383ff1231319c6ded4077b0d1415bf77bec70b' into kraken
* commit 'ad383ff1231319c6ded4077b0d1415bf77bec70b':
Use consistent device-id even the device is wiped.
Merge commit '8dffa087db44e27e5f0e5672b19fdb6975e614a7' into kraken
* commit '8dffa087db44e27e5f0e5672b19fdb6975e614a7':
Change account colors to what aren't used in Calendar.
Merge commit '772758177e3dd4fcb1c9d534afec3007b59c8bf7' into kraken
* commit '772758177e3dd4fcb1c9d534afec3007b59c8bf7':
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
Merge commit 'ef01261a8909ea3fe3e40b06cc537e0032d47898' into kraken
* commit 'ef01261a8909ea3fe3e40b06cc537e0032d47898':
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
* 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
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
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
* 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
* 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
* 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
* 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
* We should be sending CANCEL as the method with cancellations
* Fix this and update unit test
Bug: 2527606
Change-Id: I2b982e4bfd1dbc57660cf578702edf49584d2957
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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
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
* 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
- 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
* Add the (recurring) text when the invite is for a recurring
meeting
* Add a test for message text creation
Bug: 2515474
Change-Id: Ifefbc2ba1ac444175180cb7a58f4ec554d9674a3
* 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
- 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
* 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
* 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
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
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