Commit Graph

1269 Commits

Author SHA1 Message Date
Marc Blank
468fe91dd8 Prevent account reconcile from running when service is down
Bug: 2644142
Change-Id: Ia6ccf7371bc08b3b67ab3d0871f3618c5e5bd107
2010-04-30 11:43:40 -07:00
Marc Blank
09f0ab0454 Merge "Fix NPE in SyncManager" into froyo 2010-04-30 10:39:30 -07:00
Makoto Onuki
5ab7ec7123 Move a bare string to a resource.
Bug 2637666

Change-Id: I59cf5d2b30846604049d3f988b1003dd7d91ad6f
2010-04-30 09:21:04 -07:00
Marc Blank
3139d43ee2 Fix NPE in SyncManager
Bug: 2644142
Change-Id: I4336aef65669b7a4a32e43e8068edd4dd9772b03
2010-04-29 20:41:07 -07:00
Marc Blank
8ba0728533 Use timezone in exception ics files
* Exchange seems to require time zone information in ics files containing
  event exceptions, although this is NOT the case for iCalendar, and appears
  not to conform to VCALENDAR specifications
* This causes exceptions to be placed on the wrong date or perhaps even
  ignored, depending on the circumstance
* This CL simply adds time zone information to all exception ics files

Bug: 2640878
Change-Id: Ibc614eb7a2c45e9e782b10be979d9892bbfc0029
2010-04-29 10:16:58 -07:00
Marc Blank
39e6d3aed0 Fix concurrent modification exception
* Synchronize recently added call to releaseMailbox on sSyncLock

Bug: 2639210
Change-Id: Iaa1f2ed7cdc9cc0c306363487095ac5ccd02f9a3
2010-04-28 22:49:23 -07:00
Marc Blank
8917e52db0 Fix regression that prevents calendar sync w/ new accounts
* The regression is caused by a check on whether the calendar is
  syncable, as determined by the status of the Calendar (via
  CalendarProvider2).
* Unfortunately, if there IS no calendar, we were disallowing sync,
  which prevents the calendar from being created in the first place

Bug: 2619755
Change-Id: I1e94a129413bdbe9bc9bfb3608d3ca95f23d8dfb
2010-04-28 15:27:11 -07:00
Marc Blank
b7f57f25ea Remove STOPSHIP debug code
Bug: 2638014
Change-Id: I10a7ac89cce68ae1db146eb9bed574c00386ba62
2010-04-28 09:48:40 -07:00
Marc Blank
b5bf09a56d Merge "Allow more time for HttpPost watchdog timeout" into froyo 2010-04-27 23:25:15 -07:00
Marc Blank
f7369ad51f Merge "Shutdown all connections when sync service is hung" into froyo 2010-04-27 23:17:41 -07:00
Marc Blank
8f9e872eaf 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
2010-04-27 23:13:32 -07:00
Marc Blank
2341e096e6 Shutdown all connections when sync service is hung
* When a sync thread receives an alarm due to a missed socket timeout
  on an HttpPost, we try to abort the HttpPost.
* At times, however, the HttpPost cannot be aborted and the thread
  hangs indefinitely.
* In this CL, we try to break this vicious cycle by shutting down our
  ClientConnectionManager when this case is detected.  This should, in
  turn, close all of our socket connections, causing the sync threads
  to generate IOExceptions and terminate.
* After appropriate IOException waits, new sync threads should then be
  able to run normally.

Bug: 2615293
Change-Id: Idea6c3653cd60822d6260e0c5a7dad790ee25858
2010-04-27 22:49:50 -07:00
Makoto Onuki
e333b68c9e Skip security check when account id is unknown.
Doing the check caused:
   IllegalArgumentException: Unknown URI content://com.android.email.provider/account/-1
       at com.android.email.provider.EmailProvider.query(EmailProvider.java:1092)
       at android.content.ContentProvider$Transport.query(ContentProvider.java:163)
       at android.content.ContentResolver.query(ContentResolver.java:245)
       at com.android.email.activity.MessageList.isSecurityHold(MessageList.java:1146)

Bug 2635060

