Commit Graph

52 Commits

Author SHA1 Message Date
Marc Blank c6089bc01f Initial Imap2 implementation
This CL includes the following:
* New Imap2.apk generation (not included in builds)
* "Push IMAP" option for accounts when Imap2.apk present
* Account creation/setup
* 2-way sync of messages, deletions, flag updates
* Push (messages, flags)
* Folder list hierarchy handling
* Message text (one plain or html part)
* Picker UI for trash folder (placeholder)
* Capabilities handling/UI command

Major Imap2 new features:
* Push
* Multiple folder sync
* Sync window (like EAS)

TODO:
* Picker UI for sent folder
* Upload of sent messages to server
* Search
* Multiple viewable parts
* Probably lots more, incl. unit tests

Change-Id: Ia5d74073d9c307e0bdae72a7f76b27140dde7d14
2012-07-18 11:32:26 -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 919e59044b Handle UI part of enforcing email lookback limit
Bug: 5792217
Change-Id: I4351ae4d8505965a32690ecb5e6338765fb3770f
2011-12-21 17:44:59 -08:00
Marc Blank a9f1631fb8 Remove STOPSHIPs in Email/Emailcommon
Bug: 5142183
Change-Id: I1f6e31bfd2e7c32bdd7886e54b02fd4640a96e6f
2011-08-10 16:43:20 -07:00
Marc Blank 8df9af0df3 Clear account incomplete flag properly; handle unusual flow
* We waited to clear the incomplete flag until security was agreed
  to, but this can lead to accounts left incomplete; we now clear
  the flag as soon as the AccountManager account is created (by
  convention, this is when the EmailProvider account is complete)
* Also, allow onDone() to be called more than once with a saved
  account, leaving cleanly, rather than throwing a runtime
  exception

Bug: 5016792
Change-Id: Ib5fc44ac045a1dd9bd5d63f922c037ed637d5341
2011-07-15 16:23:11 -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 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
Marc Blank 335a724ee6 Implement "automatic" sync lookback (Email side)
* Update sync window options to include "Automatic" and "All"
* Make the default (for new accounts) "Automatic"

Change-Id: Icbc696f55abcfad79e66079ebb414ca50778dcaa
2011-05-05 08:16:44 -07:00
Marc Blank aeee10e57e Rework of security policy storage
* Replace crazy (and soon to be "full") bit fields stored in an account's
  securityFlags with a row in a newly created Policy table (thus, fully
  expandable)
* Update code from database version 17 to 18; adds Policy table, a
  policyKey row in Account, and a revised trigger that deletes Policy
  information for deleted Accounts
* Update old PolicySet unit tests to work against the new Policy class
* Add test for the conversion of securityFlags to Policy
* Tested in a variety of scenarios; appears to be functionally equivalent

Change-Id: I1505ee75230d6a0d3c2b62a46326f39c2c7f9eb5
2011-05-03 11:11:47 -07:00
Makoto Onuki 2fbb3db5d8 Don't use findViewById (part 1 -- account setup)
Added two new functions:
- UiUtilities.getView()
  is a fail-fast version of findViewById().  Crashes when there's no view
- setVisibilitySafe()
  same as View.setVisibility, but doesn't crash even if a view doesn't exist

Let's try to avoid the use of findViewById(), and instead use getView(), *right
after* the layout is inflated, so that we'll always fail-fast if a layout
doesn't have a required view.  (Rather than getting a NPE only when the view
is really accessed, which can be in a code path which is rarely executed--e.g.
only when there's a protocol error.)

Let's only use findViewById() only when we're sure no all the variants of a
layout have the view in question and leave a comment to make it clear it's on
purpose.

(UiUtilities has been moved from com.android.email to
com.android.email.activity)

Change-Id: I36e0bab65a989f5d34cf636f13e1eaee084547af
2011-03-30 13:47:13 -07:00
Andy Stadler f489413142 Add contextual dialogs after notifications
* When security settings notification is clicked, inform user that
  they need to change settings (before dumping them in security
  settings.)
* On an authentication failure, present a dialog to the user explaining
  that the username or password may be incorrect.
* When the device pin/password is expiring or expired, present a dialog
  to the user explaining that it needs to be updated.

Bug: 3238657
Change-Id: I8fca446fa3c1bf87a95938553dbdc362c3df220e
2011-02-18 18:23:18 -08: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
Marc Blank a7bc0319a7 Email split, part six: EmailContent
* Moved EmailContent to emailcommon

