Commit Graph

55 Commits

Author SHA1 Message Date
Marc Blank 3a5c1fb274 Email split, part neuf: Setup, logging, attachment glue
* Make "Exchange" option in account setup depend upon availability of the
  Exchange EmailService
* Make presence of Exchange logging depend upon availability of the
  Exchange EmailService
* Make AttachmentDownloadService use service rather than ExchangeService
  class
* Move SSLUtils to emailcommon/utility
* Move account manager type defs to emailcommon/AccountManagerTypes
* Update proguard.flags
* This is the penultimate CL for the Email package itself; the next CL
  creates a clean, SDK-compatible Email application

Bug: 3442973
Change-Id: I9162cf5fa6b5a043ded0fdd1e25fd3ce5948ad8f
2011-02-14 16:08:55 -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 980c2256f1 Catch base64 errors and handle in-place
Bug: 3362752
Change-Id: I63adb8663c90a7710176cc1c481bbfa5b4b859c4
2011-01-24 18:06:53 -08:00
Todd Kennedy 91a1cf1db0 Remove "view" button for .apk attachments
We don't need to allow users to install applications directly from the email
client. Instead, application installation is a two step process; the user
must first save the APK and then find it on the filesystem.

If the user does not want to allow installation of applications from unknown
sources, we don't provide the ability to save.

NOTE: After saving, we still try to open the APK which generates an error
toast. We will be removing the auto-open-after-save feature in a separate CL.

bug 3351137

Change-Id: I0eb1bc8224a154792fe852757e4b23a3059f4392
2011-01-17 10:03:44 -08:00
Andy Stadler 86753bc41c Update file type acceptance rules
* Open up all types for view/save rules
* Add anti-malware block list (based on extensions)
* Clean up code that shows/hides view & save buttons
* Redo handling of load/cancel 1sec timer
* Unit test for new little utility
* Allow larger items when on wifi

Bug: 3338984
Bug: 3334950
Bug: 3338988
Bug: 3340835

Change-Id: I991135636d507f2660e2860720dbed21bd1a955b
2011-01-11 14:40:41 -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
Marc Blank 54250337a0 Remove unused debug flag
Change-Id: I88ef517a5b4860c30f1eb2a52f15d8f07c823797
2010-12-17 10:34:43 -08:00
Andy Stadler fd5a5f14ea Turn down email logging to shippable levels.
Change-Id: I8426743aebef2329c8958926d7b29abe1309feb0
2010-12-13 16:32:02 -08:00
Makoto Onuki 5b81690de1 Show color chips for combined view.
Show color chips for account rows and message items on the combined view.

Moved hard-coded color values to resource.

Bug 3138001

Change-Id: Ib93fb9d6e9592ebd0c297f83c3dee2358a80508f
2010-11-23 13:03:06 -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
Makoto Onuki d36d911fac Add a flag to check the current thread on db accesses
Added Email.DEBUG_THREAD_CHECK.  If true, EmailProvider warns if certain
methods are called on the UI thread.

Change-Id: I6db9e45f2e449a31850c223fc9eec0fb9a575cb1
2010-09-08 18:19:36 -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
Marc Blank c184f36c2d Revert "Convert Controller to a full service"
This reverts commit 0e6d972641.

Change-Id: I005fc34152396806468edef919a3620961ddb4fe
2010-08-24 10:27:58 -07:00
Marc Blank 0e6d972641 Convert Controller to a full service
Change-Id: I2078fd047ff46f85936c8bf798a5edd3678bb5b4
2010-08-20 13:34:09 -07:00
Marc Blank 09fd4d0a18 New asynchronous attachment loading code
* Create AttachmentDownloadService to manage all attachment downloads
  1) User requested
  2) Required for email forwarding
  3) Opportunistic downloads to enhance offline use
* New attachment related UI (pending UX approval, of course)
  1) MessageView (attachment actions, progress bar, etc.)
  2) MessageCompose (attachments for forwarded messages)
  3) Associated toasts, notifications, etc.