Change-Id: I80e7c00ef2dd74ceae24a88daf43a0681124a9d4
2010-04-27 17:28:39 -07:00
Marc Blank
422ceb0efd Merge "Don't enable calendar sync if sync_events is disabled" into froyo 2010-04-27 11:59:33 -07:00
Marc Blank
f62f4afff1 Don't enable calendar sync if sync_events is disabled
* When SyncManager starts up, it reconciles the AccountManager sync settings
  with its own
* This works for Contacts, but Calendar has a second setting that needs to be
  checked - the sync_events column in the Calendar table (in CalendarProvider2)
* Before turning on Calendar sync, we now check this second setting; if
  sync_events is 0, we won't re-enable Calendar sync

Bug: 2619755
Change-Id: Iea6c99dce228d2c111a529a6c9b865ed1577b19e
2010-04-26 13:25:48 -07:00
Marc Blank
b62cbc7e7b Increase service call timeout to 45 seconds
Bug: 2627273
Change-Id: I971aa271cfc03e669e72f7871856cb9cfc10aa14
2010-04-26 08:14:01 -07:00
Marc Blank
da71abeb8f 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
2010-04-26 07:06:56 -07:00
Marc Blank
0f68676828 Merge "Fix upsync of DAILY rrule with UNTIL" into froyo 2010-04-25 20:27:54 -07:00
Marc Blank
47d124e4a1 Fix upsync of DAILY rrule with UNTIL
* Make sure we send UNTIL with FREQ=DAILY as appropriate
* Also to help debug this in the future...
    Add logging capability to utilities via SyncManager
    Add public log methods so that CalendarUtilities can log properly
    Change Log.d's to SyncManager.log in CalendarUtilities

Bug: 2623787
Change-Id: I3d651f00a3f7522e25c8d6e389469770c733953f
2010-04-24 13:05:16 -07:00
Marc Blank
d8d3719f34 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
2010-04-24 10:39:06 -07:00
Marc Blank
2f1ce56fc8 Merge "Fix upload/download of attendee status" into froyo 2010-04-23 17:21:41 -07:00
Marc Blank
7cb5e144e7 Merge "Add checks for null in SyncManager" into froyo 2010-04-23 17:19:32 -07:00
Andrew Stadler
5ac8a35c42 Merge "Fix uncommanded exit from MessageList with 2+ accounts" into froyo 2010-04-23 13:30:48 -07:00
Marc Blank
de3ae17246 Merge "Add additional test for likely NAT timeout" into froyo 2010-04-23 12:42:30 -07:00
Andrew Stadler
88fb7f7cd0 Fix uncommanded exit from MessageList with 2+ accounts
* When you have 2 or more accounts configured, MessageList gets confused.
* If you are viewing a mailbox from account A, and account B does a
  background sync, MessageList gets confused by the reports coming back
  from the Controller.  It gives up and returns to the Accounts list.
* This change adds a check for the current account and ignores the
  MessageList updates if we weren't actually waiting for them.
