Commit Graph

97 Commits

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

Bug: 3442973
Change-Id: I9162cf5fa6b5a043ded0fdd1e25fd3ce5948ad8f
2011-02-14 16:08:55 -08:00
Marc Blank 31d9acbf06 Email split, part huit: Refactor constants, clean emailcommon
* There are three pieces to this CL (sorry):
  1) Move and/or rename some constants into emailcommon
  2) Move Utility to emailcommon, moving the few UI
     related utilities back into Email (FolderProperties
     and UiUtilities)
  3) Remove all references to resources from emailcommon
* The three pieces relate in that, between them, they allow
  the emailcommon static library to compile cleanly

Bug: 3442973

Change-Id: Ic5e3abaa2a1b36999e0b6653c6c2134ea1bd544f
2011-02-14 12:18:10 -08:00
Marc Blank a7bc0319a7 Email split, part six: EmailContent
* Moved EmailContent to emailcommon

Change-Id: Ib3db1bfcfe74554c0e5afd3cfce6d72f26e9aeb9
2011-02-10 19:44:29 -08:00
Marc Blank 81d68b842e Delete calendar properly on commanded wipe
* CalendarProvider2 has unusual semantics for its delete operation on
  Calendars; this caused the user's calendar NOT to be deleted when
  the server commanded a wipe of calendar data.  The result was
  duplication of events after the subsequent resync

Bug: 3361000
Change-Id: I672034a7a444eb7ebdea60cd6dc66a31087cc6f7
2011-01-31 21:07:18 -08:00
Marc Blank cf3fb71bc6 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
2010-11-22 11:17:00 -08:00
Marc Blank 9ce8f4d2a3 Use original all-day flag when upsyncing exceptions
Bug: 3087410
Change-Id: I4bed0039758e98d4b85054876f192605eb00ee82
2010-10-13 14:10:36 -07:00
Marc Blank a0692b16e1 Fix upsync of exceptions in EAS 2.5 (Exchange 2003)
* Apparently, Exchange 2003 doesn't like to see Visibility set in
  Exceptions
* Apparently, Exchange 2003 likes to see Exception Deleted and
  ExceptionStartTime prior to other data
* The word "apparently" is used above to indicate that these
  findings are not part of any specification, but have been
  determined empirically

Bug: 2775885
Change-Id: I163f156675f65c494a59d5233b2b6e23b3f1d6a0
2010-10-08 16:32:20 -07:00
Marc Blank 517c4f39b7 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
2010-09-15 20:20:15 -07:00
Marc Blank 213c52dd64 Fix issues with handling FREQ=YEARLY in RRULEs
* Turns out that we weren't handling one of the cases for YEARLY
  RRULE; that in which the date is specified as a day of week plus
  week of month
* Also, we weren't always sending the INTERVAL properly in a few
  cases
* Fix these issues and add a unit test that confirms the fixes
* Also removed an unused argument in recurrenceParser in
  CalendarSyncAdapter

Bug: 2718948

Change-Id: If9146d484218e7d6bd9f5c2305d0e6a216aeed49
2010-09-02 18:17:42 -07:00
Marc Blank 3faa14693c Fix error upsyncing exceptions to all-day events
Bug: 2893712
Change-Id: I471e487ec1f7ce11cccdde86f8d8bd8435edd27d
2010-08-31 16:29:05 -07:00
Marc Blank 1718115cd1 Set HAS_ATTENDEE_DATA to 0 for exceptions
Bug: 2891708
Change-Id: Ia38214dcb9d72e45c1e481bc93fc6521ea206d0f
2010-08-24 17:59:17 -07:00
Marc Blank f115d31ae8 New calendar sync adapter tests
* Created MockProvider that can be used for testing the results of
  ContentProviderOperation's for Calendar/Contacts (we can't use these
  within our mock contexts because we can't instantiate the provider
  classes within the Email package)
* Wrote some unit tests for MockProvider
* Use MockProvider to test addEvent, in particular how a user's attendee
  status is stored, depending on whether the event is new or updated

