| Index: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
|
| index 2d331e7bd0fe027d18ea3ecfe0a6b3f4d7422d2d..360ab4ad67ee38eef702f31cb2ffa1f82a82e97e 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
|
| @@ -46,6 +46,7 @@ import java.io.IOException;
|
| import java.util.ArrayList;
|
| import java.util.Arrays;
|
| import java.util.HashMap;
|
| +import java.util.HashSet;
|
| import java.util.List;
|
| import java.util.Locale;
|
| import java.util.Set;
|
| @@ -245,6 +246,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
|
| }
|
|
|
| if (requestPayerPhone || requestPayerEmail) {
|
| + Set<String> uniqueContactInfos = new HashSet<>();
|
| mContactEditor = new ContactEditor(requestPayerPhone, requestPayerEmail);
|
| List<AutofillContact> contacts = new ArrayList<>();
|
| int firstCompleteContactIndex = SectionInformation.NO_SELECTION;
|
| @@ -259,11 +261,19 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
|
| mContactEditor.addEmailAddressIfValid(email);
|
|
|
| if (phone != null || email != null) {
|
| - boolean isComplete = mContactEditor.isContactInformationComplete(phone, email);
|
| - contacts.add(new AutofillContact(profile, phone, email, isComplete));
|
| - if (isComplete
|
| - && firstCompleteContactIndex == SectionInformation.NO_SELECTION) {
|
| - firstCompleteContactIndex = i;
|
| + // Different profiles can have identical contact info. Do not add the same
|
| + // contact info to the list twice.
|
| + String uniqueContactInfo = phone + email;
|
| + if (!uniqueContactInfos.contains(uniqueContactInfo)) {
|
| + uniqueContactInfos.add(uniqueContactInfo);
|
| +
|
| + boolean isComplete =
|
| + mContactEditor.isContactInformationComplete(phone, email);
|
| + contacts.add(new AutofillContact(profile, phone, email, isComplete));
|
| + if (isComplete
|
| + && firstCompleteContactIndex == SectionInformation.NO_SELECTION) {
|
| + firstCompleteContactIndex = i;
|
| + }
|
| }
|
| }
|
| }
|
|
|