Change-Id: Ib3db1bfcfe74554c0e5afd3cfce6d72f26e9aeb9
2011-02-10 19:44:29 -08:00
Marc Blank 8a57469460 Email split, part trois: AccountService
* Create AccountService.aidl and AccountServiceProxy in emailcommon
* Implement AccountService in email
* Use AccountServiceProxy in Exchange for account reconciliation,
  notifications, etc.
* Move sync window constants into emailcommon
* Split attachment provider utilities and constants into emailcommon

Bug: 3442973
Change-Id: I89dce28b799b193243c07774dab65d830ae62775
2011-02-10 14:32:01 -08:00
Marc Blank 9ba506c4dd Email split, part deux: PolicyService
* Split PolicySet from SecurityPolicy and move to emailcommon
* Define PolicyService that sync adapter services can use to
  interact with the Email DPM administrator
* Implement PolicyServiceProxy for exchange
* Implement PolicyService in email
* Modify imports, references, etc. as required

Bug: 3442973

Change-Id: I92015e21f780a68754b318da89fbb33570f334a2
2011-02-10 13:53:37 -08:00
Andy Stadler f020910461 Fix Account Manager integration
* Rework the interaction with the Account Manager
* Remove unneeded call to response.onRequestContinued()
* Store response in SetupData so it can survive the entire account
  setup flow.
* Explicitly report exit status to acct mgr at known exit points:
  * AccountSetupBasics.finish() (fail/cancel)
  * AccountSetupOptions.finish() (fail/cancel)
  * AccountSetupOptions.optionsComplete() (success)

Bug: 3335128
Change-Id: Ia55724eb1e938f2633c5ff7afb719a879be16a1b
2011-01-26 11:16:56 -08:00
Makoto Onuki f72f812f5b Merge "Use proper alert icons on dialogs" into honeycomb 2011-01-18 11:08:56 -08:00
Andy Stadler 946239e8a0 Add per-account preference for bkgnd attachments
* Add flag to Account record
* Add checkbox to Account Settings (IMAP & EAS)
* Add checkbox to Account Setup (IMAP & EAS)
* Add flag to backup/restore logic
* Update Account & AccountSetupOptions unit tests

Bug: 3360873
Change-Id: I0c407776ede4110f33716644f6f027938f21130a
2011-01-18 10:53:37 -08:00
Makoto Onuki 49518bb360 Use proper alert icons on dialogs
Bug 3364447
Bug 3241281

Change-Id: Ie791d8d5eae26a848de08658a14d6a09d06d0846
2011-01-18 10:17:23 -08:00
Andy Stadler ec9398e7c6 Fix ANR's in AccountSetupOptions
* Move all db ops off UI thread
* Reorder methods in typical progression (they were random)

Bug: 3134660
Bug: 3134677
Change-Id: Idd4f411e937336bbd09bcc03d9ad036d22dc5e19
2010-12-23 16:38:52 -08:00
Andy Stadler 2959a7e073 Fix ANRs from Email.setServicesEnabled()
* Create sync & async versions
* Rename all callsites so sync is very apparent
* Fix callsites appropriately
* Clean up interaction between reconciler and setServicesEnabled

Bug: 3133770
Bug: 3134677
Change-Id: Iefbc7814d9aa390baea6345e450e2a4768bf0a9a
2010-12-23 13:19:55 -08:00
Andy Stadler d685b469c7 Add magic intent to force account creation
* Add entry point via com.android.email.CREATE_ACCOUNT
* Enable when in monkey mode only
* Walks through setup screens as if auto-populated and as if
  connection checking always succeeds.
* Refactored some common code in AccountSetupBasicsFragment
* Removed obsolete commentary about auto-population of EAS accts
* Also fix minor typo in FLOW_MODE_ACCOUNT_MANAGER_POP_IMAP

Bug: 2735784
Change-Id: Ie7363836cd267673e963e60ae8bc32cab422576e
2010-12-04 22:53:59 -08:00
Andy Stadler 7fd78d8d61 Create XL layouts for AccountSetupOptions
* Landscape and portrait layouts
* Quick fixes to phone UX (not shippable)
* Added some CHAR_LIMIT values

Bug: 3188940
Change-Id: I093d5a6dcde2da96c173b5878900114802aead3e
2010-11-15 18:37:56 -08:00
Andrew Stadler cd09545b87 Provide runtime switch for GL acceleration
* new checkbox in debug fragment
* saved value in prefs so it's sticky
* each Activity calls a helper to enable/disable per that flag