Change-Id: I97f02d125eb7347726261e12ce70aadc539be1d4
2010-07-09 10:24:58 -07:00
Marc Blank 32db98f8eb Interpret "busy" on new events to mean "no response"
* The meaning of a busy status of "Busy" is uncertain; it could mean
  "Accepted" or "Tentative", depending on whether the event was
  created via OWA/Outlook or EAS
* We have interpreted it as "Accepted", which prevents the user from
  actually accepting the event (as a state change is required for us
  to send updates to the server/organizer)
* This CL changes the behavior such that a newly arriving event with
  a "Busy" status is shown as "No response" in the Calendar, thereby
  allowing the user to pick from any of the three possible options.

Bug: 2811859
Change-Id: Ie2c375278b79b47dedac02472dfe6e4cf1182b65
2010-07-02 14:53:11 -07:00
Marc Blank 00360c07b2 am 4cfaaa95: am 2019792f: am 04396916: Fix regression in Exchange calendar attendee response
Merge commit '4cfaaa9527d1712bbcff4caef8be3957427a0a66'

* commit '4cfaaa9527d1712bbcff4caef8be3957427a0a66':
  Fix regression in Exchange calendar attendee response
2010-06-30 15:49:02 -07:00
Marc Blank 043969163e Fix regression in Exchange calendar attendee response
* During the fix of a previous late-Froyo issue, a change was made that
  appeared superficially correct, but was semantically incorrect.  This
  changed the sense of the test for whether a reply email was required
  and caused the referenced bug.
* The trivial fix is to replace the test with the (older) proper one

Bug: 2764551

Change-Id: I7c72366252cf0607aee31ee0d76aca96a7d5fc2b
2010-06-30 11:41:22 -07:00
Marc Blank 8b7cb9cf03 Fix broken build
Change-Id: Ic6d1187ac475754057dd319684f59aa9ce9eeceb
2010-06-16 11:27:15 -07:00
Fabrice Di Meglio ecaddea386 Fix bug #1661857 (switch from using meta feed to the new allcalendars feed)
- update Events.DELETE constant

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

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

Bug: 2760514
Change-Id: I2941b392ae1058a9ead8a79f0ac73f4eb345917d
2010-06-10 18:37:21 -07:00
Marc Blank 8c742a4c65 Handle case of null organizerEmail in changed event
* A recent change assumed that organizerEmail couldn't be null while
  an event was being added.  However, there is an unusual case in
  which it CAN be null, and this CL handles that case
* Regression caused by: SHA 7f448dcd47
Bug: 2719254
Change-Id: Idb8fc79c898bcd2e53fcc8b3e42d0ba67ba762fa
2010-05-27 09:50:31 -07:00
Marc Blank b6a08f68d7 Remember to store modified organizerEmail
Bug: 2709816
Change-Id: Ib26536c127857fa8a1fdf805469872419931f21c
2010-05-26 07:33:06 -07:00
Marc Blank 7f448dcd47 Limit the number of attendees in a synced event
* If there are over 50 attendees in an event, we only store the
  organizer as an attendee (the rest are redacted) and we set
  the hasAttendeeData flag to 0
* If the user is the organizer, we reset the owner of the event
  to a bogus address, which causes the UI to prevent edits to
  the event (we can't upload without losing all of the attendee
  information on the server). We also prevent the event from ever
  being uploaded (belt & suspenders)
* If the user is an attendee, we allow changes to be uploaded
  (this would be attendee status and free/busy), but the list of
  attendees on the server is removed.
* We also mark events with redacted attendees, even though we don't
  use that information currently.  In a future version, however,
  we could use this to indicate the redacted state to the user.

Bug: 2709816
Change-Id: I2b44af59c598cedf906af12bf9b4eaf7484b9d20
2010-05-25 19:35:05 -07:00
Marc Blank 8752159c7d Fix critical typo in CalendarSyncAdapter
* Used wrong name for column

Bug: 2703075
Change-Id: I8107bd2df4fdc2ee79d126a657383b46317d0495
2010-05-25 14:05:45 -07:00
Marc Blank 3e065170f3 Fix bugs related to TZ handling for all-day events
* In bug 2703075, all-day events from time zones at GMT or later
  appear a day early; this is because the time was calculated from
  the GMT date/time of the event rather than the local date/time of
  the event; this CL correctly changes this to use local date/time
