Merge change 26813 into eclair

* changes:
  Compare rawContactIds using actual number value.
diff --git a/src/com/android/contacts/model/ExchangeSource.java b/src/com/android/contacts/model/ExchangeSource.java
index 5c2d024..0a7fb23 100644
--- a/src/com/android/contacts/model/ExchangeSource.java
+++ b/src/com/android/contacts/model/ExchangeSource.java
@@ -123,6 +123,8 @@
             kind.typeList.add(buildPhoneType(Phone.TYPE_MMS).setSecondary(true).setSpecificMax(1));
             kind.typeList
                     .add(buildPhoneType(Phone.TYPE_RADIO).setSecondary(true).setSpecificMax(1));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_ASSISTANT).setSecondary(true)
+                    .setSpecificMax(1).setCustomColumn(Phone.LABEL));
             kind.typeList.add(buildPhoneType(Phone.TYPE_CUSTOM).setSecondary(true)
                     .setSpecificMax(1).setCustomColumn(Phone.LABEL));
 
diff --git a/src/com/android/contacts/ui/widget/GenericEditorView.java b/src/com/android/contacts/ui/widget/GenericEditorView.java
index 4490fbf..53dd2e0 100644
--- a/src/com/android/contacts/ui/widget/GenericEditorView.java
+++ b/src/com/android/contacts/ui/widget/GenericEditorView.java
@@ -74,6 +74,8 @@
     protected boolean mHideOptional = true;
 
     protected EditType mType;
+    // Used only when a user tries to use custom label.
+    private EditType mPendingType;
 
     public GenericEditorView(Context context) {
         super(context);
@@ -221,7 +223,7 @@
      * If the final value is empty, this change request is ignored;
      * no empty text is allowed in any custom label.
      */
-    public Dialog createCustomDialog() {
+    private Dialog createCustomDialog() {
         final EditText customType = new EditText(mContext);
         customType.setInputType(INPUT_TYPE_CUSTOM);
         customType.requestFocus();
@@ -234,6 +236,10 @@
             public void onClick(DialogInterface dialog, int which) {
                 final String customText = customType.getText().toString().trim();
                 if (!TextUtils.isEmpty(customText)) {
+                    // Now we're sure it's ok to actually change the type value.
+                    mType = mPendingType;
+                    mPendingType = null;
+                    mEntry.put(mKind.typeColumn, mType.rawValue);
                     mEntry.put(mType.customColumn, customText);
                     rebuildLabel();
                 }
@@ -274,18 +280,22 @@
             }
         };
 
-        final DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
+        final DialogInterface.OnClickListener clickListener =
+                new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int which) {
                 dialog.dismiss();
 
-                // User picked type, so write to entry
-                mType = validTypes.get(which);
-                mEntry.put(mKind.typeColumn, mType.rawValue);
-
                 if (mType.customColumn != null) {
-                    // Show custom label dialog if requested by type
+                    // Show custom label dialog if requested by type.
+                    //
+                    // Only when the custum value input in the next step is correct one.
+                    // this method also set the type value to what the user requested here.
+                    mPendingType = validTypes.get(which);
                     createCustomDialog().show();
                 } else {
+                    // User picked type, and we're sure it's ok to actually write the entry.
+                    mType = validTypes.get(which);
+                    mEntry.put(mKind.typeColumn, mType.rawValue);
                     rebuildLabel();
                 }
             }