email: don't block extras database
This will call other setences (like delete accoutns) to block access. Just integrate in the normal database transactions Change-Id: I48d7028f2ceddcdfbc170acd1a1fe32f0322b6e6 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
This commit is contained in:
parent
8210da8b50
commit
f119f904ed
@ -750,7 +750,7 @@ public class EmailProvider extends ContentProvider
|
||||
notifyUI(UIPROVIDER_ALL_ACCOUNTS_NOTIFIER, null);
|
||||
|
||||
// Delete account suggested contacts
|
||||
mExtrasDatabase.delete(SuggestedContact.TABLE_NAME,
|
||||
db.delete(SuggestedContact.TABLE_NAME,
|
||||
SuggestedContact.ACCOUNT_KEY + " = ?", new String[]{id});
|
||||
|
||||
} else if (match == MAILBOX_ID) {
|
||||
@ -781,7 +781,7 @@ public class EmailProvider extends ContentProvider
|
||||
if (match == ACCOUNT) {
|
||||
// TODO extract account deleted
|
||||
// As a fallback clean all suggested contacts
|
||||
mExtrasDatabase.delete(SuggestedContact.TABLE_NAME, null, null);
|
||||
db.delete(SuggestedContact.TABLE_NAME, null, null);
|
||||
}
|
||||
break;
|
||||
case MESSAGE_MOVE:
|
||||
@ -6204,14 +6204,8 @@ public class EmailProvider extends ContentProvider
|
||||
}
|
||||
|
||||
// Update or insert every suggested contact
|
||||
mExtrasDatabase.beginTransactionNonExclusive();
|
||||
try {
|
||||
for (Address suggestedContact : suggestedContacts) {
|
||||
addOrUpdateSuggestedContact(accountId, suggestedContact);
|
||||
}
|
||||
mExtrasDatabase.setTransactionSuccessful();
|
||||
} finally {
|
||||
mExtrasDatabase.endTransaction();
|
||||
for (Address suggestedContact : suggestedContacts) {
|
||||
addOrUpdateSuggestedContact(accountId, suggestedContact);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6232,14 +6226,14 @@ public class EmailProvider extends ContentProvider
|
||||
? emailAddress : address.getPersonal());
|
||||
values.put(SuggestedContact.DISPLAY_NAME, address.toString());
|
||||
values.put(SuggestedContact.LAST_SEEN, System.currentTimeMillis());
|
||||
long affectedRecords = mExtrasDatabase.update(
|
||||
long affectedRecords = mDatabase.update(
|
||||
SuggestedContact.TABLE_NAME, values, where, args);
|
||||
|
||||
// Insert
|
||||
if (affectedRecords == 0) {
|
||||
values.put(SuggestedContact.ACCOUNT_KEY, accountId);
|
||||
values.put(SuggestedContact.ADDRESS, emailAddress);
|
||||
mExtrasDatabase.insertOrThrow(SuggestedContact.TABLE_NAME, null, values);
|
||||
mDatabase.insertOrThrow(SuggestedContact.TABLE_NAME, null, values);
|
||||
}
|
||||
|
||||
} catch (SQLException ex) {
|
||||
|
Loading…
Reference in New Issue
Block a user