Commit Graph

56 Commits

Author SHA1 Message Date
Marc Blank e714bb9d15 Convert authorities, intents, and account manager types
* Tested ok on wiped Nexus
* Tested ok on S3
* Upgrade verified on Nexus

Change-Id: If5d4ce594f8a309cdb59589d10b1d33f3b79326c
2012-08-31 23:26:36 -07:00
Marc Blank f6db592c31 POP3 renovation
* Much, much faster
* Remove message length pass and lots of other useless code
* Create pseudo-attachment for long messages (click to download) that
  includes size (so user can determine whether it's worth it)
* Handle download of message via pseudo-attachment; real attachments
  are then created as necessary.

TODO: Add real UI with UX input (or modify existing to clean up the
loose ends)
TODO: Optimizations for loading the whole message
TODO: Get server delete working (isn't working currently anyway)

Change-Id: I31f3809fc5a2f9fd490d33cfed70d2930654e71d
2012-08-02 15:26:30 -07:00
Marc Blank a8b683cf3f More work on Imap2
* Handle sending mail and moving to sent folder
* Implement picker for sent folder
* Upload sent items to server
* Add support for "automatic" sync window
* Move some files from Email -> emailcommon
* The added files are copied directly from Email (and can be
  removed if/when Imap2 is merged back with Email)

Change-Id: I3a6a3d224826e547748be2f1b567b6294ad5db89
2012-07-19 14:27:17 -07:00
Marc Blank f419287f22 DO NOT MERGE: Move emailcommon2 sources to emailcommon
Change-Id: I06df7e467cd2e0117df8b8db3ddc6ff9da13f1c7
2012-06-28 11:15:06 -07:00
Marc Blank 3285fb3cfd Prevent NPE with badly-timed account deletion
Bug: 5473621
Change-Id: I0956540de0de172bc3519a301598e197b449b9a8
2011-10-18 13:27:30 -07:00
Marc Blank 569785b4f9 Oops; fix NPE
Bug: 4977755

Change-Id: I117eb3a061628ee572f37123631c3da301b5e50b
2011-06-29 17:50:23 -07:00
Marc Blank 0b8e04c84d More Store cleanup
Change-Id: I8f542175b4468c7a320322a57bfdaf19a7320165
2011-06-29 15:22:05 -07:00
Marc Blank 6fea021e3d Remove redundant and unused constants
Change-Id: Ie8658f86737880e3127a0a2c3b7f0557dde98b29
2011-06-29 14:30:46 -07:00
Marc Blank 244d306ebb Remove more useless code
* Strike another blow for sanity!

Change-Id: Id95b441f9577abda66f04113793d6b1c60500ebe
2011-06-29 14:07:25 -07:00
Marc Blank 35b0e95ca7 Clean up Store implementation
* Remove unused argument from newInstance/constructor
* Create ServiceStore class, the superclass of ExchangeStore (and,
  eventually, all Stores, until they can go away completely)

Change-Id: Ic5237236c5349ecf006538c58b63c1efe8e4ea61
2011-06-29 12:50:43 -07:00
Marc Blank 66a47b8dac Clean up/simplify ExchangeUtils/ExchangeStore
* Rename ExchangeUtils to EmailServiceUtils
* Create calls for Exchange to use (eventually remove these)
* Get rid of lots of nonsense in ExchangeStore

Change-Id: Ic538cfe1de57eca24088ee1f590264283d12f511
2011-06-27 12:14:04 -07:00
Marc Blank f65bdbdaf5 Fix Store caching
Bug: 4671090
Change-Id: I07413eb713c564f6dbcac45091357153cfe19a5d
2011-06-16 09:24:44 -07:00
Marc Blank f5418f1f93 Move Account into its own top-level class
Change-Id: Ide7c991b7d4d418dbe17164421425bf898ba64ee
2011-06-13 15:37:22 -07:00
Marc Blank 85e4c101b0 Remove storeUri's except during auto-setup
* Remove per-store limitations
* Use constants for VISIBLE_WINDOW, rather than having the
  potential for differences between Stores

Change-Id: Idd5e0874bba6e3390e4f093bcb03f4b1bb399c11
2011-06-09 13:34:43 -07:00
Ben Komalo 12b82d9374 Move HostAuth to top level class.
No other changes made.

Change-Id: I1c6497c98abc0f99443ea42d8aed6295b263c123
2011-05-19 15:28:48 -07:00
Todd Kennedy 581e3c2333 Fix Store re-using old data
The key for the Store cache was not adjusting properly for account
changes (such as port changes, etc...). As such, it was possible to
get an invalid store.

Now, there's problem with leaking Account objects if the store account
changes (see bug 4440839). This is "okay" for now since account changes
are fairly uncommon and Account objects are light. However, this should
be fixed at some point.

Change-Id: I4ddcbc3e2759b7b1374d0300706373678dedec94
2011-05-17 08:48:33 -07:00
Todd Kennedy 171c3f2273 Some more re-arrangement of code
No real code changes; just moving where code / constants live. Removed
one unused method of Store.

Change-Id: Ie7532381759a568cb23601e1071c8e199b6beb07
2011-05-16 14:47:49 -07:00
Ben Komalo 53ea83ebf9 Move Mailbox to top level class.
No other changes made.

Change-Id: I3d8f3c521dc0d902be313b25252b4b6a4a96e7ee
2011-05-13 17:42:02 -07:00
Todd Kennedy c4cdb11d24 Remove notification if messages seen off device
If we receive new messages, we may display a notification to the user. If
those same messages are read elsewhere (i.e. via a web client), we will
remove the notification.

Change-Id: Iba09afe01942e0deaac8210fd6f9b315b1c8c93f
2011-05-05 12:00:27 -07:00
Todd Kennedy e87ff6c3cb Opportunistic cleanup
not making any real code changes:
* removed deprecated, unused methods
* remove 'throws' clauses when that exception is never thrown
* renamed method Controller#moveMessage()-->moveMessages()

Change-Id: Ifd006f760f0c19283e94a11a45c71295c8da35f7
2011-04-27 12:01:04 -07:00
Todd Kennedy 019341af98 Set mailbox flags for message contents
For IMAP, it's possible for a mailbox to exist on the server, but, to be
unselectable. Previously, these folders were never added to the folder list.
However, with nested folder support, we need to have these folders in the
UX so the user can get to its sub-folders (which may be selectable).

Change-Id: I11135fafbb14b40660983804fb86bd223e180d5e
2011-04-27 09:10:30 -07:00
Todd Kennedy 22208771b7 Add hierarchical folders to IMAP
We now create folder hierarcies for IMAP. This also includes a nifty SQL
statement that will get your existing database into shape.

Change-Id: If07a0632e9b250cf0c33c3e16bfba5816beab94c
2011-04-25 15:11:38 -07:00
Todd Kennedy 7155c49f35 Use Account objects instead of URI for exchange
No need to use URIs when we have the Account object.

bug: 4322402
Change-Id: I06e8a5b43063446fa41f7e81eb3638b2570abe5c
2011-04-21 13:10:32 -07:00
Todd Kennedy 200c6bd9fa Simplify mailbox synchronization logic
The logic is simplified by creating database rows for new mailboxes down
in Imapstore. This means that the difference between local and remote folder
lists are mailboxes that need to be deleted.

Note -- this is still not the final CL. We probably update the database too
frequently and the column values aren't updated to support nested folders.

Change-Id: Ifbe4e0cf74ba81e5b6156b452ab72c56c35235ab
2011-04-21 11:54:30 -07:00
Todd Kennedy a50fc99b0c Use Account instead of URI to create transports
There's no need to create a URI just to rip in appart again. Additionally, to
support additional changes (i.e. to use Mailbox instead of Folder in the
MessageController), we need to store the actual Account.

NOTE -- This change only affects IMAP and POP3. SMTP will come in a follow-on CL

Change-Id: I400036a17271c99272fd9c603547dcd713b50b9d
2011-04-20 08:31:24 -07:00
Marc Blank 31d9acbf06 Email split, part huit: Refactor constants, clean emailcommon
* There are three pieces to this CL (sorry):
  1) Move and/or rename some constants into emailcommon
  2) Move Utility to emailcommon, moving the few UI
     related utilities back into Email (FolderProperties
     and UiUtilities)
  3) Remove all references to resources from emailcommon
