diff options
author | zachh <zachh@google.com> | 2017-12-20 10:57:38 -0800 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-12-22 08:53:44 -0800 |
commit | 0fab10eb28ab1e246f572302ad0e12508a196b34 (patch) | |
tree | 6fb4d96f0c6e2d9e31ab92fb7a3da5d50384a26d /java/com/android/dialer/phonelookup/cp2 | |
parent | 48609d015f06e262796b7ce8a088243199940a8a (diff) |
Added copySubMessage method to PhoneLookup interface.
The existing way that protos are merged in CompositePhoneLookup is not correct because foo_submessage from BarDataSource may incorrectly contribute old information to the merged message.
The new copySubMessage method makes it so that each PhoneLookup is responsible for defining which submessage it is responsible for and prevents the problem.
Test: unit
PiperOrigin-RevId: 179707015
Change-Id: I566305cf64c46c698f14812d9241d166ac75a6d3
Diffstat (limited to 'java/com/android/dialer/phonelookup/cp2')
-rw-r--r-- | java/com/android/dialer/phonelookup/cp2/Cp2PhoneLookup.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/java/com/android/dialer/phonelookup/cp2/Cp2PhoneLookup.java b/java/com/android/dialer/phonelookup/cp2/Cp2PhoneLookup.java index b31d0e72e..4261b763a 100644 --- a/java/com/android/dialer/phonelookup/cp2/Cp2PhoneLookup.java +++ b/java/com/android/dialer/phonelookup/cp2/Cp2PhoneLookup.java @@ -131,6 +131,7 @@ public final class Cp2PhoneLookup implements PhoneLookup { private boolean isDirtyInternal(ImmutableSet<DialerPhoneNumber> phoneNumbers) { long lastModified = sharedPreferences.getLong(PREF_LAST_TIMESTAMP_PROCESSED, 0L); + // TODO(zachh): If a number got disassociated with a contact; the contactIds will be empty. return contactsUpdated(queryPhoneTableForContactIds(phoneNumbers), lastModified) || contactsDeleted(lastModified); } @@ -253,6 +254,11 @@ public final class Cp2PhoneLookup implements PhoneLookup { () -> getMostRecentPhoneLookupInfoInternal(existingInfoMap)); } + @Override + public void copySubMessage(PhoneLookupInfo.Builder destination, PhoneLookupInfo source) { + destination.setCp2Info(source.getCp2Info()); + } + private ImmutableMap<DialerPhoneNumber, PhoneLookupInfo> getMostRecentPhoneLookupInfoInternal( ImmutableMap<DialerPhoneNumber, PhoneLookupInfo> existingInfoMap) { currentLastTimestampProcessed = null; |