Promotion of atel.lnx.2.0-00016.

CRs      Change ID                                   Subject
--------------------------------------------------------------------------------------------------------------
1064440   I38a4eb1f2fee7b8c70592e5bb8ea965b9f88b69c   Remove SIP dial icon in dialer for some carriers
1064492   I0ef5912e39586a601774d7ce450daeadd73d830a   IMS-VT: Handle InCallActivity destroy when low battery d
1039326   I5f555c8de2604aff2a905cd87315741a8d82d4c5   IMS-VT: Validate phone number for a Video call

Change-Id: I6f680b8ced5022cfcea4d833b1301b873c18203a
CRs-Fixed: 1064492, 1064440, 1039326
diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml
index 8aaabf9..cdc254c 100644
--- a/InCallUI/res/values/strings.xml
+++ b/InCallUI/res/values/strings.xml
@@ -533,6 +533,7 @@
     <string name="open_now">Open now</string>
     <!-- Displayed when a place is closed. -->
     <string name="closed_now">Closed now</string>
+    <string name="call_failed_due_to_validate_number">Unable to make video call, incorrect number format</string>
     <string name="call_state_dialing">Dialing</string>
     <string name="call_state_holding">Holding</string>
     <string name="call_state_active">Active</string>
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java
index 56817d1..3956f04 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -366,6 +366,7 @@
     @Override
     protected void onDestroy() {
         Log.d(this, "onDestroy()...  this = " + this);
+        InCallLowBatteryListener.getInstance().onDestroyInCallActivity();
         InCallPresenter.getInstance().unsetActivity(this);
         InCallPresenter.getInstance().updateIsChangingConfigurations();
         super.onDestroy();
diff --git a/InCallUI/src/com/android/incallui/InCallLowBatteryListener.java b/InCallUI/src/com/android/incallui/InCallLowBatteryListener.java
index 49349d2..95da595 100644
--- a/InCallUI/src/com/android/incallui/InCallLowBatteryListener.java
+++ b/InCallUI/src/com/android/incallui/InCallLowBatteryListener.java
@@ -171,6 +171,28 @@
     }
 
     /**
+      * This API handles InCallActivity destroy when low battery dialog is showing
+      */
+    public void onDestroyInCallActivity() {
+        if (dismissPendingDialogs()) {
+            Log.i(this, "onDestroyInCallActivity dismissed low battery dialog");
+
+            /* Activity is destroyed when low battery dialog is showing, possibly
+               by removing the activity from recent tasks list etc. Handle this by
+               dismissing the existing low battery dialog and marking the entry
+               against the call in low battery map that the low battery indication
+               needs to be reprocessed for eg. when user brings back the call to
+               foreground by pulling it from notification bar */
+            Call call = mPrimaryCallTracker.getPrimaryCall();
+            if (call == null) {
+                Log.w(this, "onDestroyInCallActivity call is null");
+                return;
+            }
+            mLowBatteryMap.replace(call, PROCESS_LOW_BATTERY);
+        }
+    }
+
+    /**
      * This API conveys if incall experience is showing or not.
      *
      * @param showing TRUE if incall experience is showing else FALSE
@@ -512,10 +534,12 @@
      * This method dismisses the low battery dialog and
      * returns true if dialog is dimissed else false
      */
-    public void dismissPendingDialogs() {
+    public boolean dismissPendingDialogs() {
         if (isLowBatteryDialogShowing()) {
             mAlert.dismiss();
             mAlert = null;
+            return true;
         }
+        return false;
     }
 }
diff --git a/InCallUI/src/com/android/incallui/InCallMessageController.java b/InCallUI/src/com/android/incallui/InCallMessageController.java
index de6ce44..e8611b4 100644
--- a/InCallUI/src/com/android/incallui/InCallMessageController.java
+++ b/InCallUI/src/com/android/incallui/InCallMessageController.java
@@ -310,6 +310,9 @@
          case QtiCallConstants.CALL_FAIL_EXTRA_CODE_LOCAL_LOW_BATTERY:
              QtiCallUtils.displayToast(mContext, R.string.call_failed_due_to_low_battery);
              break;
+         case QtiCallConstants.CALL_FAIL_EXTRA_CODE_LOCAL_VALIDATE_NUMBER:
+             QtiCallUtils.displayToast(mContext, R.string.call_failed_due_to_validate_number);
+             break;
          default:
              break;
        }
diff --git a/res/layout/dialtacts_activity.xml b/res/layout/dialtacts_activity.xml
index bd7c091..70d0561 100644
--- a/res/layout/dialtacts_activity.xml
+++ b/res/layout/dialtacts_activity.xml
@@ -62,6 +62,7 @@
             android:layout_height="match_parent"
             android:layout_gravity="bottom|right"
             android:layout_weight="1"
+            android:visibility="gone"
             android:background="@drawable/floating_action_button"
             android:contentDescription="@string/action_menu_dialpad_button"
             android:src="@drawable/ic_add_group_holo_dark"/>
diff --git a/res/values/config.xml b/res/values/config.xml
index 614cdf2..e992426 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -33,4 +33,7 @@
   <bool name="config_regional_video_call_welcome_dialog">false</bool>
   <bool name="config_regional_pup_no_available_network">false</bool>
   <bool name="config_regional_call_data_usage_enable">false</bool>
+  <!--not display SIP dial icon -->
+  <bool name="config_hide_SIP_dial_icon">false</bool>
+
 </resources>
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 12304c0..d7bb71f 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -449,8 +449,10 @@
         mFloatingActionButton = (ImageButton) findViewById(R.id.floating_action_button);
         mDialCallButton =  findViewById(R.id.floating_action_button);
         mFloatingActionButton.setOnClickListener(this);
-        mConferenceDialButton = (ImageButton) findViewById(R.id.dialConferenceButton);
-        mConferenceDialButton.setOnClickListener(this);
+        if (!getResources().getBoolean(R.bool.config_hide_SIP_dial_icon)) {
+            mConferenceDialButton = (ImageButton) findViewById(R.id.dialConferenceButton);
+            mConferenceDialButton.setOnClickListener(this);
+        }
         mFloatingActionButtonController = new FloatingActionButtonController(this,
                 floatingActionButtonContainer,mFloatingActionButton);