Promotion of atel.lnx.2.0-00060.

CRs      Change ID                                   Subject
--------------------------------------------------------------------------------------------------------------
2005713   I4ea45e02343afb47d1835711bfd78d502cb0ccdb   IMS-VT: Initialize to current UI orientation on enabling
1085411   Ib47ce7d2a598dd68ef873f7d23236c917288d4b6   IMS-VT: Show call downgrade toast if MO Video call is co
1020168   Iaccf0a6f2d5e918f3e8d3b5652084d813d1ace66   IMS-VT: CameraCapabilities are not passed to UI.

Change-Id: I1424a103dff96c031e0b103ea6689108358c4bc1
CRs-Fixed: 1020168, 2005713, 1085411
diff --git a/InCallUI/res/values/qtistrings.xml b/InCallUI/res/values/qtistrings.xml
index 18873cc..9ef2bd8 100644
--- a/InCallUI/res/values/qtistrings.xml
+++ b/InCallUI/res/values/qtistrings.xml
@@ -143,6 +143,8 @@
     <string name="session_modify_cause_downgrade_lipsync">Call downgraded due to lipsync</string>
     <!-- Session modify cause code downgrade generic error -->
     <string name="session_modify_cause_downgrade_generic_error">Call downgraded due to generic error</string>
+    <!-- Session modify cause code downgrade generic -->
+    <string name="session_modify_cause_downgrade_generic">Video call changed to voice call</string>
 
     <!-- In-call screen: status label for an incoming conference call [CHAR LIMIT=25] -->
     <string name="card_title_incoming_conf_call">Incoming conference call</string>
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java
index feaf5ee..c8906ed 100644
--- a/InCallUI/src/com/android/incallui/Call.java
+++ b/InCallUI/src/com/android/incallui/Call.java
@@ -395,7 +395,7 @@
     private int mRequestedVideoState = VideoProfile.STATE_AUDIO_ONLY;
 
     private InCallVideoCallCallback mVideoCallCallback;
-    private boolean mIsVideoCallCallbackRegistered;
+    private VideoCall mRegisteredVideoCall;
     private String mChildNumber;
     private String mLastForwardedNumber;
     private String mCallSubject;
@@ -489,7 +489,7 @@
                 mVideoCallCallback = new InCallVideoCallCallback(this);
             }
             mTelecomCall.getVideoCall().registerCallback(mVideoCallCallback);
-            mIsVideoCallCallbackRegistered = true;
+            mRegisteredVideoCall = mTelecomCall.getVideoCall();
         }
 
         mChildCallIds.clear();
@@ -845,7 +845,7 @@
      *      callback on the {@link VideoCall}.
      */
     public VideoCall getVideoCall() {
-        return mTelecomCall == null || !mIsVideoCallCallbackRegistered ? null
+        return mTelecomCall == null || (mRegisteredVideoCall != mTelecomCall.getVideoCall()) ? null
                 : mTelecomCall.getVideoCall();
     }
 
diff --git a/InCallUI/src/com/android/incallui/InCallMessageController.java b/InCallUI/src/com/android/incallui/InCallMessageController.java
index aa5a57e..d7b7614 100644
--- a/InCallUI/src/com/android/incallui/InCallMessageController.java
+++ b/InCallUI/src/com/android/incallui/InCallMessageController.java
@@ -366,8 +366,14 @@
             return;
         }
 
-        QtiCallUtils.displayToast(mContext,
-                getSessionModificationCauseResourceId(sessionModificationCause));
+        if (sessionModificationCause ==
+                    QtiCallConstants.CAUSE_CODE_SESSION_MODIFY_DOWNGRADE_GENERIC) {
+            QtiCallUtils.displayLongToast(mContext,
+                    getSessionModificationCauseResourceId(sessionModificationCause));
+        } else {
+            QtiCallUtils.displayToast(mContext,
+                    getSessionModificationCauseResourceId(sessionModificationCause));
+        }
     }
 
     /**
@@ -398,6 +404,8 @@
                 return R.string.session_modify_cause_downgrade_thermal_mitigation;
             case QtiCallConstants.CAUSE_CODE_SESSION_MODIFY_DOWNGRADE_LIPSYNC:
                 return R.string.session_modify_cause_downgrade_lipsync;
+            case QtiCallConstants.CAUSE_CODE_SESSION_MODIFY_DOWNGRADE_GENERIC:
+                return R.string.session_modify_cause_downgrade_generic;
             case QtiCallConstants.CAUSE_CODE_SESSION_MODIFY_DOWNGRADE_GENERIC_ERROR:
             default:
                 return R.string.session_modify_cause_downgrade_generic_error;
diff --git a/InCallUI/src/com/android/incallui/InCallOrientationEventListener.java b/InCallUI/src/com/android/incallui/InCallOrientationEventListener.java
index ed10b73..1069189 100644
--- a/InCallUI/src/com/android/incallui/InCallOrientationEventListener.java
+++ b/InCallUI/src/com/android/incallui/InCallOrientationEventListener.java
@@ -108,6 +108,12 @@
             return;
         }
 
+        // Start with current UI orientation.
+        sCurrentOrientation = getCurrentUiOrientation();
+        if (sCurrentOrientation == SCREEN_ORIENTATION_UNKNOWN) {
+            sCurrentOrientation = SCREEN_ORIENTATION_0;
+        }
+
         super.enable();
         mEnabled = true;
         if (notify) {
diff --git a/InCallUI/src/com/android/incallui/QtiCallUtils.java b/InCallUI/src/com/android/incallui/QtiCallUtils.java
index 395fdfe..faf518c 100644
--- a/InCallUI/src/com/android/incallui/QtiCallUtils.java
+++ b/InCallUI/src/com/android/incallui/QtiCallUtils.java
@@ -164,6 +164,20 @@
     }
 
     /**
+     * Displays the message as a long Toast on the UI
+     */
+    public static void displayLongToast(Context context, String msg) {
+        Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
+    }
+
+    /**
+     * Displays the string corresponding to the resourceId as a long Toast on the UI
+     */
+    public static void displayLongToast(Context context, int resourceId) {
+        displayLongToast(context, context.getResources().getString(resourceId));
+    }
+
+    /**
      * The function is called when Modify Call button gets pressed. The function creates and
      * displays modify call options.
      */