History log of /packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6ac502883abcecc4c80b26ed2b1a2a1e7308505c 01-Oct-2013 Alon Albert <aalbert@google.com> Add Some Logging to GAL Provider

Change-Id: Ic70d7cfe8c2090bdcfaa2504a24c2bcefedd73de
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
ff9fed5ccdd57d5408e759f0ca6c41e79e09e999 05-Sep-2013 Martin Hibdon <mhibdon@google.com> Get rid of ContactsSyncAdapter

We still use ContactsSyncParser, but this
has been moved out of ContactsSyncAdapter and
into its own file.

Change-Id: Ifdcaa707e67aee9dc321048cc390714114a99cea
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
de6b8b15730f59f3178e4a4223ddf00c6acd16c2 30-Aug-2013 Martin Hibdon <mhibdon@google.com> Move CalendarSyncParser into its own file

Get rid of CalendarSyncAdapter, which isn't used
anymore.
Also, get the tests to compile. They don't
neccessarily pass yet, but at least they compile.

Change-Id: Icaff923a9b3d8c4c886da1e8c6410dbdf55ce395
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
ff7e02603bc8196f411c0c491d74a42e747b7dc5 08-Aug-2013 Yu Ping Hu <yph@google.com> Decouple operation management from EasServerConnection.

This restructuring touches a regrettable number of files,
but allows us to put common code in a common base class.
(Before, it was messy because it would be muddled with the
connection management code.) Specifically, we want common
error paths to be handled in one place, although this isn't
implemented yet.

The new class of interest is EasOperation. This CL changes
Ping to use this base class. Future changes will switch all
operations to work this way.

Change-Id: I1bd26336e8916cafe592352f8ee05616bce8181c
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
e2788afb86984dae29255fd9c7e24c78d90dbdad 30-Jul-2013 Yu Ping Hu <yph@google.com> Delete most of IEmailServiceCallback.

The old callback mechanism is being deprecated, and the only
remaining user of this is attachment loading.

In places where the callback was referenced in deprecated
code (e.g. ExchangeService), the code was deleted with no
attempt made to patch it up since the class is unused.

Bug: 9842867

Change-Id: Ia92aa973fe8289759d1b88916d31d86e60a67faa
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
62c287af3bed45818accf595c56879ad5c57aaf9 18-Jul-2013 Yu Ping Hu <yph@google.com> Implement sendMeetingResponse.

Bug: 9021105
Change-Id: Ieee0da78687f651afce1875eb4f016d166777660
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
56d35257ef1493e849522c3c2828d904e4c5531f 26-Jun-2013 Scott Kennedy <skennedy@google.com> Clean up a bunch of warnings

Bug: 9565838
Change-Id: Ieb65ab41c1e320647a1a17b835371c5eb8e342db
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
d1eebde673eaa2a0ffa360d59200c87e2136d271 07-Jun-2013 Yu Ping Hu <yph@google.com> Merge "Fix upsync for email." into jb-ub-mail-ur10
7d35f61afc910b8f21d3225762c251df10dc76ea 03-Jun-2013 Yu Ping Hu <yph@google.com> Fix upsync for email.

Calendar & Contact upsync are still stubs.

Change-Id: I62c168ce7e7aef449d6ff5a89919aed1fd6ce5c8
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
942b7d73f2f5b3d6c651e39463e615fe6902a910 06-Jun-2013 Scott Kennedy <skennedy@google.com> Unify LogTag

There is now only one LogTag class. The static initializer of
GmailApplication (existing), EmailApplication (new), and
Exchange (existing) will now set the log tag to "Gmail" and "Email",
respectively. Up until that code is run, it will be "UnifiedEmail".

"setprop log.tag.Gmail VERBOSE" (or .Email, .Exchange) will trigger
all logs to be printed as long as they go through LogUtils,
regardless of what tag is used by that individual log. This lets us
still turn on logging everywhere in one command, but also lets us use
more descriptive tags (like the class name).

And since we no longer have three com.android.mail.utils.LogTag
classes, builds will be much easier.

Also, we now use LogUtils everywhere.

Change-Id: Ib565414fae51d0c3367370db9717aece45f7eb36
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
bc278f1e81ef1d44c28093e830ebe84faa960843 17-May-2013 Yu Ping Hu <yph@google.com> Implement Exchange account validation.

Change-Id: I447846010e62354a53dff8c6626757bea5197a7c
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
847322e4b75287643a8381e28401ee5cf4945a44 09-May-2013 Yu Ping Hu <yph@google.com> Switch constants to existing standard values.

Change-Id: I9196714d9fd9462034d3931282ed9dbf559a1a0d
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
d7fa6b782093f91066b3fcbdb48c7ee47a685012 30-Apr-2013 Yu Ping Hu <yph@google.com> Code cleanup.

- Remove some dead code.
- Add some @Overrides where needed.
- Remove some unnecessary throws declarations.
- Clean up SyncAdapters to not use statics and locks.

Change-Id: I0dcfa159ea0535d726d9f943196d127b6c4c13cc
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
c716a538cffe7f5cea0d55683c696bc25e3568c5 18-Apr-2013 Yu Ping Hu <yph@google.com> Only acquire wakelock after ping if we had it to start.

Bug: 8640907

Change-Id: Ifff22f13a9e076a7718b8269371a2e976ee70593
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
fd7aac1fbda199ec62f8ea7f1d1edaf15018ba37 06-Sep-2012 Marc Blank <mblank@google.com> Fix potential looping issue

* If there is a change sent and no response from the server, we
won't clean up the updates/deletes table
* In this case, we'll sync every ten seconds or so (at least
until a new message comes in)
* This has been around for a very long time

Change-Id: I3569d2fb7262f06df44ca0ab0c3b85aa13527062
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
2bf91acb8174aab82582ce975a4b60702c810a9c 23-Aug-2012 Marc Blank <mblank@google.com> Convert authorities, intents, and account manager types

* Tested OK on wiped Nexus
* Tested OK on S3
* Upgrade tested on Nexus

Change-Id: Icbb939bebbaed71b7662739678b8e59e9a9e1552
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
fd64bd37caf49cd3e2acacee12c20bedd807e362 01-Aug-2012 Marc Blank <mblank@google.com> Fix autodiscover to work w/ new connection manager code

Bug: 6916100

Change-Id: I690010431dff1658efa07acbcacb442b444829eb
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
3fedf8da5e2bd8c5b5a128ffe27e6bb42ebc611d 01-Aug-2012 Marc Blank <mblank@google.com> Use updated EmailClientConnectionManager API

Change-Id: I5275ff2b7c3fa2ffbe09746b8331d97a7c066b20
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
e6c2456aa6c00ef78c6d1d1621511d7ef8507f83 28-Jun-2012 Marc Blank <mblank@google.com> DO NOT MERGE: Move exchange2 files up a level

* Goodbye, exchange1

Change-Id: Id2fc093cd43a55815047ab091b6a49c3d1138888
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
d2e4d4675d04e78591ebd38fd084fc2cdbe144a0 25-Apr-2012 Marc Blank <mblank@google.com> Create exchange2; restore ICS sources to exchange

Change-Id: I076ad6c1e24ed071fe2d2867ca0fe3fbaff5a95f
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
3b7b3fcb52000f5885d293750899ffc8d4129026 28-Jan-2012 Marc Blank <mblank@google.com> resolved conflicts for merge of 634d209a to master

Change-Id: I8d3afc817072fa5aadf2dadb828567945b43af4e
48ac73e73700994435bf182a3bccb43e96b68811 26-Jan-2012 Marc Blank <mblank@google.com> Handle HTTP redirect (451) in OPTIONS and FolderSync

Bug: 5926621
Change-Id: I400277c9f60f6527acf361da1c863e93327eb948
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
e7f05fad587f2b41bbe66212920e4a5707dbb3c9 02-Dec-2011 Marc Blank <mblank@google.com> Handle provision request during ping loop

Bug: 5699760
Change-Id: Ib014d769e6b09b0e40f58e7d99adf65504b27eb9
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
463013616f2205f7a03bde4d5867c01a0dfb0b62 14-Nov-2011 Marc Blank <mblank@google.com> am df1b1f66: Return proper code for auth failure during autodiscover

* commit 'df1b1f66c8c0708e99221eff0bba602859bc8a58':
Return proper code for auth failure during autodiscover
df1b1f66c8c0708e99221eff0bba602859bc8a58 14-Nov-2011 Marc Blank <mblank@google.com> Return proper code for auth failure during autodiscover

* Regression from HC in handling bad username/password from the
autodiscover screen

Bug: 5612276
Change-Id: I9ab5881b38225919a6d82536fd387af717dd44d7
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
84bcaea49134858ee6d31c862112caa3122ccb5d 11-Nov-2011 Marc Blank <mblank@google.com> resolved conflicts for merge of d42f97df to master

Change-Id: Ieb3ab797eb0aac0f8ea34879061834d6d57b1b0b
d42f97dffe6692e72a55c6248ba0a97f14a976cf 11-Nov-2011 Marc Blank <mblank@google.com> Add a bit of logging for HTTP errors in folder sync

Bug: 5605472
Change-Id: I1b0a62548b1703c9c3574d8799770c2dd08e9d01
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
69f58015880007c7eb2eee77aba84e0898b903ee 10-Nov-2011 Marc Blank <mblank@google.com> resolved conflicts for merge of 7e569704 to master

Change-Id: Icaea0ba7c986c2b7ebe4c4cd48bd7b60aa7b2768
d1fcfa9093afd48f1f6bcfa2c308db49b7466ca4 08-Nov-2011 Marc Blank <mblank@google.com> Make sure that account mailbox is always "syncable"

* The test isMailboxSyncable in ExchangeService lumps the account
mailbox in with regular email mailboxes; this means that the
account mailbox won't sync if "Sync Email" isn't checked in the
settings
* Fix this by always allowing the account mailbox to sync
* Also, make sure we're upgrading account flags properly for ICS

Bug: 5582884
Bug: 5532630
Bug: 5577486

Change-Id: Iee93eab31adf7a844260a0abc490280b08977a61
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
23a26b3bc11fe262194911eb174df63a0f756b4f 03-Nov-2011 Marc Blank <mblank@google.com> Handle 451 indirects during sync

Bug: 5519388
Change-Id: I17ee87fb778d1c7444fafc5ec8253019818c82a7
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
b5a252163bf6dfaa789328916f9898f281f796e3 28-Oct-2011 Marc Blank <mblank@google.com> Split EasAccountService out of EasSyncService

Change-Id: Id395e422e0363a5494501db9e9918393abcbe9aa
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
281e00b53e7d39dcf63fd7cdfd7d9efe27d235cf 02-Nov-2011 Marc Blank <mblank@google.com> resolved conflicts for merge of fa19307b to master

Change-Id: I2f6e24d16a25245819fb49f012b740f34ff41665
0b06bcd31ccdfd15478e8ee846fd963775ca036a 30-Oct-2011 Marc Blank <mblank@google.com> During validation, handle 403 as ACCESS_DENIED

* This is more correct than handling as a provisioning error, and
will allow Exchange 2007 servers to deny access by device type
* Also, never return an empty array in unsupported policy list;
this leads to garbage text being presented to the user

Bug: 5533200
Change-Id: I23e6aa70970404ac986fd4a40ef4bf41cf410155
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
c55d6dfd1ade376f080568b4f307f76d4984a761 04-Oct-2011 Marc Blank <mblank@google.com> Support new policy handling in Email application

Change-Id: Ided82615121eeed980926167bcde963e07dbc934
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
8b4543adb2e1eda9b0c0d3d7d89e03bff9e9fe44 24-Oct-2011 Marc Blank <mblank@google.com> Handle provisioning of EAS 14.0

* EAS 14.0 requires a different procedure for sending device
information than does EAS 14.1
* Sadly, this new procedure is fairly incompatible with the way
we create/provision accounts, as it requires us to finish
provisioning BEFORE sending device information and yet
treating the result as part of the provisioning process
* This is particularly clumsy for us, since we do not normally
finish provisioning during account validation (we do it after
the account has been created).
* The present CL includes some patches that enable EAS 14.0
provisioning to work properly, at least in the most common
cases; additional testing will be required to determine
whether we're covering all of the bases

Bug: 5494233
Change-Id: I99c290a7d2b49b600446b4a40339efaae1cb1aac
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
538ffdd571446a24d1436b5931c9f112ec200b51 19-Oct-2011 Marc Blank <mblank@google.com> Fix build break

Change-Id: I0d698875e0aa53b79343d62712b93adfd52f4109
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
b7e8db5257203ce221885cbdff256092a073e1da 19-Oct-2011 Marc Blank <mblank@google.com> Send "Connection: close" with Ping commands

* This is being done as requested by $VENDOR to help with an
issue related to inappropriate network activity following a
"Ping" command
* This change will increase overhead during runPingLoop, as
the connection must be rebuilt each pass, and it is possible
that other unexpected side-effects will occur

Bug: 5420438
Change-Id: I1e3f5b60566f08d9b107e5648e5e68030e3dbb5e
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
afbb79493033d7108fa8dfaa88e0427db84de09f 27-Sep-2011 Marc Blank <mblank@google.com> Properly handle unsupported policies in tryProvision

* During the ICS timeframe, we added the ability to send back a
list of unsupported policies in canProvision(). This change
allows canProvision() to return a Policy even when it's not
supportable
* The code in tryProvision(), however, wasn't changed to reflect
this, so it "passes" policies that aren't supportable
* The simple fix is to test whether the Policy is supportable
in tryProvision
* Also added some logging

Change-Id: I14613e26a0306cab61ac263071e5b6ee19ebe43d
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
5da3dfb00fc4ce733d20bc91c580d4f142e409cd 26-Sep-2011 Marc Blank <mblank@google.com> Properly show error when there's no connectivity

* While we're here, make sure the spinner is running during
initial sync; it looks weird otherwise
* Always send the "done" callback (no harm, and we might
otherwise leave the spinner running); eventually, we should
clean up handling of the "refresh" indicator

Bug: 5197888
Change-Id: I242c94310825fc1184240b372ba37365b2bdf50d
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
6dd267921d03b252b1d74ba6e75516263dfdf080 10-Sep-2011 Marc Blank <mblank@google.com> Send OPTIONS command with minimal headers

Bug: 5196927
Change-Id: I85ffdb9b0feaa978c6b4aebec4e264909adb19ae
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
ac7a749800da2d51a55845344e9c91f6332913b8 08-Sep-2011 Marc Blank <mblank@google.com> Prevent wakelock from being held when sync services finish

* Make sure that ExchangeService#done is called when all threads
exit
* Make ExchangeService#done ensure that the calling thread is
still the active syncing thread for its mailbox before taking
action
* For MR0/MR1

Bug: 5256268
Change-Id: I64bc5f2539c524f3b8d633117ca1c548a373e449
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
9745a39647af586a414ee1000b213e0c0b39534e 08-Sep-2011 Marc Blank <mblank@google.com> Revert "Ensure that ExchangeService.done() is called when exiting"

