Merge "Inform user to turn off APM for IMS_SIP_ALTERNATE_EMERGENCY_CALL cause." into pi-dev
diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml
index f0dcb67..c71dc81 100644
--- a/res/values-da/strings.xml
+++ b/res/values-da/strings.xml
@@ -417,7 +417,7 @@
     <string name="menu_add" msgid="1882023737425114762">"Tilføj kontakt"</string>
     <string name="menu_edit" msgid="7143003705504672374">"Rediger kontakt"</string>
     <string name="menu_delete" msgid="3977150783449642851">"Slet kontakt"</string>
-    <string name="menu_dial" msgid="3223106222819685808">"Ring til kontaktperson"</string>
+    <string name="menu_dial" msgid="3223106222819685808">"Ring til kontakt"</string>
     <string name="get_pin2" msgid="8204677063922225311">"Angiv PIN2-kode"</string>
     <string name="name" msgid="7329028332786872378">"Navn"</string>
     <string name="number" msgid="7905950798349903858">"Nummer"</string>
@@ -596,9 +596,9 @@
     <string name="voicemail_number_not_set" msgid="6724904736891087856">"&lt;Ikke angivet&gt;"</string>
     <string name="other_settings" msgid="3672912580359716394">"Andre indstillinger for opkald"</string>
     <string name="calling_via_template" msgid="4839419581866928142">"Opkald via <xliff:g id="PROVIDER_NAME">%s</xliff:g>"</string>
-    <string name="contactPhoto" msgid="4713193418046639466">"billede af kontaktperson"</string>
+    <string name="contactPhoto" msgid="4713193418046639466">"billede af kontakt"</string>
     <string name="goPrivate" msgid="865837794424530980">"gør privat"</string>
-    <string name="selectContact" msgid="781975788478987237">"vælg kontaktperson"</string>
+    <string name="selectContact" msgid="781975788478987237">"vælg kontakt"</string>
     <string name="not_voice_capable" msgid="2739898841461577811">"Taleopkald understøttes ikke"</string>
     <string name="description_dial_button" msgid="7459705245418435351">"ring op"</string>
     <string name="voicemail_visual_voicemail_switch_title" msgid="5012622186976275457">"Visuel telefonsvarer"</string>
diff --git a/res/values-gl/strings.xml b/res/values-gl/strings.xml
index 75b42f5..236362f 100644
--- a/res/values-gl/strings.xml
+++ b/res/values-gl/strings.xml
@@ -327,8 +327,8 @@
   </string-array>
     <string name="list_language_dtitle" msgid="5442908726538951934">"Idiomas"</string>
     <string name="enable_disable_local_weather" msgid="986967454867219114">"Tempo local"</string>
-    <string name="local_weather_enable" msgid="6199315114382448922">"Información meteorolóxica local activada"</string>
-    <string name="local_weather_disable" msgid="2510158089142626480">"Información meteorolóxica local desactivada"</string>
+    <string name="local_weather_enable" msgid="6199315114382448922">"O tempo local activado"</string>
+    <string name="local_weather_disable" msgid="2510158089142626480">"O tempo local desactivado"</string>
     <string name="enable_disable_atr" msgid="8339572391278872343">"Informes de tráfico de zona"</string>
     <string name="atr_enable" msgid="5541757457789181799">"Informes de tráfico de zona activados"</string>
     <string name="atr_disable" msgid="7085558154727596455">"Informes de tráfico de zona desactivados"</string>
diff --git a/res/values-hi/strings.xml b/res/values-hi/strings.xml
index eeeef06..8f41e8f 100644
--- a/res/values-hi/strings.xml
+++ b/res/values-hi/strings.xml
@@ -532,7 +532,7 @@
     <string name="hac_mode_summary" msgid="6833851160514929341">"श्रवण सहायक साधन संगतता चालू करें"</string>
     <string name="rtt_mode_title" msgid="6954652435543570121">"(आरटीटी) कॉल से रीयल-टाइम में मैसेज भेजें"</string>
     <string name="rtt_mode_summary" msgid="5146344277246544580">"वॉइस कॉल में मैसेज भेजने की अनुमति दें"</string>
