Commit Graph

34 Commits

Author SHA1 Message Date
Andrew Stadler 3d2b3b3b35 Logic to move phone into security-admin mode
* Create notification to display when syncs fail due to security
* Create psuedo-activity (no UI) to manage device admin state transitions
* Clean up and flesh out SecurityPolicy APIs'
* Add placeholders in EasSyncService showing how to react when policies
    are not met and sync cannot continue.

Note:  There are some STOPSHIP todo's at the top of SecurityPolicy.java.
These should explain any code that you might think is "missing".
2010-02-05 11:10:39 -08:00
Mike Lockwood 87a520d7b9 Use default values rather than hard coding green for LED notification color.
Change-Id: Id192ea4d34725abf9ce892bc24e5c8562215f3e3
BUG: 2329568

Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-01-21 11:20:23 -05: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 d16b4b921f Go to combined inbox from notification for 2+ accounts (#2147265)
* The problem is that PendingIntents aren't updated when a notification
  is updated, so the changed extras when a 2nd account gets a new message
  aren't seen by MessageList when it's started up upon tapping the
  notification (it uses the extras from the 1st account to get a new
  message)
* The fix is to use the newish (cupcake) flag in the PendingIntent that
  causes the extras in the PendingIntent to be updated

Change-Id: Ia4ab14954b2c1413526016975216b2516372f2aa
2009-10-21 13:51:16 -07:00
Andrew Stadler deffba584e Stop forcing email logging for all users
* Don't force Email.Debug == true
* Also, remove some unneeded development logging from MailService
2009-09-28 14:31:56 -07:00
Andrew Stadler 27bc39399e Turn off debugging code that was accidentally left on.
This goes with Change I52e53c4b.

Change-Id: Ife5672af1c0c5cf2b2c279a9a912beb26c64390d
2009-09-17 21:15:17 -07:00
Andrew Stadler 01f61ef912 Fix acct settings -> inbox checks -> notifications
This cleans up a number of bugs that could be generically described as
"MailService and Notifications not being updated when accounts or account
settings are changed."

This also fixes a number of race conditions, one of which was causing
accounts to be refreshed in a nearly-endless loop, and another which
could cause an endless loop of alarms to be posted & fired..

Specific changes:
* Update/reschedule any time an account is edited (this was accidentally
    broken and being handled on EAS only.)
* Make sure we reschedule if an account becomes unavailable
* Clear notifications whenever refreshing accounts
* Reload local copy of account settings whenever refreshing accounts
* When restoring prev sync times (this happens when process is killed),
    be sure to also recalculate next sync times.
* Set flags on the pending intents to make sure old pending intents are
    not being reused.
* Set a watchdog each time we check the mail, so if we are killed during
    the mail check, we will be woken up again to retry.
* Fix a 2nd race condition in which a just-created account fails to sync,
    due to not (yet) having an inbox.
* Clean up handling of Controller callback:
  * Fix a minor bug in which refresh of non-inbox mailboxes would delay
      the next timed sync of the inbox for that account.
  * If the checkmail ended in an error (result != null) the service was
      never rescheduled.

Bugs Fixed:
bug 2078149 - Update service and notifications when account settings
   change or accounts are added/deleted.
bug 2084412 - Fix race condition caused by first intent being refired
bug 2071484 - Make sure we wake up later if killed during mail check

Change-Id: I3ee0d1b389c652351de5eb798c32a2daea244067
2009-09-17 18:35:43 -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 7b03c7936a A bit more debugging to catch the service race condition.
NOTE: This switches on Email.DEBUG for everyone, and should be
removed.


Change-Id: I700099a9aa5e5c64d8c282cb8d07a47c7c408862
2009-09-04 23:13:32 -07:00
Andrew Stadler 9b9a2e69b9 Improve logging in MailService
The goal is to generate better reports to help find the race condition
described in bug 2084412

Change-Id: Idfc453af17edf08e89d2aa656585b83ed48691c8
2009-09-03 15:02:03 -07:00
Marc Blank 68c3c7518e Use LED for notification (same parameters as Gmail and GTalk services)
* Agreed to by Erick and Prasenjit

Change-Id: I1a0f3642c9b10f981b2feed55762407ed853763d
2009-08-25 11:06:17 -07:00
Andrew Stadler df86adf873 Finish the code to demand-load partially loaded messages.
This happens in two primary cases:
1.  When a very large POP message was skipped during initial sync
2.  When any message was interrupted during initial sync, e.g. by
    a dropped connection.

Changes:
* Added loadMessageForView and callbacks to Controller (and touched all
    files with Controller listeners)
* Rewrote loadMessageForView in legacy MessagingController to work with
    provider.
* Update flow in MessageView to use loadMessageForView when needed.
* Restored the use of "loading.html" and "empty.html" assets (although
    I think we should replace them with simple layouts & views.)
* Some random cleanup in MessageView

Satisfies bug # 2065563
2009-08-25 10:13:35 -07:00
Dianne Hackborn 4bc4fed47b Use new service command processing to avoid leaving the service running.
The service still needs to schedule an alarm in its onStartCommand() so that
it will run in its next poll interval.

Change-Id: I66228ef573e84a5c7d33bcb07f4772626079b960
2009-08-24 16:29:02 -07:00
Andrew Stadler e1f0b0a9bc MessageView: next/prev navigation.
in addition:
- fix AND-OR precedence in cursor query in MessageList.
- move special mailbox ids from MessageList to Mailbox
- move shared code from MessageList to com.android.email.Utility
- add invisible prev/next to landscape in order to avoid special-case in code
- select mailbox list using IN() instead of list of OR

Note:  Checked in by Andy to facilitate further work on MessageView.

Change-Id:	I8049be2b45fed1e4e697a0ed895492c4d0e59e0a
2009-08-24 15:00:45 -07:00
Andrew Stadler 4b41bae270 Enable IMAP/POP sending and EAS resend
* Finish IMAP/POP sections of Controller.sendMessage
* Rewrite MessagingController.sendPendingMessagesSynchronous
* Add deleteAllAttachmentFiles to AttachmentProvider, and unit test
* Rework sendMessage callbacks and integrate into MessageList UI
* Send pending from UI

TODO:
* Find other places from which to call deleteAllAttachmentFiles
2009-08-20 11:09:39 -07:00
Marc Blank c0c9c33322 Add URI's that atomically add a value to a particular field (Account or Mailbox)
* Message, etc. could be added, if this had a use case
* Unit test added for both Account and Mailbox cases
* Eclipse changed some parens around; it won't happen again
2009-08-20 10:27:10 -07:00
Andrew Stadler cbe513d430 Integrate EAS push notifications with the main notifications.
* Use the new account-based field for number of new messages
* Add support for async notifications in MailService
* Change EAS to call MailService to notify user
2009-08-18 19:50:18 -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
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 ded3c915d8 Add folders to AccountFolderList
* Scan folders and write into child cursors
* Clicking a folder takes you to MessageList
* Remove most links to FolderMessageList (nearly dead!)
* Repair 1-account startup behavior (takes you directly to inbox)
* Cleanup a few basic things like context menus & refresh

TODO: Magic mailbox section at the top
TODO: As always, better linkage to sync engine(s)
TODO: Menus, context menus, etc.
TODO: Proper handling of expandable list - accounts should stay open?
2009-07-10 16:46:51 -07:00
Andrew Stadler 72dce73390 Convert Accounts to AccountFolderList
* Move relevant sources & resources to new name
* Convert from ListView to ExpandableListView
* No children yet - selecting account simply jumps to FML (temp)
* No other change to functionality (e.g. no menu changes yet)
2009-07-09 12:33:09 -07:00
Andrew Stadler 7b0b463477 List messages from MessagingController & Stores.
* update MessageListener callbacks and remove the callbacks that
  edit data (this comes through the provider now).
* provide simple linkage via Controller to sync a mailbox
* update FolderMessageList to trigger mailbox sync
* rewrite synchronize to push messages into provider
* small improvements to FML (sorting;  show read/unread status)
* note: trailing whitespace cleanup in some files
2009-06-22 16:13:03 -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 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 dab90a7b35 AI 148377: Push Mode changes: (1) Add android.permission.WAKE_LOCK and
READ_PHONE_STATE so a push mode service can hold an active
  network connection, monitor roaming status, etc.  (2) Refresh
  push mode status on Refresh(), not just on Check, so UI
  (settings) changes, which call refresh(), propagate immediately
  to the stores.
  BUG=1776149

Automated import of CL 148377
2009-05-06 17:50:29 -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 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
The Android Open Source Project 3db9542af6 auto import from //depot/cupcake/@136594 2009-03-05 14:34:38 -08: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
The Android Open Source Project 687f9962d7 Code drop from //branches/cupcake/...@124589 2008-12-17 18:05:56 -08:00
The Android Open Source Project 8978aac197 Initial Contribution 2008-10-21 07:00:00 -07:00