am 26c95dda
: Update accounts backup when externally deleted
Merge commit '26c95ddace076ead10d5c42986bcc70b465e9791' into eclair-plus-aosp * commit '26c95ddace076ead10d5c42986bcc70b465e9791': Update accounts backup when externally deleted
This commit is contained in:
commit
5f0f18790f
@ -1220,6 +1220,7 @@ public class SyncManager extends Service implements Runnable {
|
|||||||
android.accounts.Account[] accts =
|
android.accounts.Account[] accts =
|
||||||
AccountManager.get(this).getAccountsByType(Eas.ACCOUNT_MANAGER_TYPE);
|
AccountManager.get(this).getAccountsByType(Eas.ACCOUNT_MANAGER_TYPE);
|
||||||
List<Account> easAccounts = getAccountList();
|
List<Account> easAccounts = getAccountList();
|
||||||
|
boolean accountsDeleted = false;
|
||||||
for (Account easAccount: easAccounts) {
|
for (Account easAccount: easAccounts) {
|
||||||
String accountName = easAccount.mEmailAddress;
|
String accountName = easAccount.mEmailAddress;
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
@ -1231,12 +1232,18 @@ public class SyncManager extends Service implements Runnable {
|
|||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
// This account has been deleted in the AccountManager!
|
// This account has been deleted in the AccountManager!
|
||||||
log("Account deleted in AccountManager; deleting from provider: " + accountName);
|
alwaysLog("Account deleted in AccountManager; deleting from provider: " +
|
||||||
|
accountName);
|
||||||
// TODO This will orphan downloaded attachments; need to handle this
|
// TODO This will orphan downloaded attachments; need to handle this
|
||||||
mResolver.delete(ContentUris.withAppendedId(Account.CONTENT_URI, easAccount.mId),
|
mResolver.delete(ContentUris.withAppendedId(Account.CONTENT_URI, easAccount.mId),
|
||||||
null, null);
|
null, null);
|
||||||
|
accountsDeleted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If we changed the list of accounts, refresh the backup
|
||||||
|
if (accountsDeleted) {
|
||||||
|
AccountBackupRestore.backupAccounts(getContext());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void releaseConnectivityLock(String reason) {
|
private void releaseConnectivityLock(String reason) {
|
||||||
|
Loading…
Reference in New Issue
Block a user