Merge "Import translations. DO NOT MERGE" into lmp-dev
diff --git a/src/com/android/contacts/ContactSaveService.java b/src/com/android/contacts/ContactSaveService.java
index cc687ec..bb03705 100644
--- a/src/com/android/contacts/ContactSaveService.java
+++ b/src/com/android/contacts/ContactSaveService.java
@@ -53,7 +53,6 @@
 import com.android.contacts.common.model.RawContactDeltaList;
 import com.android.contacts.common.model.RawContactModifier;
 import com.android.contacts.common.model.account.AccountWithDataSet;
-import com.android.contacts.util.CallerInfoCacheUtils;
 import com.android.contacts.util.ContactPhotoUtils;
 
 import com.google.common.collect.Lists;
@@ -188,10 +187,8 @@
         String action = intent.getAction();
         if (ACTION_NEW_RAW_CONTACT.equals(action)) {
             createRawContact(intent);
-            CallerInfoCacheUtils.sendUpdateCallerInfoCacheIntent(this);
         } else if (ACTION_SAVE_CONTACT.equals(action)) {
             saveContact(intent);
-            CallerInfoCacheUtils.sendUpdateCallerInfoCacheIntent(this);
         } else if (ACTION_CREATE_GROUP.equals(action)) {
             createGroup(intent);
         } else if (ACTION_RENAME_GROUP.equals(action)) {
@@ -208,16 +205,12 @@
             clearPrimary(intent);
         } else if (ACTION_DELETE_CONTACT.equals(action)) {
             deleteContact(intent);
-            CallerInfoCacheUtils.sendUpdateCallerInfoCacheIntent(this);
         } else if (ACTION_JOIN_CONTACTS.equals(action)) {
             joinContacts(intent);
-            CallerInfoCacheUtils.sendUpdateCallerInfoCacheIntent(this);
         } else if (ACTION_SET_SEND_TO_VOICEMAIL.equals(action)) {
             setSendToVoicemail(intent);
-            CallerInfoCacheUtils.sendUpdateCallerInfoCacheIntent(this);
         } else if (ACTION_SET_RINGTONE.equals(action)) {
             setRingtone(intent);
-            CallerInfoCacheUtils.sendUpdateCallerInfoCacheIntent(this);
         }
     }
 
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index f112847..ed2520d 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -125,6 +125,7 @@
     private static final String KEY_STATUS = "status";
     private static final String KEY_NEW_LOCAL_PROFILE = "newLocalProfile";
     private static final String KEY_IS_USER_PROFILE = "isUserProfile";
+    private static final String KEY_DISABLE_DELETE_MENU_OPTION = "disableDeleteMenuOption";
     private static final String KEY_UPDATED_PHOTOS = "updatedPhotos";
     private static final String KEY_IS_EDIT = "isEdit";
     private static final String KEY_HAS_NEW_CONTACT = "hasNewContact";
@@ -146,6 +147,9 @@
 
     public static final String INTENT_EXTRA_NEW_LOCAL_PROFILE = "newLocalProfile";
 
+    public static final String INTENT_EXTRA_DISABLE_DELETE_MENU_OPTION =
+            "disableDeleteMenuOption";
+
     /**
      * Modes that specify what the AsyncTask has to perform after saving
      */
@@ -339,6 +343,7 @@
     private boolean mRequestFocus;
     private boolean mNewLocalProfile = false;
     private boolean mIsUserProfile = false;
+    private boolean mDisableDeleteMenuOption = false;
 
     public ContactEditorFragment() {
     }
@@ -471,6 +476,8 @@
                 && mIntentExtras.containsKey(INTENT_EXTRA_ADD_TO_DEFAULT_DIRECTORY);
         mNewLocalProfile = mIntentExtras != null
                 && mIntentExtras.getBoolean(INTENT_EXTRA_NEW_LOCAL_PROFILE);
