- 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
* 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