Commit Graph

783 Commits

Author SHA1 Message Date
Makoto Onuki 7d3519151a Tests for IMAP FETCH
Adding regression test for the new IMAP parser.

Change-Id: Iac7f5c022e44ca5f06f735e145af15cc459eb61f
2010-05-18 10:48:11 -07:00
Makoto Onuki 128fb393e8 Relax MIME date parser.
Make the date parser accept invalid dates like
"Thu, 10 Dec 09 15:08:08 GMT-0700" which was observed in an email from eBay.

Per RFC, timezone must be either obs-zone (e.g. "GMT") or +/- with 4 digits.
The GMT+/-digits format is not permitted.

Bug 2367124

Change-Id: I59968274160aeadea70223208b463ee692660056
2010-05-17 14:14:08 -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 9580f6175d Don't sync when the background data system setting is off.
Bug 2494703

Change-Id: Ia6f4c9fc86cdcb5ca3276141cb84b4effb6ee87c
2010-05-14 13:59:11 -07:00
Makoto Onuki 6bdd7998c3 Merge "Simplify MessageRetrievalListener." 2010-05-14 10:45:43 -07:00
Makoto Onuki dbbd2ba22c Simplify MessageRetrievalListener.
Main motivation: not to make the new IMAP parser too complecated.

- Removed messageRetrieved.
  Motivation:
  - It's not easy to call messageRetrieved() at the proper timing
    from the new IMAP parser, and this method wasn't used anyway.

- Renamed messageFinished to messageRetrieved.
  And removed the "number" and "ofTotal" arguments.
  Motivation:
  - They weren't used.  Also there was inconsistency about
    what to pass as "numebr".  (i.e. 0-based or 1-based?)  There was
    even a bug that caused passing a wrong number.

Change-Id: If92dbfe681b78a0eea8125188ede63a8f00dcf49
2010-05-14 10:44:37 -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 31fa0172cf am d93f323f: am 29491840: Merge "Cleanup: Add @Override" into froyo-plus-aosp 2010-05-10 11:34:28 -07:00
Makoto Onuki d93f323faa am 29491840: Merge "Cleanup: Add @Override" into froyo-plus-aosp
Merge commit '29491840e62a3a21a9b8e4a0889450d2d0875255' into kraken

* commit '29491840e62a3a21a9b8e4a0889450d2d0875255':
  Cleanup: Add @Override