Change-Id: I1af1ae9f401bc746cc97da00dfb0e06407b79d46
2010-11-01 16:16:27 -07:00
Andrew Stadler 8bcb572ccf Convert setup to actionbars, and holo theme
* All setup activities given UI makeover:
  * Remove legacy themes from manifest - exposes default holo theme
  * Remove bottom row button(s)
  * Replace with action bar button(s)
* No change to workflow or activity/fragment organization

Change-Id: I07ce11a0a2b4b767b5ac111d466e68400fe0f30b
2010-09-08 23:27:05 -07:00
Marc Blank 64b64cca01 Rename SyncManager to ExchangeService
* Updated comments and checked for 100-columns

Change-Id: I4ab5aaa9425714f8e035e1952db3fec63d498ae1
2010-08-27 12:15:56 -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
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
Marc Blank b7fe21676e Prevent multiple calls to onDone() in AccountSetupOptions
* When "Done" is pressed in AccountSetupOptions and the Account is
  EAS, the finish() isn't called until an async method's callback
  is invoked (system account creation)
* This allowed the user to execute onDone() multiple times, each
  one of which would attempt to create an account
* The net effect was the referenced bug, which can manifest in a
  number of ugly ways
* The fix is to prevent multiple calls to onDone()

Bug: 2501574
Change-Id: I61057bbb8c1f85da07e83ed6c56474bfe4e23f6c
2010-03-12 23:17:28 -08:00
Makoto Onuki 6854a4f24a Patch for issue 2363606: Make EAS sync window default 3 days. 2010-02-23 12:25:25 -08:00
Makoto Onuki 9fe51f6329 Gather common exchange related methods into one place
So that it'll be easier to remove exchange dependency.
2010-02-02 13:36:45 -08:00
Marc Blank f3fcb8929e Implement Exchange calendar sync support
What should be working:
* Events sync down from server and appear in calendar
* Recurrences and exceptions appear in calendar
* Changed events on server should be reflected in calendar
* Deletions on server should be reflected in calendar
* Push of new/changed/deleted events should work
* Changes on device are NOT synced back to server
* New, single events on device are synced back to server
  (no time zone, attendee, or recurrence support)
* Checkbox for syncing calendar added to setup flow
* System sync glue in manifest, etc.
* Bugs are to be expected
* A few unit tests; needs more

Change-Id: I7ca262eaba562ccb9d1af5b0cd948c6bac30e5dd
2010-01-28 09:18:48 -08:00
Marc Blank 0b8b68cbeb Fix account creation race condition
* Due to the order in which account creation occurs in the Provider
  and in AccountManager, and the fact that there are data observers
  on each that initiate account reconciliation, a race condition exists
  that can cause either of these accounts to appear to be orphaned,
  and thereby get deleted
* We add an "incomplete" flag to the Account in EmailProvider and
  set/clear it during account creation.  The various reconciliation
  methods will ignore accounts marked as incomplete.

Bug: 2353755
Change-Id: I13fb144dd857f839eb3471b01f271f3a0d4d8159
2010-01-19 13:07:49 -08:00
Marc Blank 4cf3252fb0 Workaround system peculiarity to fix #2134509
* Our AccountManager listener was getting unregistered due to the way
  ApplicationContext caches AccountManager in a static member
* The result was that AccountManager registers its listeners against the
  FIRST context it is instantiated with!  Future calls will all obtain
  this pre-initialized AccountManager.
* In this case, AccountSetupOptions was the first caller (to create the
  AccountManager Account for Exchange)
* The subsequent call to register a listener therefore had its registration
  tied to the context of AccountSetupOptions, and was therefore leaked
  when AccountSetupOptions finished!
* This caused a chain of problems - the leaked receiver, an Exception in
  AccountManager when trying to ping the listener in an expired context,
  and eventually the bug referenced above, which became a P1 issue

Change-Id: I478e28d21ca77419afa8011e4ed8101cdf67ab79
2009-09-22 10:40:46 -07:00
Marc Blank a4482e865d Fix service behavior w/r/t onStartCommand, onCreate, onDestroy
* Make sure to null out vars in onDestroy
* Use START_STICKY as return value for onStartCommand
* Start SyncManager from EasAuthenticator callback, rather from the
  authenticator itself (otherwise, the Account might not have been
  created when we start SyncManager)

Change-Id: I54ff8d5586e96f016b365587717710dee3202da8
2009-09-19 13:38:59 -07:00
Marc Blank 805562e26f Fix logic for use of "Sync Contacts" button value
Change-Id: I9abed1830a61795542bdf15ee62395a63abc9222
2009-09-09 18:37:42 -07:00
Marc Blank a3c6c6ed29 Handle errors in account creation by AccountManager
* Don't create our EmailProvider Account until we get a confirmation from
  AccountManager that the system Account is created
