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

Commit b0748115 authored by Wenyi Wang's avatar Wenyi Wang Committed by android-build-merger
Browse files

Merge "Catch transaction too large exception" into ub-contactsdialer-a-dev

am: 19952cdd

* commit '19952cdd':
  Catch transaction too large exception
parents e2d83da9 19952cdd
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -275,6 +275,15 @@
    <!-- Toast displayed when saving a contact failed. [CHAR LIMIT=NONE] -->
    <string name="contactSavedErrorToast">Couldn\'t save contact changes.</string>

    <!-- Toast displayed when unlinking a contact failed. [CHAR LIMIT=NONE] -->
    <string name="contactUnlinkErrorToast">Couldn\'t unlink contact.</string>

    <!-- Toast displayed when joining a contact failed. [CHAR LIMIT=NONE] -->
    <string name="contactJoinErrorToast">Couldn\'t join contact.</string>

    <!-- Generic error default clause displayed when saving a contact failed. [CHAR LIMIT=NONE] -->
    <string name="contactGenericErrorToast">Error saving contact.</string>

    <!-- Toast displayed when saving a contact photo failed. [CHAR LIMIT=NONE] -->
    <string name="contactPhotoSavedErrorToast">Couldn\'t save contact photo changes.</string>

+22 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.contacts.editor;
import com.android.contacts.ContactSaveService;
import com.android.contacts.R;
import com.android.contacts.activities.CompactContactEditorActivity;
import com.android.contacts.activities.ContactEditorBaseActivity;
import com.android.contacts.common.model.RawContactDelta;
import com.android.contacts.common.model.ValuesDelta;
import com.android.contacts.common.model.account.AccountWithDataSet;
@@ -161,8 +162,27 @@ public class CompactContactEditorFragment extends ContactEditorBaseFragment impl
                SAVE_MODE_EXTRA_KEY, saveMode, isEditingUserProfile(),
                ((Activity) mContext).getClass(),
                CompactContactEditorActivity.ACTION_SAVE_COMPLETED, mUpdatedPhotos);
        try {
            mContext.startService(intent);

        } catch (Exception exception) {
            final int resId;
            switch (saveMode) {
                case ContactEditorBaseActivity.ContactEditor.SaveMode.SPLIT:
                    resId = R.string.contactUnlinkErrorToast;
                    break;
                case ContactEditorBaseActivity.ContactEditor.SaveMode.RELOAD:
                    resId = R.string.contactJoinErrorToast;
                    break;
                case ContactEditorBaseActivity.ContactEditor.SaveMode.CLOSE:
                    resId = R.string.contactSavedErrorToast;
                    break;
                default:
                    resId = R.string.contactGenericErrorToast;
            }
            Toast.makeText(mContext, resId, Toast.LENGTH_SHORT).show();
            onCancelEditConfirmed();
            return false;
        }
        return true;
    }