* In bug 2707966, device-edited all-day events disappear in Outlook
  and OWA after upsync; this is due to the fact that we store all-day
  events in UTC on device, whereas we need to upload all-day events
  using the original (local) time zone.  In this CL, we save away
  the original time zone and use it on upsync
* In our decoding of Exchange time zone information, we default to
  local time when we can't find a time zone that matches the bias
  and DST information; we should really default to a time zone with
  the same bias, if one exists; we do that in this CL.
* Add/modify unit tests

Bug: 2703075
Change-Id: Id80c481ecc0eae980b2e91dae7f105f924cfca28
2010-05-25 11:46:44 -07:00
Marc Blank d1e00e8aa6 Fix NPE resulting from attendees-only update from server
* Code for updating attendees in CalendarProvider2 wasn't taking
  an attendees-only update into consideration
* Fix code to allow for this, including proper updates for our
  selfAttendeeStatus and attendees ExtendedProperty values

Bug: 2668682
Change-Id: I8c7deb971cd0b6846c09ee3cd603f6fc762a9407
2010-05-10 09:39:20 -07:00
Marc Blank 85a63c3c2f Fix issues with exception downloads
* It turns out that, in addition to other requirements of the
  CalendarProvider, there is another - that the ORIGINAL_INSTANCE_TIME
  also be set with hour, minute, and second as zero (in UTC)
* Change setTimes() to properly modify ORIGINAL_INSTANCE_TIME
* Also, there was a regression due to an incorrect validity test
  for events; this regression caused all exception downsyncs to fail
* Changed isValidEventValues() to be correct for both exceptions
  and original events
* Update tests for setTimes and isValidEventValues()
* This CL also fixes 2658988

Bug: 2664229
Change-Id: I9c8aea08e606ff58e5be37ca81a2d86a181c46f6
2010-05-07 15:47:57 -07:00
Marc Blank 33f07963eb Add checks for Event validity before commit
* Enforce CalendarProvider2's requirements for valid Events
* Add unit tests for the new code
* Backport of change I42ad7acb from master
Bug: 2658149

Change-Id: I8151d035247a7dbb1fda3eae163b24ccfe055299
2010-05-06 08:28:34 -07:00
Marc Blank d2c773a806 Fix issues with incorrect email replies to event organizer
* We were previously storing the user's attendee status in the
  SYNC_ADAPTER_DATA column of the Event, but it turns out that
  this data isn't available in the Entity we retrieve when
  uploading changes to the server
* The result is that we often thought the user's status had
  changed when in fact it had not; in these cases, we sent email
  to the organizer, often with the wrong information.
* As of this CL, we store the user's attendee status in an
  ExtendedProperties row (these values are already exposed in event
  entities)
* The logic otherwise remains the same; we now get correct data,
  however

Bug: 2638762
Change-Id: Ibe8db90c16b4ca06203f77fd010aa26dde89a556
2010-04-30 10:52:18 -07:00
Marc Blank 8a19af3739 Fix upload/download of attendee status
* It turns out that the UI uses selfAttendeeStatus and the attendee's status
  from the Attendees table in confusing and undocumented ways
* selfAttendeeStatus is used in the UI, but only in certain cases. Generally speaking,
  the Attendees table status is definitive.  However, when the user sets his status
  from the UI, this data is reflected in the event's selfAttendeeStatus, since for EAS,
  the user is always the owner of his calendar
* On downsync,  we'll put the user's busy status into the Attendees table
* On upsync, we'll send busy status based on the user's attendee status in the
  Attendees table
* We'll use selfAttendeeStatus only to determine whether the user has manually changed
  his status via the UI (as before)

Bug: 2615586
Change-Id: I3a82474cfd07cbf5aa595e5214807cb55005cefa
2010-04-23 09:07:53 -07:00
Marc Blank 849ba0285c Use METHOD_ALERT instead of METHOD_DEFAULT for reminders
* Exchange has been using METHOD_DEFAULT for reminders, but it turns out
  that this doesn't work.
* Changed to use METHOD_ALERT