* The CL to be reverted caused 5267949; a different solution will
be attempted in a future CL

This reverts commit e92b160eedb90114200be19689abf94c06b5ac8c.

Change-Id: I3d4fdf6fc210c626b7dc50b1ba250870a04eed96
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
e92b160eedb90114200be19689abf94c06b5ac8c 05-Sep-2011 Marc Blank <mblank@google.com> Ensure that ExchangeService.done() is called when exiting

* Failure to do this can cause the service's wake lock to be held
inappropriately, leading to battery life issues
* Currently, this appears to be seen only in modded OS's, but it
might well be appearing on a wider scale.

Bug: 5256268
Change-Id: I02852d2c645d6c38e3813a398a52a04ca2e5d07d
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
878371fb14c4245c6b4739ff6a1de899a3aae8a8 02-Sep-2011 Marc Blank <mblank@google.com> Refresh mAccount after setting new policy

* Otherwise, we delete the wrong (i.e. stale) old policy

Bug: 5245056
Change-Id: I24174c303d5acc49e3938d2428bafb0099bf0e4f
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
752a633175ecf567fc73ab318fe32855297d175e 02-Sep-2011 Marc Blank <mblank@google.com> Revert "Don't send device info in OPTIONS command"

This reverts commit e9353616056991511d4c3a707e97ca0468c0ef42.
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
e9353616056991511d4c3a707e97ca0468c0ef42 31-Aug-2011 Marc Blank <mblank@google.com> Don't send device info in OPTIONS command

Bug: <need to find>

Change-Id: Ic7b8299fad70aeaff05485e675ac1882dcfbc9d1
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
3b73884f0524f21ad4a37127c8bcdaafca193e28 26-Aug-2011 Marc Blank <mblank@google.com> Use real deviceId when validating Exchange account

* Since we're already checking for an existing account, we can
send the actual deviceId, rather than "validate"
* The former code could cause user confusion and MSFT has
suggested that we always use the actual id
* Also, avoid creating an extra service object

Bug: 5215726
Change-Id: I3b8406741cfb664483009d34624a3270ccabfa78
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
db2f99c98a6eea4cf33daaba3c349b8c263c3e42 23-Aug-2011 Marc Blank <mblank@google.com> Fix NPE's in EasSyncService

* Make sure we catch null cursors after query

Bug: 5202449
Change-Id: Iff57ed6c67eea88b72da97b747e962e93e59388a
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
0164f9da9a96fd8146c4a61e6de01734206baf4c 12-Aug-2011 Marc Blank <mblank@google.com> Catch ProviderUnavailableException where we can

Bug: 5159311
Change-Id: I12e7ac3443154a8fd1e75bfe04db9b5ea4bee108
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
6534bd5e100625c653c9fba09243bbb67a9023c7 05-Aug-2011 Marc Blank <mblank@google.com> Fix problem with SmartReply/Forward and deleted messages

* Please read bug 5112318 for a full analysis of the issue being
fixed in this CL
* When a send fails with an HTTP 500, and that send uses a "smart"
command, we retry the send without the "smart" command
* Also handle status 150 for EAS 14 (equivalent to HTTP 500)
* A little bit of cleanup

* Bug: 5112318

Change-Id: Id8325cd324cdc27f3b65b1d14d76da1ead80255c
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
61c48abf43082f3094f21fd4c645ad9cf4dfbd74 03-Aug-2011 Marc Blank <mblank@google.com> Handle sync status 7 properly

* This indicates a failed upsync (due to a conflict with the server);
it is rare but causes subsequent sync failure. Very P1'ish
* Note that this is directly related to EAS 14.1 usage, and the case
in which the server has a "replied" update to send to the client
* We now, do a subsequent sync without upsync, and THEN, when we've
gotten the latest from the server, try to register our changes
again.

Bug: 5111438
Change-Id: Ic1268316b3286eb92ec2f143742dd6ed1b39d153
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
a3881891f7904fb4945d791e7f6d15c9e80f02d3 14-Jul-2011 Marc Blank <mblank@google.com> Send callback when access denied on FolderSync

Change-Id: I5d6bb80c61b1f11853b6a507f2f78cca5bac6061
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
c0dce2284e50f2b638bad8c1fa6e2028e46ea5d9 08-Jul-2011 Marc Blank <mblank@google.com> Add traffic flags to EAS sync

Bug: 4988322

Change-Id: Ifcdcc0d6bd21f7c9f17b0a7e00dfcdc664bc6e27
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
3d6d254c2503e317b9b0873dc6a638c974f705f4 01-Jul-2011 Ben Komalo <benkomalo@google.com> Make client certificate requests optional.

This prevents things from always failing if the server requires a client
SSL certificate.

Note that the solution used to determine if a certificate request was
made for a given request is approximate; it is timestamp based and can
theoretically give a false positive. In practice, this is very unlikely,
since another cert request had to have happened around the same time,
AND the response must be a 401/403.

Change-Id: I726b32200ed784debfa72f033f61c71bfbc2ea10
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
66c325218d8d28c25828442d36680e99cdac79c0 08-Jul-2011 Marc Blank <mblank@google.com> Fix horrendous typo & regression

* Bugs introduced in I28af1c87292fedf244b53e8eb53b2f3e19469122
* This CL fixes the bug and also adds code to ensure that proper
account flags are set on every initial sync

Change-Id: Iad6c230087cf52207b020353c0a838cd8710b628
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
55c8432b7d7e183cffdcf441b71a04c2d301d96c 06-Jul-2011 Ben Komalo <benkomalo@google.com> Fix cases where Policy can be null.

- in one case, where we checked for historical policies that were no
longer supported, we didn't check to see if there was a policy set in
the first place
- in another case, we checked to see if policies were activated, but
again, didn't check to see if any policies were set (passing a null in
that case checked the activation of the *aggregate* policies)

Bug: 4996003
Change-Id: I3c9f201fbe39c1e61e5bc33326e27ad82023b578
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
5a4d4bc3a4c5f03c0cd628ac000a9e8ac094d944 01-Jul-2011 Ben Komalo <benkomalo@google.com> Revert "Enable SD card encryption policy when emulated"

This is a manual cherry-pick of af99ce79afd3346e5e79b7d76a8dab0ea9826f59
This reverts commit 4f9b59673d0fd089cfb4b4c8e0210192394929a9.

The introduction of proper SD cards breaks the invariant that "external"
storage can be encrypted. Unfortunately, this means that accounts with
that policy bit set will have to be removed for now.

Bug: 4466311
Change-Id: I1770c01115fc6a3bb54fe58d5e9f6a32f39b0005
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
3524b49b0e8eda6a3f5d46f08fa90b44fcb5318e 02-Jul-2011 Marc Blank <mblank@google.com> Fix provision parsing error w/ manual sync while roaming

* We weren't retrieving the value for "sync manually when roaming"
and this caused a bunch of issues when parsing policies
* We also weren't handling unsupportable policies properly (i.e.
returning null and setting the array of strings representing
those policies.

Bug: 4987267
Change-Id: I7cda6cad5c4455fff0d7c87518c1dbdedb271191
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
77e0f0dc7b064e0a320d11c33ce9da2f8ae5ba3b 27-Jun-2011 Marc Blank <mblank@google.com> Refactor EAS search into a single class

* Time to start uncluttering EasSyncService
* Add support for non-global (i.e. per mailbox) search
* searchMessages() now returns the total number of matches

Change-Id: I2491891f2b3035a66ca5340ac5ff14cb3617da43
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
ea99a721a9c012f65de968a77eba228a462237c8 25-Jun-2011 Marc Blank <mblank@google.com> Have EAS search use callback when finished

Change-Id: I22ac85aaf3b6ad52659c7bfbee5e92420f814e7e
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
097cd98bed66adfffc623f977b776974296cc3fa 24-Jun-2011 Marc Blank <mblank@google.com> Fix crash due to I6de0e37936c7d38cd9c896da28d1587ff897a82d

* This is happening during EAS account creation

Change-Id: I088350c8723cbdf4396fe45260a86d6a0e1fc110
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
82c3ed7521f8419c05a8b139018321c27a9f1587 24-Jun-2011 Marc Blank <mblank@google.com> Make sure EAS search-related flags are set for existing accounts

Bug: 4943537
Change-Id: I6de0e37936c7d38cd9c896da28d1587ff897a82d
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
d586a4a9e631e79abad807f2bb328a3856e9eb23 23-Jun-2011 Marc Blank <mblank@google.com> Add account search flags for protocol versions 12.0 and later

Change-Id: I4f94324dfe170b7d447a01b21051ca78a20c71cd
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
36a3e5257d0bb0be44479cea75a20c46b078db17 16-Jun-2011 Ben Komalo <benkomalo@google.com> Propagate another cert error state up.

Change-Id: I5437259fb3f248234024ffa768276a6fe1353905
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
0b3a1547b4adf380dab1cc9a1af6c227c9a4e00f 16-Jun-2011 Ben Komalo <benkomalo@google.com> Wrap client certificate errors in EasResponse.

Client certificate errors and bad username/error passwords just return
403 and it's difficult for us to differentiate the two. The easiest way
right now is to track it using a dummy KeyManager that can detect when a
certificate is requested upon connection establishment (way low in the
bowels of the Apache HTTP stack).

This change propagates that information up to the EasResponse and
encapsulates it there.

In the future, we should be more flexible as there can theoretically be
servers that REQUEST certificates, but do not REQUIRE it, but this code
will present an error regardless.

Change-Id: I7ee36e2c2ab06bdb8ce34b8967b7cb241812ac96
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
87b42fc62ef62eed2188d11da4f0a8e0b635230a 15-Jun-2011 Ben Komalo <benkomalo@google.com> Fix ambiguously named getters.

Change-Id: I36b1f52c63029b7216939d4ff4f330da4266ad5e
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
91e6d2a4ff733417090b06f8644615a0fb9160c0 14-Jun-2011 Ben Komalo <benkomalo@google.com> Pass HostAuth when validating an account.

Now that HostAuth is fully Parcelable, no sense passing all the
individual fields.

Change-Id: I0d0589792bf49b16bd597cd59d51b71cee065f9c
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
693ed7fdd5a7ec7af87d105b76267c78a8acc3db 14-Jun-2011 RoboErik <epastern@google.com> Rename Calendar.java to CalendarContract.java

Change-Id: I814ba00e8b71003c3ca99126c73069c55fa6df6a
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
e0ac5d26481e68c25b976136a6d376c39977e779 01-Jun-2011 Ben Komalo <benkomalo@google.com> Add support for client side SSL certificates

Change-Id: I8aa6ac98a5d831d35cba7b599902e5e89b662e84
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
7372782488977df778a33d990401ce9e397f646b 14-Jun-2011 Marc Blank <mblank@google.com> Support move of Account to its own top-level class

Change-Id: Ibf427ddcfb0566354ea169997c56a67de1897c0b
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
498c903e02ef1b150d6dbd3a01d35839026db264 10-Jun-2011 Ben Komalo <benkomalo@google.com> Move EasResponse to top level class.

All behavior unmodified.

This prepares the way for some additional error codes (that aren't
necessarily HTTP error codes, since no connection can even be made) that
will be put on the EasResponse itself.

Change-Id: I1ba3b212dc63fb2f10a6462466e8fe62409b87e9
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
218ec6f25ee77f2d6cc02e898a08a667321ac542 02-Jun-2011 Marc Blank <mblank@google.com> Update searchMessages API

Change-Id: I90df578a31dfd5df2474dc823a185b45c98f5ef9
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
c171a2362e6db78385463e3b7b1bc66585fdcdfc 28-May-2011 Marc Blank <mblank@google.com> Implement mail sending in EAS 14

* Mail is sent entirely differently in EAS 14...
* While we're at it, clean up Serializer

Bug: 4500720

Change-Id: I0eeb7fd28d32c0c7ac8790140721244eb0d4f65c
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
1b52d3a2a7526810c18c040665d75a467b12677c 27-May-2011 Marc Blank <mblank@google.com> Generate correct error for username/password errors

Bug: 3405832
Change-Id: Ic6c994fcc6aa0ed88c42a5c5b06b30bf6ee821dd
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
c379d9df9eb8a5ee3ce0a308a146e8d2c73ef8e3 26-May-2011 Marc Blank <mblank@google.com> Revert "Don't report security errors from non-account mailbox"

This reverts commit d39f4e00ebd6b25b807636fbf86e2b058e51e29c.
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
e0f2fe59805655f68a899472bfc10159d9d4fa5f 26-May-2011 Marc Blank <mblank@google.com> Fix code to work properly with isActive()

* The documentation for SecurityPolicy.isActive() indicates that
we test against the settings (password, idle timeout, etc.) in
place. In fact, it only does this if the policy being tested
is already registered with the DPM
* Change code order a bit in tryProvision so that we set the new
policy immediately, rather than waiting for the result of
isActive()

Bug: 4489608

Change-Id: Ic2950a6624d1ff603701e62a01f0657456627def
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
19af9677b8a755eb094982c96226448c0c071b2c 25-May-2011 Marc Blank <mblank@google.com> Add safety net to prevent sync stoppage

* We added this change to HC/MR1 and HC/MR2 in DO NOT MERGE CL's.
Adding this in manually now

Change-Id: I053380353009febffcc6c4a016a20cf2dae79f5f
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
c936e6dc6b6979350083a8ab28a24ba8cdda45e0 20-May-2011 Ben Komalo <benkomalo@google.com> Move HostAuth to top level class.

No other changes made.

Change-Id: I8a4b23851c5eeee95c051bd81300f48333bfa07c
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
d39f4e00ebd6b25b807636fbf86e2b058e51e29c 17-May-2011 Marc Blank <mblank@google.com> Don't report security errors from non-account mailbox

Bug: 4441487
Change-Id: I55086899be9a2715cfbd3975e886781d8fc7080e
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
bb12673b0aa36ff0751ddcffe02223c6100f424e 12-May-2011 Marc Blank <mblank@google.com> Add support for EAS 14.1 attachment loading

* Move all attachment handling code out of EasSyncService and into
new AttachmentLoader class
* A bit of cleanup to existing attachment code

Change-Id: I4f6a7950b1318f838413b83d6cfae31f0467e8d1
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
4d8774462ace9a45154b2df418b9f2fe7a9c685d 14-May-2011 Ben Komalo <benkomalo@google.com> Move Mailbox to top level class.

No other changes made.
Depends on E-mail change.

Change-Id: I549fb2cb7e942f1885ec40a6619dc491f63c0de2
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
514aa3b8b4e95f2a936302e346d926d9bd814743 12-May-2011 Marc Blank <mblank@google.com> Use ATTACHMENT_NOT_FOUND when we get HTTP errors in loadAttachment

* Also, change the "part request" (attachment load) sync reason to
NOT generate mailbox sync callbacks (instead, it sends
loadAttachment callbacks)