* The three pieces relate in that, between them, they allow
  the emailcommon static library to compile cleanly

Bug: 3442973

Change-Id: Ic5e3abaa2a1b36999e0b6653c6c2134ea1bd544f
2011-02-14 12:18:10 -08:00
Todd Kennedy 32311cce01 Implement IMAP prefix support
We support two different ways for an IMAP prefix to be specified:
  1. A text field on the IMAP configuration page. This is the most obvious to
     the end user. It is also an explicit, manual configuration.
  2. RFC2342 defines a NAMESPACE IMAP command to be able to query the prefix
     from the IMAP server. This is an automatic configuration without any
     user involvement (i.e. the UI will NOT change if a prefix is loaded in
     this way)

If the user goes to the trouble of specifying a prefix, we will always honour
it instead of the namespace returned by the IMAP server -- even if the user's
configuration is wrong.

bug 1592696

Change-Id: I6b94c7aaac538f6cd9dc4694b0f1634e8c956bc1
2011-02-11 14:17:48 -08:00
Marc Blank 2193962ca2 Email split, part quatre: Move along, nothing to see here
* No code was harmed, er, changed in the making of this CL
* All that's happened is that code that is needed by both Email and
  Exchange have been moved into emailcommon
* This required import changes to many files, which explains the
  length of the CL

