[Issue 2139542] Making sure a contact cannot be joined with itself.

Change-Id: If1a8ab01941e2017ed7532a61607c4ce09793e14
diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java
index 79af879..fef9bb5 100644
--- a/src/com/android/contacts/ContactsListActivity.java
+++ b/src/com/android/contacts/ContactsListActivity.java
@@ -1719,7 +1719,7 @@
             case MODE_JOIN_CONTACT:
                 mQueryHandler.setLoadingJoinSuggestions(true);
                 mQueryHandler.startQuery(QUERY_TOKEN, null, getJoinSuggestionsUri(null), projection,
-                        null, null, null);
+                        Contacts._ID + " != " + mQueryAggregateId, null, null);
                 break;
         }
     }
@@ -1795,7 +1795,8 @@
                         null, null);
                 mAdapter.setSuggestionsCursor(cursor);
                 return resolver.query(getContactFilterUri(filter), projection,
-                        getContactSelection(), null, getSortOrder(projection));
+                        Contacts._ID + " != " + mQueryAggregateId, null,
+                        getSortOrder(projection));
             }
         }
         throw new UnsupportedOperationException("filtering not allowed in mode " + mMode);