From 05b0bb56254d9ed924dff4c09ad227eec611a695 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Fri, 23 Jul 2010 11:10:04 -0700 Subject: [PATCH] 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 --- src/com/android/exchange/EasSyncService.java | 2 ++ src/com/android/exchange/SyncManager.java | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/com/android/exchange/EasSyncService.java b/src/com/android/exchange/EasSyncService.java index a1a76dce5..1feaf01f6 100644 --- a/src/com/android/exchange/EasSyncService.java +++ b/src/com/android/exchange/EasSyncService.java @@ -1291,6 +1291,8 @@ public class EasSyncService extends AbstractSyncService { if (policyKey != null) { // Write the final policy key to the Account and say we've been successful ps.writeAccount(mAccount, policyKey, true, mContext); + // Release any mailboxes that might be in a security hold + SyncManager.releaseSecurityHold(mAccount); return true; } } else { diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java index 7a56cbbd9..dcdf6db76 100644 --- a/src/com/android/exchange/SyncManager.java +++ b/src/com/android/exchange/SyncManager.java @@ -895,6 +895,18 @@ public class SyncManager extends Service implements Runnable { } } + /** + * Release security holds for the specified account + * @param account the account whose Mailboxes should be released from security hold + */ + static public void releaseSecurityHold(Account account) { + SyncManager syncManager = INSTANCE; + if (syncManager != null) { + syncManager.releaseSyncHolds(INSTANCE, AbstractSyncService.EXIT_SECURITY_FAILURE, + account); + } + } + /** * Release a specific type of hold (the reason) for the specified Account; if the account * is null, mailboxes from all accounts with the specified hold will be released