Bug: 4409976
Change-Id: Ida0afbc66666769539ce3315f80c03c5becf80b2
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
357c572400dd7c9867103be2cb53e9f79e680c65 12-May-2011 Marc Blank <mblank@google.com> Fix a problem in which we don't set an Account's Policy

* In the case in which a policy exists but it isn't being enforced,
we didn't set the account's policy.
* This leads to behavior which prevents a new account from syncing

Change-Id: I3297782842f10d08abdf2805438e2afb11705313
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
9e86eb14c6e1f7d7730f8ca6953fdfd95fe2b143 06-May-2011 RoboErik <epastern@google.com> Update to Calendars table for db v300

See change I515b3e0a for db ugrade details.

Change-Id: I15c22f05dca11f45c3cb27392f1f53a0ffa2f0c1
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
d1d98cba6f4604c5b88b3c53a09b9741f8c87a54 11-May-2011 Marc Blank <mblank@google.com> Handle attachment policy restrictions in EAS

* We already stored the policy information, so we now mark
attachments as not-downloadable if they violate the policy
when loaded
* When policies change, call the Policy utility to reset the
not-downloadable flags
* Leave attachment policy strings in place; we'll use them
when we're able to show email-app-enforced policies

Change-Id: I9cabca861b3d32001f20ff5014af94fe753f7548
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
fa0f067a6552d837591606b9f58be183cc12bf72 05-May-2011 Marc Blank <mblank@google.com> Enforce "manual sync only when roaming"

* This policy is enforced by ExchangeService, regardless of system
support

Change-Id: I1009e8f89b2833c5f35c554d00e7795b754dff6c
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
0565fd4f943aa3e5be5e001fb16d2f3d69159de6 04-May-2011 Marc Blank <mblank@google.com> Implement "automatic" sync lookback for Exchange

* Target roughly 150-450 messages on device; these numbers are
starting points, subject to testing, etc.
* UI (name "automatic", etc.) is tentative

Change-Id: Idd36f447190066469e6254e15a7b4cf10a0fc3e8
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
3ba50d433ee89b252cd1dd9fd3eee1f2baa3945b 29-Apr-2011 Marc Blank <mblank@google.com> Exchange support for rework of security policy code

Change-Id: I457568f648a73a2ac97216b621fb6357248f2fdf
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
32c569e053c3159956e13b2e5b47eb9d167186ce 26-Apr-2011 Marc Blank <mblank@google.com> Expose unsupported policies from EAS validation

Change-Id: Ieb58fe77c061f5516c723ebf1b5086cde25fc2f1
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
77186bb1a174432ef272584374942d8b9228e39c 20-Apr-2011 Marc Blank <mblank@google.com> EAS 14.1 implementation

* Includes ABQ implementation
* Handle various quarantine (and other service denial errors) both
in validation and during a sync

Change-Id: I8b166c2364fd858847de66cbe974f04a9382fca4
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
14a4536caa29c199f664f0d71ff147c6721919e0 22-Apr-2011 Marc Blank <mblank@google.com> Remove unused method and test

Bug: 4331476
Change-Id: I43811a9403b4d7a668433fb4749bf10c79f083f1
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
9b894d4403addee4214c8faf94fa47222da7e2b0 20-Apr-2011 Marc Blank <mblank@google.com> Only check mailbox consistency when starting account mailbox sync

Bug: 4310432
Change-Id: Ic00ef34dc19c86c44d810072e25ffdabbc9fa803
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
bc2c2bd71a2026ac4bb54e6bf82f02df585f8a87 15-Apr-2011 Marc Blank <mblank@google.com> Add GZIP compression to EAS sync

* Also cleanup handling of HTTP POST responses

Bug: 4292618

Change-Id: Iba4e3b8b82eabddf59e39774bd21adf4ec1f649d
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
26d9677a1eb48553241897b63a77bbd33daa9f92 27-Mar-2011 Marc Blank <mblank@google.com> EAS implementation of searchMessages

* Clean up Parser

Change-Id: If6f7ce948f97be2309b093dc4af5cacb8dee3830
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
d0bb59f5d1c7e1d8b6c2350d3ad769a2073a0230 10-Mar-2011 Marc Blank <mblank@google.com> Clean up references to mThread in sync services

Bug: 4081120
Change-Id: Iaecca720282d60220f4088477f3e2b335b29780d
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
1b205668ed6ae85dd5cdd842cfa38b48676cd134 08-Mar-2011 Marc Blank <mblank@google.com> Don't allow duplicate attachment load requests

Bug: 3470007
Change-Id: Ie6e498258e3fc2510a5e66c94f60c9f0a4f6ed44
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
9c93cb2281bc503e0ad4e1a1691a152a4e4accd0 07-Mar-2011 Andy Stadler <stadler@google.com> DO NOT MERGE: Add parentKey and new flags to existing and new mailboxes

* Created utility that sets a mailbox's flags and sets the parent key of
any children
* Created a wrapper that calls the above for all mailboxes with an uninitialized
parent key (this is the "upgrade" case from earlier EmailProvider version
that didn't have the column
* Update FolderSyncParser to call the wrapper after any additions and also
to call the utility for all parent mailboxes affected by folder changes
sent by the server (for delete, the parent; for add, the parent, unless
top-level; for change, if the parent changed, the old and new parents)
* Add utilities to flag the start/end of folder sync, so that we can fix up
mailbox parent key/flags if the process was interrupted
* Add a check for mailbox consistency each time around the folder sync loop
and the ping loop
* Unit tests for various cases; at the moment, folder changes are simulated
via direct calls to the wrapper/utility
* TODO: Use FolderSyncParser for unit test cases instead of the simulation
* TODO: Unit tests for start/end/check utilities

Bug: 2028418
Backport of I556f44724ed4f6f9cff32d7bc084218ffcbbae5f

Change-Id: Id89b51599a671bdc6df6cbe9f3887be001618c6b
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
a76ee25c71ea2c4a7cac944c512f217b200a5093 23-Feb-2011 Marc Blank <mblank@google.com> Send proper callback status for sync failures

Bug: 3366171
Change-Id: I1e801a28dd4f4b102f46593273c5c737479313c6
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
6e34ebee26a42e956dc273134a4326b6fb0c5788 18-Feb-2011 Marc Blank <mblank@google.com> Don't start GAL lookup for account in security hold

Bug: 3399183
Change-Id: Id25e63dd8b40a9413cee755c2932f62554dae069
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
220686b40eb4cdeed35b1035dc3ad79842e4ce6e 25-Feb-2011 Marc Blank <mblank@google.com> Prepare for separate Exchange application

* Remove reference to certificate in Android.mk (the certs will
be derived from the directory, i.e. Exchange vs ExchangeGoogle)
* Remove sharedUserId and process name from manifest
* Change loadAttachment to use AttachmentProvider to open attachment
files for writing
* Always retrieve deviceId from Email app

Bug: 3442973
Change-Id: I70ddb4d2971e481b0d4def09944e54d23ef431ec
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
c8e4352ea6cfa67f15140512e84af8ccede222d2 15-Feb-2011 Marc Blank <mblank@google.com> Separate Exchange application

* Clean up AndroidManifest, Android.mk, and proguard.flags
* Refactor to use emailcommon
* Remove Email app code/resources (note: this CL starts from the
single Email application)
* Update Exchange unit tests to use EmailProvider "live" and
clean up after itself
* All unit tests pass

Bug: 3442973
Change-Id: Iced00ae546dd4ddb9a66e297d3ac2dc2977e20eb
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
e281e4f35d0e2f728e69e380692e244319b0d21b 09-Feb-2011 Marc Blank <mblank@google.com> Email split, part deux: PolicyService

* Split PolicySet from SecurityPolicy and move to emailcommon
* Define PolicyService that sync adapter services can use to
interact with the Email DPM administrator
* Implement PolicyServiceProxy for exchange
* Implement PolicyService in email
* Modify imports, references, etc. as required

Bug: 3442973

Change-Id: I92015e21f780a68754b318da89fbb33570f334a2
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
58dac270fd3a2fb1ff6cb5287ef9b61ea5080e41 09-Feb-2011 Marc Blank <mblank@google.com> Email split, part one: EmailService

* Create emailcommon package
* Move EmailService classes to emailcommon package
* Change references to aidl's to emailcommon package
* Add getApiLevel() command to EmailService

Bug: 3442973

Change-Id: Ic7d2115363cdff6ebb86c46650b0a5b2109b1c72
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
883a5c77034a3b839127167bc20d05830c8350fb 19-Jan-2011 Andy Stadler <stadler@google.com> Properly handle unsupported encryption policy

* This fixes the case of:
* a device that does *not* support device encryption
* connecting to an account that *does* require device encryption
* but also supports "non-provisioned devices" (making the encryption
requirement optional.)
* Added unit test

Bug: 3367191
Change-Id: I894e68c4119a102dad02d2e0815fccdae1e87189
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
5ae89886a6260783e269c54e19b94e919dd2ee32 15-Jan-2011 Marc Blank <mblank@google.com> When syncing folders, read all data first, then process

Bug: 3353035

Change-Id: I80212b225eae48d0351f47f0d601f77578d2fc96
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
feb60882fdf4ea57d65717b55c265e91dae9f9ce 31-Dec-2010 Marc Blank <mblank@google.com> More correct fix for EAS message list callback issue (3251757)

Bug: 3251757

Change-Id: I879a97e343e9522c7c11e10a1bdd3915fc6dbaac
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
733b1964dc192d57a856dd5b7c180afa9caa066e 21-Dec-2010 Marc Blank <mblank@google.com> Distinguish mailbox requests that are user requested

Bug: 3251757
Change-Id: Ie417ebf44c8b740db88e5854077782930359a958
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
4824be85422975124ee5296bcbc6403be3d206ec 03-Dec-2010 Marc Blank <mblank@google.com> Revert "Workaround for improper timeout for Ping commands"

* The underlying bug was fixed by bdc in I080147b017b961502b3ba98d40841fea679491eb

This reverts commit 9166aa46da96d179b5124d96babf9a34c8e1d619.

Change-Id: I51e7e585e7b1624cc2b08ea81baba6f2602a76cf
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
a7faafa9b7d64164aea98ae524ddcb79171dc798 02-Dec-2010 Marc Blank <mblank@google.com> Don't send CONNECTION_ERROR in reloadFolderList callbacks

Bug: 3249051
Change-Id: I4c06f59a644cce979c52e0578c025eb71c781fdc
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
a0b721a99173a68d9167039d5610f0802b040358 02-Dec-2010 Marc Blank <mblank@google.com> Workaround for improper timeout for Ping commands

* We're seeing our ping timeouts complete after 30 seconds (although
set to 5-17 minutes), due to the fact that our reused sockets are
not having their timeouts reset (i.e. they use the original value
of 30 seconds from when the socket was first created)
* Until the underlying issue is resolved, we'll avoid reusing
sockets for Ping commands

Bug: 3241899
Change-Id: I90b53c0d28b866a91507efafacbb3c4c0df2324c
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
08d768ea78d85b949a173fb2a65e0633d6f87ec8 01-Dec-2010 Andy Stadler <stadler@google.com> Add password expiration plumbing

* Set aggregated expiration values with DPM
* Fix min/max logic when aggregating, and fix unit test
* Add expiration tests when checking if policies are active
* Add expire-password to uses-policies set
* Handle password refresh (clear notifications and sec. holds)
* Handle password expiration (warning and/or wipe synced data)
* Unit tests for provider-level methods
* Refactor common security notification logic
* Placeholder notification strings (need final)

Bug: 3197935
Change-Id: Idf1975edd81dd7f55729156dc6b1002b7d09841f
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
985fd7accbbe517e7d1af971dfd256935f8a53f3 29-Nov-2010 Marc Blank <mblank@google.com> Add watchdog to AttachmentDownloadService

* Detect attachment downloads that have stalled and restart them
* Catch a couple of cases in which we weren't sending callbacks

Bug: 3122242

Change-Id: Id2bfd3b26182004b301cf8665f4feb6e62b98b73
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
1d578546f589b55f8c6873772f25b016945ac4c4 29-Nov-2010 Marc Blank <mblank@google.com> Make sure we send callbacks for UI requested syncs

* In the case in which a sync was requested during an already-running
sync, we weren't passing the request information into the service

Bug: 3143544
Change-Id: I098161830844f604e4aa5b9c067491d2777d78c3
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
54ca4d97c7c0955b902bea9eb2aa1cd54d435878 19-Nov-2010 Marc Blank <mblank@google.com> Use consumeContent() to ensure release of HttpClient resources

Bug: 3197531

Change-Id: I7376b438edb05411950249bbf34cffa3ad8cb5a7
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
6f898deac953e5838fa28f47a16e0fb92bbc81eb 16-Nov-2010 Marc Blank <mblank@google.com> Implement password expiration for EAS

* Hoist wipe() method from AbstractSyncParser to AbstractSyncAdapter
* Add deleteAccountPIMData(accountId) to the EmailService API
* Implement deleteAccountPIMData for EAS

Change-Id: I1037cde25fc2b24419f399446cfa0906dc0174d1
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
ee54efdb6e7caac88437dbb9f02737f8d44c3b8a 11-Nov-2010 Marc Blank <mblank@google.com> Revert "Reuse mailbox cursor unless boxes have changed"

This reverts commit 6c3fa18356e3a050be89af32ae0d8c7b1b2097e0.
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
bfbd6fa021ab8fcb8cb69bc3a0604b7b43e5c121 08-Nov-2010 Marc Blank <mblank@google.com> Reuse mailbox cursor unless boxes have changed

Change-Id: Ic91b1d7bd72e9faf04d3448c1e194663db2c889a
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
16c1f8224d1334224f53d330bcb5d2ed0892fc2b 03-Nov-2010 Marc Blank <mblank@google.com> Send sync start/finish callbacks in pairs

Bug: 3143544
Change-Id: Ifb8c3c4c12e32df6a7d058446a0279c26048e0f3
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
cd020abdfc6a60d041d62d8348e9c4ead7780bd4 26-Oct-2010 Marc Blank <mblank@google.com> Only callback with sync error if sync was a service request

* EasSyncService was using the callback for all syncs, including
those running in the background. We really only want to report
back when syncs initiated by Controller fail...

Bug: 2239661
Change-Id: I7c4aceb74fe94ca38f5bdbbabe5dda62ccac60ec
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
39fd7f258e1ca1a8d83dd53aff6da3ebb5007456 19-Oct-2010 Marc Blank <mblank@google.com> Respect the RESPONSE_REQUESTED tag in meeting invite mail

Bug: 2639037
Change-Id: I4bd73f23ba270fa0ead72971b5a79d9db678a8dd
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
3e8f6373729ed72f7f1cdab951b3f9de275aaee6 11-Oct-2010 Marc Blank <mblank@google.com> Fix remote wipe with mobile sync server