+        mDisableDeleteMenuOption = mIntentExtras != null
+                && mIntentExtras.getBoolean(INTENT_EXTRA_DISABLE_DELETE_MENU_OPTION);
     }
 
     public void setListener(Listener value) {
@@ -504,6 +511,7 @@
             mEnabled = savedState.getBoolean(KEY_ENABLED);
             mStatus = savedState.getInt(KEY_STATUS);
             mNewLocalProfile = savedState.getBoolean(KEY_NEW_LOCAL_PROFILE);
+            mDisableDeleteMenuOption = savedState.getBoolean(KEY_DISABLE_DELETE_MENU_OPTION);
             mIsUserProfile = savedState.getBoolean(KEY_IS_USER_PROFILE);
             mUpdatedPhotos = savedState.getParcelable(KEY_UPDATED_PHOTOS);
             mIsEdit = savedState.getBoolean(KEY_IS_EDIT);
@@ -1072,6 +1080,7 @@
             splitMenu.setVisible(mState.size() > 1 && !isEditingUserProfile());
             // Cannot join a user profile
             joinMenu.setVisible(!isEditingUserProfile());
+            deleteMenu.setVisible(!mDisableDeleteMenuOption);
         } else {
             // something else, so don't show the help menu
             helpMenu.setVisible(false);
@@ -1767,6 +1776,7 @@
         outState.putLong(KEY_SHOW_JOIN_SUGGESTIONS, mAggregationSuggestionsRawContactId);
         outState.putBoolean(KEY_ENABLED, mEnabled);
         outState.putBoolean(KEY_NEW_LOCAL_PROFILE, mNewLocalProfile);
+        outState.putBoolean(KEY_DISABLE_DELETE_MENU_OPTION, mDisableDeleteMenuOption);
         outState.putBoolean(KEY_IS_USER_PROFILE, mIsUserProfile);
         outState.putInt(KEY_STATUS, mStatus);
         outState.putParcelable(KEY_UPDATED_PHOTOS, mUpdatedPhotos);
diff --git a/src/com/android/contacts/list/EmailAddressListAdapter.java b/src/com/android/contacts/list/EmailAddressListAdapter.java
index 5df4b34..d19f960 100644
--- a/src/com/android/contacts/list/EmailAddressListAdapter.java
+++ b/src/com/android/contacts/list/EmailAddressListAdapter.java
@@ -132,6 +132,7 @@
 
     @Override
     protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        super.bindView(itemView, partition, cursor, position);
         ContactListItemView view = (ContactListItemView)itemView;
         bindSectionHeaderAndDivider(view, position);
         bindName(view, cursor);
diff --git a/src/com/android/contacts/list/JoinContactListAdapter.java b/src/com/android/contacts/list/JoinContactListAdapter.java
index 23dc109..f08fcbb 100644
--- a/src/com/android/contacts/list/JoinContactListAdapter.java
+++ b/src/com/android/contacts/list/JoinContactListAdapter.java
@@ -182,6 +182,7 @@
 
     @Override
     protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        super.bindView(itemView, partition, cursor, position);
         switch (partition) {
             case PARTITION_SUGGESTIONS: {
                 final ContactListItemView view = (ContactListItemView) itemView;
diff --git a/src/com/android/contacts/list/LegacyContactListAdapter.java b/src/com/android/contacts/list/LegacyContactListAdapter.java
index 98144fe..837991b 100644
--- a/src/com/android/contacts/list/LegacyContactListAdapter.java
+++ b/src/com/android/contacts/list/LegacyContactListAdapter.java
@@ -82,6 +82,7 @@
 
     @Override
     protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        super.bindView(itemView, partition, cursor, position);
         ContactListItemView view = (ContactListItemView)itemView;
         bindName(view, cursor);
         bindViewId(view, cursor, PERSON_ID_COLUMN_INDEX);
diff --git a/src/com/android/contacts/list/LegacyPhoneNumberListAdapter.java b/src/com/android/contacts/list/LegacyPhoneNumberListAdapter.java
index f9f0357..b5c96df 100644
--- a/src/com/android/contacts/list/LegacyPhoneNumberListAdapter.java
+++ b/src/com/android/contacts/list/LegacyPhoneNumberListAdapter.java
@@ -87,6 +87,7 @@
 
     @Override
     protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        super.bindView(itemView, partition, cursor, position);
         ContactListItemView view = (ContactListItemView)itemView;
         bindName(view, cursor);
         bindViewId(view, cursor, PHONE_ID_COLUMN_INDEX);
diff --git a/src/com/android/contacts/list/LegacyPostalAddressListAdapter.java b/src/com/android/contacts/list/LegacyPostalAddressListAdapter.java
index d4919e7..4c598cd 100644
--- a/src/com/android/contacts/list/LegacyPostalAddressListAdapter.java
+++ b/src/com/android/contacts/list/LegacyPostalAddressListAdapter.java
@@ -87,6 +87,7 @@
 
     @Override
     protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        super.bindView(itemView, partition, cursor, position);
         ContactListItemView view = (ContactListItemView)itemView;
         bindName(view, cursor);
         bindViewId(view, cursor, POSTAL_ID_COLUMN_INDEX);
diff --git a/src/com/android/contacts/list/PostalAddressListAdapter.java b/src/com/android/contacts/list/PostalAddressListAdapter.java
index c715f30..951a933 100644
--- a/src/com/android/contacts/list/PostalAddressListAdapter.java
+++ b/src/com/android/contacts/list/PostalAddressListAdapter.java
@@ -123,6 +123,7 @@
 
     @Override
     protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        super.bindView(itemView, partition, cursor, position);
         ContactListItemView view = (ContactListItemView)itemView;
         bindSectionHeaderAndDivider(view, position);
         bindName(view, cursor);
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index d7c0c45..eda9a91 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -125,6 +125,7 @@
 import com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette;
 import com.android.contacts.common.util.ViewUtil;
 import com.android.contacts.detail.ContactDisplayUtils;
+import com.android.contacts.editor.ContactEditorFragment;
 import com.android.contacts.interactions.CalendarInteractionsLoader;
 import com.android.contacts.interactions.CallLogInteractionsLoader;
 import com.android.contacts.interactions.ContactDeletionInteraction;
@@ -141,7 +142,6 @@
 import com.android.contacts.widget.MultiShrinkScroller;
 import com.android.contacts.widget.MultiShrinkScroller.MultiShrinkScrollerListener;
 import com.android.contacts.widget.QuickContactImageView;
-
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
 
@@ -771,6 +771,10 @@
     }
 
     private void processIntent(Intent intent) {
+        if (intent == null) {
+            finish();
+            return;
+        }
         Uri lookupUri = intent.getData();
 
         // Check to see whether it comes from the old version.
@@ -2162,6 +2166,11 @@
                                 mContactData.getRawContacts().get(0).getDataSet());
                     }
 
+                    // Add this flag to disable the delete menu option on directory contact joins
+                    // with local contacts. The delete option is ambiguous when joining contacts.
+                    intent.putExtra(ContactEditorFragment.INTENT_EXTRA_DISABLE_DELETE_MENU_OPTION,
+                            true);
+
                     startActivityForResult(intent, REQUEST_CODE_CONTACT_SELECTION_ACTIVITY);
                 } else if (InvisibleContactUtil.isInvisibleAndAddable(mContactData, this)) {
                     InvisibleContactUtil.addToDefaultGroup(mContactData, this);
diff --git a/src/com/android/contacts/util/CallerInfoCacheUtils.java b/src/com/android/contacts/util/CallerInfoCacheUtils.java
deleted file mode 100644
index 9e53159..0000000
--- a/src/com/android/contacts/util/CallerInfoCacheUtils.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.contacts.util;
-
-import android.content.Context;
-import android.content.Intent;
-
-/**
- * Utilities for managing CallerInfoCache.
- *
- * The cache lives in Phone package and is used as fallback storage when database lookup is slower
- * than expected. It remembers some information necessary for responding to incoming calls
- * (e.g. custom ringtone settings, send-to-voicemail).
- *
- * Even though the cache will be updated periodically, Contacts app can request the cache update
- * via broadcast Intent. This class provides that mechanism, and possibly other misc utilities
- * for the update mechanism.
- */
-public final class CallerInfoCacheUtils {
-    private static final String UPDATE_CALLER_INFO_CACHE =
-            "com.android.phone.UPDATE_CALLER_INFO_CACHE";
-
-    private CallerInfoCacheUtils() {
-    }
-
-    /**
-     * Sends an Intent, notifying CallerInfo cache should be updated.
-     *
-     * Note: CallerInfo is *not* part of public API, and no guarantee is available around its
-     * specific behavior. In practice this will only be used by Phone package, but may change
-     * in the future.
-     *
-     * See also CallerInfoCache in Phone package for more information.
-     */
-    public static void sendUpdateCallerInfoCacheIntent(Context context) {
-        context.sendBroadcast(new Intent(UPDATE_CALLER_INFO_CACHE));
-    }
-}
\ No newline at end of file