Not able to call a number that isn't saved in contacts, when pressing the call button from messaging app

Bug 5922602

Don't build the options menu until after the visibility of the recipients
editor is determined.

Change-Id: Ie70019808b130f5ac982285a48b537dce60ca914
diff --git a/src/com/android/mms/ui/ComposeMessageActivity.java b/src/com/android/mms/ui/ComposeMessageActivity.java
index 96979a7..085822f 100644
--- a/src/com/android/mms/ui/ComposeMessageActivity.java
+++ b/src/com/android/mms/ui/ComposeMessageActivity.java
@@ -1814,7 +1814,6 @@
 
         // Let the working message know what conversation it belongs to
         mWorkingMessage.setConversation(mConversation);
-        invalidateOptionsMenu();
 
         // Show the recipients editor if we don't have a valid thread. Hide it otherwise.
         if (mConversation.getThreadId() <= 0) {
@@ -1830,6 +1829,10 @@
         } else {
             hideRecipientEditor();
         }
+        invalidateOptionsMenu();    // do after show/hide of recipients editor because the options
+                                    // menu depends on the recipients, which depending upon the
+                                    // visibility of the recipients editor, returns a different
+                                    // value (see getRecipients()).
 
         updateSendButtonState();