Hiding the type OTHER

Bug: 3143954
Change-Id: I9d5e19394b56f4ea667c3fa1dda5d182d3ef2c18
diff --git a/src/com/android/contacts/model/AccountType.java b/src/com/android/contacts/model/AccountType.java
index e62d0ba..e6d8987 100644
--- a/src/com/android/contacts/model/AccountType.java
+++ b/src/com/android/contacts/model/AccountType.java
@@ -271,6 +271,11 @@
         public int specificMax;
         public String customColumn;
 
+        /**
+         * True if this type may be shown as blank.
+         */
+        public boolean unspecifiedType;
+
         public EditType(int rawValue, int labelRes) {
             this.rawValue = rawValue;
             this.labelRes = labelRes;
@@ -292,6 +297,11 @@
             return this;
         }
 
+        public EditType setUnspecifiedType(boolean unspecifiedType) {
+            this.unspecifiedType = unspecifiedType;
+            return this;
+        }
+
         @Override
         public boolean equals(Object object) {
             if (object instanceof EditType) {
diff --git a/src/com/android/contacts/model/FallbackAccountType.java b/src/com/android/contacts/model/FallbackAccountType.java
index ff3f5c5..601e77e 100644
--- a/src/com/android/contacts/model/FallbackAccountType.java
+++ b/src/com/android/contacts/model/FallbackAccountType.java
@@ -89,23 +89,28 @@
     }
 
     protected EditType buildPhoneType(int type) {
-        return new EditType(type, Phone.getTypeLabelResource(type));
+        return new EditType(type, Phone.getTypeLabelResource(type))
+                .setUnspecifiedType(type == Phone.TYPE_OTHER);
     }
 
     protected EditType buildEmailType(int type) {
-        return new EditType(type, Email.getTypeLabelResource(type));
+        return new EditType(type, Email.getTypeLabelResource(type))
+                .setUnspecifiedType(type == Email.TYPE_OTHER);
     }
 
     protected EditType buildPostalType(int type) {
-        return new EditType(type, StructuredPostal.getTypeLabelResource(type));
+        return new EditType(type, StructuredPostal.getTypeLabelResource(type))
+                .setUnspecifiedType(type == StructuredPostal.TYPE_OTHER);
     }
 
     protected EditType buildImType(int type) {
-        return new EditType(type, Im.getProtocolLabelResource(type));
+        return new EditType(type, Im.getProtocolLabelResource(type))
+                .setUnspecifiedType(type == Im.TYPE_OTHER);
     }
 
-    protected EventEditType buildEventType(int type, boolean yearOptional) {
-        return new EventEditType(type, Event.getTypeResource(type)).setYearOptional(yearOptional);
+    protected EditType buildEventType(int type, boolean yearOptional) {
+        return new EventEditType(type, Event.getTypeResource(type)).setYearOptional(yearOptional)
+                .setUnspecifiedType(type == Event.TYPE_OTHER);
     }
 
     protected EditType buildRelationType(int type) {
diff --git a/src/com/android/contacts/views/detail/ContactDetailFragment.java b/src/com/android/contacts/views/detail/ContactDetailFragment.java
index 62da845..dacc9cb 100644
--- a/src/com/android/contacts/views/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/views/detail/ContactDetailFragment.java
@@ -679,12 +679,14 @@
                 entry.typeString = "";
                 for (EditType type : kind.typeList) {
                     if (type.rawValue == entry.type) {
-                        if (type.customColumn == null) {
-                            // Non-custom type. Get its description from the resource
-                            entry.typeString = context.getString(type.labelRes);
-                        } else {
-                            // Custom type. Read it from the database
-                            entry.typeString = values.getAsString(type.customColumn);
+                        if (!type.unspecifiedType) {
+                            if (type.customColumn == null) {
+                                // Non-custom type. Get its description from the resource
+                                entry.typeString = context.getString(type.labelRes);
+                            } else {
+                                // Custom type. Read it from the database
+                                entry.typeString = values.getAsString(type.customColumn);
+                            }
                         }
                         break;
                     }