-    <string name="rtt_mode_more_information" msgid="6080420780730383030">"आरटीटी उन कॉल करने वालों की मदद करता है, जो बधिर हैं, ऊंचा सुनते हैं, जिन्हें बोलने में दिक्कत है या जिनके लिए सिर्फ़ आवाज़ काफ़ी नहीं होती.&lt;br&gt; &lt;a href=<xliff:g id="URL">http://support.google.com/mobile?p=telephony_rtt</xliff:g>&gt;अधिक जानें&lt;/a&gt;\n       &lt;br&gt;&lt;br&gt; - आरटीटी कॉल, मैसेज लेख के रूप में सेव किए जाते हैं\n       &lt;br&gt; - वीडियो कॉल के लिए आरटीटी उपलब्ध नहीं है"</string>
+    <string name="rtt_mode_more_information" msgid="6080420780730383030">"आरटीटी उन कॉल करने वालों की मदद करता है, जो सुन नहीं सकते हैं, ऊंचा सुनते हैं, जिन्हें बोलने में दिक्कत है या जिनके लिए सिर्फ़ आवाज़ काफ़ी नहीं होती.&lt;br&gt; &lt;a href=<xliff:g id="URL">http://support.google.com/mobile?p=telephony_rtt</xliff:g>&gt;ज़्यादा  जानें&lt;/a&gt;\n       &lt;br&gt;&lt;br&gt; - आरटीटी कॉल, मैसेज लेख के रूप में सेव किए जाते हैं\n       &lt;br&gt; - वीडियो कॉल के लिए आरटीटी उपलब्ध नहीं है"</string>
   <string-array name="tty_mode_entries">
     <item msgid="512950011423868021">"TTY बंद"</item>
     <item msgid="3971695875449640648">"TTY पूर्ण"</item>
diff --git a/res/values-ne/strings.xml b/res/values-ne/strings.xml
index 6d473ce..6d6abe0 100644
--- a/res/values-ne/strings.xml
+++ b/res/values-ne/strings.xml
@@ -136,7 +136,7 @@
     <string name="close_dialog" msgid="2365884406356986917">"ठिक छ"</string>
     <string name="enable" msgid="7248657275000173526">"सकृय पार्नुहोस्"</string>
     <string name="disable" msgid="4678348128118573672">"निस्कृय पार्नुहोस्"</string>
-    <string name="change_num" msgid="239476305819844391">"अपडेट गर्नुहोस्"</string>
+    <string name="change_num" msgid="239476305819844391">"अद्यावधिक गर्नुहोस्"</string>
   <string-array name="clir_display_values">
     <item msgid="5560134294467334594">"नेटवर्क पूर्वनिर्धारित"</item>
     <item msgid="7876195870037833661">"सङ्ख्या लुकाउनुहोस्"</item>
diff --git a/res/values-sw/strings.xml b/res/values-sw/strings.xml
index 8e07fe3..6062313 100644
--- a/res/values-sw/strings.xml
+++ b/res/values-sw/strings.xml
@@ -90,7 +90,7 @@
     <string name="sum_loading_settings" msgid="1826692909391168620">"Mipangilio inapakia..."</string>
     <string name="sum_hide_caller_id" msgid="1071407020290873782">"Nambari imefichwa kwa simu unayopiga"</string>
     <string name="sum_show_caller_id" msgid="6768534125447290401">"Namba inaonekana kwa simu zinazopigwa"</string>
-    <string name="sum_default_caller_id" msgid="1954518825510901365">"Tumia mipangilio ya kiendesha chaguo msingi kuonyesha namba kwa simu zinazopigwa"</string>
+    <string name="sum_default_caller_id" msgid="1954518825510901365">"Tumia mipangilio ya kiendesha chaguomsingi kuonyesha namba kwa simu zinazopigwa"</string>
     <string name="labelCW" msgid="6120513814915920200">"Simu inayosubiri kupokewa"</string>
     <string name="sum_cw_enabled" msgid="8083061901633671397">"Wakati ninapokea simu, niarifu kuhusu simu zingine zinazoingia"</string>
     <string name="sum_cw_disabled" msgid="3648693907300104575">"Wakati ninapokea simu, niarifu kuhusu simu zingine zinazoingia"</string>
@@ -138,7 +138,7 @@
     <string name="disable" msgid="4678348128118573672">"Zima"</string>
     <string name="change_num" msgid="239476305819844391">"Sasisha"</string>
   <string-array name="clir_display_values">
