Promotion of atel.lnx.2.0-00036.

CRs      Change ID                                   Subject
--------------------------------------------------------------------------------------------------------------
1097132   I3bc68b7d5ea143632f4ea6b1e7f9a8ca78272986   IMS: Grey out merge menu item in more options
1098780   I4962bbc832c9b6526fb1de87498fc6fc7eb3e139   IMS-VT: Modify conditional logic of showing upgrade vide

Change-Id: I6be35fa788cf8a79a263886d9d70a8f69fa0cc2c
CRs-Fixed: 1097132, 1098780
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java
index cdc0359..fa76bba 100644
--- a/InCallUI/src/com/android/incallui/CallButtonFragment.java
+++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java
@@ -290,6 +290,7 @@
         } else if (id == R.id.overflowButton) {
             if (mOverflowPopup != null) {
                 updateRecordMenu();
+                updateMergeCallsMenuItem();
                 mOverflowPopup.show();
             }
         } else if (id == R.id.manageVideoCallConferenceButton) {
@@ -356,6 +357,13 @@
         }
     }
 
+    private void updateMergeCallsMenuItem() {
+        MenuItem item = mOverflowPopup.getMenu().findItem(BUTTON_MERGE);
+        if (item != null) {
+            item.setEnabled(mMergeButton.isEnabled());
+        }
+    }
+
     public void updateColors() {
         MaterialPalette themeColors = InCallPresenter.getInstance().getThemeColors();
 
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index ec330a2..e71b3ab 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -268,6 +268,10 @@
     }
 
     public void mergeClicked() {
+        if (mCall == null) {
+            return;
+        }
+
         if (getUi().getContext().getResources().getBoolean(
                 R.bool.add_multi_participants_enabled)){
             int participantsCount = 0;
@@ -485,11 +489,11 @@
         final boolean showUpgradeToVideo =
                 /* When useExt is true, show upgrade button for an active/held
                    call if the call has either voice or video capabilities */
+                ((isCallActive || isCallOnHold) &&
                 ((useExt && QtiCallUtils.hasVoiceOrVideoCapabilities(call)) ||
                 /* When useCustomVideoUi is true, show upgrade button for an active/held
                    voice call only if the current call has video capabilities */
-                (useCustomVideoUi && !isVideo && hasVideoCallCapabilities(call))
-                && (isCallActive || isCallOnHold)) ||
+                (useCustomVideoUi && !isVideo && hasVideoCallCapabilities(call)))) ||
                 /* When useExt and custom UI are false, default to Google behaviour */
                 (!isVideo && !useExt && !useCustomVideoUi && hasVideoCallCapabilities(call));