TODO:
* Unit tests
* Cache Management (separate CL)

Change-Id: I7864a5fb1c3f4f2be68d98341a971edc6cbacfe1
2010-08-19 14:01:08 -07:00
Makoto Onuki 21efedb67f Rework/cleanup of "refresh".
Added RefreshManager, which is responsible for getting refresh requests
from UI and keeping track of what is being refreshed.

Conceptually it's a part of Controller, but extracted for easier testing.

- Now sendPendingMessagesForAllAccounts() is owned by RefreshManager
  rather than Controller.
- Also updateMailboxRefreshTime/mailboxRequiresRefresh have been moved
  in from the Email class.
- Now MessagingException implements a method to return an error message
  for the UI.

The refresh button on 2-pane doesn't work as intended yet, because the
spec is a bit too complicated (as described in the TODO in
MessageListXLFragmentManager.onRefhres()).

This change touches many file mostly because it cleans up a lot
of code duplication.

Change-Id: I058ab745ccff10f6e574f6ec4569c84ac4a3e10e
2010-08-18 11:06:45 -07:00
Makoto Onuki 02fa70aa18 Refactoring MessageListXL
I always thought our Activities are way too fat, meaning we've put too many
things into activities without any structure.

The major problems with this are:
- They have too many fields, which are not final and not even orthogonal.
  This makes them very hard to understand/maintain.  Changing one tiny bit
  can always cause unanticipated side-effects.
- Very hard, or almost impossible to test.

I really think we should break them into independent and self-contained
subcomponents which can be tested separately.

Introducing MessageListXLStateManager, which manages the current account,
mailbox and message, and show/hide/update fragments accordingly
for MessageListXL.

