Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7241445c authored by Andre Johansson's avatar Andre Johansson Committed by Steve Kondik
Browse files

Contact icon cannot be replaced when set from gallery.

It is not possible to replace a contact icon for the
default account type.
This fix adds the default account type to the check that is
made before trying to add or replace a contact icon.

Change-Id: I8fc2a71347c2a9123fe61edece3aef79d0900b14
parent fade1bb2
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -175,8 +175,9 @@ public class AttachImage extends Activity {
    /**
     * 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 @@ public class AttachImage extends Activity {
            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, GoogleSource.ACCOUNT_TYPE,
                            ExchangeSource.ACCOUNT_TYPE})
                            .withExpectedCount(0).build());