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
This commit is contained in:
Marc Blank 2010-07-23 11:10:04 -07:00
parent 8b36acb10d
commit 05b0bb5625
2 changed files with 14 additions and 0 deletions

View File

@ -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 {

View File

@ -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