* To test the positive case for this code (make sure we didn't break it),
  verify that the inbox on an IMAP account is displayed properly
  immediately after you add it.

Bug: 2619513
Change-Id: Ib31254b4099ba6b7922b06d42e2b7928551e4fb2
2010-04-23 12:17:43 -07:00
Marc Blank
bc27894815 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
2010-04-23 10:53:21 -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
f44b9440d8 Add checks for null in SyncManager
Bug: 2619723
Change-Id: Iea3c3258274bdf86784e232922290841ad0d9d36
2010-04-22 17:43:30 -07:00
Marc Blank
1880ad6a83 Send correct busy status information in upsyncs to EAS
* Fix unit test that was failing

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

Bug: 2608483
Change-Id: I571078ae7123b601b53096104c4c5f4ef20da031
2010-04-21 16:27:09 -07:00
Marc Blank
21c04fe31c Merge "Further harden getListOrNull" into froyo 2010-04-21 08:10:14 -07:00
Marc Blank
07fb9f8bea Further harden getListOrNull
* Add a bounds check
* Add a test for ImapList

Bug: 2611022
Change-Id: I3ad88fbc8d3145298731ab19ef7ff68d4011bb00
2010-04-20 19:31:29 -07:00
Marc Blank
bb11c91175 Fix NPE sending mail on servers without Outbox folders
* stopPing (in SyncManager) assumes that every mailbox has a serverId
  but this is not the case on some servers, in which case we hit an
  NPE during a check for the account mailbox
* Check for a null serverId when testing for the account mailbox

Bug: 2606385
Change-Id: Idfa8abd8ef9e2c0a2ac01d0b168a21c934f6fdf3
2010-04-19 21:19:49 -07:00
Marc Blank
075d34947f 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
2010-04-18 23:08:28 -07:00
Marc Blank
a90bb03c25 Merge "Use METHOD_ALERT instead of METHOD_DEFAULT for reminders" into froyo 2010-04-17 14:54:55 -07:00
Marc Blank
17e8ba7eda Merge "Speed up provision notification after security failure" into froyo 2010-04-16 18:16:17 -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
23a88a8044 Speed up provision notification after security failure
Bug: 2591899
Change-Id: I038e0b96f03c7dd24e11ee36f3c9464c84fb2930
2010-04-16 14:36:55 -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
Andrew Stadler
ce592f32f9 Merge "Remove incorrect error reporting in MessageList" into froyo 2010-04-15 15:08:12 -07:00
Andrew Stadler
54607e872d Remove incorrect error reporting in MessageList
* Previously I added a call to updateBanner() during the sequence where
    we update the mailboxlist (searching for the requested mailbox to
    display.)  This was an attempt to provide some error information
    for certain corner case security configuration problems.
* This was misfiring during legitimate connections (specifically, initial
    sync of valid EAS accounts) and causing a Connection Error message
    when none was intended.
* Rather than continue hacking, I'm simply removing the error banner
    from updateMailboxList.
* This is essentially a direct rollback of change
    c98b64c801, although I've added
    a bit more commentary than there was originally.
* The long-term solution, rather than continue band-aiding this, is to
    move most of this logic into a service independent of the UI, and
    provide more organized error reporting.

Bug: 2585159
Bug: 2599377
Change-Id: I99b7b1c8a7cfaa3fd3ff9b578d5721f05133d88a
2010-04-15 14:53:56 -07:00
Marc Blank
a97d85014f Merge "Properly decode a uid from the globalObjId in invites" into froyo 2010-04-15 13:41:04 -07:00
Marc Blank
7e30b2e22f Properly decode a uid from the globalObjId in invites
* Meeting invitations in EAS include a globalObjId.  It turns out
  that this id is EITHER the actual uid (if Exchange created it)
  or a wrapper for the actual uid (if some other client created it)
* To find out which case we're dealing with, we have to look at
  the base64 decoded string for the magic "vCal-Uid" substring
* If it's there, we pull the real uid out of the decoded string
* Otherwise, we build a hex strong from the decoded bytes
* Write unit test for this process

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

Bug: 2524465
Change-Id: I2309e033d65430810f2856285c1fa9bf2f8fb5e3
2010-04-14 23:51:35 -07:00
Andrew Stadler
3b3b5b0f2b Run the account reconciler every time we start SyncManager
* This takes care of *some* of the race conditions where the
  account DB is blown away but the Email app is not running, so we
  don't get any notification of a change;  We have to try and
  sort this out early.
* SyncManager is started by Welcome, so this catches many cases of
  entering the email app.

Bug: 2567986
Change-Id: I76bea5b636802ba5c1677d8b1825fb3c61f7b2d9
2010-04-14 22:18:14 -07:00
Makoto Onuki
d2a0d23380 Use consistent device-id even the device is wiped.
Use hash of device id (TelephonyManager.getDeviceId()) instead of a random
value.

Bug 2596537

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

Bug: 2563998
Change-Id: Ifbe086e26205bb28c2514f84cb28e839888b1eb0
2010-04-14 19:16:46 -07:00
Andrew Stadler
694fe3b0c7 Merge "Safer error handling in AccountNames" into froyo 2010-04-14 17:42:55 -07:00
Andrew Stadler
fa669234be Safer error handling in AccountNames
The error handling for (mAccount == null) would crash.  Use a simpler
path here and just abandon the setup process.

The root cause of this (the account being null) is probably solved
by 3ae84b247d, but still a good idea to
clean this up.

Bug: 2558344
Change-Id: I3167234f99e9d39844f2b56a4d94f25465c7c269
2010-04-14 17:41:28 -07:00