Commit Graph

73 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 03cd72805d Revert to old Email app
* These are the last sources in the ICS-MR1 tree

Change-Id: Ida4651bddd92a06a518d00f3e1f275ab3a80c8ae
2012-04-25 13:58:23 -07:00
Conley Owens 58ce2d0c3a Make TAG field package-private in several classes
Specifically, several internal classes.

This makes a little more sense since they are accessed outside of the
class that they are defined in.

In addition, this fixes errors created by proguard when building with
OpenJDK.

Change-Id: If2e2f90558e04e777a0c4dbc2ccd1f6c46dd8228
2011-12-20 11:58:29 -08:00
Ben Komalo c5c44eed77 Fix account creation issues.
This is a theoretically dangerous issue that has surfaced only as a
monkey bug so far. The issue is that callers that create an Intent set
some global state, expecting that state to still be valid when the
Intent is handled. However, if the process was killed before the Intent
could be handled, or if that global singleton was not saved properly,
that state was lost and SetupData was never initialized properly.

Bug: 5337276
Change-Id: I6bd08a0dec13f54c7ba8d536ebdc87e6c559c483
2011-10-20 14:08:20 -07:00
Ben Komalo 025d29fd4b Fix some missed account setup flags.
There were two places where account flags were being set on setup: one
was in manual setup when the user selected the account type
(pop/imap/eas), and another was when it was automatically determined
from XML. The two paths were inconsistent and one was setting bits like
SUPPORTS_SEARCH but the other wasn't.

This fixes being able to search in IMAP

Bug: 5011932
Change-Id: I50eada7485aaef4e2a85d25fa7eb9ac7ab03093a
2011-07-10 18:26:15 -07:00
Makoto Onuki bc2eaadde9 Use parallel executor
We should eventually replace all with EmailAsyncTask, but it's the safest thing
we can do now to avoid regression.

Change-Id: I78bfc4fb2be1dcfadeb7f90092ec7adb35c1d393
2011-07-01 11:04:11 -07:00
Marc Blank 6fea021e3d Remove redundant and unused constants
Change-Id: Ie8658f86737880e3127a0a2c3b7f0557dde98b29
2011-06-29 14:30:46 -07:00
Marc Blank f5418f1f93 Move Account into its own top-level class
Change-Id: Ide7c991b7d4d418dbe17164421425bf898ba64ee
2011-06-13 15:37:22 -07:00
Ben Komalo 313586c8eb Introduce client cert alias for HostAuth.
Some email servers require client certificates to be presented to
establish an SSL connection. While this certificate will be maintained
by the system key store, we need to store the "alias" of the certificate
stored in that system store.

Wiring up to use the actual alias will be done in future CL's. It is
currently unused.

Change-Id: I8d1290151342daea9ceb0df8a4088405b44faa81
2011-06-07 18:48:23 -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
Ben Komalo 2866284a6d Rename AccountSettingsXL -> AccountSettings
This activity already supports phone and tablet mode.
Only renames in this change - no other change.

Change-Id: Ieca17137af45e3860812091f69cd4d9b55ddf3ec
2011-05-13 09:58:15 -07:00
Makoto Onuki 44f45f4221 Merge "Don't use findViewById (part 1 -- account setup)" 2011-03-31 11:06:15 -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
Todd Kennedy 08534762bd Allow globals in the providers.xml
We now allow a single global character ['*'] to be specified somewhere in
the domain attribute. Additionally, we will replace the string "$domain"
with the matched domain in all attributes -- user name, password and URIs.

bug 4090086

Change-Id: I46a637ed364c1a079e1230fa22393a1bac059b1f
2011-03-29 11:12:13 -07:00
Todd Kennedy a819783491 Fix NPE when creating an account from template
if you create an account using one of the pre-defined templates (such as
Yahoo!), the user name and password were not being set in the HostAuth
structure. This was causing an NPE when we tried to generate an IMAP ID.

Change-Id: I9619cddc0ab758c187cf4b9c7c84485ac1f4bfdd
2011-02-17 14:43:50 -08:00
Todd Kennedy 040ddf60cf Resolve build warnings; part 5
Remove dependence upon URIs for creating the host auth structure

Change-Id: I92dee36fa329a8976b76bbd4991ed3469c6475f2
2011-02-16 17:38:31 -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
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
Andy Stadler a97faa25ac Discard result of Dupe Account check if paused
Fixes a potential race condition with a slow DB lookup and a
fast user (or monkey).

