Promotion of atel.lnx.2.0-00015.

CRs      Change ID                                   Subject
--------------------------------------------------------------------------------------------------------------
1065725   I5d7e5aeff1482d1df663718c02a2bf1f0203c5bf   Fix active call InCallUI buttons highlight when EM call
1002286   I0c242d40a3d254b150ebeef354761fa67b17296f   IMS-VT: Remove one directional video call support
1060450   I66b02bde20e611a57bf43bfe32238e5b30586bd9   Dialer: add several simplized Chinese strings for Dialer
1001730   I7dfc33ea6335c4c7b6eb41d5793d63a23968183c   InCallUI: Config to control call record feature
962058   If25bcc546a299ef70343b409dbd6590d1655892a   Dialer: Input ,(pause) or ;(wait) when long press * or #
1064403   I16b9d7fa5319482c6755a590089c2c0a772aec2d   Using Setting provider to get WiFi call configuration in
1007015   I733385bb78a5f7092d16ae351f57a1f7c02ee9e5   Dialer:phone interface has highlight when receive a BT r

Change-Id: I34a68be4d0a441e84f37fd8db628c1a1b15f7d2c
CRs-Fixed: 1064403, 1007015, 962058, 1002286, 1065725, 1060450, 1001730
diff --git a/InCallUI/res/values/qticonfig.xml b/InCallUI/res/values/qticonfig.xml
index 67c50f3..0e65f94 100644
--- a/InCallUI/res/values/qticonfig.xml
+++ b/InCallUI/res/values/qticonfig.xml
@@ -27,8 +27,6 @@
   ~ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   -->
 <resources>
-    <!-- Determines UI extensions for video calls should be used. -->
-    <bool name="video_call_use_ext">true</bool>
     <!-- Config to show/hide Video quality toast -->
     <bool name="config_display_video_quality_toast">true</bool>
     <!-- Config to show/hide call session event toast like player start/stop -->
@@ -56,4 +54,6 @@
     <bool name="config_enable_modify_call_preview">false</bool>
     <!-- Config to show/hide HD Icon2 -->
     <bool name="config_show_hd2">false</bool>
+    <!-- Config to enalbe call record -->
+    <bool name="enable_call_record">false</bool>
 </resources>
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index 4fbce2a..ceae8c0 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -316,6 +316,11 @@
 
         VideoProfile videoProfile = new VideoProfile(VideoProfile.STATE_AUDIO_ONLY);
         videoCall.sendSessionModifyRequest(videoProfile);
