Do not allow adding contracts for private numbers.

Some call log entries do not have an actual number available. In those
cases, do not allow adding them as contacts, because that would lead to
a contact with an invalid number.

Bug: 5051868
Change-Id: Icc64f9714d7fd3fd6f985c4663dd937648980ae4
diff --git a/src/com/android/contacts/CallDetailActivity.java b/src/com/android/contacts/CallDetailActivity.java
index d411927..2bea2f3 100644
--- a/src/com/android/contacts/CallDetailActivity.java
+++ b/src/com/android/contacts/CallDetailActivity.java
@@ -307,11 +307,16 @@
             // and then we can remove the "!isSipNumber" check above.
             mainActionIntent = null;
             mainActionIcon = 0;
-        } else {
+        } else if (canPlaceCallsTo) {
             mainActionIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
             mainActionIntent.setType(Contacts.CONTENT_ITEM_TYPE);
             mainActionIntent.putExtra(Insert.PHONE, mNumber);
             mainActionIcon = R.drawable.sym_action_add;
+        } else {
+            // If we cannot call the number, when we probably cannot add it as a contact either.
+            // This is usually the case of private, unknown, or payphone numbers.
+            mainActionIntent = null;
+            mainActionIcon = 0;
         }
 
         if (mainActionIntent == null) {