* It appears as if our running multiple sync threads can confuse the
mobile sync server during a remote wipe (the server expects the next
client response to be an acknowledgment, whereas it might well be
a command or response from a different thread)
* To avoid this, we first put the account on security hold and then
shut down all other sync threads for the account
* After this, we send the acknowledgment and the remote wipe proceeds
normally.
* NOTE: It's possible that, due to the vagaries of multithreaded
operation, one of the other syncing threads could still send a non-
acknowledgment response to the server before our provisioning thread
gets a chance to send its acknowledgment. However, since the other
syncing threads will terminate (and not restart, because of the hold),
the provision/remote wipe/ack sequence will work on the subsequent
attempt

Bug: 2844888
Change-Id: Ib4ffbbc67b681e69176b6c1d5515fa80c7d1e121
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
07ac0fba502f3ef8ebcc724ace23b45e78fd422f 08-Oct-2010 Marc Blank <mblank@google.com> Make sure updatePolicies is always called during provisioning

Bug: 3055269
Change-Id: Ia266de108847923c01b5e0838a249aa9ee8f2d85
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
a11e0c0d45e4053824c72dc9042d9b76005da4a6 06-Oct-2010 Marc Blank <mblank@google.com> Fix issue w/ duplicated messages after move (to trash/folder)

Bug: 2994014
Change-Id: Ia223447f799ebd6490da2dc5caf1d1270b446a44
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
8f29d002c63fdd370e201ea92c532beac4e818e9 30-Sep-2010 Marc Blank <mblank@google.com> Provide better information w/ 500 error in EAS validation

* HTTP error 500 occurs with Exchange 2003 when the user tries to
authenticate with wrong credentials; we report this as "Cannot
connect to server", which is wrong
* Error 500 is supposed to mean "internal server error", but since
we know that an authentication error can cause this, we now put
up a better error message

Bug: 2933381
Change-Id: I9319a5ed6fbf4c92739f305b42b6b1cad7036a4b
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
fe81ae342918c8b5e8eb00c286c03b0e1f704e44 22-Sep-2010 Marc Blank <mblank@google.com> am 9b5c615c: am deed4505: Merge "Increase EAS command timeout from 20 to 30 seconds" into gingerbread

Merge commit '9b5c615ceea0270878a5b89fc0a063eeb9ffdd3e'

* commit '9b5c615ceea0270878a5b89fc0a063eeb9ffdd3e':
Increase EAS command timeout from 20 to 30 seconds
50152e46d2c45fffbe57e399774376a494e220fc 22-Sep-2010 Marc Blank <mblank@google.com> Increase EAS command timeout from 20 to 30 seconds

Bug: 3027271
Change-Id: Ic58fea147d179ffd18f28a8ce5d290a1b37302ce
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
5bb9fd2d7c145286d22adbe6e6e1b11d9ee5daac 03-Sep-2010 Marc Blank <mblank@google.com> DO NOT MERGE: Don't disable account box if sync freq -> "Never"

Bug: 2905667
Change-Id: Iec214b0fed093ff39dc70d5d821577bcf15f00ed
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
a5c0278475c336bc043f6e66b2c2323ac4c027f8 18-Sep-2010 Marc Blank <mblank@google.com> Increase EmailServiceProxy timeout for validation attempts

* Use 90 seconds (instead of 45 seconds)

Bug: 3008626
Change-Id: I31258a5fbcca1f489c8bf6fb2ed8f3dcad5d2e26
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
4f15001bdfd11c79524b4e44d60041967779e763 13-Sep-2010 Marc Blank <mblank@google.com> HTML support for EAS 2.5 email

* Load MIME data for these messages and parse, looking for a body either
in HTML or plain text or both
* If the MIME data had been trunctated and we can't find text, mark the
message as partially loaded and load the body text as we did before
(i.e. get the plain text body); this should be a rare case

TODO: Consider what is testable in the new EmailSyncAdapter code

Change-Id: I00a3066a373a0596431335593de356a4dda7f036
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
7307f7e5c2c4f85f6f3e0ebaf5775f65cba4b20c 15-Sep-2010 Marc Blank <mblank@google.com> Remove GAL lookup dependency on running ExchangeService

Change-Id: I4ff4017bcbb29862e07fde63e2ac01e3552ccd83
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
3bb795f3232db8a28e5ed1039267cb5a531f54e0 03-Sep-2010 Marc Blank <mblank@google.com> Don't disable account mailbox when sync freq -> "Never"

Bug: 2905667

Change-Id: I7052281a186534597702fa137a2ecfe8b1280575
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
469544cd1b9652c446c96b97f4abbdb65d7e06aa 01-Sep-2010 Marc Blank <mblank@google.com> Enforce a limit on GAL lookup responses

Change-Id: Id353758c1221d2f1097566e7becc8baacf7984d9
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
0209d8248a237f68b4ae6ed1917a6ea28d30eb32 31-Aug-2010 Marc Blank <mblank@google.com> Change EAS User-Agent to a constant String

Change-Id: Ie1efcbc1666bd9bc759aca8134eba21cb9e2467b
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
77382ac1a020285b838c7d86e409e2f6c12860a4 26-Aug-2010 Marc Blank <mblank@google.com> Add Android OS version to EAS User-Agent; update EAS version

Bug: 2953691

Change-Id: I2b2b16c7cb8950a644306b2aa25bcc53ab0c2731
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
385a0be662509754e687bcfa9813208b050bf951 27-Aug-2010 Marc Blank <mblank@google.com> Rename SyncManager to ExchangeService

* Updated comments and checked for 100-columns

Change-Id: I4ab5aaa9425714f8e035e1952db3fec63d498ae1
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
caf737ce6273f8156ce0dcbcbd6b90b811c2675f 27-Aug-2010 Marc Blank <mblank@google.com> Fix "move to folder" for both IMAP and EAS

* We were zero'ing the server id BEFORE the move, rather than
afterward; this is fixed in the current CL

Change-Id: I4a5f2b2de5794a110a8f657c80dfeac4955b5909
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
4471a6960d352242cc65bddf7888cc5335840c74 24-Aug-2010 Marc Blank <mblank@google.com> EAS implementation of "move to folder"

* Handle errors cases appropriately

Change-Id: I16060cc5c4fc648c299a2fa8f9f57d9aa5c37f56
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
b20a744b01fef0082b106f44612a3d0fec361800 24-Aug-2010 Marc Blank <mblank@google.com> Change EAS request implementation to use LinkedBlockingQueue

* Make sure that requests added during sync() aren't missed

Change-Id: I20a7788f3695ef6a99642240230f0d004f034f44
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
6f61d1668fe8cae1bf01488ea4752a51d48fbb58 10-Aug-2010 Marc Blank <mblank@google.com> 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
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
d156c9a3b03da6ed6324efde9e0283018f3bdcf2 29-Jul-2010 Marc Blank <mblank@google.com> am a95e40df: am 4f12c25e: am 05b0bb56: Release held mailboxes after policy refresh

Merge commit 'a95e40df2f4c6c17e53a438e1229199d823efca6'

* commit 'a95e40df2f4c6c17e53a438e1229199d823efca6':
Release held mailboxes after policy refresh
e5987a354240977e8daa094fe0638531cbbf7162 23-Jul-2010 Marc Blank <mblank@google.com> Release held mailboxes after policy refresh

* When a sync fails due to a provisioning error (on initial sync
or after policies are refreshed on the server), sync mailboxes go
into a "hold" state until the security error is resolved. Meanwhile,
the account mailbox handles provisioning. If this is NOT successful,
we put a hold on the account and go through the UI steps of setting
up security on the device. When this is done, we release the hold on
the account, which releases the hold on the mailboxes.
* If provisioning IS successful, however, a refresh of the existing
settings would be an example, we do NOT release the adapters, and
this is the bug we're seeing.
* This CL simply causes any held mailboxes in a successfully provisioned
to be released from the hold

Bug: 2865623
Change-Id: I59e780e9bd4ea908182b786dfd0e5851f5bf5f3b
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
6395f3dba4bf2eeb71186103d33846bc2b8c9e28 15-Jul-2010 Marc Blank <mblank@google.com> resolved conflicts for merge of 84f7d07d to master

Change-Id: I62abe3b8aa31a1b551d0396e184b648c305033ec
2b9c021f20f1fd03587b08c9556f4a9062662580 14-Jun-2010 Marc Blank <mblank@google.com> Backport: Handle "Allow non-provisionable devices" properly

* Backport from master branch
* Send policy key of "0" when validating; this gets us the policies
even if "Allow..." is enabled (currently, we simply don't see the
policies)
* If we don't support all of the policies, send back the response
code indicating support for partial support. If we get a positive
response back, then we're good to go - the server allows devices
with partial support. Otherwise, we fail as we always have - with
the toast indicating that the device doesn't support required
policies
* Remove PolicySet.isSupported() and ensure proper field ranges
within the constructor
* Update tests as appropriate

Bug: 2759782
Change-Id: Ida5663a9b35c75ecc61a5f442be0bd60b433cb73
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
1b5ae20491783b1761a5a2747427f4b99ae5e16e 13-Jul-2010 Marc Blank <mblank@google.com> Handle correction of rejected Ping heartbeat

* Handle status 5 for Ping command (heartbeat of out range)
* Write unit test for heartbeat reset

Bug: 2834195
Change-Id: Ic7952a4b296cf15c6ba895d6579fe7956b171e5b
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
5aec61dc15c62cff0cf55a3d6cb483f9e338230a 14-Jun-2010 Marc Blank <mblank@google.com> Preliminary GAL/Contacts integration for EAS

Change-Id: I9997ac96f83f427c71caf12d591ba6069bedf935
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
8eeede0d74ba2b139ce96d883541f12a562cc17e 28-Jun-2010 Marc Blank <mblank@google.com> Fix problem with unencoded data in URI sent to EAS

* We need to encode the itemId and collectionId for SmartForward and
SmartReply
* Add unit test for the fix
* Small change + test to EasSyncService usage of URI encoding to use
a non-deprecated method

Bug: 2787725
Change-Id: I428b308b56cc359b8cdd9e42bc3f42c65b6797dc
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
7b4c3ab965df57afdcddc5bce109467458c409f4 02-Jun-2010 Marc Blank <mblank@google.com> Streamline security setup flow

* The setup flow is changed such that the user is asked to activate
device administration before leaving the setup flow, rather than
having to wait for the notification to appear, etc.
* Accounts requiring security are created in a security hold state
to prevent initial sync until device administration is active

Change-Id: I7e33cf98466370ae27414b99018f7aee71e9e237
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
cb5c48824628e93e98ca24edec46f05c54851af1 23-Jun-2010 Marc Blank <mblank@google.com> Fix GAL search in EAS 12.1

* We weren't sending the proper protocol version to GAL search, which
causes errors when using 12.1
* The simple fix is to send the agreed upon protocol version, instead
of the default (which is 2.5)
* Replace parsing of protocol version with lookup

Bug: 2793588
Change-Id: Ib2a255d8467004ce985d2d688b37066e1e09d78a
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
808e6cfb9f53bff350570a2d77c5477a9c212f15 23-Jun-2010 Marc Blank <mblank@google.com> Handle empty sync responses in EAS 12.1

* Return normally, changing PUSH boxes to PING, as required

Bug: 2787463
Change-Id: I3413b99ff8e41f68dd3b3a09f14b9e8f194ad362
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
7dde8276e9e168d933ebfdb86b4f2d8ec5d7b872 14-Jun-2010 Marc Blank <mblank@google.com> Handle "Allow non-provisionable devices" properly

* Send policy key of "0" when validating; this gets us the policies
even if "Allow..." is enabled (currently, we simply don't see the
policies)
* If we don't support all of the policies, send back the response
code indicating support for partial support. If we get a positive
response back, then we're good to go - the server allows devices
with partial support. Otherwise, we fail as we always have - with
the toast indicating that the device doesn't support required
policies
* Remove PolicySet.isSupported() and ensure proper field ranges
within the constructor
* Update tests as appropriate

Bug: 2759782
Change-Id: I5f354a0e2d81844aff75d8a8a6de3b97f0020c1f
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
98e10b617c8a7110359b77a3ce6ef785255ec698 10-Jun-2010 Marc Blank <mblank@google.com> 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
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
450dd050b8c23e2bd5c4288490d24d7ca69a7269 10-Jun-2010 Marc Blank <mblank@google.com> 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
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
b8afe40f071ce141093ecb8b5e2b3446935a8a68 20-May-2010 Marc Blank <mblank@google.com> 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
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
e7d9602fce0d4b404d68716da7eb0567da9dad47 27-May-2010 Marc Blank <mblank@google.com> Implement basic EAS 12.1 functionality

* Support required protocol changes
* Handle new security policies based on current device capabilities

Change-Id: Id1d629d41d957911344e6c503d28418f5e7e1386
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
515283c2e896245b50f53b09700628be44929423 21-May-2010 Marc Blank <mblank@google.com> Fix problem w/ sync of large calendars (never syncs)

* While working w/ Microsoft on this issue, we determined that Windows
Mobile 6.0 does not suffer from this issue; when we compared our
logs with those from the WM client, we noticed a difference in the
commands being sent to the server on initial sync (we send some extra
options whereas WM doesnot)
* As an experiment, I removed these options from the initial
sync, and this change solved the problem with a persistently unsyncable
account (time to receive: 60-70 seconds vs. > 240 seconds).
* The fix is to remove all "options" from the initial sync for a given
collection (i.e. with SyncKey=0)
* Note that Microsoft's documentation does not generally address the issue
of what should/should not be sent in an initial sync command

Bug: 2569162
Change-Id: Ib20ea56fb380ee8c9a01b139f7fa98b7ff505e7a
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
e489e48b50bf8a44ddeccd12efa029f8a7b5f85b 21-May-2010 Marc Blank <mblank@google.com> Fix problem w/ sync of large calendars (never syncs)

* While working w/ Microsoft on this issue, we determined that Windows
Mobile 6.0 does not suffer from this issue; when we compared our
logs with those from the WM client, we noticed a difference in the
commands being sent to the server on initial sync (we send some extra
options whereas WM doesnot)
* As an experiment, I removed these options from the initial
sync, and this change solved the problem with a persistently unsyncable
account (time to receive: 60-70 seconds vs. > 240 seconds).
* The fix is to remove all "options" from the initial sync for a given
collection (i.e. with SyncKey=0)
* Note that Microsoft's documentation does not generally address the issue
of what should/should not be sent in an initial sync command

Bug: 2569162
Change-Id: I69642cc0097296956029485abb85ac750303c865
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
8efd25be4e1db3c0c79aae2ca1b4664b21bb410b 19-May-2010 Marc Blank <mblank@google.com> Allow limited looping requests in sync

* Microsoft has documented cases in which the server can continue to
send MoreAvailable=true even when no new data is received. This
can cause looping behavior, which we stop when we recognize it.
* This workaround, however, can prevent the situation from resolving
itself, and lead to delayed sync (up to a few hours has been noticed)
* In this limited CL, we allow the sync to loop up to a maximum number
of times before stopping it forcibly.