Bug: 2604156
Change-Id: Ia76bb2fc150202de9c49af9ab8caf86c9bda775f
2010-04-16 17:48:14 -07:00
Marc Blank a8f7b3e16e Store all day events w/ UTC timezone
* All day events are supposed to be stored w/ UTC as the time zone
* We already zero out hour, minute, and day
* Use DTEND for non-recurring and DURATION for recurring all day events

Bug: 2440161
Change-Id: I31f2e5a355b721c06b4022b57ccc8a29b288a5d9
2010-04-16 15:11:43 -07:00
Marc Blank 095eee4156 Set selfAttendeeStatus and busyStatus properly on downsync/upsync
* Set selfAttendeeStatus on download from busy status
* Set busyStatus on upload from selfAttendeeStatus

Bug: 2587076

Change-Id: I34eaa0d3861bcec0cbfd51761b31965e44f5162b
2010-04-16 13:39:51 -07:00
Marc Blank 3fdaa32969 Only set ORIGINAL_INSTANCE_TIME in exceptions
* We were setting this for all events, but apparently CalendarProvider
  does not approve, and generates warnings
* Only set this for exceptions

Bug: 2550631
Change-Id: I8a7152eb0d4233432b1a5b5664da964d5433fbae
2010-04-14 08:41:38 -07:00
Marc Blank 627006a8e3 Fix issue with deleted recurrence
* It turns out that this bug is due to a bad rebase/merge for a previous CL
  in which the changed code appears in its new form AND old form
* Fixes change SHA c3aa318200 (CL 48406)
* Don't say it.

Bug: 2587775
Change-Id: I3f70a97e498db30345452b942909448049680fdf
2010-04-13 19:50:51 -07:00
Marc Blank 0005eba750 Fix cancellation messages for deleted attendee
* We weren't sending a proper ics file for the deleted attendee, and
  this caused Exchange to send a message to the wrong people (the
  referenced bug)
* Split out code that adds attendees to outgoing mail
* Changed the optional last argument to createMessageForX to be a specified
  attendee, i.e. the only addressee to be used for the message

Bug: 2548465
Change-Id: I629fcfaffe621408ea460d42c9c7c283929f7e79
2010-04-13 13:37:51 -07:00
Marc Blank de30222689 Always check serverId AND calendarId in queries
* With multiple accounts, serverId's are not guaranteed to be unique
  (indeed, they rarely are)
* There were two queries in CalendarSyncAdapter that checked only
  serverId and this has caused the referenced bug PLUS others that
  would have turned up later on
* This is a critical fix

Bug: 2589815
Change-Id: I49bc6cb5bb4708f4bf4ca60a891ff78f0b25e989
2010-04-12 16:37:50 -07:00
Marc Blank e3df9f95ea Sync description with exceptions
* We weren't sending up the event description with exceptions, so
  changes to description were being lost on upload
* Move the code uploading description so that it happens with
  exceptions as well as top-level events

Bug: 2590020
Change-Id: Ifab556bed68671f3ee8cab02b657adbd8ba9c50c
2010-04-12 14:22:11 -07:00
Marc Blank c3aa318200 Send email to organizer if attendee deletes event/exception
* There are two cases, event and exception and both are fixed in this CL

Bug: 2587775
Change-Id: Id325c4877a77074ca6edd4d7fbeb54971d4cf984
2010-04-12 10:12:46 -07:00
Marc Blank c5c5bf7da7 Always add changed exceptions to the upload list
* We were adding deleted exceptions to the "deleted" list; this is bad,
  because the exception then gets deleted from the database after the
  sync.  The symptom is that the deleted exception reappears on the
  calendar.

Bug: 2587837
Change-Id: If497f82ba0b2b817d1cef6165ded23d19876528f
2010-04-11 15:33:39 -07:00
Marc Blank 6a4eae5f41 Fix upload of multi-day all day events
* We were assuming a single day for all-day events
* Use the actual end date
* Make sure we send date/time back to server in local TZ
* Also fixes #2500863

Bug: 2578776
Change-Id: I58767a574248935b9840ce93e634a24e54abe62f
2010-04-10 18:03:39 -07:00
Andrew Stadler 80bd83fd85 Upsync appropriate organizer name/email
* We need to send name & email for Exchange 2007
* For Exchange 2003, only name & email if the event is new

