Merge "Fix remote wipe with mobile sync server"
This commit is contained in:
commit
92f30bedf2
@ -1391,17 +1391,29 @@ public class EasSyncService extends AbstractSyncService {
|
||||
sp.updatePolicies(mAccount.mId);
|
||||
if (pp.getRemoteWipe()) {
|
||||
// We've gotten a remote wipe command
|
||||
ExchangeService.alwaysLog("!!! Remote wipe request received");
|
||||
// Start by setting the account to security hold
|
||||
sp.setAccountHoldFlag(mAccount, true);
|
||||
// Force a stop to any running syncs for this account (except this one)
|
||||
ExchangeService.stopNonAccountMailboxSyncsForAccount(mAccount.mId);
|
||||
|
||||
// If we're not the admin, we can't do the wipe, so just return
|
||||
if (!sp.isActiveAdmin()) return false;
|
||||
if (!sp.isActiveAdmin()) {
|
||||
ExchangeService.alwaysLog("!!! Not device admin; can't wipe");
|
||||
return false;
|
||||
}
|
||||
|
||||
// First, we've got to acknowledge it, but wrap the wipe in try/catch so that
|
||||
// we wipe the device regardless of any errors in acknowledgment
|
||||
try {
|
||||
ExchangeService.alwaysLog("!!! Acknowledging remote wipe to server");
|
||||
acknowledgeRemoteWipe(pp.getPolicyKey());
|
||||
} catch (Exception e) {
|
||||
// Because remote wipe is such a high priority task, we don't want to
|
||||
// circumvent it if there's an exception in acknowledgment
|
||||
}
|
||||
// Then, tell SecurityPolicy to wipe the device
|
||||
ExchangeService.alwaysLog("!!! Executing remote wipe");
|
||||
sp.remoteWipe();
|
||||
return false;
|
||||
} else if (sp.isActive(ps)) {
|
||||
|
@ -1288,7 +1288,7 @@ public class ExchangeService extends Service implements Runnable {
|
||||
*
|
||||
* @param acctId
|
||||
*/
|
||||
static public void folderListReloaded(long acctId) {
|
||||
static public void stopNonAccountMailboxSyncsForAccount(long acctId) {
|
||||
ExchangeService exchangeService = INSTANCE;
|
||||
if (exchangeService != null) {
|
||||
exchangeService.stopAccountSyncs(acctId, false);
|
||||
|
@ -118,7 +118,7 @@ public class FolderSyncParser extends AbstractSyncParser {
|
||||
mContentResolver.delete(Mailbox.CONTENT_URI, ALL_BUT_ACCOUNT_MAILBOX,
|
||||
new String[] {Long.toString(mAccountId)});
|
||||
// Stop existing syncs and reconstruct _main
|
||||
ExchangeService.folderListReloaded(mAccountId);
|
||||
ExchangeService.stopNonAccountMailboxSyncsForAccount(mAccountId);
|
||||
res = true;
|
||||
resetFolders = true;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user