resolved conflicts for merge of af7bd11e to master

Change-Id: If0816ca5306aae0e59219b095e3923c0b7d9a23b
diff --git a/src/com/android/contacts/AttachImage.java b/src/com/android/contacts/AttachImage.java
index ba1892a..5e0ead4 100644
--- a/src/com/android/contacts/AttachImage.java
+++ b/src/com/android/contacts/AttachImage.java
@@ -175,8 +175,9 @@
     /**
      * Inserts a photo on the raw contact.
      * @param values the photo values
-     * @param assertAccount if true, will check to verify if the account is Google or exchange,
-     *     no photos exist (Google and exchange only take one picture)
+     * @param assertAccount if true, will check to verify that no photos exist for Google,
+     *     Exchange and unsynced phone account types. These account types only take one picture,
+     *     so if one exists, the account will be updated with the new photo.
      */
     private void insertPhoto(ContentValues values, Uri rawContactDataUri,
             boolean assertAccount) {
@@ -185,10 +186,11 @@
             new ArrayList<ContentProviderOperation>();
 
         if (assertAccount) {
-            // make sure for Google and exchange, no pictures exist
+            // Make sure no pictures exist for Google, Exchange and unsynced phone accounts.
             operations.add(ContentProviderOperation.newAssertQuery(rawContactDataUri)
-                    .withSelection(Photo.MIMETYPE + "=? AND "
-                            + RawContacts.ACCOUNT_TYPE + " IN (?,?)",
+                    .withSelection(Photo.MIMETYPE + "=? AND ("
+                            + RawContacts.ACCOUNT_TYPE + " IN (?,?) OR "
+                            + RawContacts.ACCOUNT_TYPE + " IS NULL)",
                             new String[] {Photo.CONTENT_ITEM_TYPE, GoogleAccountType.ACCOUNT_TYPE,
                             ExchangeAccountType.ACCOUNT_TYPE})
                             .withExpectedCount(0).build());