Merge "IMS: Grey out merge menu item in more options"
diff --git a/InCallUI/res/layout-w500dp-land/call_card_fragment.xml b/InCallUI/res/layout-w500dp-land/call_card_fragment.xml
index 049f41f..89b7fb5 100644
--- a/InCallUI/res/layout-w500dp-land/call_card_fragment.xml
+++ b/InCallUI/res/layout-w500dp-land/call_card_fragment.xml
@@ -187,14 +187,20 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent" />
 
+    <!-- Margin left and centerHorizontal don't work well together, so use a Space instead. -->
+    <Space
+        android:id="@+id/floating_end_call_action_button_margin_left"
+        android:layout_width="@dimen/end_call_button_margin_left"
+        android:layout_height="wrap_content"
+        android:layout_centerHorizontal="true" />
+
      <FrameLayout
         android:id="@+id/floating_end_call_action_button_container"
         android:layout_width="@dimen/end_call_floating_action_button_diameter"
         android:layout_height="@dimen/end_call_floating_action_button_diameter"
         android:background="@drawable/fab_red"
-        android:layout_alignParentRight="true"
+        android:layout_toRightOf="@id/floating_end_call_action_button_margin_left"
         android:layout_alignParentBottom="true"
-        android:layout_marginRight="@dimen/end_call_button_margin_right"
         android:layout_marginBottom="@dimen/end_call_button_margin_bottom">
         <ImageButton android:id="@+id/floating_end_call_action_button"
             android:layout_width="match_parent"
diff --git a/InCallUI/res/values-w500dp-land/dimens.xml b/InCallUI/res/values-w500dp-land/dimens.xml
index 01cf165..42b0886 100644
--- a/InCallUI/res/values-w500dp-land/dimens.xml
+++ b/InCallUI/res/values-w500dp-land/dimens.xml
@@ -33,5 +33,5 @@
 
     <dimen name="video_preview_margin">20dp</dimen>
 
-    <dimen name="end_call_button_margin_right">80dp</dimen>
+    <dimen name="end_call_button_margin_left">50dp</dimen>
 </resources>
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java
index 42890f2..feaf5ee 100644
--- a/InCallUI/src/com/android/incallui/Call.java
+++ b/InCallUI/src/com/android/incallui/Call.java
@@ -368,6 +368,12 @@
                     List<android.telecom.Call> conferenceableCalls) {
                 update();
             }
+
+            @Override
+            public void onConnectionEvent(android.telecom.Call call, String event, Bundle extras) {
+                Log.d(this, "TelecomCallCallback onConnectionEvent call=" + call);
+                update();
+            }
     };
 
     boolean mIsActiveSub = false;
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index 9593d93..665ed8b 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -503,11 +503,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));
 
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java
index dd2af36..4598d3c 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -309,8 +309,8 @@
         InCallPresenter.getInstance().setThemeColors();
         InCallPresenter.getInstance().onUiShowing(true);
 
-        // Clear fullscreen state onResume; the stored value may not match reality.
-        InCallPresenter.getInstance().clearFullscreen();
+        // Exit fullscreen state onResume; the stored value may not match reality.
+        InCallPresenter.getInstance().setFullScreen(false);
 
         // If there is a pending request to show or hide the dialpad, handle that now.
         if (mShowDialpadRequest != DIALPAD_REQUEST_NONE) {