-    <item msgid="5560134294467334594">"Chaguo msingi la mtandao"</item>
+    <item msgid="5560134294467334594">"Chaguomsingi la mtandao"</item>
     <item msgid="7876195870037833661">"Ficha nambari"</item>
     <item msgid="1108394741608734023">"Onyesha nambari"</item>
   </string-array>
diff --git a/sip/res/values-iw/strings.xml b/sip/res/values-iw/strings.xml
index edd8d64..2204e0a 100644
--- a/sip/res/values-iw/strings.xml
+++ b/sip/res/values-iw/strings.xml
@@ -26,7 +26,7 @@
     <string name="sip_call_options_entry_1" msgid="7217659161237099900">"לכל השיחות כאשר רשת הנתונים זמינה"</string>
     <string name="sip_call_options_entry_2" msgid="1815335903940609729">"‏עבור שיחות SIP בלבד"</string>
     <string name="sip_call_options_wifi_only_entry_1" msgid="1358513095551847314">"לכל השיחות"</string>
-    <string name="add_sip_account" msgid="800843669753980091">"הוסף חשבון"</string>
+    <string name="add_sip_account" msgid="800843669753980091">"חשבון חדש"</string>
     <string name="remove_sip_account" msgid="1367664438506503690">"הסר חשבון"</string>
     <string name="sip_account_list" msgid="5610858485304821480">"‏חשבונות SIP"</string>
     <string name="saving_account" msgid="5336529880235177448">"שומר את החשבון..."</string>
diff --git a/src/com/android/phone/GsmUmtsAdditionalCallOptions.java b/src/com/android/phone/GsmUmtsAdditionalCallOptions.java
index 082eaa9..b79cdd8 100644
--- a/src/com/android/phone/GsmUmtsAdditionalCallOptions.java
+++ b/src/com/android/phone/GsmUmtsAdditionalCallOptions.java
@@ -2,8 +2,10 @@
 
 import android.app.ActionBar;
 import android.os.Bundle;
+import android.os.PersistableBundle;
 import android.preference.Preference;
 import android.preference.PreferenceScreen;
+import android.telephony.CarrierConfigManager;
 import android.util.Log;
 import android.view.MenuItem;
 
@@ -26,6 +28,9 @@
     private Phone mPhone;
     private SubscriptionInfoHelper mSubscriptionInfoHelper;
 
+    private boolean mShowCLIRButton;
+    private boolean mShowCWButton;
+
     @Override
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
@@ -41,24 +46,60 @@
         mCLIRButton = (CLIRListPreference) prefSet.findPreference(BUTTON_CLIR_KEY);
         mCWButton = (CallWaitingSwitchPreference) prefSet.findPreference(BUTTON_CW_KEY);
 
