From 0fab10eb28ab1e246f572302ad0e12508a196b34 Mon Sep 17 00:00:00 2001 From: zachh Date: Wed, 20 Dec 2017 10:57:38 -0800 Subject: 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 --- java/com/android/dialer/phonelookup/PhoneLookup.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'java/com/android/dialer/phonelookup/PhoneLookup.java') diff --git a/java/com/android/dialer/phonelookup/PhoneLookup.java b/java/com/android/dialer/phonelookup/PhoneLookup.java index eeab4dadd..bb14c1ff6 100644 --- a/java/com/android/dialer/phonelookup/PhoneLookup.java +++ b/java/com/android/dialer/phonelookup/PhoneLookup.java @@ -61,6 +61,12 @@ public interface PhoneLookup { ListenableFuture> getMostRecentPhoneLookupInfo( ImmutableMap existingInfoMap); + /** + * Populates the sub-message that this {@link PhoneLookup} is responsible for by copying the + * sub-message value from {@code source} to {@code destination} + */ + void copySubMessage(PhoneLookupInfo.Builder destination, PhoneLookupInfo source); + /** * Called when the results of the {@link #getMostRecentPhoneLookupInfo(ImmutableMap)} have been * applied by the caller. -- cgit v1.2.3