Merge 161b6608f8eb73b349ff4aeacdefd7ec22388a9b on remote branch

Change-Id: Ifa5d67a56e0d789047596973377a21b72ebb4a87
diff --git a/InCallUI/res/layout/video_call_views.xml b/InCallUI/res/layout/video_call_views.xml
index 1926fcc..8292803 100644
--- a/InCallUI/res/layout/video_call_views.xml
+++ b/InCallUI/res/layout/video_call_views.xml
@@ -33,7 +33,7 @@
     <FrameLayout
         android:id="@+id/previewVideoContainer"
         android:layout_width="70dp"
-        android:layout_height="0dp"
+        android:layout_height="70dp"
         android:layout_gravity="bottom|right"
         android:layout_margin="@dimen/video_preview_margin" >
 
diff --git a/InCallUI/res/values-mcc460-mnc00/qticonfig.xml b/InCallUI/res/values-mcc460-mnc00/qticonfig.xml
index de8962c..a900f36 100644
--- a/InCallUI/res/values-mcc460-mnc00/qticonfig.xml
+++ b/InCallUI/res/values-mcc460-mnc00/qticonfig.xml
@@ -37,6 +37,4 @@
     <bool name="config_conference_call_show_participant_status">true</bool>
     <!-- Config to enable/disable add multi participants -->
     <bool name="add_multi_participants_enabled">true</bool>
-    <!-- Config to add participant only in conferencall call-->
-    <bool name="add_participant_only_in_conference">true</bool>
 </resources>
diff --git a/InCallUI/res/values-mcc460-mnc02/qticonfig.xml b/InCallUI/res/values-mcc460-mnc02/qticonfig.xml
index 9613155..ca0cf90 100644
--- a/InCallUI/res/values-mcc460-mnc02/qticonfig.xml
+++ b/InCallUI/res/values-mcc460-mnc02/qticonfig.xml
@@ -37,6 +37,4 @@
     <bool name="config_conference_call_show_participant_status">true</bool>
     <!-- Config to enable/disable add multi participants -->
     <bool name="add_multi_participants_enabled">true</bool>
-    <!-- Config to add participant only in conferencall call-->
-    <bool name="add_participant_only_in_conference">true</bool>
 </resources>
diff --git a/InCallUI/res/values-mcc460-mnc07/qticonfig.xml b/InCallUI/res/values-mcc460-mnc07/qticonfig.xml
index de8962c..a900f36 100644
--- a/InCallUI/res/values-mcc460-mnc07/qticonfig.xml
+++ b/InCallUI/res/values-mcc460-mnc07/qticonfig.xml
@@ -37,6 +37,4 @@
     <bool name="config_conference_call_show_participant_status">true</bool>
     <!-- Config to enable/disable add multi participants -->
     <bool name="add_multi_participants_enabled">true</bool>
-    <!-- Config to add participant only in conferencall call-->
-    <bool name="add_participant_only_in_conference">true</bool>
 </resources>
diff --git a/InCallUI/res/values-mcc460-mnc08/qticonfig.xml b/InCallUI/res/values-mcc460-mnc08/qticonfig.xml
index de8962c..a900f36 100644
--- a/InCallUI/res/values-mcc460-mnc08/qticonfig.xml
+++ b/InCallUI/res/values-mcc460-mnc08/qticonfig.xml
@@ -37,6 +37,4 @@
     <bool name="config_conference_call_show_participant_status">true</bool>
     <!-- Config to enable/disable add multi participants -->
     <bool name="add_multi_participants_enabled">true</bool>
-    <!-- Config to add participant only in conferencall call-->
-    <bool name="add_participant_only_in_conference">true</bool>
 </resources>
diff --git a/InCallUI/res/values/qticonfig.xml b/InCallUI/res/values/qticonfig.xml
index 41c6298..61126a9 100644
--- a/InCallUI/res/values/qticonfig.xml
+++ b/InCallUI/res/values/qticonfig.xml
@@ -42,8 +42,6 @@
     <bool name="config_conference_call_show_participant_status">false</bool>
     <!-- Config to enable/disable add multi participants -->
     <bool name="add_multi_participants_enabled">false</bool>
-    <!-- Config to add participant only in conferencall call-->
-    <bool name="add_participant_only_in_conference">false</bool>
     <!-- Config to if show preview before the receiver accepts a show me upgrade video call -->
     <bool name="config_enable_modify_call_preview">false</bool>
     <!-- Config to show/hide HD Icon2 -->
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index 91a8e0b..a23669b 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -404,6 +404,7 @@
             mCall.getVideoSettings().setCameraDir(cameraDir);
             videoCall.setCamera(cameraId);
             videoCall.requestCameraCapabilities();
+            InCallZoomController.getInstance().onCameraEnabled(cameraId);
         }
     }
 
@@ -538,8 +539,8 @@
         final boolean showMute = call.can(android.telecom.Call.Details.CAPABILITY_MUTE);
         int callTransferCapabilities = call.isEmergencyCall()? 0 : call.getTransferCapabilities();
         boolean showAddParticipant = call.can(CAPABILITY_ADD_PARTICIPANT);
-        if (ui.getContext().getResources().getBoolean(
-            R.bool.add_participant_only_in_conference)) {
+        if (QtiImsExtUtils.isCarrierConfigEnabled(getUi().getContext(),
+                "add_participant_only_in_conference")) {
             showAddParticipant = showAddParticipant&&(call.isConferenceCall());
         }
 
diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
index 0b61102..b715e2d 100644
--- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
@@ -303,6 +303,7 @@
 
         // Register for surface and video events from {@link InCallVideoCallListener}s.
         InCallVideoCallCallbackNotifier.getInstance().addSurfaceChangeListener(this);
+        InCallUiStateNotifier.getInstance().addListener(this, true );
         mCurrentVideoState = VideoProfile.STATE_AUDIO_ONLY;
         mCurrentCallState = Call.State.INVALID;
 
@@ -311,7 +312,6 @@
         onStateChange(inCallState, inCallState, CallList.getInstance());
         InCallVideoCallCallbackNotifier.getInstance().addVideoEventListener(this,
                 VideoUtils.isVideoCall(mCurrentVideoState));
-        InCallUiStateNotifier.getInstance().addListener(this, true );
     }
 
     /**
@@ -1279,6 +1279,15 @@
             return;
         }
 
+        if (shallTransmitStaticImage()) {
+            setPauseImage();
+        }
+
+        if (mPreviewSurfaceState == PreviewSurfaceState.NONE) {
+            Log.w(this, "onCameraDimensionsChange: capabilities received when camera is OFF.");
+            return;
+        }
+
         mPreviewSurfaceState = PreviewSurfaceState.CAPABILITIES_RECEIVED;
         Point previewDimensions = ui.getPreviewSize();
 
@@ -1295,10 +1304,6 @@
         changePreviewDimensions(width, height);
         ui.setPreviewRotation(mDeviceOrientation);
 
-        if (shallTransmitStaticImage()) {
-            setPauseImage();
-        }
-
         // Check if the preview surface is ready yet; if it is, set it on the {@code VideoCall}.
         // If it not yet ready, it will be set when when creation completes.
         if (ui.isPreviewVideoSurfaceCreated()) {