Bug: 3384992
Change-Id: I0602820e1d9f49eb01b09c9d78db3d0fc47ccfb1
2011-01-25 23:18:45 -08:00
Andy Stadler 858c282277 Handle leading/trailing space in passwords
* Allow, but provide warnings via EditText.setError()
* Remove one last instance of password trim()

Bug: 2981433
Change-Id: I406a4f8b8f27cc5ce90424a8cafe88a677e72f45
Signed-off-by: Andy Stadler <stadler@google.com>
2011-01-19 16:40:15 -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
Dianne Hackborn 31e2576791 Follow API changes.
Change-Id: I1ca0fe365b953fa98a462912309a1c9647277ba7
2011-01-17 16:24:00 -08:00
Brett Chabot ea4c564261 Use new public API to protect force account creation.
Check value of ActivityManager.isRunningInTestHarness() before allowing force
account creation, instead of ActivityManager.isUserAMonkey().

Bug 3329873

Change-Id: I5028eef9caced2cacc9c187dfd746865939fdedd
2011-01-09 15:25:52 -08:00
Andy Stadler 8b5cd2beff Remove UI thread access in AccountSetupBasics
* Move getOwnerName to a FutureTask
* Use AsyncTask for call to Utility.findExistingAccount()

Change-Id: I85e35a12cc28b1dda8a0ccd930869316032a3b12
2011-01-03 23:07:25 -08:00
Andy Stadler 3dedc8b191 Defragment AccountSetupBasics
* This was an early attempt at fragmentation
* But it turned out that no fragment was needed here - it is
  not shared or reused in any way.
* Precursor to doing final layouts for the activity.
* Tested working:
    Automatic provider lookup
    Manual
    POP/IMAP and EAS flow modes (from accounts & sync)
    Force account creation intent
    Provider note
    Duplicate account detection

Change-Id: I434edd4b152391d36e70440873932db3ec1a1c99
2010-12-09 11:05:34 -08:00
Andy Stadler 6175300474 Allow non-monkey creation of test accounts
* Set the debugging flag to allow it
* Add STOPSHIP (it cannot go out like this)