-        mPreferences.add(mCLIRButton);
-        mPreferences.add(mCWButton);
-
-        if (icicle == null) {
-            if (DBG) Log.d(LOG_TAG, "start to init ");
-            mCLIRButton.init(this, false, mPhone);
+        PersistableBundle b = null;
+        if (mSubscriptionInfoHelper.hasSubId()) {
+            b = PhoneGlobals.getInstance().getCarrierConfigForSubId(
+                    mSubscriptionInfoHelper.getSubId());
         } else {
-            if (DBG) Log.d(LOG_TAG, "restore stored states");
-            mInitIndex = mPreferences.size();
-            mCLIRButton.init(this, true, mPhone);
-            mCWButton.init(this, true, mPhone);
-            int[] clirArray = icicle.getIntArray(mCLIRButton.getKey());
-            if (clirArray != null) {
-                if (DBG) Log.d(LOG_TAG, "onCreate:  clirArray[0]="
-                        + clirArray[0] + ", clirArray[1]=" + clirArray[1]);
-                mCLIRButton.handleGetCLIRResult(clirArray);
+            b = PhoneGlobals.getInstance().getCarrierConfig();
+        }
+
+        if (b != null) {
+            mShowCLIRButton = b.getBoolean(
+                    CarrierConfigManager.KEY_ADDITIONAL_SETTINGS_CALLER_ID_VISIBILITY_BOOL);
+            mShowCWButton = b.getBoolean(
+                    CarrierConfigManager.KEY_ADDITIONAL_SETTINGS_CALL_WAITING_VISIBILITY_BOOL);
+        }
+
+        if (mCLIRButton != null) {
+            if (mShowCLIRButton) {
+                mPreferences.add(mCLIRButton);
             } else {
-                mCLIRButton.init(this, false, mPhone);
+                prefSet.removePreference(mCLIRButton);
+            }
+        }
+
+        if (mCWButton != null) {
+            if (mShowCWButton) {
+                mPreferences.add(mCWButton);
+            } else {
+                prefSet.removePreference(mCWButton);
+            }
+        }
+
+        if (mPreferences.size() != 0) {
+            if (icicle == null) {
+                if (DBG) Log.d(LOG_TAG, "start to init ");
+                doPreferenceInit(mInitIndex);
+            } else {
+                if (DBG) Log.d(LOG_TAG, "restore stored states");
+                mInitIndex = mPreferences.size();
+                if (mShowCWButton) {
+                    mCWButton.init(this, true, mPhone);
+                }
+                if (mShowCLIRButton) {
+                    mCLIRButton.init(this, true, mPhone);
+                    int[] clirArray = icicle.getIntArray(mCLIRButton.getKey());
+                    if (clirArray != null) {
+                        if (DBG) {
+                            Log.d(LOG_TAG, "onCreate:  clirArray[0]="
+                                    + clirArray[0] + ", clirArray[1]=" + clirArray[1]);
+                        }
+                        mCLIRButton.handleGetCLIRResult(clirArray);
+                    } else {
+                        mCLIRButton.init(this, false, mPhone);
+                    }
+                }
             }
         }
 
@@ -73,7 +114,7 @@
     protected void onSaveInstanceState(Bundle outState) {
         super.onSaveInstanceState(outState);
 
-        if (mCLIRButton.clirArray != null) {
+        if (mShowCLIRButton && mCLIRButton.clirArray != null) {
             outState.putIntArray(mCLIRButton.getKey(), mCLIRButton.clirArray);
         }
     }
@@ -82,10 +123,7 @@
     public void onFinished(Preference preference, boolean reading) {
         if (mInitIndex < mPreferences.size()-1 && !isFinishing()) {
             mInitIndex++;
-            Preference pref = mPreferences.get(mInitIndex);
-            if (pref instanceof CallWaitingSwitchPreference) {
-                ((CallWaitingSwitchPreference) pref).init(this, false, mPhone);
-            }
+            doPreferenceInit(mInitIndex);
         }
         super.onFinished(preference, reading);
     }
@@ -99,4 +137,15 @@
         }
         return super.onOptionsItemSelected(item);
     }
+
+    private void doPreferenceInit(int index) {
+        if (mPreferences.size() != 0) {
+            Preference pref = mPreferences.get(index);
+            if (pref instanceof CallWaitingSwitchPreference) {
+                ((CallWaitingSwitchPreference) pref).init(this, false, mPhone);
+            } else if (pref instanceof CLIRListPreference) {
+                ((CLIRListPreference) pref).init(this, false, mPhone);
+            }
+        }
+    }
 }
diff --git a/src/com/android/phone/GsmUmtsCallOptions.java b/src/com/android/phone/GsmUmtsCallOptions.java
index 3b27d28..ab44b54 100644
--- a/src/com/android/phone/GsmUmtsCallOptions.java
+++ b/src/com/android/phone/GsmUmtsCallOptions.java
@@ -18,14 +18,12 @@
 
 import android.os.Bundle;
 import android.os.PersistableBundle;
-import android.preference.CheckBoxPreference;
 import android.preference.Preference;
 import android.preference.PreferenceActivity;
 import android.preference.PreferenceScreen;
 import android.telephony.CarrierConfigManager;
 import android.view.MenuItem;
 
