Merge change 26614 into eclair

* changes:
  Make Contacts app not allow users to create empty label for TYPE_CUSTOM field.
diff --git a/src/com/android/contacts/ViewContactActivity.java b/src/com/android/contacts/ViewContactActivity.java
index 14039f0..70c1867 100644
--- a/src/com/android/contacts/ViewContactActivity.java
+++ b/src/com/android/contacts/ViewContactActivity.java
@@ -963,8 +963,7 @@
 
                             if (protocolObj instanceof Number) {
                                 int protocol = ((Number) protocolObj).intValue();
-                                host = ContactsUtils.lookupProviderNameFromId(
-                                        protocol).toLowerCase();
+                                host = ContactsUtils.lookupProviderNameFromId(protocol);
                                 if (protocol == CommonDataKinds.Im.PROTOCOL_GOOGLE_TALK
                                         || protocol == CommonDataKinds.Im.PROTOCOL_MSN) {
                                     entry.maxLabelLines = 2;
@@ -975,9 +974,10 @@
                             }
 
                             // Only add the intent if there is a valid host
+                            //  host is null for CommonDataKinds.Im.PROTOCOL_CUSTOM
                             if (!TextUtils.isEmpty(host)) {
                                 entry.intent = new Intent(Intent.ACTION_SENDTO,
-                                        constructImToUrl(host, entry.data));
+                                        constructImToUrl(host.toLowerCase(), entry.data));
                             }
                             //TODO(emillar) Add in presence info
                             /*if (!aggCursor.isNull(METHODS_STATUS_COLUMN)) {
diff --git a/src/com/android/contacts/ui/ShowOrCreateActivity.java b/src/com/android/contacts/ui/ShowOrCreateActivity.java
index 8d3ed01..7728b36 100755
--- a/src/com/android/contacts/ui/ShowOrCreateActivity.java
+++ b/src/com/android/contacts/ui/ShowOrCreateActivity.java
@@ -23,6 +23,7 @@
 
 import android.app.Activity;
 import android.app.AlertDialog;
+import android.app.Dialog;
 import android.content.ComponentName;
 import android.content.ContentUris;
 import android.content.DialogInterface;
@@ -68,6 +69,8 @@
 
     static final int CONTACT_ID_INDEX = 0;
 
+    static final int CREATE_CONTACT_DIALOG = 1;
+
     static final int QUERY_TOKEN = 42;
 
     private NotifyingAsyncQueryHandler mQueryHandler;
@@ -189,24 +192,33 @@
                 finish();
 
             } else {
+	        showDialog(CREATE_CONTACT_DIALOG);
+           }
+        }
+    }
+
+    @Override
+    protected Dialog onCreateDialog(int id) {
+        switch(id) {
+	    case CREATE_CONTACT_DIALOG:
                 // Prompt user to insert or edit contact
-                Intent createIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
+                final Intent createIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
                 createIntent.putExtras(mCreateExtras);
                 createIntent.setType(RawContacts.CONTENT_ITEM_TYPE);
 
-                CharSequence message = getResources().getString(
+                final CharSequence message = getResources().getString(
                         R.string.add_contact_dlg_message_fmt, mCreateDescrip);
 
-                new AlertDialog.Builder(this)
+                return new AlertDialog.Builder(this)
                         .setTitle(R.string.add_contact_dlg_title)
                         .setMessage(message)
                         .setPositiveButton(android.R.string.ok,
                                 new IntentClickListener(this, createIntent))
                         .setNegativeButton(android.R.string.cancel,
                                 new IntentClickListener(this, null))
-                        .show();
-            }
+                        .create();
         }
+	return super.onCreateDialog(id);
     }
 
     /** {@inheritDoc} */