2010-05-10 11:30:36 -07:00
Makoto Onuki 29491840e6 Merge "Cleanup: Add @Override" into froyo-plus-aosp 2010-05-10 11:29:51 -07:00
Makoto Onuki 165e8bfe7a Cleanup: Add @Override
(Note it's for froyo-plus-asop)

Change-Id: Ic4211c08586e33c44d5d6267c0c9d37f8c7cdc85
2010-05-07 15:28:26 -07:00
Makoto Onuki c563ce1b80 am b8970dab: am e46ac1a6: Cleanup imports. 2010-05-07 15:20:47 -07:00
Makoto Onuki b8970dabb6 am e46ac1a6: Cleanup imports.
Merge commit 'e46ac1a61f32bd762a879457b1850087a1ad3a8c' into kraken

* commit 'e46ac1a61f32bd762a879457b1850087a1ad3a8c':
  Cleanup imports.
2010-05-07 15:17:35 -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
Makoto Onuki 1f2caa8095 Fix 3 problems that FindBugs found.
Bug 2666278 [findbugs] broken double-lock pettern in Utility.FolderProperties.getInstance()
Bug 2666207 [findbugs] potential NPE in MessagingController.processPendingDeletesSynchronous()
Bug 2666195 [findbugs] Potential NPE in AccountSetupNames.onCreate()

Change-Id: I2ee5bd5b7c80f8bdd32b3c45abb655a3d3fb8c9e
2010-05-07 14:04:50 -07:00
Andrew Stadler b0c37bd8c0 am 1e037acd: am 7cdd6899: am a7628f3b: Merge "Better handling for untyped attachments" into froyo 2010-05-03 09:36:28 -07:00
Makoto Onuki 9d2b44d473 am eaf1139c: am a094cc25: am cf362a48: Collectly preserve the service start-id. 2010-05-03 09:36:26 -07:00
Andrew Stadler 1e037acda7 am 7cdd6899: am a7628f3b: Merge "Better handling for untyped attachments" into froyo
Merge commit '7cdd6899fbe820af852974cd0b7025b72bfe242a' into kraken

* commit '7cdd6899fbe820af852974cd0b7025b72bfe242a':
  Better handling for untyped attachments
2010-05-03 09:34:02 -07:00
Makoto Onuki eaf1139c6c am a094cc25: am cf362a48: Collectly preserve the service start-id.
Merge commit 'a094cc259da268ad6f78f50afe5cbbf674418b86' into kraken

* commit 'a094cc259da268ad6f78f50afe5cbbf674418b86':
  Collectly preserve the service start-id.
2010-05-03 09:33:56 -07:00
Andrew Stadler a7628f3bc0 Merge "Better handling for untyped attachments" into froyo 2010-05-03 07:22:00 -07:00
Andrew Stadler 80ebde2897 Better handling for untyped attachments
* IMAP/POP rely on sender to set mime type of attachments
* Which doesn't always work, because senders don't always provide it
* Remap using filename extensions, when needed
* This is applied as late as possible - in the MessageView, and in
  the content provider getType().  No changes to how we write databases,
  and no change to existing attachment rows.

Bug: 2356638
Change-Id: Ie69e3fd12f406aac803583f9d1299a8af4fba010
2010-04-30 15:01:10 -07:00
Makoto Onuki cf362a48c1 Collectly preserve the service start-id.
We were passing the wrong arguments, which caused the service left running.

Bug 2646212

Change-Id: Ie5aeaeb80635c8e805fc2e9c6f4aec3b21942740
2010-04-30 14:41:47 -07:00
Makoto Onuki 7446a41fbd am 0a06a1a6: am 4a1565fd: am 5ab7ec71: Move a bare string to a resource. 2010-04-30 11:33:31 -07:00
Makoto Onuki 0a06a1a683 am 4a1565fd: am 5ab7ec71: Move a bare string to a resource.
Merge commit '4a1565fd7ec426ba4615aedeb3f2ddcb03ecac22' into kraken

* commit '4a1565fd7ec426ba4615aedeb3f2ddcb03ecac22':
  Move a bare string to a resource.
2010-04-30 11:29:32 -07:00
Makoto Onuki 5ab7ec7123 Move a bare string to a resource.
Bug 2637666

Change-Id: I59cf5d2b30846604049d3f988b1003dd7d91ad6f
2010-04-30 09:21:04 -07:00
Andy Stadler 1bfe167734 am 656d89d6: am 78d3c602: am b915c3c0: Merge "Skip security check when account id is unknown." into froyo 2010-04-28 09:52:13 -07:00
Andy Stadler 656d89d67f am 78d3c602: am b915c3c0: Merge "Skip security check when account id is unknown." into froyo
Merge commit '78d3c6022ccf87566261faf694ff506a68ec6b6f' into kraken

* commit '78d3c6022ccf87566261faf694ff506a68ec6b6f':
  Skip security check when account id is unknown.
2010-04-28 09:43:18 -07:00
Makoto Onuki e333b68c9e Skip security check when account id is unknown.
Doing the check caused:
   IllegalArgumentException: Unknown URI content://com.android.email.provider/account/-1
       at com.android.email.provider.EmailProvider.query(EmailProvider.java:1092)
       at android.content.ContentProvider$Transport.query(ContentProvider.java:163)
       at android.content.ContentResolver.query(ContentResolver.java:245)
       at com.android.email.activity.MessageList.isSecurityHold(MessageList.java:1146)

Bug 2635060

Change-Id: I80e7c00ef2dd74ceae24a88daf43a0681124a9d4
2010-04-27 17:28:39 -07:00
Marc Blank 6b594cc97b am a238577c: am d718abd3: am b62cbc7e: Increase service call timeout to 45 seconds 2010-04-26 11:20:02 -07:00
Marc Blank a238577cb7 am d718abd3: am b62cbc7e: Increase service call timeout to 45 seconds
Merge commit 'd718abd38c12a902b85ba6341c4eda1c778d68b7' into kraken

* commit 'd718abd38c12a902b85ba6341c4eda1c778d68b7':
  Increase service call timeout to 45 seconds
2010-04-26 11:10:23 -07:00
Marc Blank b62cbc7e7b Increase service call timeout to 45 seconds
Bug: 2627273
Change-Id: I971aa271cfc03e669e72f7871856cb9cfc10aa14
2010-04-26 08:14:01 -07:00
Andrew Stadler 5f1fdc2111 am f6e5f6e3: am da0fb178: am 5ac8a35c: Merge "Fix uncommanded exit from MessageList with 2+ accounts" into froyo 2010-04-23 13:41:34 -07:00
Andrew Stadler f6e5f6e395 am da0fb178: am 5ac8a35c: Merge "Fix uncommanded exit from MessageList with 2+ accounts" into froyo
Merge commit 'da0fb1784c7675841cd64cb7c19020491667872f' into kraken

* commit 'da0fb1784c7675841cd64cb7c19020491667872f':
  Fix uncommanded exit from MessageList with 2+ accounts
2010-04-23 13:36:09 -07:00
Andrew Stadler 88fb7f7cd0 Fix uncommanded exit from MessageList with 2+ accounts
* When you have 2 or more accounts configured, MessageList gets confused.
* If you are viewing a mailbox from account A, and account B does a
  background sync, MessageList gets confused by the reports coming back
  from the Controller.  It gives up and returns to the Accounts list.
* This change adds a check for the current account and ignores the
  MessageList updates if we weren't actually waiting for them.
* To test the positive case for this code (make sure we didn't break it),
  verify that the inbox on an IMAP account is displayed properly
  immediately after you add it.

Bug: 2619513
Change-Id: Ib31254b4099ba6b7922b06d42e2b7928551e4fb2
2010-04-23 12:17:43 -07:00
Makoto Onuki f4dac9f266 Send local IP address with EHLO instead of "localhost".
Bug 1515345

Change-Id: I181c9f0d79fbdf62f7df77f72a1ec9653797b6dd
2010-04-22 11:23:08 -07:00
Andrew Stadler d729ff891a am 151b9aa8: am 5d5d7854: Harden UpgradeAccounts against runtime errors (e.g. NPE)
Merge commit '151b9aa8dff6350c9e247579599bf70e1c55eea1' into kraken

* commit '151b9aa8dff6350c9e247579599bf70e1c55eea1':
  Harden UpgradeAccounts against runtime errors (e.g. NPE)
2010-04-21 18:19:27 -07:00
Andrew Stadler 5d5d7854c2 Harden UpgradeAccounts against runtime errors (e.g. NPE)
* Harden each of the major upgrade steps so any errors (e.g. NPE) are
  caught and that account goes into error state.
* Make sure that any account in error state is abandoned properly - all
  steps skipped except the final delete/cleanup.
* Bugfix: The variable that indicates that an account has gone into an
  error state (upgrade failed) state was being set in the UI thread and
  tested in the worker thread, so it was not properly stopping the
  upgrade of any given account.  Split that variable into two, one for the
  UI thread (set/read by the handler) and one for the worker thread.
* Bugfix: Report errors against the correct account, when 2+ accounts are
  being upgraded.

Bug: 2608483
Change-Id: I571078ae7123b601b53096104c4c5f4ef20da031
2010-04-21 16:27:09 -07:00
Marc Blank fc08120213 am a0c71419: am 21c04fe3: Merge "Further harden getListOrNull" into froyo
Merge commit 'a0c71419cedaa0f84d12da61e415642b79cc0a9c' into kraken

* commit 'a0c71419cedaa0f84d12da61e415642b79cc0a9c':
  Further harden getListOrNull
2010-04-21 08:18:04 -07:00
Marc Blank 07fb9f8bea Further harden getListOrNull
* Add a bounds check
* Add a test for ImapList

Bug: 2611022
Change-Id: I3ad88fbc8d3145298731ab19ef7ff68d4011bb00
2010-04-20 19:31:29 -07:00
Andrew Stadler 901c23032b am a126a168: am ce592f32: Merge "Remove incorrect error reporting in MessageList" into froyo
Merge commit 'a126a168b6d70143e6cc94531f20ff889b15357b' into kraken

* commit 'a126a168b6d70143e6cc94531f20ff889b15357b':
  Remove incorrect error reporting in MessageList
2010-04-15 15:14:20 -07:00
Andrew Stadler 54607e872d Remove incorrect error reporting in MessageList
* Previously I added a call to updateBanner() during the sequence where
    we update the mailboxlist (searching for the requested mailbox to
    display.)  This was an attempt to provide some error information
    for certain corner case security configuration problems.
* This was misfiring during legitimate connections (specifically, initial
    sync of valid EAS accounts) and causing a Connection Error message
    when none was intended.
* Rather than continue hacking, I'm simply removing the error banner
    from updateMailboxList.
* This is essentially a direct rollback of change
    c98b64c801, although I've added
    a bit more commentary than there was originally.
* The long-term solution, rather than continue band-aiding this, is to
    move most of this logic into a service independent of the UI, and
    provide more organized error reporting.

Bug: 2585159
Bug: 2599377
Change-Id: I99b7b1c8a7cfaa3fd3ff9b578d5721f05133d88a
2010-04-15 14:53:56 -07:00
Andrew Stadler fa6d2b7b61 am 1bf66bb8: am 186aa619: Cleanup probable causes of close cursor access
Merge commit '1bf66bb8fcb4fcb74706d8e0917b7ac9f62d6710' into kraken

* commit '1bf66bb8fcb4fcb74706d8e0917b7ac9f62d6710':
  Cleanup probable causes of close cursor access
2010-04-15 00:22:49 -07:00
Andrew Stadler 186aa619dc Cleanup probable causes of close cursor access
* Monkey is hitting this fairly often
* Multiple fixes that are all good
  * We were launching LoadAccountsTask twice
  * Don't use a managed cursor for the inner accounts cursor - always
      close it manually by calling changeCursor(null) and letting the
      MergeCursor handle its sub-cursors.
  * Add isCancelled() check
  * When replacing adapter, be sure to close cursor

Bug: 2524465
Change-Id: I2309e033d65430810f2856285c1fa9bf2f8fb5e3
2010-04-14 23:51:35 -07:00
Makoto Onuki 6f83fe6317 am ad383ff1: am d2a0d233: Use consistent device-id even the device is wiped.
Merge commit 'ad383ff1231319c6ded4077b0d1415bf77bec70b' into kraken

* commit 'ad383ff1231319c6ded4077b0d1415bf77bec70b':
  Use consistent device-id even the device is wiped.
2010-04-14 22:22:18 -07:00
Makoto Onuki d2a0d23380 Use consistent device-id even the device is wiped.
Use hash of device id (TelephonyManager.getDeviceId()) instead of a random
value.

Bug 2596537

Change-Id: I22303f7287ee6e9edccec349d03f14adbd33f6f7
2010-04-14 21:39:18 -07:00
Andrew Stadler 16fa3af652 am bd9f4ab3: am 79ef52cf: Improve handling of UI reset cases
Merge commit 'bd9f4ab329b4d01493c84b3d93d678c9d5a594fe' into kraken

* commit 'bd9f4ab329b4d01493c84b3d93d678c9d5a594fe':
  Improve handling of UI reset cases
2010-04-14 20:36:26 -07:00
Andrew Stadler 79ef52cfb3 Improve handling of UI reset cases
* When account disappears (e.g. delete from Accounts & Sync) the Welcome
   activity should launch with FLAG_ACTIVITY_CLEAR_TOP to remove any
   stacked activities as well.
* When account disappears entering AccountSetupNames, don't fall out
   of Eas Flow Mode.
* Followup to 5e354cd1db

Bug: 2563998
Change-Id: Ifbe086e26205bb28c2514f84cb28e839888b1eb0
2010-04-14 19:16:46 -07:00
Andrew Stadler 8249155e42 am 1ec609e9: am 694fe3b0: Merge "Safer error handling in AccountNames" into froyo
Merge commit '1ec609e99e00957788f4cb5d1965b9d4659f46ff' into kraken

* commit '1ec609e99e00957788f4cb5d1965b9d4659f46ff':
  Safer error handling in AccountNames
2010-04-14 17:50:25 -07:00
Andrew Stadler 694fe3b0c7 Merge "Safer error handling in AccountNames" into froyo 2010-04-14 17:42:55 -07:00