-import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneConstants;
 
 public class GsmUmtsCallOptions extends PreferenceActivity {
@@ -64,25 +62,45 @@
     }
 
     public static void init(PreferenceScreen prefScreen, SubscriptionInfoHelper subInfoHelper) {
-        Preference callForwardingPref = prefScreen.findPreference(CALL_FORWARDING_KEY);
-        callForwardingPref.setIntent(subInfoHelper.getIntent(GsmUmtsCallForwardOptions.class));
-
-        Preference additionalGsmSettingsPref =
-                prefScreen.findPreference(ADDITIONAL_GSM_SETTINGS_KEY);
-        additionalGsmSettingsPref.setIntent(
-                subInfoHelper.getIntent(GsmUmtsAdditionalCallOptions.class));
-
-        Preference callBarringPref = prefScreen.findPreference(CALL_BARRING_KEY);
         PersistableBundle b = null;
         if (subInfoHelper.hasSubId()) {
             b = PhoneGlobals.getInstance().getCarrierConfigForSubId(subInfoHelper.getSubId());
         } else {
             b = PhoneGlobals.getInstance().getCarrierConfig();
         }
-        if (b != null && b.getBoolean(CarrierConfigManager.KEY_CALL_BARRING_VISIBILITY_BOOL)) {
-            callBarringPref.setIntent(subInfoHelper.getIntent(GsmUmtsCallBarringOptions.class));
-        } else {
-            prefScreen.removePreference(callBarringPref);
+
+        Preference callForwardingPref = prefScreen.findPreference(CALL_FORWARDING_KEY);
+        if (callForwardingPref != null) {
+            if (b != null && b.getBoolean(
+                    CarrierConfigManager.KEY_CALL_FORWARDING_VISIBILITY_BOOL)) {
+                callForwardingPref.setIntent(
+                        subInfoHelper.getIntent(GsmUmtsCallForwardOptions.class));
+            } else {
+                prefScreen.removePreference(callForwardingPref);
+            }
+        }
+
+        Preference additionalGsmSettingsPref =
+                prefScreen.findPreference(ADDITIONAL_GSM_SETTINGS_KEY);
+        if (additionalGsmSettingsPref != null) {
+            if (b != null && (b.getBoolean(
+                    CarrierConfigManager.KEY_ADDITIONAL_SETTINGS_CALL_WAITING_VISIBILITY_BOOL)
+                    || b.getBoolean(
+                    CarrierConfigManager.KEY_ADDITIONAL_SETTINGS_CALLER_ID_VISIBILITY_BOOL))) {
+                additionalGsmSettingsPref.setIntent(
+                        subInfoHelper.getIntent(GsmUmtsAdditionalCallOptions.class));
+            } else {
+                prefScreen.removePreference(additionalGsmSettingsPref);
+            }
+        }
+
+        Preference callBarringPref = prefScreen.findPreference(CALL_BARRING_KEY);
+        if (callBarringPref != null) {
+            if (b != null && b.getBoolean(CarrierConfigManager.KEY_CALL_BARRING_VISIBILITY_BOOL)) {
+                callBarringPref.setIntent(subInfoHelper.getIntent(GsmUmtsCallBarringOptions.class));
+            } else {
+                prefScreen.removePreference(callBarringPref);
+            }
         }
     }
 }
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 691d9ff..6a26f76 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -788,13 +788,6 @@
             int max = mSubscriptionManager.getActiveSubscriptionInfoCountMax();
             mActiveSubInfos = new ArrayList<SubscriptionInfo>(max);
 
-            IntentFilter intentFilter = new IntentFilter(
-                    TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
-            activity.registerReceiver(mPhoneChangeReceiver, intentFilter);
-
-            activity.getContentResolver().registerContentObserver(ENFORCE_MANAGED_URI, false,
-                    mDpcEnforcedContentObserver);
-
             Log.i(LOG_TAG, "onCreate:-");
         }
 
@@ -822,6 +815,10 @@
             @Override
             public void onReceive(Context context, Intent intent) {
                 Log.i(LOG_TAG, "onReceive:");
+                if (getActivity() == null || getContext() == null) {
+                    // Received broadcast and activity is in the process of being torn down.
+                    return;
+                }
                 // When the radio changes (ex: CDMA->GSM), refresh all options.
                 updateBody();
             }
@@ -835,6 +832,10 @@
             @Override
             public void onChange(boolean selfChange) {
                 Log.i(LOG_TAG, "DPC enforced onChange:");
+                if (getActivity() == null || getContext() == null) {
+                    // Received content change and activity is in the process of being torn down.
+                    return;
+                }
                 updateBody();
             }
         }
@@ -843,11 +844,6 @@
         public void onDestroy() {
             unbindNetworkQueryService();
             super.onDestroy();
-            if (getActivity() != null) {
-                getActivity().unregisterReceiver(mPhoneChangeReceiver);
-                getActivity().getContentResolver().unregisterContentObserver(
-                        mDpcEnforcedContentObserver);
-            }
         }
 
         @Override
@@ -884,6 +880,13 @@
 
             mSubscriptionManager.addOnSubscriptionsChangedListener(mOnSubscriptionsChangeListener);
 
