Reset suggestion fields before reusing the object.
This avoids leaking data from one suggestion into the next for
option attributes.
Bug:5845926
Change-Id: I6c70cb042bf4b92c1e5fd80e8da96d625ef7f7db
diff --git a/src/com/android/providers/contacts/GlobalSearchSupport.java b/src/com/android/providers/contacts/GlobalSearchSupport.java
index 2acae60..70dbd31 100644
--- a/src/com/android/providers/contacts/GlobalSearchSupport.java
+++ b/src/com/android/providers/contacts/GlobalSearchSupport.java
@@ -174,6 +174,21 @@
private String buildUri() {
return Contacts.getLookupUri(contactId, lookupKey).toString();
}
+
+ public void reset() {
+ contactId = 0;
+ photoUri = null;
+ lookupKey = null;
+ presence = -1;
+ text1 = null;
+ text2 = null;
+ icon1 = null;
+ icon2 = null;
+ intentData = null;
+ intentAction = null;
+ filter = null;
+ lastAccessTime = null;
+ }
}
private final ContactsProvider2 mContactsProvider;
@@ -370,6 +385,7 @@
suggestion.text2 = shortenSnippet(c.getString(6));
}
cursor.addRow(suggestion.asList(projection));
+ suggestion.reset();
}
} finally {
c.close();