Commit Graph

3648 Commits

Author SHA1 Message Date
Makoto Onuki
36d3dfaeac Extract MockVendorPolicy, add standard mechanism to inject it.
One thing that bothers me regarding the new ImapStore is that there is no
tests to verify if the way how getImapId() uses a vendor policy hasn't changed.
This part is hard to test with a real vendor policy, and it can easily be
overlooked even if it's broken.

This CL offers ImapStoreUnitTests a way to test the interaction between
getImapId() and a vendor policy.

Also fixed a bug in VendorPolicyLoaderTest where it assumed the test apk
package name is "com.android.email.tests", but it may actually be
"com.google.android.email.tests" now.  (Broken since the test makefile
used inherit-package.)

Change-Id: I8feb616ea28cb5cae5b4fba57e363771014ac599
2010-06-11 15:11:15 -07:00
Marc Blank
3fa4e06cab am 1e7009c8: am b2422f28: am 7a358316: Merge "Work around problem w/ large CalendarProvider2 transactions" into froyo
Merge commit '1e7009c89e7e9aa7b2434ea4dac9a998c03ac373'

* commit '1e7009c89e7e9aa7b2434ea4dac9a998c03ac373':
  Work around problem w/ large CalendarProvider2 transactions
2010-06-11 11:33:03 -07:00
Marc Blank
1e7009c89e am b2422f28: am 7a358316: Merge "Work around problem w/ large CalendarProvider2 transactions" into froyo
Merge commit 'b2422f28d0897f9795e698c2aaba68156e794cbd' into gingerbread-plus-aosp

* commit 'b2422f28d0897f9795e698c2aaba68156e794cbd':
  Work around problem w/ large CalendarProvider2 transactions
2010-06-11 11:31:47 -07:00
Marc Blank
b2422f28d0 am 7a358316: Merge "Work around problem w/ large CalendarProvider2 transactions" into froyo
Merge commit '7a358316ae1c52fadf7ce8470fc5d257d1a71eaa' into gingerbread

* commit '7a358316ae1c52fadf7ce8470fc5d257d1a71eaa':
  Work around problem w/ large CalendarProvider2 transactions
2010-06-11 11:29:48 -07:00
Marc Blank
195f943548 am 7a358316: Merge "Work around problem w/ large CalendarProvider2 transactions" into froyo
Merge commit '7a358316ae1c52fadf7ce8470fc5d257d1a71eaa' into froyo-plus-aosp

* commit '7a358316ae1c52fadf7ce8470fc5d257d1a71eaa':
  Work around problem w/ large CalendarProvider2 transactions
2010-06-11 11:29:02 -07:00
Marc Blank
7a358316ae Merge "Work around problem w/ large CalendarProvider2 transactions" into froyo 2010-06-11 11:27:28 -07:00
Andrew Stadler
c82a73cc35 am a3b18142: (-s ours) am a3962dc7: am 572c06f9: (-s ours) DO NOT MERGE - Revert workaround for KeyguardLock problem
Merge commit 'a3b1814284a059f7728410eddb84986022d34685'

* commit 'a3b1814284a059f7728410eddb84986022d34685':
  DO NOT MERGE - Revert workaround for KeyguardLock problem
2010-06-11 11:27:13 -07:00
Andrew Stadler
a3b1814284 am a3962dc7: am 572c06f9: (-s ours) DO NOT MERGE - Revert workaround for KeyguardLock problem
Merge commit 'a3962dc7cf7df3ed7f135bdd4f6b934f75b51ee4' into gingerbread-plus-aosp

* commit 'a3962dc7cf7df3ed7f135bdd4f6b934f75b51ee4':
  DO NOT MERGE - Revert workaround for KeyguardLock problem
2010-06-11 11:25:56 -07:00
Andrew Stadler
057ee26f5b am 572c06f9: DO NOT MERGE - Revert workaround for KeyguardLock problem
Merge commit '572c06f91be8c809b8978d985259564f88c6f212' into froyo-plus-aosp

* commit '572c06f91be8c809b8978d985259564f88c6f212':
  DO NOT MERGE - Revert workaround for KeyguardLock problem
2010-06-11 11:24:27 -07:00
Andrew Stadler
a3962dc7cf am 572c06f9: (-s ours) DO NOT MERGE - Revert workaround for KeyguardLock problem
Merge commit '572c06f91be8c809b8978d985259564f88c6f212' into gingerbread

* commit '572c06f91be8c809b8978d985259564f88c6f212':
  DO NOT MERGE - Revert workaround for KeyguardLock problem
