Commit Graph

412 Commits

Author SHA1 Message Date
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