diff options
author | Tyler Gunn <tgunn@google.com> | 2020-12-07 19:18:18 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-12-07 19:18:18 +0000 |
commit | f11480d985931abe02f4d14998ffef2121b192a8 (patch) | |
tree | 4b92bbaeac0b73dae1e82b70133389777d147803 | |
parent | 4f5adbb7d019f11ab987131c7f8ded709b9cf3c4 (diff) | |
parent | 0085ffbb5cf88fce51bd75f4079eeabded4a14cf (diff) | |
download | ContactsProvider-temp_rvc_qpr_merge.tar.gz |
Merge "Ensure update/deletes in the call log notify content observers." am: 0085ffbb5ctemp_rvc_qpr_merge
Original change: https://android-review.googlesource.com/c/platform/packages/providers/ContactsProvider/+/1519373
Change-Id: I87e7d3eb3d44441f9415c38cd2df7d1c66a3e9f0
-rw-r--r-- | src/com/android/providers/contacts/CallLogProvider.java | 12 | ||||
-rw-r--r-- | src/com/android/providers/contacts/DbModifierWithNotification.java | 16 |
2 files changed, 18 insertions, 10 deletions
diff --git a/src/com/android/providers/contacts/CallLogProvider.java b/src/com/android/providers/contacts/CallLogProvider.java index e547e6da..9fa651cb 100644 --- a/src/com/android/providers/contacts/CallLogProvider.java +++ b/src/com/android/providers/contacts/CallLogProvider.java @@ -564,7 +564,11 @@ public class CallLogProvider extends ContentProvider { throw new UnsupportedOperationException("Cannot update URL: " + uri); } - return qb.update(db, values, selectionBuilder.build(), selectionArgs); + int rowsUpdated = qb.update(db, values, selectionBuilder.build(), selectionArgs); + if (rowsUpdated > 0) { + DbModifierWithNotification.notifyCallLogChange(getContext()); + } + return rowsUpdated; } private int deleteInternal(Uri uri, String selection, String[] selectionArgs) { @@ -597,7 +601,11 @@ public class CallLogProvider extends ContentProvider { case CALLS: // TODO: Special case - We may want to forward the delete request on user 0 to the // shadow provider too. - return qb.delete(db, selectionBuilder.build(), selectionArgs); + int deletedCount = qb.delete(db, selectionBuilder.build(), selectionArgs); + if (deletedCount > 0) { + DbModifierWithNotification.notifyCallLogChange(getContext()); + } + return deletedCount; default: throw new UnsupportedOperationException("Cannot delete that URL: " + uri); } diff --git a/src/com/android/providers/contacts/DbModifierWithNotification.java b/src/com/android/providers/contacts/DbModifierWithNotification.java index 852301d3..03ebd1f1 100644 --- a/src/com/android/providers/contacts/DbModifierWithNotification.java +++ b/src/com/android/providers/contacts/DbModifierWithNotification.java @@ -109,7 +109,7 @@ public class DbModifierWithNotification implements DatabaseModifier { packagesModified); } if (rowId > 0 && mIsCallsTable) { - notifyCallLogChange(); + notifyCallLogChange(mContext); } return rowId; } @@ -126,20 +126,20 @@ public class DbModifierWithNotification implements DatabaseModifier { ContentUris.withAppendedId(mBaseUri, rowId), packagesModified); } if (rowId > 0 && mIsCallsTable) { - notifyCallLogChange(); + notifyCallLogChange(mContext); } return rowId; } - private void notifyCallLogChange() { - mContext.getContentResolver().notifyChange(Calls.CONTENT_URI, null, false); + public static void notifyCallLogChange(Context context) { + context.getContentResolver().notifyChange(Calls.CONTENT_URI, null, false); Intent intent = new Intent("com.android.internal.action.CALL_LOG_CHANGE"); intent.setComponent(new ComponentName("com.android.calllogbackup", "com.android.calllogbackup.CallLogChangeReceiver")); - if (!mContext.getPackageManager().queryBroadcastReceivers(intent, 0).isEmpty()) { - mContext.sendBroadcast(intent); + if (!context.getPackageManager().queryBroadcastReceivers(intent, 0).isEmpty()) { + context.sendBroadcast(intent); } } @@ -201,7 +201,7 @@ public class DbModifierWithNotification implements DatabaseModifier { notifyVoicemailChange(mBaseUri, packagesModified); } if (count > 0 && mIsCallsTable) { - notifyCallLogChange(); + notifyCallLogChange(mContext); } if (hasMarkedRead) { // A "New" voicemail has been marked as read by the server. This voicemail is no longer @@ -283,7 +283,7 @@ public class DbModifierWithNotification implements DatabaseModifier { notifyVoicemailChange(mBaseUri, packagesModified); } if (count > 0 && mIsCallsTable) { - notifyCallLogChange(); + notifyCallLogChange(mContext); } return count; } |