2010-06-11 11:23:54 -07:00
Andrew Stadler
572c06f91b DO NOT MERGE - Revert workaround for KeyguardLock problem
This reverts commit 3ee0cad5f5.

Because commit 284b62e1b8c3419bfd02c6fea5ba0a68146c06f8 fixes the underlying
conflict between DeviceAdmin policies and apps attempting to disable the
Keyguard Lock, this patch is no longer required.

Accounts with a server policy requiring a device PIN or Password will
now work properly.

Bug: 2737842
Change-Id: I533c27a01a8a331dc11a0cb84bcc78f48edf621c
2010-06-11 11:21:41 -07:00
Marc Blank
826c83a231 Work around problem w/ large CalendarProvider2 transactions
* We're seeing binder transaction failures when we try to send more than around
  1500 CPO's to CalendarProvider2 in a batch (the limit is related to memory
  usage in binder transactions)
* When an event has A attendees and E exceptions in an event, we currently must
  create A*E CPO's; this number can become very large and cause a binder failure
* The result of a failure is looping behavior, resulting in failed sync and very
  much reduced battery life
* The workaround here is to redact all non-organizer and non-user attendees from
  exceptions once we reach half of the maximum number of CPO's.  This has been
  determined empirically and is set to 500 CPO's in this CL
* We also reduce our sync "window" to 4 calendar/contact items per sync command
  to help limit the potential size of our batch
* For later releases, we should reconsider this and see if something that is more
  of a "fix", rather than a workaround, can be implemented

Bug: 2760514
Change-Id: I06ca1a1ae88c772342a9e46b5997c41678e95144
2010-06-11 10:44:39 -07:00
Marc Blank
9d56a515e6 Merge "Work around problem w/ large CalendarProvider2 transactions" 2010-06-11 10:34:07 -07:00
Marc Blank
5c34594dba Work around problem w/ large CalendarProvider2 transactions
* We're seeing binder transaction failures when we try to send more than around
  1500 CPO's to CalendarProvider2 in a batch (the limit is related to memory
  usage in binder transactions)
* When an event has A attendees and E exceptions in an event, we currently must
  create A*E CPO's; this number can become very large and cause a binder failure
* The result of a failure is looping behavior, resulting in failed sync and very
  much reduced battery life
* The workaround here is to redact all non-organizer and non-user attendees from
  exceptions once we reach half of the maximum number of CPO's.  This has been
  determined empirically and is set to 500 CPO's in this CL
* We also reduce our sync "window" to 4 calendar/contact items per sync command
  to help limit the potential size of our batch
* For later releases, we should reconsider this and see if something that is more
  of a "fix", rather than a workaround, can be implemented

Bug: 2760514
Change-Id: I2941b392ae1058a9ead8a79f0ac73f4eb345917d
2010-06-10 18:37:21 -07:00
Makoto Onuki
8cd8694b63 Merge "Renaming MessageListAdapter to MessagesAdapter" 2010-06-10 14:17:18 -07:00
Kenny Root
cf988934c8 am 45f86bbb: am be21f272: am 8cfeacdc: Import revised translations 2010-06-09 22:48:30 -07:00
Kenny Root
45f86bbbc3 am be21f272: am 8cfeacdc: Import revised translations 2010-06-09 22:47:27 -07:00
Kenny Root
23e8bd1b7f am 8cfeacdc: Import revised translations
Merge commit '8cfeacdcb371f0f7df5e3532a96fd75125f15224' into froyo-plus-aosp

* commit '8cfeacdcb371f0f7df5e3532a96fd75125f15224':
  Import revised translations
2010-06-09 22:46:33 -07:00
Kenny Root
be21f272a2 am 8cfeacdc: Import revised translations
Merge commit '8cfeacdcb371f0f7df5e3532a96fd75125f15224' into kraken

* commit '8cfeacdcb371f0f7df5e3532a96fd75125f15224':
  Import revised translations
2010-06-09 22:46:12 -07:00
Kenny Root
8cfeacdcb3 Import revised translations
Change-Id: Ic8818f3a44fe8cd06241ecdbad4082bf5afc828c
2010-06-09 22:41:54 -07:00
Jean-Baptiste Queru
65bca31122 am e70f4e74: merge from froyo-plus-aosp 2010-06-09 16:24:15 -07:00
Jean-Baptiste Queru
e70f4e74c8 merge from froyo-plus-aosp
Change-Id: Ibbc09c6cacf9d0f06ff88eec0fcf3a245e2e2535
2010-06-09 16:21:55 -07:00
Makoto Onuki
851f3219e2 Renaming MessageListAdapter to MessagesAdapter
in line with MailboxesAdapter.