Bug: 2735784
Change-Id: Id5d162f7f1879b76004a24d5d81e769b06ef8d29
2010-12-08 16:43:23 -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 7988164ddf First pass of XL account setup
* AccountSetupBasics now has an XL version
* This is from prelim wireframes
* Final colors, text size, and positioning all TBD
* Fixed a StrictMode violation (counting #accounts in onCreate)
* Lightweight (non-shippable) fixes for functional phone UX

Bug: 3188940
Change-Id: Idf6cb514208eba07eaa20b20abfd5fcc3dae1751
2010-11-14 21:16:49 -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
Daisuke Miyakawa 43f2321d10 Modify code style.
Change-Id: I40eeb738ca2dcc7f21ddbc603b03debde5ac27d3
2010-10-10 15:17:52 -07:00
Daisuke Miyakawa 9dac94975f Use AccountAuthenticatorResponse properly.
Current implementation ignores callbacks coming from
AccountManager, which should be called everytime
when this Activity finishes its job.

Bug: 3069222
Change-Id: Iea03cf94bdfe8da184e415bf7e759ddeb46ecdd9
2010-10-08 16:16:43 -07:00
Andrew Stadler 2731aef45c Convert exchange setup to use checker fragment
* AccountCheckSettingsFragment now supports AutoDiscover
* Clean up callbacks for account check & autodiscover errors
* AccountSetupExchange now supports rotation
* Remove dead code in SetupData & AccountSetupBasics

TODO next CL: Remove all edit flows from setup activities
TODO next CL: Remove old CheckSettings activity

Change-Id: I3c9884856ca6e70226374fdb28400bfb3588387e
2010-09-13 14:04:45 -07:00
Andrew Stadler fd14496c49 Convert setup to use checker fragment
* Activities modified to use new check-settings fragment:
  * AccountSetupBasics (auto-setup for imap/pop)
  * AccountSetupIncoming
  * AccountSetupOutgoing

Next CL: Same work for exchange, and terminate old CheckSettings activity.

Change-Id: If5c5bfe331161b2429f7d7a4bd13290932f03c47
2010-09-10 15:51:37 -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
Andrew Stadler 57f125a01b Move debug settings from own activity to setting fragment
* Add DebugFragment and incorporate it into AccountSettingsXL
* Tap "Email preferences" 10 times in a row to enable debug settings.
  (Or type D E B U G works as well.)
* Point broadcast receiver (*#*#EMAIL#*#*) to AccountSettingsXL
* Remove old debug launchers in AccountFolderList
* Remove old Debug activity

Change-Id: Ib289c42878a07c23f815654ce4570c1399aa49de
2010-08-31 11:11:54 -07:00
Andrew Stadler 1b156352f3 Fragmentize Incoming settings (IMAP/POP server)
Also, extract DuplicateAccountDialogFragment for reuse.

Change-Id: I042a158e264d949024347d477d6e9ec999c244d3
2010-08-10 14:28:20 -07:00
Makoto Onuki b98f219cf0 Open 2 pane after adding an account.
- After adding an account, and when a shortcut to an account is clicked,
  launch Welcome instead of MessageList.
- Then welcome launches the appropriate activity.
  (MessageList or MessageListXL)

- Welcome no longer launches AccountFolderList, which will be gone
  according to the current plan.

Always going through Welcome makes sure that the account backup/restore
and the reconciler will always get kicked.

Change-Id: Ia57027eba16e98c5d8854e8d3c1d8773bcfbf1e5
2010-08-10 09:50:52 -07:00
Andrew Stadler a75bab5504 Fragmentize AccountSetupBasics
Change-Id: I99eb4cd4f8aa80d25a01d720244ccee599cba1d8
2010-08-09 22:44:41 -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 42e3f10a95 Use "*#*#36245#*#*" to activate the debug screen.
Dial *#*#36245#*#* on the dialer to activate the debug screen.
"36245" = "email"

It's useful when
- There's no keyboard.
- There's no account set up yet.
  (You can do it by entering the special username/password on new account
  screen, but that's a bit of a pain.)

It's also easier to tell to people.

Also, removed "sensitive logging", which should never be used.

Change-Id: Id692f8b216f2d85abe1880c452d2067f170dac83
2010-07-01 16:15:07 -07:00
Marc Blank 9d387ff0bb Fix validation use of FolderSync
* 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
2010-05-28 10:48:17 -07:00
Andrew Stadler 63ab9de1b8 Partial solution to make EAS setup respect "manual"
* Track whether the user clicked "manual" vs. clicking next (and falling
  into "manual" because the account is not found in the providers list.
  Convert this into an "allowAutoDiscover" parameter.
* Pass "allowAutoDiscover" down into AccountSetupAccountType and through
    into AccountSetupExchange.  (Note, it's unused/ignored for POP & IMAP
    accounts and should not affect them.)
* In AccountSetupExchange, use the existing EXTRA_DISABLE_AUTO_DISCOVER
    (previously only for testing) to suppress autodiscover in manual mode.

Bug: 2570919
Change-Id: I2583e00d1e6cc26bbd4b85134eddae8cc3a1f91e
2010-04-05 19:08:05 -07:00
Andrew Stadler 9f73249031 Continuing work on account migration
* Prune all folders, messages & attachments that won't migrate
* Clean up SSL/TLS values for better connection results & security
* Move account setup lookup code to AccountSettingsUtils to share it
* Cleanup config/auto-rotation settings to prevent relaunch of
  auto-discover or account check (from exchange).
* A couple of other very small fixes

Bug: 2065528
2010-03-03 22:19:41 -08:00
Andrew Stadler ecb1af8041 Finish up IMAP ID implementation
* scrub all external strings to keep them compliant for IMAP protocol
* move Build.MODEL to x-android-device-model
* send x-android-mobile-net-operator
* send AGUID
* unit tests for above
* retrieve providers from VendorPolicyLoader

Bug: 2332183
2010-02-01 15:53:46 -08:00
Makoto Onuki e5c3c98e9a Fix confusing setup screen title.
Change the title of the screen for adding an exchange account from "Set up email" to "Add an Exchange account".

Bug: 2159019
2010-02-01 14:24:38 -08:00
Makoto Onuki f613489663 Add "vendor policy" loader, and alternate exchange descriptive text.
- Dynamically switch to the alternate exchange strings to substitute overlays.
- Added the mechanism to load the "vendor policy", which tells you when the
  alternate strings should be used.

Bug: 2382710
2010-01-27 17:40:56 -08:00
Andrew Stadler 5e91cccd4b Quick backup/restore of accounts
* Workaround for (HTC bug 2275383) & (Moto bug 2226582)
* Adds checkpoints for backing up and restoring accounts
* Uses legacy Account / prefs to back up accounts - this is because
  some of this code will be reused for legacy account migration
* Unit tests of Account & LegacyConversions
* Unit tests of backup & restore
* Not done:  testing of EAS/Account Manager interface (this will require
  deeper dependency injection, to avoid the embedded calls to the Account
  Manager and other system services.)
2010-01-20 01:36:01 -08: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