Bug: 2685984
Change-Id: I85981b85b71c4e7d53e69da2520543e8ef04c889
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
f94231ce89ee12a29a9ab9601445fd820bef81d0 19-May-2010 Marc Blank <mblank@google.com> Allow limited looping requests in sync

* Microsoft has documented cases in which the server can continue to
send MoreAvailable=true even when no new data is received. This
can cause looping behavior, which we stop when we recognize it.
* This workaround, however, can prevent the situation from resolving
itself, and lead to delayed sync (up to a few hours has been noticed)
* In this limited CL, we allow the sync to loop up to a maximum number
of times before stopping it forcibly.

Bug: 2685984
Change-Id: I2913b7e3438f6180c3c440508fab892176a06540
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
1d7c38cd7be83e124b0c7e952b85234d4ee64f47 13-May-2010 Marc Blank <mblank@google.com> Test for NPE in EasSyncService during alarm() call

Bug: 2681197
Change-Id: I1795f81ef5a41440fa6fa17f278562fc076dff3f
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
83ffeefe6055b946692ff36ff17eea40ba6c423f 14-May-2010 Andrew Stadler <stadler@android.com> Try autodiscover with bare name if we get 401 with address

* Some autodiscover servers appear to require the bare user name
for authentication rather than the user's email address. This
is apparently common for complex organizations maintaining a
group of email domains
* If we get a 401 when trying to connect to an autodiscover server
using the email address, we try again using just the bare name

Bug: 2682833
Change-Id: Ia07ca336e189069d4f3539e2245b3d53c82e3324
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
ce6e547c3bf65ff7c06c14e09aeb871e9fa55f0b 13-May-2010 Marc Blank <mblank@google.com> Server sending unsupported policies will cause NPE

* Add null check after trying to create a PolicySet during
provisioning.

Bug: 2683220
Change-Id: If20adbd4287b291e6470591fd2c3ac1f69ad2355
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
9b0ebbbe8e94b8da8b95ef4a84d76ab1e8f6a676 28-Apr-2010 Marc Blank <mblank@google.com> Remove STOPSHIP debug code

Bug: 2638014
Change-Id: I10a7ac89cce68ae1db146eb9bed574c00386ba62
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
5660b2e69436f2839de0659ada4880570c02b4a6 28-Apr-2010 Marc Blank <mblank@google.com> Allow more time for HttpPost watchdog timeout

* The current timeout is triggering more often than it should, which
causes delays and inefficiency. Increase it from 10 to 30 seconds.

Bug: 2615293
Change-Id: I54b74cc7ad9f1c8286af49b957584670c071640c
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
5b4baf900a589e0ed00289631f6d0e1f85a95ecd 24-Apr-2010 Marc Blank <mblank@google.com> Improve sync thread alerting mechanism

* When a sync thread triggers an alarm by failing to return from
an HttpPost beyond the socket timeout, we call abort() on the
HttpPost to force it to stop
* It appears that there are cases in which this is insufficient,
and the thread remains hung in a blocked state
* The result of this failure is to prevent the syncing mailbox from
ever syncing again, and is typically seen by a failure to receive
new mail (as reported in the referenced bug)
* In this CL, we add code to wait for 10 seconds after calling the
abort() method. If the HttpPost is still hung, we interrupt() the
thread, and have SyncManager release the Mailbox, so that another
thread can be started.

Bug: 2615293
Change-Id: I6a48195fc68bb950126006326a5b30448d3bbb63
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
2675dc0ccc3bebaae73900c3446b2c6c08e40eef 24-Apr-2010 Marc Blank <mblank@google.com> Tweak NAT timeout behavior

* Change "broken pipe" behavior to simply run through the ping loop
again, rather than be treated as a NAT timeout

Bug: 2615293
Change-Id: I67c3200f148a8c2beda58f812c29af8a726a4b9c
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
4ea0f8f6310f68c327ca8f219301eecabedde27a 22-Apr-2010 Marc Blank <mblank@google.com> Add additional test for likely NAT timeout

* This prevents unnecessary delays in receiving push mail
* At present, there is a likely 5 minute delay on receiving new pushed
mail on the network displaying the behavior we're testing for

Bug: 2615293
Change-Id: Ic42e576fa683790f96434fcbad5ee873d0730f6d
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
2b82632e75c2154ab3eda63fbfb00f6236a297dd 17-Apr-2010 Marc Blank <mblank@google.com> Add admin check before trying a remote wipe

* The code assumed that if we asked for a remote wipe, that it would
be executed. This isn't the case, however, if we're not a device
admin at that time
* Test for Email app as device administrator before trying remote wipe

Bug: 2603931
Change-Id: I09dcff00e77bcf1e40c742c9dee923e6e07eecae
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
7726978228698ed6ee155723065b3c06a880ebe2 16-Apr-2010 Marc Blank <mblank@google.com> Speed up provision notification after security failure

Bug: 2591899
Change-Id: I038e0b96f03c7dd24e11ee36f3c9464c84fb2930
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
9e029e58959e581637a1288a1ff9ef44cad63576 14-Apr-2010 Marc Blank <mblank@google.com> Try a longer timeout for initial sync

* We are still seeing an issue with at least one user on initial
calendar sync.
* Increase the read timeout a great deal for initial sync, as it
can a very long time for the server to respond

Bug: 2569162
Change-Id: I495c38dc58d9a80c5a21e40b6fc5d165d10a3c1a
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
2ca2e1caef16fde39df2c795ac4c9477f9a8c6d9 13-Apr-2010 Marc Blank <mblank@google.com> Fix acknowledgment of Exchange remote wipe

* The XML acknowledging the wipe was malformed

Bug: 2589695
Change-Id: I24428a21ce5b08f32c372dcbb50b24d6e6c42645
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
16b445cd6c4de57ae144fe76449ac6953333f0e9 12-Apr-2010 Marc Blank <mblank@google.com> Increase timeouts for Exchange sync; prevent early upload sync

* It's reported that 50% of third party users have issues syncing
Calendar in Exchange
* In testing, it was determined that the server takes > 30 seconds
to respond to a sync request initially, which is beyond our timeout
limit
* Also, I found that the system SyncManager was trying to trigger an
upload sync at the same time (i.e. before the sync session was
established with the server)
* There are four changes here:
1) Prevent upload syncs while the sync key is null or "0" ("0"
is the initial state)
2) Increase timeout for connection; at worst, this will
cause a short extra delay in syncs with a bad connection, but this
will be unnoticable to users
3) Increase the read timeout for initial sync to twice that of
regular syncs (the initial sync always seems to take longer)
3) Reduce the lookback for calendar to two weeks (from one month);
this is a better default anyway, and it probably reduces the server
and client load a great deal
* Empirically, this solves the bug for a known completely repeatable
case.

Bug: 2569162
Change-Id: I36b1c3e1e0b65f50d42e05f1830fed912191651f
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
95fcf9c6db1886fdd0d3f98259671cbe3f7ec0d5 11-Apr-2010 Marc Blank <mblank@google.com> Only allow the account mailbox to attempt provisioning

* We were allowing all sync services to attempt provisioning, but this
could potentially lead to a race condition in which two different
policy keys are created on the server (this is speculative)
* Change to allow only the account mailbox to attempt provisioning
* Log policy keys when verbose exchange logging is enabled
* We'll see if this solves the referenced bug

Bug: 2569162
Change-Id: I36c60098a4866882a8f9f4c288da54ea378d9aee
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
b25739e9cf48fb450a6906d8f82ddd58a8ade40c 10-Apr-2010 Marc Blank <mblank@google.com> Check for active device admin before each ping loop

* Accounts that require security need to check that the Email app
is still an active device admin from time to time
* Add a check for this before each run of the ping loop

Bug: 2583282
Change-Id: I1491821b7d0c1a341b1fe7ef1002c8b21aed12c2
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
7b377bf23e53f2fda5c7c0f19ddf2f9d1096945e 09-Apr-2010 Marc Blank <mblank@google.com> Fix GAL lookup for provisioned EAS accounts

Bug: 2582551
Change-Id: I316a2f9105ae4c693c401ad5e79922f4de1881b6
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
806339045480c09fe7c964ba46531c03b34f6890 04-Apr-2010 Marc Blank <mblank@google.com> Fix remote wipe (which probably never worked)

Bug: 2567641
Change-Id: Iceeebbc5f5bb93d72ab349cc1c0a71c1bd5f5387
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
adf9fb5f9830ff7933ddc3066cefa5abb52a2773 04-Apr-2010 Marc Blank <mblank@google.com> Add timeout/watchdog to autodiscover network calls

* Split out network operations w/ timeout and watchdog from send HttpClientPost
* Use this in autodiscover calls
* Add logging to help debug this issue, in case there are additional problems

Bug: 2568077
Change-Id: I2a2e1abca2c4dab02c8e04c304f67db2a7b4cb22
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
5aaa361db58bf40c46455b299aa284b97bdd243c 03-Apr-2010 Andrew Stadler <stadler@android.com> Improve handling of unsupported security policies

* If the server asks for more than we can support, don't throw
and error from PolicySet creation. Let isSupported() do that.
* Overlong password lengths cannot be supported and isSupported is false.
* Overlong timeouts & max wipes can be reduced to supported
amount (this actually increases security) and isSupported is true.
* Clean up an obsolete comment
* Unit tests

Bug: 2567804
Change-Id: I2d664a7f2a315b9f9bdcb867fe2cd98f74de6f66
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
9972a855025df83129b9c7de4010024188219bd3 31-Mar-2010 Marc Blank <mblank@google.com> Make serializer logging respect user's debug setting

* We now check that the user has verbose debug logging on
before spamming with serializer logging

Bug: 2561834
Change-Id: I5eda2ca5f16cde728b0febaa990d66fc99bb93a0
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
6137d3f2ce68db51926a5e33bf1f57e49bcf8a31 29-Mar-2010 Doug Zongker <dougz@android.com> relocate android.util.base64.* -> android.util.*

b/2553469 - API REVIEW: android.util.base64

Change-Id: I5394427a8e2c94b87ca45a533e417f7088a69f8f
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
114f17e8efea93380680417af4503c8e6820c394 26-Mar-2010 Marc Blank <mblank@google.com> Synchronize access to our cached account list

* The recent change that moves our account change handling out of the
UI thread caused ConcurrentModificationException's during account
creation
* We now synchronize all access to our cached account list to prevent
this

Bug: 2546724
Change-Id: I92b2becedd36a335a81f7e3bd9617f2923e00e6c
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
6e4eccde96c40935019800fb9034abbdce31aaf8 20-Mar-2010 Marc Blank <mblank@google.com> Handle other validation errors more appropriately

* Previously, we handled the error case for security related errors
* Add code to fail on ANY error, and in particular to recognize the
error in which an OWA server address is used instead of an EAS
server address

Bug: 2494110
Change-Id: Iab7df56e82f5ff73b1f58d386ec6f844db26a312
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
5ea28d42b2aee64747a35d8bf012afff1604bc4c 19-Mar-2010 Makoto Onuki <omakoto@google.com> Fix potential NPE with restoreMailboxWithId().

There are a few places where we don't do the check in restoreMailboxWithId,
but they don't look trivial enough for me to fix.

Bug 2530534

Change-Id: I77b37a87ef108048077f14c1e8a3457ee494100a
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
d5fadc87ea52aee033afd476369b29b29bfd434f 19-Mar-2010 Marc Blank <mblank@google.com> Handle EAS versions better

* Properly parse the server's supported versions
* Choose the highest server version that we support
* Fail with MessagingException if we don't support any server
versions

Bug: 2527408
Change-Id: I0a2822c8fab31a65c8fea9b78b4a8c23df1804a3
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
c5f958fb9eeafb267f23f2e25769d345be5b22ad 16-Mar-2010 Marc Blank <mblank@google.com> Add temporary logging to Calendar upsync

Change-Id: Ica4771fb2f6fbe125c7251c0cb4e2f5ecbe88dc3
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
a6bcdcbd31fc4a07ccba54e74ac4ca7e476262fe 16-Mar-2010 Andrew Stadler <stadler@android.com> GAL (continued)

* Clean up logging
* Clean up TODO's
* Clean up some unused code & warnings
* Bugfix: trim query string before calling provider
* Bugfix: use correct # for "First n results..."
* Bugfix: tie separator position tracking into cursor, to avoid
some concurrency problems when multiple cursors are in flight.

Bug: 2249514
Change-Id: Icf26599ecb9b27cbf88cd80e9abf4a3428598193
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
346afd9d453de9c15ba92b2af7a0e1b1146a9231 16-Mar-2010 Marc Blank <mblank@google.com> Send appropriate response email when reply from MessageView

* The code was hard-wired to accept (ancient placehold code)
* Send code that depends on the user's actual response
* Rename inappropriately named method in Controller

Bug: 2515961
Change-Id: I8985a3206fc8c4498521b08806a1093abaf4a42c
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
96bdc2bfdd4d316259380dfba37c4d22dab7aaa0 13-Mar-2010 Andrew Stadler <stadler@android.com> GAL support

* Provides GAL autocomplete in email address fields in message composition.

General TODO list:
UI: Implement divider in adapter, not in GAL provider
UI: Use listview_separator for divider
UI: Clean up strings, move all to resources
UI: Only have one GAL lookup in flight at any time
UI: Unit tests

GAL: Use side channel for status, not a row
GAL: Shorten timeout for interactive GAL lookup
GAL: Make watchdogs work
GAL: Figure out why some calls never return (conn pool exhaustion?)
GAL: Unit tests

Bug: 2249514
Change-Id: I513e25628bc2f5ed0920e0ee509cd598b1817b3a
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
b1ffc81c7e3ee9297133a7924092192998ab3839 07-Mar-2010 Marc Blank <mblank@google.com> Make sure that Ping success removes mailbox from error list

* We keep track of sync errors and have an increasing backoff for
failures.
* Make sure that a successful Ping (i.e. one that received a response
at the specified timeout) clears the sync error state for the
pinging mailbox

Change-Id: I35d188aa04618e7604bf6a7905e2ce6992ee3c54
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
c4bc56c4057d2d7596b75c60ee792676251804f5 06-Mar-2010 Marc Blank <mblank@google.com> Use watchdog alarms with mailbox syncs