Change-Id: I4ed387db2f5ce1f9bad282521c62eeec0c697db4
2010-06-09 14:43:43 -07:00
Marc Blank
d92abd08fc Stop log spew from SyncManager
Bug: 2734841
Change-Id: I9f14e4a4bfcd09c4e60ec4df2d7fc5cc7ef0aa51
2010-06-08 16:41:21 -07:00
Makoto Onuki
954bcd45b0 Move account deletion feature to Controller.
Change-Id: Icd3a7cc4ff0db8fb65d3e01868543e7ce8ea79e7
2010-06-08 10:25:09 -07:00
Andrew Stadler
96d40ec87b am 285486a2: (-s ours) am 3ee0cad5: (-s ours) DO NOT MERGE Workaround for KeyguardLock problem 2010-06-08 10:14:53 -07:00
Andrew Stadler
f184bba2c3 am 3ee0cad5: DO NOT MERGE Workaround for KeyguardLock problem
Merge commit '3ee0cad5f5e21a24dbe43d21afaac1dd76a2059b' into froyo-plus-aosp

* commit '3ee0cad5f5e21a24dbe43d21afaac1dd76a2059b':
  DO NOT MERGE Workaround for KeyguardLock problem
2010-06-07 18:32:45 -07:00
Andrew Stadler
285486a278 am 3ee0cad5: (-s ours) DO NOT MERGE Workaround for KeyguardLock problem
Merge commit '3ee0cad5f5e21a24dbe43d21afaac1dd76a2059b' into kraken

* commit '3ee0cad5f5e21a24dbe43d21afaac1dd76a2059b':
  DO NOT MERGE Workaround for KeyguardLock problem
2010-06-07 18:32:09 -07:00
Makoto Onuki
3f545a4060 Controller rework.
- Controller.Result is now a class rather than an interface,
  so subclasses don't have to implement empty methods.

- Replaced Threads with AsyncTasks, which is more light weighted
  because it uses pooled threads.

- Removed the Result argument from Controller's methods.
  These argumetns weren't used, except in serviceCheckMail.

  Regarding serviceCheckMail, the new code behave differenly from the old code.
  If there's already listeners registered when it's colled, they wouldn't get
  called in the old code, but they will in the new code.
  But I think this difference is okay because that's how it works for
  POP/IMAP accounts.

Change-Id: I37a857ce7c089c1a411cb7f1fcfcb72c9f5fd2a6
2010-06-07 16:33:44 -07:00
Makoto Onuki
f11399b1ea Merge "Fix for failing SecurityPolicyTests." 2010-06-07 16:16:00 -07:00
Makoto Onuki
0fb092b389 Fix for failing SecurityPolicyTests.
This fixes the following exception.

java.lang.UnsupportedOperationException
        at android.test.mock.MockContext.getApplicationContext(MockContext.java:82)

Bug 2725552

Change-Id: Iaca177defe5f5e836211c58270379da056fa64e0
2010-06-07 16:14:53 -07:00
Andrew Stadler
80091c8ef7 Refactor MailboxList to use Fragment API
* Moves all list-related implementation to new MailboxListFragment
* One item that remains to be done is to remove the dependency on the
  activity for handling context menu (longpress) in the list.

Change-Id: I7b5769d9d81fb685cf480de3d3e18b4e1c078f2d
2010-06-07 16:02:52 -07:00
Makoto Onuki
afa85bb102 Fix typo on exchange server setting screen.
Bug 2742113

Change-Id: I43bd3d6328745169bacb1fd750cce0a08dc18742
2010-06-04 13:10:58 -07:00
Andrew Stadler
3ee0cad5f5 DO NOT MERGE Workaround for KeyguardLock problem
* The device policies that enforce the use of a device PIN or password
  can be sidestepped by apps that implement KeyguardManager.KeyguardLock
* This renders the policies unuseable
* To prevent this, the email app now scans for any packages holding the
  DISABLE_KEYGUARD permission.  The existence of any non-system app
  with this permission will put all security-enabled EAS accounts into
  a security hold, and post a dialog describing the problem.
* The user must uninstall any such app(s) in order to sync their EAS data.

Bug: 2737842
Change-Id: I4c96d76b12d9242b5c755dd60d7578a825fae597
2010-06-04 11:10:03 -07:00
Makoto Onuki
c7b6145c12 Fix the cache in Controller.
Turned out we can't reuse EmailServiceProxy, so only cache the account type.