+
+        if (QtiCallUtils.useCustomVideoUi(getUi().getContext())) {
+            InCallAudioManager.getInstance().onModifyCallClicked(mCall,
+                    VideoProfile.STATE_AUDIO_ONLY);
+        }
     }
 
     public void showDialpadClicked(boolean checked) {
@@ -341,6 +346,11 @@
         VideoProfile videoProfile = new VideoProfile(currUnpausedVideoState);
         videoCall.sendSessionModifyRequest(videoProfile);
         mCall.setSessionModificationState(Call.SessionModificationState.WAITING_FOR_RESPONSE);
+
+        if (QtiCallUtils.useCustomVideoUi(context)) {
+            InCallAudioManager.getInstance().onModifyCallClicked(mCall,
+                    currUnpausedVideoState);
+        }
     }
 
     public void changeToVideo(int videoState) {
@@ -481,17 +491,27 @@
         final boolean showMerge = call.can(
                 android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE);
         final boolean useExt = QtiCallUtils.useExt(ui.getContext());
-
+        final boolean useCustomVideoUi =
+                QtiCallUtils.useCustomVideoUi(ui.getContext());
         final boolean isCallActive = call.getState() == Call.State.ACTIVE;
-        final boolean showUpgradeToVideo = (!isVideo  && !useExt && hasVideoCallCapabilities(call))
-                || (useExt && QtiCallUtils.hasVoiceOrVideoCapabilities(call)
-                && (isCallActive || isCallOnHold));
+
+        final boolean showUpgradeToVideo =
+                /* When useExt is true, show upgrade button for an active/held
+                   call if the call has either voice or video capabilities */
+                ((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)) ||
+                /* When useExt and custom UI are false, default to Google behaviour */
+                (!isVideo && !useExt && !useCustomVideoUi && hasVideoCallCapabilities(call));
 
         final boolean showDowngradeToAudio = isVideo && isDowngradeToAudioSupported(call);
         final int callState = call.getState();
 
-        final boolean showRecord = (callState == Call.State.ACTIVE
-                || callState == Call.State.ONHOLD);
+        final boolean showRecord = ((callState == Call.State.ACTIVE
+                || callState == Call.State.ONHOLD)
+                && (ui.getContext().getResources().getBoolean(R.bool.enable_call_record)));
 
         final boolean showMute = call.can(android.telecom.Call.Details.CAPABILITY_MUTE);
         int callTransferCapabilities = call.isEmergencyCall()? 0 : call.getTransferCapabilities();
@@ -524,7 +544,7 @@
         ui.showButton(BUTTON_UPGRADE_TO_VIDEO, showUpgradeToVideo && !mEnhanceEnable);
         ui.showButton(BUTTON_DOWNGRADE_TO_AUDIO, showDowngradeToAudio && !useExt);
         ui.showButton(BUTTON_SWITCH_CAMERA, isVideo);
-        ui.showButton(BUTTON_PAUSE_VIDEO, isVideo && !useExt);
+        ui.showButton(BUTTON_PAUSE_VIDEO, isVideo && !useExt && !useCustomVideoUi);
         ui.showButton(BUTTON_DIALPAD, true);
         ui.showButton(BUTTON_MERGE, showMerge);
         ui.showButton(BUTTON_ADD_PARTICIPANT, showAddParticipant && !mEnhanceEnable);
@@ -552,6 +572,7 @@
         }
 
         ui.updateButtonStates();
+        ui.updateColors();
     }
 
     private boolean hasVideoCallCapabilities(Call call) {
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index bbc95d3..69446a9 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -931,6 +931,7 @@
             mCallStateIcon.setAlpha(0.0f);
             mCallStateIcon.setVisibility(View.GONE);
         }
