aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTa-wei Yen <twyen@google.com>2017-05-24 18:30:10 -0700
committerTa-wei Yen <twyen@google.com>2017-05-25 15:05:31 -0700
commit58a1f876fb972d290bba505365605ab6f4087c7f (patch)
tree7b61e453e289c8fae19f1f091721a1e73ef318fb /src
parent90f690852cd16ad92674cc196c29aeecbdf45e04 (diff)
downloadContactsProvider-58a1f876fb972d290bba505365605ab6f4087c7f.tar.gz
Allow voicemail DIRTY flag to be explicity set
The DIRTY flag is used to indicate there are local changes that needs to be uploaded to the server. Previously this flag is automatically set to 1 if the modifying package does not own the voicemail. For example when dialer marked the voicemail as read, ContactsProvider will mark it as dirty, and the source telephony will query for dirty entries and upload it to the server. After visual voicemail is unbundled, the voicemail source is no longer guaranteed to be separated from the voicemail UI. In this CL, the DIRTY field will no longer be overriden if the caller sets the field. Bug: 38302993 Test: CtsProviderTestCases Change-Id: I4a3d08a7ab2b9d61d271ae548ecdbc358af48f3e
Diffstat (limited to 'src')
-rw-r--r--src/com/android/providers/contacts/DbModifierWithNotification.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/providers/contacts/DbModifierWithNotification.java b/src/com/android/providers/contacts/DbModifierWithNotification.java
index f67a2a8f..cb5460ce 100644
--- a/src/com/android/providers/contacts/DbModifierWithNotification.java
+++ b/src/com/android/providers/contacts/DbModifierWithNotification.java
@@ -37,9 +37,11 @@ import android.provider.VoicemailContract;
import android.provider.VoicemailContract.Status;
import android.provider.VoicemailContract.Voicemails;
import android.util.Log;
+
import com.android.common.io.MoreCloseables;
import com.android.providers.contacts.CallLogDatabaseHelper.Tables;
import com.android.providers.contacts.util.DbQueryUtils;
+
import com.google.android.collect.Lists;
import com.google.common.collect.Iterables;
import java.util.ArrayList;
@@ -172,7 +174,14 @@ public class DbModifierWithNotification implements DatabaseModifier {
// from the server and thus is synced or "clean". Otherwise, it means that a local
// change is being made to the database, so the entries should be marked as "dirty"
// so that the corresponding sync adapter knows they need to be synced.
- final int isDirty = isSelfModifyingOrInternal(packagesModified) ? 0 : 1;
+ int isDirty;
+ Integer callerSetDirty = values.getAsInteger(Voicemails.DIRTY);
+ if (callerSetDirty != null) {
+ // Respect the calling package if it sets the dirty flag
+ isDirty = callerSetDirty == 0 ? 0 : 1;
+ } else {
+ isDirty = isSelfModifyingOrInternal(packagesModified) ? 0 : 1;
+ }
values.put(VoicemailContract.Voicemails.DIRTY, isDirty);
if (isDirty == 0 && values.containsKey(Calls.IS_READ) && getAsBoolean(values,