* Put up an erorr dialog if AccountManager fails for some reason (this is
  what we saw in bug #2072668)
2009-08-26 13:20:23 -07:00
Andrew Stadler bcff14acf2 Create setup flow for use by Accounts manager.
* Create a new entry point for the exchange setup flow and switch
    EASAuthenticatorService to call it
* Pass "eas flow mode" down through the setup screens
* Slightly modify their behavior as we go (e.g. we skip the
    (account type" screen since we know it's EAS.)
* Add a checkbox to "sync contacts from this account" and pass that
    value into ExchangeStore when we set up the account.
* Change the flow exit to pop back to the account manager instead of
    taking the user to the new inbox.

This CL satisfies cases 1 & 2 of bug # 1974752.
2009-08-20 15:51:36 -07:00
Marc Blank 948c36f47a Reimplement EAS contacts sync to work w/ new system facilities
* Modify to work with ContactsProvider2
* Modify to work with system AccountManager
* Modify to work with system SyncManager (for triggering user-change syncs)
* Sync server->client for adds/deletes implemented (CP2 doesn't handle delete yet)
* Sync server->client changes handled efficiently (only write changes)
* Some fields still not handled
* Rewrote most of the CPO code to handle server->client changes
* Sync client->server works for supported fields
2009-07-30 09:22:40 -07:00
Andrew Stadler 9e2c6bd5f2 Remove saveOrUpdate from EmailContent to prevent stale writes
* Numerous classes modified to deal with this change
  * Fixes bugs 1993292 and 1994671
  * Renamed various setter and getter methods to reflect the underlying
    field names
  * Renamed syncFrequency to syncInterval in Account and Mailbox
  * Convenience method added to AccountSettings to save only user settings
  * Calls to content.update(context, content.toContentValues()), which save
    all fields, should be double-checked for correctness, making sure that
    content has current data and will not conflict with other threads that
    might modify that data
  * Ran all unit tests to confirm proper function

NOTE:  The logic to enforce single default account no longer works,
because that logic is in Account.save() and does not run via
Account.update().  I have patched out a small section of the relevant unit
test and will file a bug to come back for this fix.
2009-07-22 15:13:30 -07:00
Andrew Stadler 54c1f2bf9a Improvements to default account handling
* Remove all references to Account.mIsDefault, which was not the right
    way to find the default account (it is lazy initialized)
* Change Account.getDefaultAccount to getDefaultAccountId, which is more
    efficient and suitable in most uses.
* Wrote unit tests for provider default account handling

This should resolve bug 1983390 as well as a few other issues with default
account management.
2009-07-21 16:44:16 -07:00
Marc Blank a290f503f1 Refactored EmailStore, EmailContent, EmailProvider
EmailStore goes away, replaced by EmailContent
All database activity is moved to EmailProvider
2009-06-15 14:49:11 -07:00
Andrew Stadler 294a4fd0c6 Enable creation of new accounts using provider-based accounts.
What works:
* Editing existing accounts
* Create new accounts
* Checking account settings against server

What breaks (in approx order of planned fixes)
* Some details of account editing
* Viewing mailboxes & messages
* Mail sync using accounts
* Import of existing accounts
2009-06-05 16:09:18 -07:00
Andrew Stadler 9019315b26 Conversion to provider-based Account. What works:
* Editing existing accounts
 * Two placeholder accounts are written

What breaks (in approx order of planned fixes)
 * Some details of account editing
 * New account creation,
 * Viewing mailboxes & messages
 * Mail sync using accounts
 * Import of existing accounts
2009-06-03 16:11:36 -07:00
Andy Stadler 9197f42894 AI 148216: Provide UI for fixed sync window sizes, as required by EAS.
When in fixed sync window size mode, change "load more
  messages" to "refresh".
  BUG=1789913

Automated import of CL 148216
2009-05-01 15:30:33 -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
Andy Stadler 2b0c619f1e AI 144520: General cleanup after the integrations in CL 143018. Some spelling
errors, inconsistencies in passing Application/Activity/Context, and
  some error handling cleanups.  These are all changes that would have
  probably been made before the original submits, but I didn't want
  to fix them in the integration step.
  BUG=1740621

Automated import of CL 144520
2009-04-03 15:40:49 -07:00
The Android Open Source Project 96c5af40d6 auto import from //depot/cupcake/@135843 2009-03-03 19:32:22 -08:00
The Android Open Source Project 8c2158a5eb auto import from //depot/cupcake/@135843 2009-03-03 18:28:50 -08:00