* There are cases in which an HTTP POST can hang indefinitely; this
will eventually be caught, but it could be a long time until this
happens (I've seen hours)
* Set a watchdog alarm for all HTTP POSTs (rather than just PING)

Bug: 2492860
Change-Id: Ifccbb54c191c4164bb3188e0291490276bce25fb
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
e8ea6833e0541f0a0a3ceb1d78c84ac9ce359210 06-Mar-2010 Marc Blank <mblank@google.com> Stop pings when other syncs in the same account start

* When a mailbox syncs, pings should be aborted, or they appear to
end up timing out with a stale connection (observation from logs)
* The result of timing out is lack of push until the heartbeat time
has elapsed and our alarm triggers
* Also refactor code; some of the names of methods was unfortunate
and these methods were being used in this CL

Bug: 2492848
Change-Id: Ib626a5d3cf6d2c61e3b11f4886a3fedbf9727bfa
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
2ff60f148dfc0ea1b35168a01d8c48de5658e073 06-Mar-2010 Marc Blank <mblank@google.com> Persist pingHeartbeat after pingLoop finishes

* We weren't persisting the current heartbeat after the loop finishes,
so we'd end up starting next time with the default start heartbeat
* The new code is a bit more efficient, as we'd start the next pingLoop
with the heartbeat previously in effect

Bug: 2492854
Change-Id: I1d488e3eb05530c452605b25108b35af582e692f
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
9c300767e8f6ab7a700aa1064791e75ff1a0bf3d 05-Mar-2010 Marc Blank <mblank@google.com> Fix #2490068 (Exchange 2003 won't upload)

* It turns out that Events don't store null for empty fields like location
and description, but rather an empty string.
* Exchange 2003 doesn't like seeing empty values, so check for this before
uploading.

Bug: 2490068

Change-Id: Ib208f9d6ec116a99adf798939dfbc4d4bdd15edf
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
8e26c42accbaf72eff6694173496aba0e6aa37f6 02-Mar-2010 Mihai Preda <preda@google.com> Move parseDateTimeToMillis() to com.android.email.Utility.
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
aa288fe7ccbd28abcf990ce8337f2da677a1d370 01-Mar-2010 Marc Blank <mblank@google.com> Stop calendar/contacts sync in progress when sync setting is turned off

* Syncs in progress weren't checking the getSyncAutomatically setting in
the account; therefore, a long sync would continue running even though the
user unchecked the "Sync Calendar/Contacts" box in the settings
* Make the adapters check the flag each time through its sync loop (which
is currently 5 items); this should cause in-progress syncs to stop within
a few seconds

Bug: 2185319
Change-Id: Ie181f6de4219ecf27fff58ed59a277ae285622c5
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
094e6da9f5c5728eb10a3572717db2ba55718df3 28-Feb-2010 Marc Blank <mblank@google.com> Fix #2474554 (After meeting policy req's, no sync)

* We weren't retrying the initial account sync after policies are
successfully enabled. This results in failure to sync, as we
go right into a ping loop.
* Retry account sync after provisioning is first successful

Bug: 2474554
Change-Id: I20165a5941626b690710f82088d8d861679084b2
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
5c6e14ab2f2e4c5dfc97cdeaedcc105159a9f29c 23-Feb-2010 Marc Blank <mblank@google.com> Send replies to exchange meeting requests

* When the user selects accept/decline/tentative in MessageView, we now send
an email to the organizer, with an iCalendar attachment indicating the reply
* Added a unit test for the reply case, but more tests to be added to handle
other circumstances

Change-Id: Iff799d88a92b6546735bf4965b22febf3a82b56f
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
4f9719f9e1af38a85ec1d2a0df48e0836a2ff94e 17-Feb-2010 Marc Blank <mblank@google.com> Fix bug with meeting responses

* We were sending the wrong collectionId to the server, resulting
in a failure (status == 2)

Change-Id: I02ef4039a4ecfbc54ab5cdac2c36e39aea5d7170
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
85a57898618f48773884e8bc34ca1e8995cc3690 16-Feb-2010 Marc Blank <mblank@google.com> Fix #2321966 (handle EAS version upgrade)

* Add code to recheck protocol version at least once a day

Bug: 2321966
Change-Id: I938a23e1330b7ccfc2149c2988b53462f6a9d7d1
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
9cbd5664b81e31772377aa91cbbad29301e547ee 15-Feb-2010 Doug Zongker <dougz@android.com> use the framework Base64 instead of android-common

Change-Id: Ib4f75f66fe8acb1bb5de614bb10e8c938b1d27ef
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
b37fc8b9b5f8d1806252051b823bbd1e887f482c 11-Feb-2010 Marc Blank <mblank@google.com> Add support for Exchange 2003 provisioning

* Provisioning for Exchange 2003 and Exchange 2007 now supported
* Added end-to-end test of Exchange 2003 provisioning parser

Change-Id: I1f86f2909351a8220b963551cd33fecdf59a7e26
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
bbc1811956084987767779e31525c5013dab59d8 10-Feb-2010 Marc Blank <mblank@google.com> Fix ordering error in processing a provision request

* After receiving a provision response from the server, first check
for a remote wipe command, as this should always take precendence
* After that, see if the requested policies are active, and if so,
acknowledge them to the server
* Otherwise, indicate that we are blocked due to a security failure

Change-Id: Ie70fae18772f4e3161cf72132982e429c6548e48
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
2a53f1091aa5a9bb5ca5bc15c730c7e550745ac8 09-Feb-2010 Marc Blank <mblank@google.com> Release security holds based on flags; implement remote wipe

* When the UI indicates that security policies for a particular
account are now in force and releases the security hold (a bit
in the Account flags), we release any syncs that had been
waiting due to security errors
* Clean up code related to sync holds
* Add unit test for sync hold release
* Add support for server-directed remote wipe

Change-Id: I6209f75e4b57c850ae1ac27f407630c9c740514f
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
f78833e76c1decf3a4a1371040a16205d1e59312 08-Feb-2010 Doug Zongker <dougz@android.com> replace Email's private base64 class with one from android-common

Convert all usages of com.android.email.codec.binary.Base64 to use
com.android.common.Base64 instead, except for Base64OutputStream
(which doesn't exist in android-common yet).

Change-Id: I339a1f451245138187080c7444fcabef8d13f8aa
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
20da011530088036d2bf45d3836d6986a4b5d423 07-Feb-2010 Marc Blank <mblank@google.com> Additional work on EAS security

* Add more final plumbing for exchange security
* If policies are supported, we now check to see if they are active;
if so, we acknowledge this to the server, after which we are given a
final policy key which can be used for syncing

Change-Id: I5992c790294e35b5ec5343c7665e2e7fd31a75ca
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
8692940e9f576e7ebbb47f17abd2bc825e42c021 18-Dec-2009 Marc Blank <mblank@google.com> Initial implementation of EAS security

* This first implementation integrates with early CLs for
Email app integration with device security
* Check for policies added to validation process
* If the server has no policy requirements, there is no change
to the existing process
* We automatically declare a set of policies to be unsupported
if any are known to the sync adapter to be unsupported
(e.g. no attachments or password history)
* We call isSupported (PolicySet) to determine whether other
policies use values that the OS can support (e.g. password length,
inactivity time, etc.)
* Depending on whether the server's policies are unsupported or
supported, we throw the proper exception back to the caller

Change-Id: I704cb2151dd87f54c83c2aa23976a8ac8e2c501a
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
afb04a3af2f954affbca09cca462321f46349e00 05-Feb-2010 Andrew Stadler <stadler@android.com> 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".
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
fb7374e65f99b228be9b080597b0cfd7224e3858 05-Feb-2010 Andrew Stadler <stadler@android.com> Integrate policies into account setup process

* Rename SECURITY_POLICIES_REQUIRED to SECURITY_POLICIES_UNSUPPORTED
* Create new pathway for SECURITY_POLICIES_REQUIRED, making it advisory
* Cleaned up strings for account setup error dialogs
* Refactored AccountSetupExchange.onActivityResult() to split up the
three primary use cases, making them more readable.
* Always finish() in AcccountSetupAccountScreen, because it's usually
cleaner to return to the previous screen (enter username & password).
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
704cb199ced39727d84103c7170fc888a54f6c97 04-Feb-2010 Marc Blank <mblank@google.com> Fix #2415185 (Email disappears after a while)

* Exchange account validation tests security policies by sending a
FolderSync command and determining whether this generates an
error
* Unfortunately, we use the real deviceId when sending the command
and this causes the next real sync to fail such that all data is
wiped and reloaded (the bug)
* The fix is to use a false device id while doing validation

Bug: 2415185
Change-Id: Ibe577e36f770d737ba5952b347aa0d73bda3568a
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
28d918b477d9a6ab790e872aa4170b1ae566cf42 29-Jan-2010 Makoto Onuki <omakoto@google.com> Move non-exchange specific classes to com.android.email.service.
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
5862a85e17e81866ca82a9905577931947fbd44e 29-Oct-2009 Marc Blank <mblank@google.com> Implement Exchange calendar sync support

What should be working:
* Events sync down from server and appear in calendar
* Recurrences and exceptions appear in calendar
* Changed events on server should be reflected in calendar
* Deletions on server should be reflected in calendar
* Push of new/changed/deleted events should work
* Changes on device are NOT synced back to server
* New, single events on device are synced back to server
(no time zone, attendee, or recurrence support)
* Checkbox for syncing calendar added to setup flow
* System sync glue in manifest, etc.
* Bugs are to be expected
* A few unit tests; needs more

Change-Id: I7ca262eaba562ccb9d1af5b0cd948c6bac30e5dd
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
7531be7774769c84b499b1de5dc46da3a9468316 25-Jan-2010 Marc Blank <mblank@google.com> Handle Exchange meeting invitation responses

* Includes some refactoring of internal "request" code in SyncManager
* Adds Message flags to tag meeting invites and cancellations
* Adds meetingResponse method in EmailService
* Hooks into Controller and MessageView UI included

Change-Id: I4c5e10bccc4b41956b94d9dfa55925e5af030939
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
52f7f7effdd320594cd1c5c8c67443ad51eca3af 15-Jan-2010 Marc Blank <mblank@google.com> Fix autodiscover when attempted with Exchange 2003 server

* Make sure 403 error in autodiscover isn't treated as an auth error
(401 is used for that)
* Make non-auth errors in autodiscover fail silently (and move user
to manual setup)

Bug: 2374302
Change-Id: I4699bff70cf5ec4a513e6443e4817543c2ab2cef
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
4d14c368c1123394068c2f29caf7d3d04c56770a 18-Dec-2009 Marc Blank <mblank@google.com> 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
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
fa088c04714957a4ebcd02a588e09878bbf4dbd4 07-Jan-2010 Marc Blank <mblank@google.com> Make sure protocol version is always set in sync services

* A recent change caused an issue in which protocolVersion could
be null, resulting in an NPE
* Ensure that protocolVersion is always set to a valid version,
defaulting to 2.5

Bug: 2353859
Change-Id: I6e07ba3df5362c988658e401bebc1776a6780876
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
ddd7a7dabdd39feb3f769a3141eb4b0dd54db9e1 18-Dec-2009 Marc Blank <mblank@google.com> Add sanity checks in SyncManager and EasSyncService

* Prevent possible NPE's

Change-Id: I2b3c747609c6a87ec6060fd59006f2912dfcc591
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
54250c7c23b43b644961a8f241a3a3edcc9c796e 15-Dec-2009 Marc Blank <mblank@google.com> Fix potential NPE in earlier CL

* Noted this problem in reviewing a newer CL
* Fix is to add a check in setupService

Change-Id: Ia4d71365f8036aac8bf531b835b184dabfbc06fa
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
3852792f1c79dcfca6dc9be67f11e4a53788a462 10-Dec-2009 Marc Blank <mblank@google.com> Use correct EAS protocol version in Outbox (fixes #2319892)

* We inadvertently failed to set the EAS version in EasOutboxService,
so the default of 2.5 is used
* This works, but SmartReply/SmartForward were enhanced in 12.0 and we
aren't taking advantage of those changes
* The fix is to set the version using common code

Change-Id: I3b505448003f340681deeb8fb22e61e9dd8d10a0
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
2fc36123bfe4a3ee0f7d70052d49d08427c6d862 03-Dec-2009 Marc Blank <mblank@google.com> Fix #2300147 (mistakenly reporting connection error)

* When a mailbox sync is stopped intentionally (for example, if account
settings change), we report a connection error by mistake
* Handle this case properly, reporting "success" (i.e. no error state)
* Remove obsolete comment

Change-Id: I9bec1244267cd2240c369b9b7f905948381a0f91
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
eb9517c855a275880ac2cd4dbcca0d0a37b70567 10-Nov-2009 Marc Blank <mblank@google.com> Fix #2251837; better response when provisioning is required.

* Currently, we validate EAS accounts using a command that will
succeed even if we do not support required security policies.
* This causes a confusing "invalid username or password" error
when trying to sync with a validated account in the case that
there are, in fact, required policies
* The fix is to send a sync command after validating the user name
and password; a 403 error indicates the requirement for
security policies.
* When we see the 403 error, we put up a message that is appropriate
to the situation.

Change-Id: Ic40820253dca1f357297b2355ad987bc39d0775f
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
95e8381b688152dd60e0eda84aef3bfc14fd1672 29-Oct-2009 Marc Blank <mblank@google.com> Allow sync data to arrive via the chunked transfer encoding.

* Fixes #2216885
* The bug is that the sync adapters weren't set up to handle chunked
encoding, primarily because 1) I hadn't seen any servers use it, and
2) when we changed from HttpUrlConnection to HttpClient, support for
chunked wasn't added (HttpUrlConnection didn't support it)
* The fix for xml data is trivial, since the Content-Length returned in
the chunked case (-1) was being disallowed, but works perfectly well
with HttpClient.
* The fix for attachments is less trivial, but still straightforward.
* With this change, we are no longer dependent on receiving content-length,
which is highly desirable

Change-Id: Ie3bd6af0cf68f3afa190711d96b1dbd2e6341f79
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
f26cb0519df2ce1af2e103adce4555ebd640af45 30-Oct-2009 Marc Blank <mblank@google.com> am 1e1d7cb1: Merge change Ie2804ddc into eclair

Merge commit '1e1d7cb189e7ea7164d1335539d68d3d3ca8c0e5' into eclair-mr2

* commit '1e1d7cb189e7ea7164d1335539d68d3d3ca8c0e5':
Fix #2225869 (Regression in attachment loading / Exchange 2003)
42f47790b84483b15fdf4c7f53b283dd1d56d3fa 30-Oct-2009 Marc Blank <mblank@google.com> Fix #2225869 (Regression in attachment loading / Exchange 2003)