Change-Id: I5499c2440082580d6f0739ae85b888f1afb65ba8
2010-06-03 16:31:20 -07:00
Makoto Onuki
a00bf4e0d0 Merge "Cache for Controller.getServiceForAccount." 2010-06-03 15:47:23 -07:00
Makoto Onuki
b87e999fbc Cleaning up MessageList
- Removed Handler.
- Refactored FindMailboxTask so it only does DB access on a worker thread.
  (Moved the actual task out of doInBackground)
- Removed unused imports, which I forgot when I extracted the adapter.

Change-Id: Ib76ce2ab7901dd39d2ed51d8a61d7be9df55b337
2010-06-03 15:45:22 -07:00
Makoto Onuki
768aff4c88 Cache for Controller.getServiceForAccount.
Change-Id: I607c437d6e0781ae8305df22c13a0e3a003c623f
2010-06-03 15:31:35 -07:00
Makoto Onuki
4a2615e2a5 Remove Handlers from Activities.
AccountFolderList, MessageCompose and MailboxList.

Also,
- ControllerResultUiThreadWrapper now takes a Handler instead of an Activity.
  So that it can be used from a Service as well.

- ControllerResultUiThreadWrapper.getWrappee() to get the wrapped object.
  We'll eventually need this.

- I'll work on MessageList too, but the might be relatively
  large, so I'll do that in a separate CL

Change-Id: I281d88d5af1834248ec3f7463f0df3f5635149be
2010-06-02 16:47:18 -07:00
Makoto Onuki
0a892ae04f Extract MessageListAdapter.
Change-Id: I0e441b7fff925c7703ab88ab54240c5b42d045c4
2010-06-02 16:37:47 -07:00
Makoto Onuki
0fd444b0b4 Implement destroy() for all ImapElement classes.
- This is to make sure we're not touching any ImapResponse that's
  already been destroyed.

- I didn't add "is it already destroyed?" check to them
  (except for ImapTempFileLiteral), because it can be costly.
  Just let NPE be thrown.

Change-Id: Idc7b88c4844727922841cbad8a106bf781181d45
2010-06-02 10:13:42 -07:00
Makoto Onuki
977a7d206a Always destroy ImapResponses.
Unfortunately it's hard to write tests for this change, but at least
all tests pass with Idc7b88c4.

Change-Id: If0335a848dfcc23aecea22c21b2cce73dac7ff6f
2010-06-02 09:56:46 -07:00
Makoto Onuki
4a82cd7720 Merge "Add TODOs to ImapStore." 2010-06-01 17:09:25 -07:00
Andrew Stadler
5925dab764 Merge "Extract MailboxesAdapter from MailboxList" 2010-06-01 16:47:33 -07:00
Andrew Stadler
ca59313085 Extract MailboxesAdapter from MailboxList
* Create MailboxesAdapter
* No unit tests (nothing to test here outside of view binding)

Change-Id: Id3ca06eeffbfe46a6aa683eb212a096496a3129f
2010-06-01 16:45:29 -07:00
Makoto Onuki
d7470b8687 Add TODOs to ImapStore.
Change-Id: I5a9f246eb81cfca6008f82e8c2ffff8b7f28ba1d
2010-06-01 14:14:21 -07:00
Makoto Onuki
bf58053406 Follow-up to the new IMAP parser.
- Replace string literals in ImapStore with constants.
- Simplifies ImapStore.en/decodeFolderName
- Mix cases in the test data to test for case-insensitivity

Change-Id: I88424357227bcf78528df5e6a1c4ba45d54cc65b
2010-06-01 10:50:15 -07:00
Makoto Onuki
3cc80998ba Merge "Fix ANR in one time initializer and unify BroadccastReceivers." 2010-05-28 16:31:18 -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
7e24c6c6f9 Get rid of Handlers and make activities (more) BG thread free.
Part 1: MessageView

- It's an attempt to get rid of Handlers from Activities, and
  reduce the amount of code that runs run a BG thread in them.

- Introduced ResultUiThreadWrapper, which wraps another Controller.Result
  and make callbacks get called on the UI thread.

  - It'll make the logic in ControllerResults cleaner and more straightforward.

  - ResultUiThreadWrapper isn't too memory efficient because it allocates a
    Runnable even if the wrappee's target method is empty.
    However these callbacks don't get called often, and optimizing it would
    make code more complicated, so I don't think it's worth optimizing.

- Now we can assume all the methods in activities except
  AsyncTask.doInBackground runs on the UI thread, with some special exceptions
  like MediaScannerNotifier.
  In my previous abandoned change, I named methods that can run on BG threads
  '*OnUiThread', but now there's no need to do that.

  This also means we can minimize the use of synchronizations.

Change-Id: Ia6d9d2a266ebf5a4b23d712e9eaea3272adbd2a6
2010-05-28 16:02:21 -07:00