Add action to copy the phone number in the dialer.

This is different from the call action as it does not actually dial the
number but allows the user to edit the number before dialing.

As for the delete action, this might not be its final location, but this
moves it to the right activity, the call details page instead of the
long-press menu in the call log.

Change-Id: I0110f7f876d3ee34adc0461a858a8ab1e694f1bd
diff --git a/src/com/android/contacts/CallDetailActivity.java b/src/com/android/contacts/CallDetailActivity.java
index 138ce25..7f01481 100644
--- a/src/com/android/contacts/CallDetailActivity.java
+++ b/src/com/android/contacts/CallDetailActivity.java
@@ -261,15 +261,24 @@
                     // Build list of various available actions
                     List<ViewEntry> actions = new ArrayList<ViewEntry>();
 
-                    Intent callIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
-                            Uri.fromParts("tel", mNumber, null));
-                    actions.add(new ViewEntry(android.R.drawable.sym_action_call,
-                            getString(R.string.menu_callNumber, mNumber), callIntent));
+                    final boolean isSipNumber = PhoneNumberUtils.isUriNumber(mNumber);
+                    final Uri numberCallUri;
+                    if (isSipNumber) {
+                        numberCallUri = Uri.fromParts("sip", mNumber, null);
+                    } else {
+                        numberCallUri = Uri.fromParts("tel", mNumber, null);
+                    }
 
-                    Intent smsIntent = new Intent(Intent.ACTION_SENDTO,
-                            Uri.fromParts("sms", mNumber, null));
-                    actions.add(new ViewEntry(R.drawable.sym_action_sms,
-                            getString(R.string.menu_sendTextMessage), smsIntent));
+                    actions.add(new ViewEntry(android.R.drawable.sym_action_call,
+                            getString(R.string.menu_callNumber, mNumber),
+                            new Intent(Intent.ACTION_CALL_PRIVILEGED, numberCallUri)));
+
+                    if (!isSipNumber) {
+                        Intent smsIntent = new Intent(Intent.ACTION_SENDTO,
+                                Uri.fromParts("sms", mNumber, null));
+                        actions.add(new ViewEntry(R.drawable.sym_action_sms,
+                                getString(R.string.menu_sendTextMessage), smsIntent));
+                    }
 
                     actions.add(new ViewEntry(android.R.drawable.ic_menu_close_clear_cancel,
                             getString(R.string.recentCalls_removeFromRecentList),
@@ -283,6 +292,12 @@
                                 }
                             }));
 
+                    if (!isSipNumber) {
+                        actions.add(new ViewEntry(android.R.drawable.sym_action_call,
+                                getString(R.string.recentCalls_editNumberBeforeCall),
+                                new Intent(Intent.ACTION_DIAL, numberCallUri)));
+                    }
+
                     ViewAdapter adapter = new ViewAdapter(this, actions);
                     setListAdapter(adapter);
                 }