* The fix to bug #2191778 inadvertently broke attachment loading for
Exchange 2003 servers; the server responds with a 403 error (indicating
an authentication issue)
* All other communications with the server work properly
* We use a slightly different set of calls in the case of attachments (we
wanted to change as little as possible in the fix to #2191778) than we
do in the other cases
* The fix here is to use the same calling sequence for attachments that we
use elsewhere
* This fix has been observed to work on multiple servers, and in various
SSL scenarios (on/off, trusted/untrusted)

Change-Id: Ie2804ddcbfa2b10edff42f7a3811734c325e933d
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
3835cf4eb972576eb19326ba7f9098a30ff1811e 08-Oct-2009 Marc Blank <mblank@google.com> Server validates even though server address is wrong DO NOT MERGE

* Fixes #2173664
* Make sure that not only is the OPTIONS command accepted, but that
the server reports EAS versions and commands

Change-Id: Ic29d3eacfdc54d107600afc443964a1e8b3d5e59
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
22e927cc109f3668ef3cf2fe46feef273c7ba53e 21-Oct-2009 Marc Blank <mblank@google.com> Fix timing-dependent crash in Medium tests (#2202726)

Change-Id: I218079f24f1ce08d770624d1272e1d9a46c1be26
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
4c79acdbd8dc58f503a9be300b862a400c462f6a 19-Oct-2009 Marc Blank <mblank@google.com> am 55a97fc3: Fix attachment loading with "accept certificates" checked

Merge commit '55a97fc360ac549631af3aa3aad9833812674562' into eclair-mr2

* commit '55a97fc360ac549631af3aa3aad9833812674562':
Fix attachment loading with "accept certificates" checked
5bd8d6f8310305bce81071ade6ebdb42dbed6b72 19-Oct-2009 Marc Blank <mblank@google.com> Fix attachment loading with "accept certificates" checked

* Fixes #2191778 (P1/S1)
* Attachment retrieval wasn't using newer code to create its
HttpClient.
* Fix is simple, extremely safe

Change-Id: I65be27decae8719bbad8ac7dce1c1164de4371a5
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
e19f23f3ce05f18d621ab05d24b10fccd361e24d 14-Oct-2009 Andrew Stadler <stadler@android.com> am dee4e253: Do not trust server-provided content type for attachments

Merge commit 'dee4e25320c5154a5626446e1aa37f63ae97c48c' into eclair-mr2

* commit 'dee4e25320c5154a5626446e1aa37f63ae97c48c':
Do not trust server-provided content type for attachments
bcad014d88df037adddc60b242173d4439dfff6b 14-Oct-2009 Andrew Stadler <stadler@android.com> Do not trust server-provided content type for attachments

* Fixes a bug that caused some attachments to be labeled with the
wrong content type and thus unable to be opened by local apps.
* When the attachment code was written, MimeTypeMap had very few
entries, so we tried to get the mime type of Exchange attachments
from the stream when the file was read off the server. It turns
out that the server's idea of mime type is unpredictable
* In the meantime, MimeTypeMap has been fleshed out, so we really
do know the type in the vast majority of cases (and including all
common document types)
* The fix is to remove the lines related to reading the mime
type from the attachment stream
* Content type is set (properly) when attachment record is created. See
EasEmailSyncParser.getMimeTypeFromFileName() for details.

Fixes bug http://b/2182955

Change-Id: Iebb3de529df4548327d7112e1dedb3bd448462a4
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
6ca9dfb8cafb5534d8b4766044f9b7ad910f51f5 13-Oct-2009 Marc Blank <mblank@google.com> am 4e424a33: Merge change Ie093215f into eclair

Merge commit '4e424a33c29446d750790e360e43fb7c83ec0c6f' into eclair-mr2

* commit '4e424a33c29446d750790e360e43fb7c83ec0c6f':
Add truncation at 100k (EAS 2.5) and 200k (EAS 12) (#2184807)
895d1e3132622653160516d420231ed366ab411b 13-Oct-2009 Marc Blank <mblank@google.com> Add truncation at 100k (EAS 2.5) and 200k (EAS 12) (#2184807)

* Prevents OOM errors with huge message bodies

Change-Id: Ie093215f96a514b3a1bcd31aa1f5957d1ada7719
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
7e7d8f3d22eded30a72391ede85e511539ae2a26 11-Oct-2009 Marc Blank <mblank@google.com> am ea878be1: Make sure we hold WakeLock during mail sending (fixes #2180551)

Merge commit 'ea878be11729cd793d9183fc264118241cd5a5b6' into eclair-mr2

* commit 'ea878be11729cd793d9183fc264118241cd5a5b6':
Make sure we hold WakeLock during mail sending (fixes #2180551)
940d64c988589390353875bf1351818bd628cfb7 09-Oct-2009 Marc Blank <mblank@google.com> Make sure we hold WakeLock during mail sending (fixes #2180551)

* Don't runAsleep unless this is a Ping
* Relates to #2178288 in that it's possible that the system could
sleep while we're trying to send (not sure if this is possible;
will check), so we prevent it by holding a WakeLock in this case

Change-Id: Ib3f8786501b942e1cfcb7a0bbb07b8e3084e2a86
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
8f60657c61027536016ed9a26b0f1bcfb1b904ea 09-Oct-2009 Marc Blank <mblank@google.com> am 4b59cfc8: Fix problem with timeouts and sending attachments (#2178288)

Merge commit '4b59cfc8ed4054ffb5ad85cea8aba94a430cc2cb' into eclair-mr2

* commit '4b59cfc8ed4054ffb5ad85cea8aba94a430cc2cb':
Fix problem with timeouts and sending attachments (#2178288)
e4957f03ab45eeaaa895455de2f544c06852356f 09-Oct-2009 Marc Blank <mblank@google.com> Fix problem with timeouts and sending attachments (#2178288)

* Standard Exchange command timeouts are 20 seconds
* For sending, however, these need to be significantly longer to
handle the case of sending large attachments, as sending (of any
length) happens in a single HTTP Post command
* Having an infinite timeout leads to the (small) possibility of the
Outbox hanging for a long time, holding up the sending of other
mail, so we set a long, but not infinite timeout for this case
* Timeout now set for 15 minutes
* Prevent sync of Outbox and Drafts (the UI triggers these by changing
the contents of these boxes, but we need to ignore the pings that
are generated this way)

Change-Id: I5b830d6b4e94525d95138b2112be12898a37882e
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
3b5688726987b9dbf020a35e0f80e3460fb0d838 08-Oct-2009 Marc Blank <mblank@google.com> Server validates even though server address is wrong

* Fixes #2173664
* Make sure that not only is the OPTIONS command accepted, but that
the server reports EAS versions and commands

Change-Id: I15dccd1fbd06aa3cf2ba8fbbf72d20918ec44617
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
b9781ea88a58e746b74076ec499e9885e195acc9 05-Oct-2009 Marc Blank <mblank@google.com> Help with another push inconsistency edge case (#2131432)

* If we are forced to abort a "ping" due to a watchdog alarm, we should
handle this as a ping failure (which potentially changes the heartbeat)
rather than a garden variety IOException.
* This prevents the additional overhead of connection error backoffs,
which would only tend to increase the time needed to recover from the
error.
* In one case reported by Moto, this appears to be the behavior of a WiFi
router with NAT timeout. This fix will cause maximum delay for pushed
mail to be reduced in most cases.

Change-Id: I2b0e3b10d82762d20f63cac3ac4638a03f13f842
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
8d12fd6f9d0993a8eaf7777d57ad04d80dfd2dd1 02-Oct-2009 Marc Blank <mblank@google.com> Fix push failure edge case (#2161999)

* Unsafe (potentially stale) data was being written to the Mailbox table near
the end of each sync. It would effectively undo changes made to the
Mailbox in other threads that occurred while the Mailbox was syncing.
* In this particular case, changes to sync interval (push/ping/timed)
were being overwritten, which could cause push to get lost for as
long as 30 minutes (the pingLoop timeout when there aren't any
pingable mailboxes)
* Watchdog alarm was being set to wrong time (typo)
* Add extra user logging in case there are additional cases of push
* Only set sync status and time on successful sync
* Move ping error check into pingParser to avoid unnecessary sync

Change-Id: Icb4494078480ada39b7494b3abf380fb08858406
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
27cf341571fac3d8dbe866f503c34fc31e02bf85 30-Sep-2009 Marc Blank <mblank@google.com> Fix an issue related to ping loop errors and ping state; add logging

Change-Id: Ie6d16a8914205ddf63ae1929961279f66360eb89
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
2033dfc4e2e6e352b34565112266084d72c443f1 29-Sep-2009 Marc Blank <mblank@google.com> Near-final tweaks to sync timeouts and logging

* Tighten up user logging
* Send all HttpClient commands w/ watchdog to prevent
holding wakelocks too long
* Fix case in which no ping boxes are ready in which
ping loop would hang on to WakeLock indefinitely
* Release WakeLock for waits < 10 seconds, rather than
30s in SyncManager
* Improve logging of IOExceptions
* Log network status (at least until #2150976 is fixed)

Change-Id: I020b8a21c2c4f536d5b6df871f6b5c03fdc66ab8
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
252e460a92f91d9549a3b41376410f7ac7263db8 29-Sep-2009 Marc Blank <mblank@google.com> Fix sendPing to set proper ping timeouts

* We were setting the timeout and heartbeat to the same time,
which could cause mistaken timeouts
* Set timeout ten seconds after the heartbeat for now, and set
an alarm a few seconds after that

Change-Id: Ic2f7b44c9626ebbdd7a8821f53f7aaf6169f62c3
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
726d60d9b758f0383f8f8481190fc1a638427209 28-Sep-2009 Marc Blank <mblank@google.com> Reduce the sync window from 20 items to 5 (partial fix #2149029)

* This change trades off network time / overhead with time keeping
ContactsProvider2 busy
* The net effect will probably be to reduce some UI slowdowns while
syncing Exchange contacts, while increasing the time it takes to
sync those contacts

Change-Id: I56e2358698aa4c901cda4559f7a8f9117681f627
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
7310cbacf2cf614c949330faff3882082054c120 25-Sep-2009 Marc Blank <mblank@google.com> Run sync threads in background priority (helps with #2126515)

* Seems to improve UI responsiveness while doing large syncs,
but it can still slow down quite a bit

Change-Id: I539b8a9a96a922d810fba02ff4093759489a8153
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
74c196e6645cd5547c3ff2e7b6be377c00f1ca74 24-Sep-2009 Marc Blank <mblank@google.com> Add more ping logging to detect odd looping behavior in Moto log

Change-Id: I66f9789cf9ded590ec96b502c2f74f5d0ae5d17d
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
8a1fe23c8b305f3f401d3155ceebbb9a975cb7c2 21-Sep-2009 Marc Blank <mblank@google.com> Make sure we don't start account sync without push/ping active

* Wait for mailboxes to finish the initial sync while waiting in pingLoop

Change-Id: Ie1606e225261e071981cef0aab3bd623a360fc86
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
b49f0afcb09e0e06228e09059b3c8d9d48e1543d 19-Sep-2009 Marc Blank <mblank@google.com> Revert change to AccountManager naming; use email address again

* Forces wipe of existing accounts

Change-Id: I65d08e07a2d74f94f9142e85791d9bf49c100241
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
647aa5f1f229947d982548f698c4533fe538f884 18-Sep-2009 Marc Blank <mblank@google.com> Fix problem w/ SmartReply & SmartForward in Exchange 2003

* It doesn't like URLEncoded commands; go figure!
* Fixes #2127892

Change-Id: Ibae8cad990ed45accb6699716fda56f45c850939
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
0a72733f434a0161a227208a439bd4a426102657 16-Sep-2009 Marc Blank <mblank@google.com> Change AccountManager username for Exchange to the user's login credential

* This is not a backward-compatible change (sorry)
* Existing AccountManager EAS accounts and contacts are deleted
* Existing EmailProvider data is deleted
* Change works with new code (stadler) to avoid account duplication

Change-Id: Ife09c51fa714d91054d017b497bce603add5375a
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
5843b85178a359446f81770ed7734604a1b2fa7d 16-Sep-2009 Marc Blank <mblank@google.com> Fix EAS sending (#2122221)

Change-Id: I92ea4b1a77d96bf7992ea34026a2c5d30f33c317
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
85f44a524693fb6ede88b3b1e683ca7b493d5983 09-Sep-2009 Marc Blank <mblank@google.com> Implement SmartReply/SmartForward for EAS; fixes #2098779

* SmartForward and SmartReply are EAS commands that automatically
include the original message and, if a forward, all original
attachments, regardless of whether they've been downloaded to
the device
* Both commands improve battery life by sending less data; greatly
so for SmartForward if there are attachments

Change-Id: I12432cd5275a3b54e9a80d5cd59da437c4a086cc
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
7672d9eac8a70bae0a4310b7ae83f861992de853 13-Sep-2009 Marc Blank <mblank@google.com> Don't wait longer than 10s for ping boxes to be ready

* Do a short ping in this case, which at least will allow the device
to sleep while waiting
* Addresses #2116749

Change-Id: I9e70feaeef1361e1d66652dc66b92f6ee14751bf
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
7cf921b830554e52f88a45ca4a290b17d2a1b146 12-Sep-2009 Marc Blank <mblank@google.com> Don't sync if the "Sync Contacts" checkbox isn't set

Change-Id: I606f6c384fa34283ccee1eeaac90123347846f28
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
a02df6c9ec4f5dabf0d028d48c274092f9ef9c03 11-Sep-2009 Marc Blank <mblank@google.com> Fix connection failure retry behavior; don't try syncing w/o connectivity

* Also remove some logging and correct some erroneous logging
* Fix the backoff behavior on IOException

Change-Id: I5fb5a0bf73eaa681eb7b9c305c838e78e7ba88ab
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
1ec0390ce7c27890a46f877d858f7ac6b6a8920c 10-Sep-2009 Marc Blank <mblank@google.com> Change ping loop wait from 10s to 1s to reduce WakeLock use

* There is a better way of implementing this, which I'll write up in
Buganizer, but this will help our battery life testing

Change-Id: I2583f0cb9c62b38aee64166138385d7b14855832
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
e44d5875af006f4217718a1c0fc0e235af3863af 06-Sep-2009 Marc Blank <mblank@google.com> Rework EAS account creation & ssl operation

* Fixes 2048663, 2025029, and 2100131
* Add "Trust Certificates" checkbox in EAS account creation
* Use custom ClientConnectionManager for HttpClient with registry
for plain, ssl, and tssl (trusted ssl) connection
* Use a ConnectionPool for HttpClient connections
* Remove "Domain" checkbox in EAS account creation
* Remove tests related to the "Domain" field
* TODO Write a test for valid usernames (requires a bit of research)
<name>, <email address>, <domain>/<name, and <domain>\<name> are all
valid, but there might be others

Change-Id: I4a0338df5960bfd3d679a88aaf22d1c49f49992b
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
458c47296f7643342493de8feca5e89f33d0eccc 29-Aug-2009 Marc Blank <mblank@google.com> Fix some Contacts upsync bugs; add logging for serialization

Change-Id: I855a8ee3df520f53fc94866b8463d314cf800ca5
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
a05c26d8d2cce3faa152096cb8116fce375c6d81 27-Aug-2009 Marc Blank <mblank@google.com> Clean up onCreate/onDestroy methods for SyncManager

* Put most of onDestroy code into the run method of SyncManager's thread
* Clean up code for updating Mailboxes' SyncKey and interval
* Fixes 2080472

Change-Id: Ie16c851a686142d9fd1d810a942aa786690b1034
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
48af7392c82262d17700e3fbdccf3a582809d449 24-Aug-2009 Marc Blank <mblank@google.com> Add initial support for uploading new Contacts to Exchange server

* Refactor the sync adapters to separate out parsing from commit
* Use ContactsProvider to save the SyncKey for contacts
* Fixes #2072664 and #2072456

Change-Id: I1e85c498496e83d9523489636a75f366f7fbd106
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
1431215b5fc40d0d6498b0fe602ad4d1b8a66ff3 23-Aug-2009 Marc Blank <mblank@google.com> Fix a few sync-related bugs:

* Don't leak the receiver registered by AccountManager for updates
* Only restart dead threads if they aren't logged in the syncErrorMap
(to prevent looping behavior as seen in bug #2072456

Change-Id: Id1b4c53ef8b721bf8bfa8426627fd76831864c70
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
f3ae2f9ee2ced1afc5cac4ebad125161726b6c0b 20-Aug-2009 Marc Blank <mblank@google.com> Implement sendMessageStatus callback in EAS

* Change API for callback to include message subject (when msg is isn't valid)
* Update users of callback to add the new argument
* Use API in EasOutboxService to send status messages back to the UI

Still TODO: Add relevant error codes for sending problems that are not related
to connection or login issues
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
7ad79c00d01a68cc0874b5fcae7c487c88b39748 19-Aug-2009 Marc Blank <mblank@google.com> Fix message sending from EAS (the service wasn't properly set up)

* Cleanup of EasSyncService
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
1403386ebffa1b6093a506a6a24db4523acdc315 18-Aug-2009 Marc Blank <mblank@google.com> Make sure we log exceptions in FileLogger
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
4626078bf9d930b2007162db142b5961b38e2166 18-Aug-2009 Marc Blank <mblank@google.com> Have all mailboxes fall back reversibly on ping loop errors
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
1b06024587a4499bcf3f9005337e8f7cae5ffa26 14-Aug-2009 Marc Blank <mblank@google.com> Implement adaptive ping timeout; release wake lock waiting for connectivity

* Remove unused/duplicated classes (e.g. Base64, WbxmlSerializer, etc.)
* Code cleanup in AbstractSyncService, EasSyncService
* Remove last references to HttpURLConnection (using HttpClient now)
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
0a4d05f0d8753c67364f7167e62cea82aef9a81e 13-Aug-2009 Marc Blank <mblank@google.com> Cleanup; delete unused files, change log statements

* Two files were unused and therefore deleted
* userLog was changed to avoid using string concatentation until the logging
decision is made
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
9e93e3403ad25add433cb9d2cb0f8cb9154e57ee 12-Aug-2009 Marc Blank <mblank@google.com> Stream rfc822 messages to a temporary file, and send using an InputStreamEntity

* Removes the need to store the entire outgoing message in memory
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
f4ec9557c58b0c5918e3ae4cde23e1355dc0a2af 12-Aug-2009 Marc Blank <mblank@google.com> Separate syncInterval constants for Account and Mailbox to remove confusion
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
05381a6662f28609e8005023515abb82af00e1d4 12-Aug-2009 Marc Blank <mblank@google.com> Minor changes to ping variables &c
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
96293e01d2c94b7a811f06f56e5f115dd48bc03e 11-Aug-2009 Marc Blank <mblank@google.com> Use 5 minute ping time when connected via mobile (prevent NAT timeout)
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
0d88d88926b63042e68c4ea0dc67143ed00d52d0 11-Aug-2009 Marc Blank <mblank@google.com> Change PIM fallback sync to 30 mins; try ping again if changes are found
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
f9423affa52661c2f552df35f0b9ddeecd8fa8fe 11-Aug-2009 Marc Blank <mblank@google.com> Make verbose logging less verbose; add exception message to logging
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
c1e79c036cd2a40e8a6e66b8ea4d37d121d355ba 10-Aug-2009 Marc Blank <mblank@google.com> Push fallback per mailbox, rather than for entire account

* Also cleanup code, add comments, remove unused methods
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
77424af660458104b732bdcb718874b17d0cab3a 09-Aug-2009 Marc Blank <mblank@google.com> 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)
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
5c5b1184a17ceee3b585d3e3eeba414a9b08fb19 09-Aug-2009 Marc Blank <mblank@google.com> Make small changes as recommended by stadler (for CL9459)
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
f708e075473f4c186c44b61bc5ad5c73c901b61e 09-Aug-2009 Marc Blank <mblank@google.com> Use wake locks in running syncs; clean up associated code
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
8047ef058e41c164c2c8ab230ae8d123f042c167 08-Aug-2009 Marc Blank <mblank@google.com> Switch from HttpURLConnection to HttpClient
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
9d4ac93efbba01afe668f9406feec69b3a2374eb 08-Aug-2009 Marc Blank <mblank@google.com> Refactor, cleanup, and fix sync bugs

* Found/fixed major sync bug re: first-time sync (emulator only)
* Moved deviceId code to SyncManager
* Added code to handle some edge cases related to sync errors
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
1b275b9408d5b856e2482fa3951827489e9585cc 07-Aug-2009 Marc Blank <mblank@google.com> Fix various problems related to synchronization, reload folder list, etc.

* The reloadFolderList service call mustn't reset the account mailbox if the foler
list has never synced
* Be careful to not commit anything after a mailbox has been stopped
* Be careful to synchronize before checking the stopped state of a mailbox
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
ed5b71376cb6fc3f54d63268afbd798e0b0c0a1b 05-Aug-2009 Marc Blank <mblank@google.com> Try to work around the "ping loop" problem in some Exchange 2003 servers

* First try reloading the folder list; this can sometimes work
* Otherwise, change push to 5 minute sync
* Send notification if we switch to 5 minute sync so there are no surprises
* Added syncStatus column to EmailProvider (can be used for any purpose)
* Use syncStatus to keep track of sync type, result type, and change count;
detect ping loop as consecutive ping's with no changes
* Remove InteractiveSyncService (no longer needed)
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
618966d6899b6a517bdd77b20eb9dd62cea4f6f5 04-Aug-2009 Marc Blank <mblank@google.com> Add support for note and category upload for Contacts

* Also fixed a few random bugs found while debugging
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
368adeb5779fed5d64770d2131125dd93e43ab78 03-Aug-2009 Marc Blank <mblank@google.com> Add support for additional EAS contact fields

* Fix a few misc. bugs found while testing
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
0f2a0c93a85ce615ffe521bbc6f5217afae7094b 03-Aug-2009 Marc Blank <mblank@google.com> Send OPTIONS less frequently; remove extraneous Log command
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
4d37107554db72f30c68e1df4a2fecd8d4b28d1c 03-Aug-2009 Marc Blank <mblank@google.com> Fix bugs related to push & reloading folder list

* Fixed bug #2026451 (updateFolderList isn't interrupting pingLoop)
* Added some logging code related to 'ping' and manual service starts
* Handle exit from stopped sync thread better
* Fixed a bug in ContactsSyncAdapter service in which a cursor didn't
get properly closed.
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
7c582a7fb883b3be728f270fbe5277676fe37cf9 31-Jul-2009 Marc Blank <mblank@google.com> Massive reworking of EAS serialization; much smaller and faster now

* Remove all use of Strings in favor of the parser's static final int's
* Strings remain in Tags for debugging output only
* Renamed lots of classes to be more consistent
* Centralized logging behavior in Eas class
* Found and fixed some bugs in the process:
- Account deletion wasn't removing HostAuth's correctly in the trigger
- Adding a second EAS account was trashing the first one
- Fixed looping sync behavior caused by Exchange 2003 bug
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
a26c8a8ff1a1d26ed182ed12eb289a372e4a8bb4 31-Jul-2009 Marc Blank <mblank@google.com> Fix 2026451 (folder list update callback not being made)

* Make sure updateFolderList service call stops the account mailbox sync
* Make sure SyncManager is kicked so that it will restart (and thus do
a folder list sync)
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
fde52611eeae5ec6548f59c8e91e23bf65e6bd07 30-Jul-2009 Marc Blank <mblank@google.com> Add support for the syncMailboxStatus/syncMailboxListStatus callback

* Allows UI to show proper progress indications depending on the status
of a particular mailbox (running, finished, or error state)
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
147e03d50b8a793d58d67917af4bc6333f8afac1 27-Jul-2009 Marc Blank <mblank@google.com> Reimplement EAS contacts sync to work w/ new system facilities

* Modify to work with ContactsProvider2
* Modify to work with system AccountManager
* Modify to work with system SyncManager (for triggering user-change syncs)
* Sync server->client for adds/deletes implemented (CP2 doesn't handle delete yet)
* Sync server->client changes handled efficiently (only write changes)
* Some fields still not handled
* Rewrote most of the CPO code to handle server->client changes
* Sync client->server works for supported fields
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
81d9179a5bd856c39ae74f591983bf662d99fb05 29-Jul-2009 Marc Blank <mblank@google.com> First pass at implementing new IEmailServiceCallback.

* Add setCallback method to IEmailService interface
* Remove the callback from loadAttachment and loadMore in SyncManager and
EmailServiceProxy
* Remove the callback from PartRequest
* Update EasSyncService to use the saved callback in SyncManager

Note: Unsure how to handle the case in which SyncManager dies, since it
will no longer have the callback available...
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
bb7360cbcfa12694ebd8a842f8d1d25fc6897dfd 28-Jul-2009 Andrew Stadler <stadler@android.com> Finish Attachment support for EAS accounts.

* Change service API to allow caller to supply complete target path/file
* Also allow caller to supply the final content_uri
* In MessageView, use full integration with EAS service API and
attachments content provider to enable:
* Save: Only works on SD card
* View: Works w/o SD card using content provider & intents
* Thumbnail previews
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
842515bc55b31ad9034c4048ebb402248a69d18a 24-Jul-2009 Marc Blank <mblank@google.com> Load EAS attachments internally with new API ; re-sync after account changes

* Fix bugs #1993689 and #1997842
* Update test for attachment name creation
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
67698e240187c902bed123bf18d342ff25ec75c7 24-Jul-2009 Marc Blank <mblank@google.com> Move to single EmailContent file; fix bug #1998157
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
c7208378fc7f04fc3589757f3e2fdbeef549b548 23-Jul-2009 Andrew Stadler <stadler@android.com> Moving message operations into Controller, and load attachments.

* Moved logic into Controller:
* toggling read/unread
* toggling favorite status
* some new unit tests
* load attachment
* Completed logic for EAS to save attachments and MessageView to
begin and complete that process.

NOTE: Until EAS has a mode for saving the attachment locally (and I
rewrite the attachmentprovider to handle the new database) I am
implementing "view" attachment to just call "save". This means that
attachments "viewed" will be dropped onto the SD card, instead of
cached and flushed.

TODO: Controller is not properly working in its own thread, yet, so
we are not properly preventing ANR's yet.
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
9387711d77c0d3f186f82d9b9512f8a15b4a60df 23-Jul-2009 Andrew Stadler <stadler@android.com> 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.
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
ab701c862d6e380c8e09ac53ed493aec5d523d3d 21-Jul-2009 Marc Blank <mblank@google.com> Prevent EAS startup race condition while debugging

* Make sure that mAccount and mMailbox are up-to-date at all sync starts
* Prevent duplication of mailboxes in schema, since it's always wrong
* Add a service call to enable/disable logging in EAS
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
b0ce70f8d18dfe14fdd72be528d89eda1ba229fe 20-Jul-2009 Marc Blank <mblank@google.com> Work on EmailService calls, attachment loading, etc.

* Stubbed in attachment loading in MessageView for EAS messages
* Modified MessageView.Listener to implement IEmailServiceCallback
for testing callback functionality
* Rewrote EmailServiceProxy entirely
* Simplified loadAttachment service call
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
00d91b2e12d65df06916afdc4bebca67fd27214c 18-Jul-2009 Marc Blank <mblank@google.com> Changes to EAS: attachments, HTML text, and sending mail (without atts)

* Added HTML support for Exchange 2007 and later
* Modified MessageView to show HTML parts of body (if present)
* Replace some unused convenience methods in Body to be ones that are more
useful (i.e. retrive body for a given message id)
* Made EAS sending operational
* Updated SyncManager to recognize the creation of new messages and check
for work to be done (i.e. starting Outbox sync)
* Modified MessageView to remove EmailContent.X references
* Also changed the pattern EmailContent.getContent(cursor, class) to the better
new ClassName().restore(cursor)
* Add a test of the utility to determine mime type from file name (since
EAS doesn't provide this with attachment header information)
* Fixed bug in ProviderTestUtils in which the base (EmailContent) fields weren't
being checked for equality in the various subclass equality testers. Fixed a
bug in saving emails that was caught by fixing this bug.
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
22bc4e0e4f4a5e43e4eea8d59e1961860c507594 16-Jul-2009 Marc Blank <mblank@google.com> Fix push bug, minor changes to logging and removal of debug code
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
d95115d72be6797835e1286fb8f0d2e5a01cf3a8 16-Jul-2009 Marc Blank <mblank@google.com> Add support for attachments in EmailProvider and (preliminary) EAS

* EmailProvider now saves Attachment records atomically with Message (and Body,
of course) if an ArrayList is stored in mAttachments
* Update EAS code to support attachment discovery
* Update EAS code to support attachment download via service API (preliminary)
* Add test for atomic attachment save
* Add test for unique file creation (external)
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
8480f5bc2eb612920f7e17312a693b4d8c26f14b 15-Jul-2009 Marc Blank <mblank@google.com> Fix bugs related to EAS upsync and the cleanup afterward.
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
6396cfb310b09c53b8e9b51d9ba58d2f6b65c266 07-Jul-2009 Andrew Stadler <stadler@android.com> Various EAS related changes related to accounts and services.

* Renamed ISyncManager/ISyncManagerCallback to IEmailService/IEmailServiceCallback
* Restored ExchangeTransportExample to its original state; created ExchangeStore to
handle validation functionality instead; updated stores.xml to reflect these changes.
* Add support for AccountManager in EAS code (this is necessary for the contacts and
calendar providers to work with syncable data); created EasAuthenticatorService to
as our authenticator, which required adding authenticator.xml and modifying the
manifest to register our service with AccountManager metadata
* Created EmailServiceProxy as a convenience for the UI in calling into the EAS
service; created EmailServiceStatus class for status codes in callbacks.
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java
ab30d429e0c6069604aead9b5e6845b6b91b6a02 05-Jul-2009 Marc Blank <mblank@google.com> Major refactor and cleanup of EAS code

* Rewrote push logic to encompass multiple folders (i.e. calendar/contacts)
* Change inbox from push frequency to ping frequency after initial sync
* Implement upsync logic for email (i.e. sending changes to the server)
* Did cleanup of some files (there's still some to do) re: format, style
* Initial one-way sync of Contacts data - add and delete are implemented
* Created adapter package for all parts of the EAS adapter
* Created utility package for utility code that will eventually be merged
with code in the Email application (Base64, QuotedPrintable, etc.)
* SyncManager/AbstractSyncService can be used in the future for other
protocols, especially IMAP push
/packages/apps/Exchange/src/com/android/exchange/EasSyncService.java