Bug: 2586661
Change-Id: Ia35c2c7a645a3d20b7031e9a43b8b5044a40f005
2010-04-10 17:35:34 -07:00
Andrew Stadler 06699c0d91 Send meeting status with all upsynced changes
* Meeting status differentiates between appointments and meetings,
  which is important in Outlook and OWA
* Fix older, completely incorrect code for upsyncing categories

Bug: 2586071
Change-Id: I277252ef2c31e5b8ec7ceda69c229f5fd100ecdb
2010-04-10 17:24:23 -07:00
Marc Blank 0cd9cbf088 Add organizer to Attendees before handling exceptions
* Exceptions take a copy of Attendees when they are created, but
  we weren't adding the organizer to Attendees before exceptions
  were parsed
* Fix this by adding the organizer just before exception parsing
* If there aren't any exceptions, we add the organizer as before

Bug: 2585817
Change-Id: Ie894682977e38a55d975135c8fc2fd8f2d4b1365
2010-04-10 09:58:50 -07:00
Marc Blank 1b2ed80da7 Handle exception deletion properly
* First, make sure we catch the cases of DELETED=1 and eventStatus=cancelled
* Second, only send email updates if the user is the organizer

Bug: 2583054
Change-Id: I886efa0f28931dc815bc31d4d6adb3d700f83c6b
2010-04-09 14:02:35 -07:00
Marc Blank b6cbf52656 Fix auto-send of invites when attendee status changes
* Use AS_SYNC_ADAPTER flag when changing attendee information in
  downsyncs
* Allow DTSTAMP to come before new attendee information in the case
  in which only attendees are changing
* Add _SYNC_DATA of "0" for all newly synced events

Bug: 2582513
Change-Id: Iacde0ddf3f2a99d108e00ef1991edfc34613f5c7
2010-04-08 17:26:06 -07:00
Marc Blank f1bbf05380 Send busy_status = 2 on all upsync's
* Right now, we only send this for 2.5 (where it's required)
* If we don't send this for 12.0 and later, the status will be
  set to "free", which is almost always going to be wrong
* So always send busy status = 2 (we can't know differently, as
  we don't track free/busy)

Bug: 2575611
Change-Id: I11d952b68ac0ef7a022b030037ce6408f72d4a90
2010-04-07 09:44:09 -07:00
Marc Blank 79976209d7 Synchronize getSyncKey/setSyncKey in Calendar and Contacts sync
* When the sync state of Calendar/Contacts is changed, a number of observer calls
  are triggered.  In addition, we might have a running sync.
* The syncKey operations need to be synchronized, because we may otherwise
  inadvertently use stale data when syncing, which would cause symptoms
  as seen in the referenced bug

Bug: 2561864
Change-Id: I03db58fe01c45778d271fad34d8d4940edefe8fe
2010-04-01 17:07:02 -07:00
Marc Blank 82701d7725 Only send meeting emails after upsync is confirmed finished
* We were queueing up emails during our upsync, but before the upsync
  was complete.  If there were connection issues, we could pile up
  multiple copies of the same message, each of which would eventually
  get sent out
* Fix is to simply queue up the outgoing mail and send it all after
  the sync operation is complete.

Bug: 2515975
Change-Id: Ide3eb2deb6e959d0637d28efabd613efb3c6e209
2010-04-01 12:24:24 -07:00
Marc Blank 54585c9511 Fix sending of cancellations to uninvited guests
* Had to add an optional argument to the email creator for this case,
  since there may not be any remaining addressees to send to (if the
  only guest was uninvited)
* The optional argument forces the creation of a message, even if there
  are no addressees

Bug: 2548465
Change-Id: I88784f49ce7afedce331fc756c5ecef4e73a07bc
2010-03-28 13:54:33 -07:00
Marc Blank 4b4e00e4ce Fix #2548436 (Use EVENT_TIMEZONE rather than TIMEZONE)
* Prior fix used the wrong column when adding time zone information
  to downloaded exceptions

Bug: 2548436
Change-Id: Idc1001fd58d2fba51823624a15862fe439c9ff6a
2010-03-26 12:49:07 -07:00