Merge "Delete account from DE and CE databases" into nyc-dev
am: a087d7f4fa
* commit 'a087d7f4fa6de262aef346acb336fcb826d05d23':
Delete account from DE and CE databases
Change-Id: Ied3a5d614b814be094df50317db494f60b5a4727
This commit is contained in:
@@ -432,6 +432,7 @@ public class AccountManagerService
|
|||||||
|
|
||||||
final HashMap<String, Integer> knownAuth = getAuthenticatorTypeAndUIDForUser(
|
final HashMap<String, Integer> knownAuth = getAuthenticatorTypeAndUIDForUser(
|
||||||
mAuthenticatorCache, accounts.userId);
|
mAuthenticatorCache, accounts.userId);
|
||||||
|
boolean userUnlocked = isLocalUnlockedUser(accounts.userId);
|
||||||
|
|
||||||
synchronized (accounts.cacheLock) {
|
synchronized (accounts.cacheLock) {
|
||||||
final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
|
final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
|
||||||
@@ -530,7 +531,18 @@ public class AccountManagerService
|
|||||||
if (obsoleteAuthType.contains(accountType)) {
|
if (obsoleteAuthType.contains(accountType)) {
|
||||||
Slog.w(TAG, "deleting account " + accountName + " because type "
|
Slog.w(TAG, "deleting account " + accountName + " because type "
|
||||||
+ accountType + "'s registered authenticator no longer exist.");
|
+ accountType + "'s registered authenticator no longer exist.");
|
||||||
db.delete(TABLE_ACCOUNTS, ACCOUNTS_ID + "=" + accountId, null);
|
db.beginTransaction();
|
||||||
|
try {
|
||||||
|
db.delete(TABLE_ACCOUNTS, ACCOUNTS_ID + "=" + accountId, null);
|
||||||
|
// Also delete from CE table if user is unlocked; if user is currently
|
||||||
|
// locked the account will be removed later by syncDeCeAccountsLocked
|
||||||
|
if (userUnlocked) {
|
||||||
|
db.delete(CE_TABLE_ACCOUNTS, ACCOUNTS_ID + "=" + accountId, null);
|
||||||
|
}
|
||||||
|
db.setTransactionSuccessful();
|
||||||
|
} finally {
|
||||||
|
db.endTransaction();
|
||||||
|
}
|
||||||
accountDeleted = true;
|
accountDeleted = true;
|
||||||
|
|
||||||
logRecord(db, DebugDbHelper.ACTION_AUTHENTICATOR_REMOVE, TABLE_ACCOUNTS,
|
logRecord(db, DebugDbHelper.ACTION_AUTHENTICATOR_REMOVE, TABLE_ACCOUNTS,
|
||||||
|
|||||||
Reference in New Issue
Block a user