Change-Id: I4e12455ba057a4a8054fdbd0b578c73afa411c8a
2011-02-10 16:28:37 -08:00
Marc Blank d6d874f8c6 Streamline security setup flow
* The setup flow is changed such that the user is asked to activate
  device administration before leaving the setup flow, rather than
  having to wait for the notification to appear, etc.
* Accounts requiring security are created in a security hold state
  to prevent initial sync until device administration is active

Change-Id: I7e33cf98466370ae27414b99018f7aee71e9e237
2010-06-25 09:32:11 -07:00
Makoto Onuki 968be441b4 Don't store arbitrary Context in singletons, which causes memory leak.
We have singletons that store a Context passed to getInstance().
The problem is that when we call them, we casually pass any Context at hand.
If it's an activity (which is often the case), it'll never be GCed.

This CL make them store the application context insteaed.

Change-Id: I1abcc2c08d3f8201416d6c14720f041693823b4e
2010-05-20 16:21:06 -07:00
Makoto Onuki b3f7dd0169 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.

Change-Id: I3fde73ba5f1f9ff675fff07c510e1e49521dde42
2010-05-11 17:06:37 -07:00
Makoto Onuki e46ac1a61f Cleanup imports.
(Note it's for froyo-plus-asop)

Change-Id: Ia5b771cd41099ab486ba2e556b441fc7c0affe5f
2010-05-07 14:33:44 -07:00
Marc Blank 17da1767e3 Implement Autodiscover for Exchange servers
* Autodiscover allows complete configuration using only email address
  and password
* Code handles the two standard autodiscover addresses and redirect
* Autodiscover process starts when the user chooses "Exchange" as the
  account type.  If the account is created via the AccountManager,
  autodiscover begins upon tapping "Next" for the first time
* If autodiscover fails due to anything other than auth failure for
  autodiscover-capable servers, the user is placed into the standard manual
  configuration screen

Bug: 2366019
Change-Id: I936712b924833d9a133e8da04e11c3ba45d92f92
2010-01-13 17:11:49 -08:00
Andrew Stadler e4a7cc440f Re-enable modernized version of "optional" SSL/TLS
* Add "Accept all certificates" modes to incoming/outgoing secure choices
* Change URI scheme slightly to make "trust" a flag, not part of the
    protocol.
* Change Stores to know about new URI scheme
* Slightly rework Transport API to make "trust" an independent flag
* Adapt HostAuth to handle new Uri scheme
* Remove the old ambiguous "optional" code, which was allowing
    some unsigned certificates, but was *also* allowing TLS to
    optionally start (though not SSL, despite the UI strings.)
* Add a few unit tests to EmailContent
* Add logging and a bunch of comments to TrustManagerFactory, and a bit
    of simple cleanup to make it more readable.
* Add missing conversion of SSLException->CertificateValidationException
    in TLS so we get the correct certificate errors from TLS too.
* Re-enable TLS for mac.com accounts (which had a certificate problem)

Fixes bug http://b/2119755, http://b/1374780, and probably a raft of
earlier and/or external bugs about certificate problems.

Change-Id: Iaf99a8da3eaadaa4cdeec224737838b5d6813e55
2009-09-29 15:28:43 -07:00
Andrew Stadler 46d7d7f1b6 Rework service to use provider accounts and controller.
* Rewrite service logic to select and update one account at a time
* Add checkmail API to Controller, and much rework/cleanup of existing
   callback API's
* Rewrite notification posting code
* Rewire connection to MessageList to be opened by notifications, to
   cancel notifications, and to reset the "new message" count whenever
   an account is viewed.
* Boilerplate cleanup to a lot of activities because they share the
   callbacks that have had minor changes.
* Remove old push controls from Store API

In progress:
* To provide notification mechanism for EAS pushed mail
2009-08-18 00:54:34 -07:00
Mihai Preda a492673609 Review Email tests annotations (small/medium/large) and change some annotations based on time.
Fix an NPE appearing when running the test suite.

BUG: 1566281, 1910409.
2009-06-18 12:16:28 -07:00
Andy Stadler 3b7a93e8bb AI 148375: Explicitly remove deleted accounts from the Store cache. This resolves
possible bugs when an account is deleted and recreated.
  BUG=1740626

Automated import of CL 148375
2009-05-06 17:42:22 -07:00
Andy Stadler c9f151d4fe AI 148230: Allow stores to indicate if they support server-side copying of sent
mail into the "Sent" folder, thus eliminating the need to perform a 2nd
  upload into the server's Sent folder.  IMAP and POP3 do not support
  this (although IMAP could when it recognizes Gmail IMAP servers.)
  BUG=1807499

Automated import of CL 148230
2009-05-01 16:36:34 -07:00
Andy Stadler 035dfc0859 AI 148215: Provide a better way for stores to get their callbacks, since they
might be null at creation time, and available slightly later.
  BUG=1807499

Automated import of CL 148215
2009-05-01 15:25:32 -07:00
Andy Stadler 9ba72bb00d AI 148204: Encapsulate a requirement for some remote stores, that need to preload
message structures before fetching the message body.  Code for IMAP &
  POP3 is unaffected, but remote stores can override
  requireStructurePrefetch() in order to trigger the new behavior.
  BUG=1807499

Automated import of CL 148204
2009-05-01 14:40:58 -07:00
Andy Stadler c5c2b96739 AI 148145: Remove the account-based storage of store persistent data, and instead
combine it with the same code that handles folder persistent data (in
  the database).  The schema is really simple;  Rows with a folder id of
  -1 are store data.  This also adds the ability to use keys to store
  multiple values, instead of a single string per account.  Added/updated
  unit tests.
  3rd party stores will need slight code changes because the persistent
  callbacks now accept keys.
  BUG=1807499

Automated import of CL 148145
2009-04-30 16:47:50 -07:00
Andy Stadler c05afb24bb AI 148019: Add "accountInstanceLimit" to stores.xml so a given type of connection
(e.g. EAS) can limit itself to n (usually 1) accounts per device.
  The UI for this is really simple - don't show the EAS button when the
  limit is reached.  More work would be required in
  AccountSetupAccountType.java in order to do a more sophisticated UI
  (e.g. show the button but pop a toast if the limit is reached.)
  BUG=1740626

Automated import of CL 148019
2009-04-29 17:10:25 -07:00
Andy Stadler 100867a231 AI 147730: 1. Create an API by which a Store can specify its own custom
synchronizer code.
  2. Refactor (and spell-fix) the core folder synchronizer.  Extract
  the innards that are IMAP/POP specific, leaving common wrapper
  code in a simpler shell.
  3. For each account & folder to sync, check the store and call
  the specialized sync'er (if provided) or the generic one.
  BUG=1807499

Automated import of CL 147730
2009-04-24 13:25:34 -07:00
Andy Stadler 72288724d4 AI 147538: Because mPreferences is transient, we need to pass Context into the
persistent callbacks, in order to recreate it occasionally.
  BUG=1786939

Automated import of CL 147538
2009-04-23 16:42:23 -07:00
Andy Stadler 3f66d3de11 AI 147486: Change the remote/local mapping callback to be folder-by-folder instead
of for the entire store.
  BUG=1807499

Automated import of CL 147486
2009-04-23 10:49:42 -07:00
Andy Stadler 912dc3b194 AI 147423: Provide a hook to notify remote stores that local stores are set up.
BUG=1807499

Automated import of CL 147423
2009-04-22 18:45:22 -07:00
Andy Stadler 4836f3c289 AI 146331: Make the download window sizing adjustable on a per-store basis.
The default values are 25 (default) and 25 (increment).  This is fine
  for Stores that control downloads by # of messages, but won't work for
  stores that use other measurements - e.g. EAS windows the download in #
  of days.  So for this change:
  1.  Allow the StoreInfo to provide non-default values
  2.  Remove the hardcoded references to the default values
  3.  Use StoreInfo values everywhere
  4.  Set the values to 1,1 in EAS store info
  BUG=1789913

Automated import of CL 146331
2009-04-15 10:58:59 -07:00
Andy Stadler cd7e5664f9 AI 146061: Add persistent storage that Store classes can access.
The current design for Store classes (e.g. IMAP) did not provide for
  any persistent storage.  This is the beginning of a mechanism to
  provide that.  It's quite simplisitic - each Store can read/write one
  persistent string - but that's enough for the first simple use case
  (saving some sync data for EAS).
  The core changes here - suggest reviewing first - are in Account.java,
  Store.java, and AccountUnitTests.java.  Everything else is just
  following the API change that was necessary.
  Note that, by definition, this only applies to remote stores (e.g.
  IMAP, POP3).  You'll see everywhere that LocalStore is passed null, and
  this is correct - LocalStore *is* persistent storage and does not need
  access (so far, at least).
  BUG=1786939

Automated import of CL 146061
2009-04-13 20:07:56 -07:00
Andy Stadler 8664ecf181 AI 145227: Add callback for push-mode stores to report async updates.
The logic for this is quite simplistic, for now:  When the store
  reports that it has new messages, it triggers a service refresh,
  just as if a pull-mode interval had expired and it is time to
  check the server.
  Note, unfortunately at this time there are no tests, because there
  are not currently any good test seams in MailService.java.
  BUG=1776149

Automated import of CL 145227
2009-04-08 18:42:42 -07:00
Andy Stadler ea6fea9bb2 AI 144953: Provide UI for push mode accounts.
1.  Generalize the code for the various spinners that control
  account check frequency.
  2.  Provide an API for looking up store attributes (and refactor
  existing instatiateStore logic to use it).
  3.  Cleanup the old code that was used to setup frequency spinners.
  4.  Hardwire Exchange accounts to default into push mode.
  Notes to tester:
  1.  For each account type (POP, IMAP, EAS) we need to check that
  auto & manual creation "do the right thing" for frequencies.
  POP & IMAP should offer "none" or time intervals, while EAS
  should offer "push", "none", or time intervals.
  2.  EAS accounts should default to "push", all others to "15 min"
  3.  Make sure that you can edit existing account settings and see
  the right choices (only EAS should be offered push).
  4.  I couldn't write an automated test for the mail checker service,
  please confirm that POP & IMAP accounts are checked at the right
  intervals (or never, if set for "none".)
  BUG=1776149

Automated import of CL 144953
2009-04-07 17:35:13 -07:00