+        mCallStateIcon.requestLayout();
 
         if (VideoUtils.isVideoCall(videoState)
                 || (state == Call.State.ACTIVE && sessionModificationState
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 259de79..af5a7d9 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -445,7 +445,7 @@
         return null;
     }
 
-    private void updatePrimaryCallState() {
+    public void updatePrimaryCallState() {
         if (getUi() != null && mPrimary != null) {
             boolean isWorkCall = mPrimary.hasProperty(PROPERTY_ENTERPRISE_CALL)
                     || (mPrimaryContactInfo == null ? false
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java
index 5db5eeb..56817d1 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -335,6 +335,7 @@
         if (mShowPostCharWaitDialogOnResume) {
             showPostCharWaitDialog(mShowPostCharWaitDialogCallId, mShowPostCharWaitDialogChars);
         }
+        InCallPresenter.getInstance().updatePrimaryCallState();
     }
 
     // onPause is guaranteed to be called when the InCallActivity goes
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index 8fe52d0..729bd33 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -1348,6 +1348,18 @@
     }
 
     /**
+     * Update  color of sim card icon
+     */
+    public void updatePrimaryCallState() {
+        for (InCallEventListener listener : mInCallEventListeners) {
+            if (listener instanceof CallCardPresenter) {
+                listener.updatePrimaryCallState();
+                break;
+            }
+        }
+    }
+
+    /**
      * Called by the {@link CallCardPresenter} to inform of a change in visibility of the secondary
      * caller info bar.
      *
@@ -2085,6 +2097,7 @@
     public interface InCallEventListener {
         public void onFullscreenModeChanged(boolean isFullscreenMode);
         public void onSecondaryCallerInfoVisibilityChanged(boolean isVisible, int height);
+        public void updatePrimaryCallState();
     }
 
     public interface InCallUiListener {
diff --git a/InCallUI/src/com/android/incallui/QtiCallUtils.java b/InCallUI/src/com/android/incallui/QtiCallUtils.java
index 234fa4d..6a4383a 100644
--- a/InCallUI/src/com/android/incallui/QtiCallUtils.java
+++ b/InCallUI/src/com/android/incallui/QtiCallUtils.java
@@ -51,6 +51,7 @@
 
 import org.codeaurora.internal.IExtTelephony;
 import org.codeaurora.ims.QtiCallConstants;
+import org.codeaurora.ims.utils.QtiImsExtUtils;
 
 /**
  * This class contains Qti specific utiltity functions.
@@ -239,7 +240,18 @@
         if (context == null) {
             Log.w(context, "Context is null...");
         }
-        return context != null && context.getResources().getBoolean(R.bool.video_call_use_ext);
+        return context != null && QtiImsExtUtils.useExt(context);
+    }
+
+    /**
+     * Checks the boolean flag in config file to figure out if custom video ui is required or
+     * not
+     */
+    public static boolean useCustomVideoUi(Context context) {
+        if (context == null) {
+            Log.w(context, "Context is null...");
+        }
+        return context != null && QtiImsExtUtils.useCustomVideoUi(context);
     }
 
     /**
@@ -515,7 +527,7 @@
 
     /**
      * Returns true if local has the VT Receive and if remote capability has VT Transmit set i.e.
-     * Local can transmit and remote can receive
+     * Remote can transmit and local can receive
      */
     public static boolean hasReceiveVideoCapabilities(Call call) {
         return call != null &&
diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
index 33717f6..5b7adcd 100644
--- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
@@ -514,6 +514,10 @@
         cancelAutoFullScreen();
     }
 
+    @Override
+    public void updatePrimaryCallState() {
+    }
+
     /**
      * Handles changes to the visibility of the secondary caller info bar.
      *
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 382f20b..ca28569 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -300,4 +300,63 @@
     <string name="no_call_log">没有通话记录</string>
     <string name="clear">清除</string>
     <string name="description_clear_search">清除搜索记录</string>
+    <string name="recentCalls_empty">"您没有任何通话记录"</string>
+    <!-- The description text for the call log tab.
+    Note: AccessibilityServices use this attribute to announce what the view represents.
+    This is especially valuable for views without textual representation like ImageView.
+    [CHAR LIMIT=NONE] -->
+    <string name="recentCallsIconLabel">"通话记录"</string>
+    <!-- Menu item used to call a contact from the call log -->
+    <string name="recentCalls_callNumber">"呼叫<xliff:g id="NAME">%s</xliff:g>"</string>
+    <!-- Text for a menu item to report a call as having been incorrectly identified.
+         [CHAR LIMIT=30] -->
+    <string name="call_detail_menu_report">"报告错误的号码"</string>
+    <!-- Menu item used to copy a number from the call log to the dialer so it can be edited before calling it -->
+    <string name="recentCalls_editNumberBeforeCall">"呼叫之前编辑号码"</string>
+    <!-- Menu item used to add a number from the call log to contacts -->
+    <string name="recentCalls_addToContact">"添加到联系人"</string>
+    <!-- Menu item used to remove a single call from the call log -->
+    <string name="recentCalls_removeFromRecentList">"从通话记录中删除"</string>
+    <!-- Menu item used to remove all calls from the call log -->
+    <string name="recentCalls_deleteAll">"清除通话记录"</string>
+    <!-- Menu item used to delete a voicemail. [CHAR LIMIT=30] -->
+    <string name="recentCalls_trashVoicemail">"删除语音邮件"</string>
+    <!-- Menu item used to share a voicemail. [CHAR LIMIT=30] -->
+    <string name="recentCalls_shareVoicemail">"分享语音邮件"</string>
+    <!-- Label of the button displayed when the call log is empty. Allows the user to make a call. -->
+    <string name="recentCalls_empty_action">"拨打电话"</string>
+    <!-- String resource for the font-family to use for the call log activity's title
+         Do not translate. -->
+    <string name="call_log_activity_title_font_family">sans-serif-light</string>
+    <!-- String resource for the font-family to use for the full call history footer
+         Do not translate. -->
+    <string name="view_full_call_history_font_family">sans-serif</string>
+    <!-- Text displayed when the list of incoming calls is empty -->
+    <string name="recentIncoming_empty">"您没有任何来电。"</string>
+    <!-- Text displayed when the list of outgoing calls is empty -->
+    <string name="recentOutgoing_empty">"您没有任何外拨电话。"</string>
+    <!-- Text displayed when the list of missed calls is empty -->
+    <string name="recentMissed_empty">"您没有任何未接电话。"</string>
+    <!-- Text displayed when the list of voicemails is empty -->
+    <string name="recentVoicemails_empty">"您未收到任何语音邮件。"</string>
+
+    <string name="add_to_white_list">"加入白名单"</string>
+    <string name="add_to_black_list">"加入黑名单"</string>
+    <string name="remove_from_black_list">"从黑名单中移除"</string>
+    <string name="remove_from_white_list">"从白名单中移除"</string>
+    <string name="firewall_remove_success">"已成功移除"</string>
+    <string name="yes">"是"</string>
+    <string name="no">"否"</string>
+    <string name="input_number">"输入号码"</string>
+    <string name="speed_dial_cancel">"取消"</string>
+    <string name="speed_dial_ok">"确定"</string>
+    <string name="call_data_info_label">"通话/流量计时器"</string>
+    <string name="call_data_info_description">"语音通话时长和流量使用时间"</string>
+    <string name="alert_call_over_wifi">"将通过 Wi-Fi 拨打电话。"</string>
+    <string name="alert_call_no_cellular_coverage">"移动网络不可用。请连接至可用的 Wi-Fi 拨打电话。"</string>
+    <string name="alert_user_connect_to_wifi_for_call">"请连接至 Wi-Fi 拨打电话。"</string>
+    <string name="video_call">"视频通话"</string>
+    <string name="video_call_welcome_title"><b>"欢迎使用全新的视频通话拨号器"</b></string>
+    <string name="video_call_welcome_message">"我们都希望在电话的另一端传来熟悉的声音,但打电话显然比不上面对面交流!下面介绍了如何获取实时(或 FaceTime?)连接: 需要 4G LTE 或 Wi-Fi 连接;被叫方设备必须也支持视频通话;视频通话使用高速数据;您也可以将语音通话升级到视频通话;访问 "<a>"https://support.t-mobile.com/docs/DOC-23574"</a>" 了解详细信息。"</string>
+    <string name="video_call_welcome_message_repeat">"每次都显示这条信息"</string>
 </resources>
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index 98986c5..8dab294 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -316,8 +316,6 @@
         = "com.android.wificall.READY";
     private static final String ACTION_WIFI_CALL_READY_EXTRA
         = "com.android.wificall.ready.extra";
-    private static final String SYSTEM_PROPERTY_WIFI_CALL_READY
-        = "persist.sys.wificall.ready";
     private BroadcastReceiver mWifiCallReadyReceiver;
     private boolean isConfigAvailableNetwork = false;
 
@@ -709,6 +707,14 @@
         // Long-pressing zero button will enter '+' instead.
         final DialpadKeyButton zero = (DialpadKeyButton) fragmentView.findViewById(R.id.zero);
         zero.setOnLongClickListener(this);
+
+        // Long-pressing star button will enter ','(pause) instead.
+        final DialpadKeyButton star = (DialpadKeyButton) fragmentView.findViewById(R.id.star);
+        star.setOnLongClickListener(this);
+
+        // Long-pressing pound button will enter ';'(wait) instead.
+        final DialpadKeyButton pound = (DialpadKeyButton) fragmentView.findViewById(R.id.pound);
+        pound.setOnLongClickListener(this);
     }
 
     @Override
@@ -816,8 +822,7 @@
             };
             IntentFilter filter = new IntentFilter(ACTION_WIFI_CALL_READY_STATUS_CHANGE);
             context.registerReceiver(mWifiCallReadyReceiver, filter);
-            changeDialpadButton(
-                    SystemProperties.getBoolean(SYSTEM_PROPERTY_WIFI_CALL_READY, false));
+            changeDialpadButton(WifiCallUtils.isWifiCallReadyEnabled(context));
          }
         Trace.endSection();
     }
@@ -1181,6 +1186,28 @@
                 mDigits.setCursorVisible(true);
                 return false;
             }
+            case R.id.star: {
+                if (mDigits.length() > 1) {
+                    // Remove tentative input ('*') done by onTouch().
+                    removePreviousDigitIfPossible('*');
+                    keyPressed(KeyEvent.KEYCODE_COMMA);
+                    stopTone();
+                    mPressedDialpadKeys.remove(view);
+                    return true;
+                }
+                return false;
+            }
+            case R.id.pound: {
+                if (mDigits.length() > 1) {
+                    // Remove tentative input ('#') done by onTouch().
+                    removePreviousDigitIfPossible('#');
+                    keyPressed(KeyEvent.KEYCODE_SEMICOLON);
+                    stopTone();
+                    mPressedDialpadKeys.remove(view);
+                    return true;
+                }
+                return false;
+            }
             case R.id.two:
             case R.id.three:
             case R.id.four:
diff --git a/src/com/android/dialer/util/WifiCallUtils.java b/src/com/android/dialer/util/WifiCallUtils.java
index fb143c8..0aa9a43 100644
--- a/src/com/android/dialer/util/WifiCallUtils.java
+++ b/src/com/android/dialer/util/WifiCallUtils.java
@@ -41,7 +41,7 @@
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
 import android.os.Handler;
-import android.os.SystemProperties;
+import android.provider.Settings;
 import android.telephony.CellInfo;
 import android.telephony.TelephonyManager;
 import android.util.Log;
@@ -63,11 +63,13 @@
     private TextView mTextView;
     private boolean mViewRemoved = true;
 
-    private static final String SYSTEM_PROPERTY_WIFI_CALL_READY = "persist.sys.wificall.ready";
-    private static final String SYSTEM_PROPERTY_WIFI_CALL_TURNON = "persist.sys.wificall.turnon";
+    private static final String WIFI_CALL_READY = "wifi_call_ready";
+    private static final String WIFI_CALL_TURNON = "wifi_call_turnon";
+    private static final int WIFI_CALLING_DISABLED = 0;
+    private static final int WIFI_CALLING_ENABLED = 1;
 
     public void addWifiCallReadyMarqueeMessage(Context context) {
-        if (mViewRemoved && SystemProperties.getBoolean(SYSTEM_PROPERTY_WIFI_CALL_READY, false)) {
+        if (mViewRemoved && isWifiCallReadyEnabled(context)) {
             if (mWindowManager == null) mWindowManager =
                 (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
             if(mTextView == null){
@@ -168,9 +170,18 @@
         diaBuilder.create().show();
     }
 
+    public static boolean isWifiCallReadyEnabled(final Context context) {
+        return (Settings.Global.getInt(context.getContentResolver(),
+                WIFI_CALL_READY, WIFI_CALLING_DISABLED) == WIFI_CALLING_ENABLED);
+    }
+
+    public static boolean isWifiCallTurnOnEnabled(final Context context){
+        return (Settings.Global.getInt(context.getContentResolver(),
+                WIFI_CALL_TURNON, WIFI_CALLING_DISABLED) == WIFI_CALLING_ENABLED);
+    }
+
     public static boolean shallShowWifiCallDialog(final Context context) {
-        boolean wifiCallTurnOn = SystemProperties.getBoolean(
-                SYSTEM_PROPERTY_WIFI_CALL_TURNON, false);
+        boolean wifiCallTurnOn = isWifiCallTurnOnEnabled(context);
 
         ConnectivityManager conManager = (ConnectivityManager) context
                 .getSystemService(Context.CONNECTIVITY_SERVICE);