With this class, MessageListXL will be able to switch accounts/mailboxes/
messages by just calling the methods such as selectAccount(), without
worrying about when to show/hide what fragment and how to initialize them.
(In other words, MessageListXLStateManager encapsulates the two-pane screen
transition.  It's not intended to be reused for the phone UI.)

I didn't make it a nested class in MessageListXL, because nested classes can't
have real private members (private member are accessible from outer classes and
even brother classes!!), and I wanted it to be really self-contained anyway.

Change-Id: I1c121e99e30f12cc118e1c35abc9b30f49939a4a
2010-07-27 15:10:54 -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
Makoto Onuki 898283b6fa Fix ANR in one time initializer and unify BroadccastReceivers.
- Merged all three BroadcastReceivers into one.
  (Changed class name because old ones may have been disabled.)

- Use IntentService to perform the tasks in a worker thread.

Note the new receiver will never be disabled.  We always need to start
exchange.SyncManager.

Bug 2722155
Bug 2416929

Change-Id: I8241880fc1ee38d85dcdca7e1d46fc2f6b2d375b
2010-05-28 16:28:01 -07:00
Makoto Onuki 0a8030562a Fix flaky tests
Follow up to I3bf7d340.  Make sure temp directory is set before running tests.

Turned out Application.onCreate doesn't seem to be guaranteed to be run
before unit tests.

Without this, some tests may fail saying: "TempDirectory not set.
Application hasn't started??", if onCreate runs too late.

Change-Id: Ic5aee939a2c21f9579a643d0729dd0e9ba81022e
2010-05-17 14:07:34 -07:00
Makoto Onuki 9c9e757917 Add static method to get temp dir in Email.
I need to be able to get the temp dir from anywhere without Context
for the new IMAP parser.

Change-Id: I3bf7d34059399a8253c0760ebc392804ea434412
2010-05-13 18:27:34 -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 162b017140 Change account colors to what aren't used in Calendar.
Bug 2535090

Change-Id: I252e04afa402303d226a56f1d7852f50dc26e2ec
2010-04-14 15:18:12 -07:00
Andrew Stadler 5e354cd1db Exit most activities when accounts are deleted
This resolves cases like this:  You are in the inbox of an Exchange
account.  You click home, settings, accounts & sync, and you delete
the account.  Now re-enter the Email app.  You'll be left in a strangely
empty inbox, for an account that no longer exists.

* Set a flag any time the reconciler deletes an account
* Check that flag in onResume of any activity that depends on the account
    list and could be left in an "empty" state if account(s) are deleted.
* The Activities in which we check it are:
  * AccountFolderList
  * AccountSettings
  * MailboxList
  * MessageCompose
  * MessageList
  * MessageView
* Clear the flag any time we come in through Welcome, which will dispatch
    to other activities properly based on the number of accounts found.

Bug: 2563998
Change-Id: I00fc542581c2bed92d744a4c2e48a88f83737f11
2010-04-14 09:28:04 -07:00
Marc Blank 37658316f9 Use a single account color resource table; add convenience methods
* The color chip resource table was duplicated in three files
* Move these into a common location in Email.java and add
  convenience method for retrieving color chip resource id based
  on accountId
* Simplifies future changes to account color selection
* Add RGB color information on these resources (provided by
  rfulcher) and add a convenience method for retrieving these

Change-Id: If1c2d22fba91cfce46a2618cd2b73cf7a534ce51
2010-02-08 09:21:54 -08:00
Makoto Onuki 91237e9dcb Adding script for building Email app without exchange.
remove-exchange-support.sh makes it possible to build the email app without
exchange support.

This script:
- removes all packages under com.android.exchange.
- removes all lines surrounded by EXCHANGE-REMOVE-SECTION-START and
  EXCHANGE-REMOVE-SECTION-END

And the resulting source should still build and run fine.

Bug: 2369784
2010-02-03 11:39:46 -08:00
Makoto Onuki faed6178b1 Move Eas.ACCOUNT_MANAGER_TYPE out of the package.
Moved Eas.ACCOUNT_MANAGER_TYPE to Email.EXCHANGE_ACCOUNT_MANAGER_TYPE.

This constant is not related to the exchange protocol, and referred in
a lot of different places.  Moving it out of the package will make it a lot
simpler when removing exchange dependency.
2010-02-01 15:38:15 -08:00
Makoto Onuki 8ee17c7012 Unifying dupe code in Debug.java and Email.java. 2010-01-29 15:44:56 -08:00
Andrew Stadler 92a1ff9b77 Per spec, allow all attachments to be added via INTENT.
* Change manifest intent-filter to */*
* Split incoming whitelist into send_ui and send_intent versions

Bugs:  2097457 (general) & 2138790 (.vcf)

Change-Id: Id4a2bb3a75808811578c643a7b841de9491efce4
2009-09-27 23:49:10 -07:00
Marc Blank 5fed934083 Make sure we call setServicesEnabled in the BootReceiver
* Otherwise, there's a chance that various activities will be
  disabled (like MessageCompose), even if there are existing
  accounts.
* Enable BootReceiver by default

Change-Id: Id4669c41a846545d8bac5ad85736e1508074864a
2009-09-23 15:31:46 -07:00
Andrew Stadler fa52e6c956 Clean out old mailbox names logic and fix a couple of bugs.
* Get rid of old Account.getxxxFolderName() calls.
* Clean up any call sites to them
* Properly rename the existing special folder name identifiers
* Use a hash table in MessagingController to improve identification
    of special folders for IMAP accounts
* Fix a bug in Controller, which was creating new server-side folders
    using localized names.
* Fix a bunch of code in Controller that was using mContext, instead of
    using mProviderContext to support testability.
* Fix broken unit tests in ControllerProviderOpsTests

Fixes bug 1904373
2009-09-21 14:44:30 -07:00
satok d2174733b1 Auto-sync of stale mailboxes
BUG: 2050116
- auto sync onResume
- add mNonPushMode
-- mNonPushMode is updated in SetFooterTask
2009-09-15 14:38:13 +09:00
Andrew Stadler 77398c4289 Reenable Load More Messages for IMAP/POP
* Properly reset all mailbox limit values
* When load more messages is clicked, increment limit and resync
* Also fixed a race condition in provider

Resolves bug 2065626

Change-Id:	If50f25a5cb3b549b3acc48406c78533ad86ed4d5
2009-08-23 23:45:54 -07:00
Andrew Stadler 76a211e0d9 Fix EAS debug switches and clean up debug prefs code. 2009-08-13 17:43:25 -07:00
Marc Blank cc402e42ab Clear error states on network reconnect; add temporary notifications; see details
* When we get a network connect broadcast, clear error states so sync can
  restart for any boxes in an error state
* Add temporary notification code for the testers
* Add file-based debug logger
* Add Exchange logging to debug screen (adds additional exchange debugging)
* Add Exchange sd card logging to debug screen (logs to sd card)
* Change setLogging service API to send an int rather than a boolean
* Make sure push mailboxes are set up again when account changes to push
* Make sure push mailboxes are set up again when account mailbox starts
* (Fixed contacts sync bug found during debugging these changes)
2009-08-09 21:20:47 -07:00
Mihai Preda 2917e895c7 MessageCompose:
- set displayName for composed messages (from To:)
- set FLAG_LOADED
- do the save & send in an AsyncTask
- some clean-up
2009-08-03 13:04:21 +02:00
Andrew Stadler 77898e14e9 Enable logging in EAS based on Email.DEBUG flag. 2009-07-30 21:47:32 -07:00
Mihai Preda 334903369e initial Controller.sendMessage() and invocation from MessageCompose. 2009-07-28 20:48:42 +02:00
Mihai Preda f33986d5cc Eliminate Config.LOGV (deprecated, always false).
Add Email.LOGD as a development log guard.
2009-07-16 14:09:15 -07:00
Mihai Preda c6893ddf0f First steps towards using the new EmailContent.Message in MessageCompose. 2009-07-15 13:13:45 -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 68a9ccfcde final cleanups to get basic message operations working properly.
* Generate compatibility UUID early enough to stick, so our localstore
db's are created correctly and not recreated over and over again.
* Compose menu items working
* Fix single-account mode (go straight to inbox)
* Lightweight Account projections where possible
* Properly show/hide default account checkbox (during new acct screens)

What works:
* All unit tests
* Editing existing accounts
* Create new accounts
* Checking account settings against server
* Mail sync using accounts
* Viewing mailboxes
* Viewing messages
* Composing messages

What breaks (in approx order of planned fixes)
* Some details of account editing
* Import of existing accounts
2009-06-09 16:13:05 -07:00
Andrew Stadler c0033f24a2 Convert remainder of app to use provider-based accounts
What works:
* Unit tests, except for com.android.email.activity.setup.*
* Editing existing accounts
* Create new accounts
* Checking account settings against server
* Mail sync using accounts
* Viewing mailboxes

What breaks (in approx order of planned fixes)
* Unit tests in com.android.email.activity.setup.*
* Viewing messages
* Composing messages
* Some details of account editing
* Import of existing accounts
2009-06-08 15:42:40 -07:00
Andy Stadler 09866af013 AI 148257: Allow preview of any files (mime type */*) by removing
the original filters.  This affects preview, not download.
  This does not preflight the launch at all, it is very simple
  as it simply downloads the attachment and then tries to open it.
  If no activity is found, it uses a toast to say "couldn't do
  that."  A better fix will be to pre-check the mime type to see
  if there are any intent filters to handle it.
  BUG=1650669

Automated import of CL 148257
2009-05-04 10:28:41 -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
Tadashi Takaoka d12181df8f Automated import from //branches/donutburger/...@142461,142461 2009-03-24 22:45:09 -07:00
Andy Stadler 7265bb729b Automated import from //branches/donutburger/...@142152,142152 2009-03-24 21:31:47 -07:00
The Android Open Source Project 96c5af40d6 auto import from //depot/cupcake/@135843 2009-03-03 19:32:22 -08:00