+            final Context context = getActivity();
+            IntentFilter intentFilter = new IntentFilter(
+                    TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
+            context.registerReceiver(mPhoneChangeReceiver, intentFilter);
+            context.getContentResolver().registerContentObserver(ENFORCE_MANAGED_URI, false,
+                    mDpcEnforcedContentObserver);
+
             Log.i(LOG_TAG, "onResume:-");
 
         }
@@ -1220,6 +1223,10 @@
 
             mSubscriptionManager
                     .removeOnSubscriptionsChangedListener(mOnSubscriptionsChangeListener);
+
+            final Context context = getActivity();
+            context.unregisterReceiver(mPhoneChangeReceiver);
+            context.getContentResolver().unregisterContentObserver(mDpcEnforcedContentObserver);
             if (DBG) log("onPause:-");
         }
 
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index ae3ec4e..5e1fe22 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -2745,15 +2745,6 @@
     }
 
     /**
-     * @return true if the IMS resolver is busy resolving a binding and should not be considered
-     * available, false if the IMS resolver is idle.
-     */
-    public boolean isResolvingImsBinding() {
-        enforceModifyPermission();
-        return PhoneFactory.getImsResolver().isResolvingBinding();
-    }
-
-    /**
      * Sets the ImsService Package Name that Telephony will bind to.
      *
      * @param slotId the slot ID that the ImsService should bind for.
@@ -3683,7 +3674,7 @@
         synchronized (mLastModemActivityInfo) {
             ModemActivityInfo info = (ModemActivityInfo) sendRequest(CMD_GET_MODEM_ACTIVITY_INFO,
                     null);
-            if (info != null) {
+            if (isModemActivityInfoValid(info)) {
                 int[] mergedTxTimeMs = new int[ModemActivityInfo.TX_POWER_LEVELS];
                 for (int i = 0; i < mergedTxTimeMs.length; i++) {
                     mergedTxTimeMs[i] =
@@ -3712,6 +3703,25 @@
         result.send(0, bundle);
     }
 
+    // Checks that ModemActivityInfo is valid. Sleep time, Idle time, Rx time and Tx time should be
+    // less than total activity duration.
+    private boolean isModemActivityInfoValid(ModemActivityInfo info) {
+        if (info == null) {
+            return false;
+        }
+        int activityDurationMs =
+            (int) (info.getTimestamp() - mLastModemActivityInfo.getTimestamp());
+        int totalTxTimeMs = 0;
+        for (int i = 0; i < info.getTxTimeMillis().length; i++) {
+            totalTxTimeMs += info.getTxTimeMillis()[i];
+        }
+        return (info.isValid()
+            && (info.getSleepTimeMillis() <= activityDurationMs)
+            && (info.getIdleTimeMillis() <= activityDurationMs)
+            && (info.getRxTimeMillis() <= activityDurationMs)
+            && (totalTxTimeMs <= activityDurationMs));
+    }
+
     /**
      * {@hide}
      * Returns the service state information on specified subscription.
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index d6fb3ad..2b0f49f 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -538,6 +538,7 @@
         @Override
         public void onRttModifyResponseReceived(int status) {
             updateConnectionProperties();
+            refreshConferenceSupported();
             if (status == RttModifyStatus.SESSION_MODIFY_REQUEST_SUCCESS) {
                 sendRttInitiationSuccess();
             } else {
@@ -554,7 +555,12 @@
 
         @Override
         public void onRttInitiated() {
-            updateConnectionProperties();
+            if (mOriginalConnection != null) {
+                // if mOriginalConnection is null, the properties will get set when
+                // mOriginalConnection gets set.
+                updateConnectionProperties();
+                refreshConferenceSupported();
+            }
             sendRttInitiationSuccess();
         }
 
@@ -2117,6 +2123,9 @@
         if (mTreatAsEmergencyCall) {
             isConferenceSupported = false;
             Log.d(this, "refreshConferenceSupported = false; emergency call");
+        } else if (isRtt()) {
+            isConferenceSupported = false;
+            Log.d(this, "refreshConferenceSupported = false; rtt call");
         } else if (!isConferencingSupported || isIms && !isImsConferencingSupported) {
             isConferenceSupported = false;
             Log.d(this, "refreshConferenceSupported = false; carrier doesn't support conf.");