Merge "support expanding advanced settings from intent extra"
diff --git a/res/drawable/progress_indeterminate_horizontal_material_trimmed.xml b/res/drawable/progress_indeterminate_horizontal_material_trimmed.xml
new file mode 100644
index 0000000..905dc55
--- /dev/null
+++ b/res/drawable/progress_indeterminate_horizontal_material_trimmed.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- Variant of progress_indeterminate_horizontal_material in frameworks/base/core/res, which
+     draws the whole height of the progress bar instead having blank space above and below the
+     bar. -->
+<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:drawable="@drawable/vector_drawable_progress_indeterminate_horizontal_trimmed" >
+    <target
+        android:name="rect2_grp"
+        android:animation="@*android:anim/progress_indeterminate_horizontal_rect2" />
+    <target
+        android:name="rect1_grp"
+        android:animation="@*android:anim/progress_indeterminate_horizontal_rect1" />
+</animated-vector>
\ No newline at end of file
diff --git a/res/drawable/signal_strength_1x.xml b/res/drawable/signal_strength_1x.xml
new file mode 100644
index 0000000..d1d2229
--- /dev/null
+++ b/res/drawable/signal_strength_1x.xml
@@ -0,0 +1,28 @@
+<!--
+Copyright (C) 2018 The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="8.5dp"
+    android:height="17dp"
+    android:viewportWidth="12.0"
+    android:viewportHeight="24.0"
+    android:tint="?android:attr/colorControlNormal">
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M3.500000,11.000000L1.800000,11.000000L1.800000,4.400000L0.200000,5.100000L0.200000,3.700000l3.100000,-1.300000l0.200000,0.000000L3.500000,11.000000z"/>
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M8.600000,5.500000l1.200000,-3.000000l1.900000,0.000000L9.700000,6.700000l2.200000,4.300000L9.900000,11.000000L8.700000,7.900000L7.400000,11.000000L5.500000,11.000000l2.100000,-4.300000L5.600000,2.500000l1.900000,0.000000L8.600000,5.500000z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/signal_strength_3g.xml b/res/drawable/signal_strength_3g.xml
new file mode 100644
index 0000000..49f52a9
--- /dev/null
+++ b/res/drawable/signal_strength_3g.xml
@@ -0,0 +1,28 @@
+<!--
+Copyright (C) 2018 The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="9.208dp"
+    android:height="17dp"
+    android:viewportWidth="13.0"
+    android:viewportHeight="24.0"
+    android:tint="?android:attr/colorControlNormal">
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M2.000000,6.000000l0.800000,0.000000c0.300000,0.000000 0.500000,-0.100000 0.700000,-0.300000s0.200000,-0.500000 0.200000,-0.900000c0.000000,-0.300000 -0.100000,-0.600000 -0.200000,-0.800000S3.200000,3.700000 2.900000,3.700000C2.700000,3.700000 2.500000,3.800000 2.300000,4.000000S2.100000,4.400000 2.100000,4.700000L0.500000,4.700000C0.500000,4.000000 0.700000,3.400000 1.100000,3.000000s1.000000,-0.600000 1.700000,-0.600000c0.800000,0.000000 1.400000,0.200000 1.900000,0.600000s0.700000,1.000000 0.700000,1.800000c0.000000,0.400000 -0.100000,0.700000 -0.300000,1.100000S4.600000,6.500000 4.300000,6.600000C4.700000,6.800000 5.000000,7.100000 5.200000,7.400000s0.300000,0.700000 0.300000,1.200000c0.000000,0.800000 -0.200000,1.400000 -0.700000,1.800000s-1.100000,0.700000 -1.900000,0.700000c-0.700000,0.000000 -1.300000,-0.200000 -1.800000,-0.600000s-0.700000,-1.000000 -0.700000,-1.800000L2.000000,8.700000C2.000000,9.000000 2.100000,9.300000 2.300000,9.500000s0.400000,0.300000 0.600000,0.300000c0.300000,0.000000 0.500000,-0.100000 0.700000,-0.300000S3.900000,9.000000 3.900000,8.600000c0.000000,-0.500000 -0.100000,-0.800000 -0.300000,-1.000000S3.200000,7.300000 2.800000,7.300000L2.000000,7.300000L2.000000,6.000000z"/>
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M12.500000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S6.700000,9.000000 6.700000,7.900000L6.700000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000s1.200000,-0.800000 2.100000,-0.800000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000l-1.600000,0.000000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000s-0.500000,-0.300000 -0.900000,-0.300000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S8.400000,5.000000 8.400000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L10.799999,7.800000L9.600000,7.800000L9.600000,6.600000l2.900000,0.000000L12.500000,9.900000z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/signal_strength_g.xml b/res/drawable/signal_strength_g.xml
new file mode 100644
index 0000000..7258c94
--- /dev/null
+++ b/res/drawable/signal_strength_g.xml
@@ -0,0 +1,25 @@
+<!--
+Copyright (C) 2018 The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="4.958dp"
+    android:height="17dp"
+    android:viewportWidth="7.0"
+    android:viewportHeight="24.0"
+    android:tint="?android:attr/colorControlNormal">
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M6.500000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S0.700000,9.000000 0.700000,7.900000L0.700000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000s1.200000,-0.800000 2.100000,-0.800000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000L4.700000,5.200000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000S4.000000,3.700000 3.600000,3.700000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S2.300000,5.000000 2.300000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L4.700000,7.800000L3.500000,7.800000L3.500000,6.600000l2.900000,0.000000L6.400000,9.900000z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/signal_strength_lte.xml b/res/drawable/signal_strength_lte.xml
new file mode 100644
index 0000000..e6edd24
--- /dev/null
+++ b/res/drawable/signal_strength_lte.xml
@@ -0,0 +1,31 @@
+<!--
+Copyright (C) 2018 The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="9.208dp"
+    android:height="17dp"
+    android:viewportWidth="13.0"
+    android:viewportHeight="24.0"
+    android:tint="?android:attr/colorControlNormal">
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M2.000000,9.700000l2.000000,0.000000L4.000000,11.000000L0.300000,11.000000L0.300000,2.500000L2.000000,2.500000L2.000000,9.700000z"/>
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M8.300000,3.800000L7.000000,3.800000L7.000000,11.000000L5.300000,11.000000L5.300000,3.800000L4.000000,3.800000L4.000000,2.500000l4.300000,0.000000L8.300000,3.800000z"/>
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M12.400000,7.300000l-1.700000,0.000000l0.000000,2.400000l2.100000,0.000000L12.799999,11.000000L9.000000,11.000000L9.000000,2.500000l3.700000,0.000000l0.000000,1.300000l-2.100000,0.000000l0.000000,2.100000l1.700000,0.000000L12.300000,7.300000z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/vector_drawable_progress_indeterminate_horizontal_trimmed.xml b/res/drawable/vector_drawable_progress_indeterminate_horizontal_trimmed.xml
new file mode 100644
index 0000000..dc0352a
--- /dev/null
+++ b/res/drawable/vector_drawable_progress_indeterminate_horizontal_trimmed.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- Variant of vector_drawable_progress_indeterminate_horizontal in frameworks/base/core/res, which
+     draws the whole height of the progress bar instead having blank space above and below the
+     bar. -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:height="10dp"
+    android:width="360dp"
+    android:viewportHeight="10"
+    android:viewportWidth="360" >
+    <group
+        android:name="progress_group"
+        android:translateX="180"
+        android:translateY="5" >
+        <path
+            android:name="background_track"
+            android:pathData="M -180.0,-5.0 l 360.0,0 l 0,10.0 l -360.0,0 Z"
+            android:fillColor="?android:attr/colorControlActivated"
+            android:fillAlpha="?android:attr/disabledAlpha"/>
+        <group
+            android:name="rect2_grp"
+            android:translateX="-197.60001"
+            android:scaleX="0.1" >
+            <path
+                android:name="rect2"
+                android:pathData="M -144.0,-5.0 l 288.0,0 l 0,10.0 l -288.0,0 Z"
+                android:fillColor="?android:attr/colorControlActivated" />
+        </group>
+        <group
+            android:name="rect1_grp"
+            android:translateX="-522.59998"
+            android:scaleX="0.1" >
+            <path
+                android:name="rect1"
+                android:pathData="M -144.0,-5.0 l 288.0,0 l 0,10.0 l -288.0,0 Z"
+                android:fillColor="?android:attr/colorControlActivated" />
+        </group>
+    </group>
+</vector>
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 5dc7279..f6d1b79 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -108,4 +108,6 @@
     <dimen name="floating_action_button_width">67dp</dimen>
     <dimen name="floating_action_button_height">67dp</dimen>
     <dimen name="floating_action_button_margin_bottom">32dp</dimen>
+
+    <dimen name="signal_strength_icon_size">24dp</dimen>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 72be3b2..a84fd0c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -387,6 +387,16 @@
     <string name="preferred_network_mode_summary">Change the network operating mode</string>
     <string name="preferred_network_mode_dialogtitle">Preferred network type</string>
     <string name="forbidden_network">(forbidden)</string>
+    <!-- Available networks screen, name of button when user wants to select network manually  -->
+    <string name="choose_network_title">Choose network</string>
+    <!-- Available networks screen, text when no networks connected -->
+    <string name="network_disconnected">Disconnected</string>
+    <!-- Available networks screen, text when network connected -->
+    <string name="network_connected">Connected</string>
+    <!-- Available networks screen, text when a network is connecting -->
+    <string name="network_connecting">Connecting...</string>
+    <!-- Available networks screen, text when a network cannot be connected -->
+    <string name="network_could_not_connect">Couldn’t connect</string>
 
     <!-- The preferred network modes in Mobile network settings -->
     <string-array name="preferred_network_mode_choices">
@@ -524,7 +534,9 @@
     <!-- Mobile network settings UI: notification message shown when you
          lose data connectivity because you're roaming and you have the
          "data roaming" feature turned off. -->
-    <string name="roaming_reenable_message">You\'ve lost data connectivity because you left your home network with data roaming turned off.</string>
+    <string name="roaming_reenable_message">Data roaming is turned off. Tap to turn on.</string>
+    <!-- Roaming notification tile, notifying lost of roaming data connection -->
+    <string name="roaming_notification_title">Lost mobile data connection</string>
     <!-- Mobile network settings screen, dialog message when user selects the Data roaming check box -->
     <string name="roaming_warning">You may incur significant charges.</string>
     <!-- Mobile network settings screen, dialog message title when user selects the Data roaming check box -->
@@ -1499,111 +1511,111 @@
     <!-- In-call screen: status label displayed briefly after a call ends -->
     <string name="clh_card_title_call_ended_txt">Call ended</string>
     <!-- In-call screen: call failure reason (radio is off) -->
-    <string name="clh_callFailed_powerOff_txt">Radio off</string>
+    <string name="clh_callFailed_powerOff_txt">Airplane mode is on</string>
     <!-- In-call screen: call failure reason (SIM error) -->
-    <string name="clh_callFailed_simError_txt">No SIM card or SIM card error</string>
+    <string name="clh_callFailed_simError_txt">Can\'t access SIM card</string>
     <!-- In-call screen: call failure message displayed in an error dialog -->
     <string name="clh_incall_error_out_of_service_txt">Mobile network not available</string>
 
     <!-- See CallFailCause for details on what causes each message -->
     <!-- In-call screen: call failure reason (Cause Number 1) -->
-    <string name="clh_callFailed_unassigned_number_txt">Unassigned (unallocated) number</string>
+    <string name="clh_callFailed_unassigned_number_txt">Issue with phone number you are trying to dial. Error code 1.</string>
     <!-- In-call screen: call failure reason (Cause Number 3) -->
-    <string name="clh_callFailed_no_route_to_destination_txt">No route to destination</string>
+    <string name="clh_callFailed_no_route_to_destination_txt">Couldn\'t complete call. Error code 3.</string>
     <!-- In-call screen: call failure reason (Cause Number 6) -->
-    <string name="clh_callFailed_channel_unacceptable_txt">Channel unacceptable</string>
+    <string name="clh_callFailed_channel_unacceptable_txt">Couldn\'t complete call. Error code 6.</string>
     <!-- In-call screen: call failure reason (Cause Number 8) -->
-    <string name="clh_callFailed_operator_determined_barring_txt">Operator determined barring</string>
+    <string name="clh_callFailed_operator_determined_barring_txt">Couldn\'t complete call. Error code 8.</string>
     <!-- In-call screen: call failure reason (Cause Number 16) -->
-    <string name="clh_callFailed_normal_call_clearing_txt">Normal call clearing</string>
+    <string name="clh_callFailed_normal_call_clearing_txt">Couldn\'t complete call. Error code 16.</string>
     <!-- In-call screen: call failure reason (Cause Number 17) -->
     <string name="clh_callFailed_user_busy_txt">User busy</string>
     <!-- In-call screen: call failure reason (Cause Number 18) -->
-    <string name="clh_callFailed_no_user_responding_txt">No user responding</string>
+    <string name="clh_callFailed_no_user_responding_txt">User not responding</string>
     <!-- In-call screen: call failure reason (Cause Number 19) -->
-    <string name="clh_callFailed_user_alerting_txt">User alerting, no answer</string>
+    <string name="clh_callFailed_user_alerting_txt">Couldn\'t complete call. Error code 19.</string>
     <!-- In-call screen: call failure reason (Cause Number 21) -->
     <string name="clh_callFailed_call_rejected_txt">Call rejected</string>
     <!-- In-call screen: call failure reason (Cause Number 22) -->
     <string name="clh_callFailed_number_changed_txt">Number changed</string>
     <!-- In-call screen: call failure reason (Cause Number 25) -->
-    <string name="clh_callFailed_pre_emption_txt">Pre-emption</string>
+    <string name="clh_callFailed_pre_emption_txt">Couldn\'t complete call. Error code 25.</string>
     <!-- In-call screen: call failure reason (Cause Number 26) -->
-    <string name="clh_callFailed_non_selected_user_clearing_txt">Non selected user clearing</string>
+    <string name="clh_callFailed_non_selected_user_clearing_txt">Couldn\'t complete call. Error code 26.</string>
     <!-- In-call screen: call failure reason (Cause Number 27) -->
-    <string name="clh_callFailed_destination_out_of_order_txt">Destination out of order</string>
+    <string name="clh_callFailed_destination_out_of_order_txt">Couldn\'t complete call. Error code 27.</string>
     <!-- In-call screen: call failure reason (Cause Number 28) -->
     <string name="clh_callFailed_invalid_number_format_txt">Invalid number format (incomplete number)</string>
     <!-- In-call screen: call failure reason (Cause Number 29) -->
-    <string name="clh_callFailed_facility_rejected_txt">Facility rejected</string>
+    <string name="clh_callFailed_facility_rejected_txt">Couldn\'t complete call. Error code 29.</string>
     <!-- In-call screen: call failure reason (Cause Number 30) -->
-    <string name="clh_callFailed_response_to_STATUS_ENQUIRY_txt">Response to STATUS ENQUIRY</string>
+    <string name="clh_callFailed_response_to_STATUS_ENQUIRY_txt">Couldn\'t complete call. Error code 30.</string>
     <!-- In-call screen: call failure reason (Cause Number 31) -->
-    <string name="clh_callFailed_normal_unspecified_txt">Normal, unspecified</string>
+    <string name="clh_callFailed_normal_unspecified_txt">Couldn\'t complete call. Error code 31.</string>
     <!-- In-call screen: call failure reason (Cause Number 34) -->
-    <string name="clh_callFailed_no_circuit_available_txt">No circuit/channel available</string>
+    <string name="clh_callFailed_no_circuit_available_txt">Couldn\'t complete call. Error code 34.</string>
     <!-- In-call screen: call failure reason (Cause Number 38) -->
-    <string name="clh_callFailed_network_out_of_order_txt">Network out of order</string>
+    <string name="clh_callFailed_network_out_of_order_txt">Couldn\'t complete call. Error code 38.</string>
     <!-- In-call screen: call failure reason (Cause Number 41) -->
-    <string name="clh_callFailed_temporary_failure_txt">Temporary failure</string>
+    <string name="clh_callFailed_temporary_failure_txt">Couldn\'t complete call. Error code 41.</string>
     <!-- In-call screen: call failure reason (Cause Number 42) -->
-    <string name="clh_callFailed_switching_equipment_congestion_txt">Switching equipment congestion</string>
+    <string name="clh_callFailed_switching_equipment_congestion_txt">Couldn\'t complete call. Error code 42.</string>
     <!-- In-call screen: call failure reason (Cause Number 43) -->
-    <string name="clh_callFailed_access_information_discarded_txt">Access information discarded</string>
+    <string name="clh_callFailed_access_information_discarded_txt">Couldn\'t complete call. Error code 43.</string>
     <!-- In-call screen: call failure reason (Cause Number 44) -->
-    <string name="clh_callFailed_requested_circuit_txt">Requested circuit/channel not available</string>
+    <string name="clh_callFailed_requested_circuit_txt">Couldn\'t complete call. Error code 44.</string>
     <!-- In-call screen: call failure reason (Cause Number 47) -->
-    <string name="clh_callFailed_resources_unavailable_unspecified_txt">Resources unavailable, unspecified</string>
+    <string name="clh_callFailed_resources_unavailable_unspecified_txt">Couldn\'t complete call. Error code 47.</string>
     <!-- In-call screen: call failure reason (Cause Number 49) -->
-    <string name="clh_callFailed_quality_of_service_unavailable_txt">Quality of service unavailable</string>
+    <string name="clh_callFailed_quality_of_service_unavailable_txt">Couldn\'t complete call. Error code 49.</string>
     <!-- In-call screen: call failure reason (Cause Number 50) -->
-    <string name="clh_callFailed_requested_facility_not_subscribed_txt">Requested facility not subscribed</string>
+    <string name="clh_callFailed_requested_facility_not_subscribed_txt">Couldn\'t complete call. Error code 50.</string>
     <!-- In-call screen: call failure reason (Cause Number 55) -->
-    <string name="clh_callFailed_incoming_calls_barred_within_the_CUG_txt">Incoming calls barred within the CUG</string>
+    <string name="clh_callFailed_incoming_calls_barred_within_the_CUG_txt">Couldn\'t complete call. Error code 55.</string>
     <!-- In-call screen: call failure reason (Cause Number 57) -->
-    <string name="clh_callFailed_bearer_capability_not_authorized_txt">Bearer capability not authorized</string>
+    <string name="clh_callFailed_bearer_capability_not_authorized_txt">Couldn\'t complete call. Error code 57.</string>
     <!-- In-call screen: call failure reason (Cause Number 58) -->
-    <string name="clh_callFailed_bearer_capability_not_presently_available_txt">Bearer capability not presently available</string>
+    <string name="clh_callFailed_bearer_capability_not_presently_available_txt">Couldn\'t complete call. Error code 58.</string>
     <!-- In-call screen: call failure reason (Cause Number 63) -->
-    <string name="clh_callFailed_service_or_option_not_available_unspecified_txt">Service or option not available, unspecified</string>
+    <string name="clh_callFailed_service_or_option_not_available_unspecified_txt">Couldn\'t complete call. Error code 63.</string>
     <!-- In-call screen: call failure reason (Cause Number 65) -->
-    <string name="clh_callFailed_bearer_service_not_implemented_txt">Bearer service not implemented</string>
+    <string name="clh_callFailed_bearer_service_not_implemented_txt">Couldn\'t complete call. Error code 65.</string>
     <!-- In-call screen: call failure reason (Cause Number 68) -->
-    <string name="clh_callFailed_ACM_equal_to_or_greater_than_ACMmax_txt">ACM equal to or greater than ACMmax</string>
+    <string name="clh_callFailed_ACM_equal_to_or_greater_than_ACMmax_txt">Couldn\'t complete call. Error code 68.</string>
     <!-- In-call screen: call failure reason (Cause Number 69) -->
-    <string name="clh_callFailed_requested_facility_not_implemented_txt">Requested facility not implemented</string>
+    <string name="clh_callFailed_requested_facility_not_implemented_txt">Couldn\'t complete call. Error code 69.</string>
     <!-- In-call screen: call failure reason (Cause Number 70) -->
-    <string name="clh_callFailed_only_restricted_digital_information_bearer_capability_is_available_txt">Only restricted digital information bearer capability is available</string>
+    <string name="clh_callFailed_only_restricted_digital_information_bearer_capability_is_available_txt">Couldn\'t complete call. Error code 70.</string>
     <!-- In-call screen: call failure reason (Cause Number 79) -->
-    <string name="clh_callFailed_service_or_option_not_implemented_unspecified_txt">Service or option not implemented, unspecified</string>
+    <string name="clh_callFailed_service_or_option_not_implemented_unspecified_txt">Couldn\'t complete call. Error code 79.</string>
     <!-- In-call screen: call failure reason (Cause Number 81) -->
-    <string name="clh_callFailed_invalid_transaction_identifier_value_txt">Invalid transaction identifier value</string>
+    <string name="clh_callFailed_invalid_transaction_identifier_value_txt">Couldn\'t complete call. Error code 81.</string>
     <!-- In-call screen: call failure reason (Cause Number 87) -->
-    <string name="clh_callFailed_user_not_member_of_CUG_txt">User not member of CUG</string>
+    <string name="clh_callFailed_user_not_member_of_CUG_txt">Couldn\'t complete call. Error code 87.</string>
     <!-- In-call screen: call failure reason (Cause Number 88) -->
-    <string name="clh_callFailed_incompatible_destination_txt">Incompatible destination</string>
+    <string name="clh_callFailed_incompatible_destination_txt">Couldn\'t complete call. Error code 88.</string>
     <!-- In-call screen: call failure reason (Cause Number 91) -->
-    <string name="clh_callFailed_invalid_transit_network_selection_txt">Invalid transit network selection</string>
+    <string name="clh_callFailed_invalid_transit_network_selection_txt">Couldn\'t complete call. Error code 91.</string>
     <!-- In-call screen: call failure reason (Cause Number 95) -->
-    <string name="clh_callFailed_semantically_incorrect_message_txt">Semantically incorrect message</string>
+    <string name="clh_callFailed_semantically_incorrect_message_txt">Couldn\'t complete call. Error code 95.</string>
     <!-- In-call screen: call failure reason (Cause Number 96) -->
-    <string name="clh_callFailed_invalid_mandatory_information_txt">Invalid mandatory information</string>
+    <string name="clh_callFailed_invalid_mandatory_information_txt">Couldn\'t complete call. Error code 96.</string>
     <!-- In-call screen: call failure reason (Cause Number 97) -->
-    <string name="clh_callFailed_message_type_non_existent_or_not_implemented_txt">Message type non-existent or not implemented</string>
+    <string name="clh_callFailed_message_type_non_existent_or_not_implemented_txt">Couldn\'t complete call. Error code 97.</string>
     <!-- In-call screen: call failure reason (Cause Number 98) -->
-    <string name="clh_callFailed_message_type_not_compatible_with_protocol_state_txt">Message type not compatible with protocol state</string>
+    <string name="clh_callFailed_message_type_not_compatible_with_protocol_state_txt">Couldn\'t complete call. Error code 98.</string>
     <!-- In-call screen: call failure reason (Cause Number 99) -->
-    <string name="clh_callFailed_information_element_non_existent_or_not_implemented_txt">Information element non-existent or not implemented</string>
+    <string name="clh_callFailed_information_element_non_existent_or_not_implemented_txt">Couldn\'t complete call. Error code 99.</string>
     <!-- In-call screen: call failure reason (Cause Number 100) -->
-    <string name="clh_callFailed_conditional_IE_error_txt">Conditional IE error</string>
+    <string name="clh_callFailed_conditional_IE_error_txt">Couldn\'t complete call. Error code 100.</string>
     <!-- In-call screen: call failure reason (Cause Number 101) -->
-    <string name="clh_callFailed_message_not_compatible_with_protocol_state_txt">Message not compatible with protocol state</string>
+    <string name="clh_callFailed_message_not_compatible_with_protocol_state_txt">Couldn\'t complete call. Error code 101.</string>
     <!-- In-call screen: call failure reason (Cause Number 102) -->
-    <string name="clh_callFailed_recovery_on_timer_expiry_txt">Recovery on timer expiry</string>
+    <string name="clh_callFailed_recovery_on_timer_expiry_txt">Couldn\'t complete call. Error code 102.</string>
     <!-- In-call screen: call failure reason (Cause Number 111) -->
-    <string name="clh_callFailed_protocol_Error_unspecified_txt">Protocol error, unspecified</string>
+    <string name="clh_callFailed_protocol_Error_unspecified_txt">Couldn\'t complete call. Error code 111.</string>
     <!-- In-call screen: call failure reason (Cause Number 127) -->
-    <string name="clh_callFailed_interworking_unspecified_txt">Interworking, unspecified</string>
+    <string name="clh_callFailed_interworking_unspecified_txt">Couldn\'t complete call. Error code 127.</string>
     <!-- Call settings screen, setting option name -->
     <string name="labelCallBarring">Call barring</string>
     <!-- Call barring settings screen, setting summary text when a call barring option is activated -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 2b893e5..d003aec 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -187,6 +187,12 @@
         <item name="android:preferenceScreenStyle">@style/SettingsPreferenceScreen</item>
     </style>
 
+    <style name="TrimmedHorizontalProgressBar" parent="android:Widget.Material.ProgressBar.Horizontal">
+        <item name="android:indeterminateDrawable">@drawable/progress_indeterminate_horizontal_material_trimmed</item>
+        <item name="android:minHeight">3dip</item>
+        <item name="android:maxHeight">3dip</item>
+    </style>
+
     <style name="Empty" parent="@android:style/Theme.Material.Light">
         <item name="android:windowIsTranslucent">true</item>
         <item name="android:windowBackground">@android:color/transparent</item>
diff --git a/res/xml/cdma_options.xml b/res/xml/cdma_options.xml
index 8a41f87..6ac5dae 100644
--- a/res/xml/cdma_options.xml
+++ b/res/xml/cdma_options.xml
@@ -38,7 +38,7 @@
     <PreferenceCategory
         android:key="category_cdma_apn_key">
         <!-- The launching Intent will be defined thru code as we need to pass some Extra -->
-        <Preference
+        <com.android.phone.RestrictedPreference
             android:key="button_cdma_apn_key"
             android:title="@string/apn_settings"
             android:persistent="false"/>
diff --git a/res/xml/gsm_umts_options.xml b/res/xml/gsm_umts_options.xml
index e6ddc37..e3e2617 100644
--- a/res/xml/gsm_umts_options.xml
+++ b/res/xml/gsm_umts_options.xml
@@ -37,7 +37,7 @@
     <!--we want user to change it with caution.-->
     <PreferenceCategory
         android:key="category_gsm_apn_key">
-        <Preference
+        <com.android.phone.RestrictedPreference
             android:key="button_gsm_apn_key"
             android:title="@string/apn_settings"
             android:persistent="false" />
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 233530e..8da980c 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -101,6 +101,7 @@
     private SwitchPreference mButtonAutoRetry;
     private PreferenceScreen mVoicemailSettingsScreen;
     private SwitchPreference mEnableVideoCalling;
+    private Preference mButtonWifiCalling;
 
     /*
      * Click Listeners, handle click based on objects attached to UI.
@@ -200,6 +201,8 @@
                         (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
                 mEnableVideoCalling.setEnabled(
                         telephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE);
+                mButtonWifiCalling.setEnabled(
+                        telephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE);
             }
         }
     };
@@ -239,6 +242,8 @@
         mButtonAutoRetry = (SwitchPreference) findPreference(BUTTON_RETRY_KEY);
 
         mEnableVideoCalling = (SwitchPreference) findPreference(ENABLE_VIDEO_CALLING_KEY);
+        mButtonWifiCalling = findPreference(getResources().getString(
+                R.string.wifi_calling_settings_key));
 
         PersistableBundle carrierConfig =
                 PhoneGlobals.getInstance().getCarrierConfigForSubId(mPhone.getSubId());
@@ -309,9 +314,6 @@
             /* tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); */
         }
 
-        Preference wifiCallingSettings = findPreference(
-                getResources().getString(R.string.wifi_calling_settings_key));
-
         final PhoneAccountHandle simCallManager = mTelecomManager.getSimCallManager();
         if (simCallManager != null) {
             Intent intent = PhoneAccountSettingsFragment.buildPhoneAccountConfigureIntent(
@@ -320,17 +322,17 @@
                 PackageManager pm = mPhone.getContext().getPackageManager();
                 List<ResolveInfo> resolutions = pm.queryIntentActivities(intent, 0);
                 if (!resolutions.isEmpty()) {
-                    wifiCallingSettings.setTitle(resolutions.get(0).loadLabel(pm));
-                    wifiCallingSettings.setSummary(null);
-                    wifiCallingSettings.setIntent(intent);
+                    mButtonWifiCalling.setTitle(resolutions.get(0).loadLabel(pm));
+                    mButtonWifiCalling.setSummary(null);
+                    mButtonWifiCalling.setIntent(intent);
                 } else {
-                    prefSet.removePreference(wifiCallingSettings);
+                    prefSet.removePreference(mButtonWifiCalling);
                 }
             } else {
-                prefSet.removePreference(wifiCallingSettings);
+                prefSet.removePreference(mButtonWifiCalling);
             }
         } else if (!mImsMgr.isWfcEnabledByPlatform() || !mImsMgr.isWfcProvisionedOnDevice()) {
-            prefSet.removePreference(wifiCallingSettings);
+            prefSet.removePreference(mButtonWifiCalling);
         } else {
             int resId = com.android.internal.R.string.wifi_calling_off_summary;
             if (mImsMgr.isWfcEnabledByUser()) {
@@ -350,19 +352,19 @@
                         if (DBG) log("Unexpected WFC mode value: " + wfcMode);
                 }
             }
-            wifiCallingSettings.setSummary(resId);
+            mButtonWifiCalling.setSummary(resId);
         }
 
         try {
             if (mImsMgr.getImsServiceState() != ImsFeature.STATE_READY) {
                 log("Feature state not ready so remove vt and wfc settings for "
                         + " phone =" + mPhone.getPhoneId());
-                prefSet.removePreference(wifiCallingSettings);
+                prefSet.removePreference(mButtonWifiCalling);
                 prefSet.removePreference(mEnableVideoCalling);
             }
         } catch (ImsException ex) {
             log("Exception when trying to get ImsServiceStatus: " + ex);
-            prefSet.removePreference(wifiCallingSettings);
+            prefSet.removePreference(mButtonWifiCalling);
             prefSet.removePreference(mEnableVideoCalling);
         }
     }
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index 1b1327f..2bb8d6f 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -174,7 +174,7 @@
                     mConfigFromDefaultApp[phoneId] = null;
                     mConfigFromCarrierApp[phoneId] = null;
                     mServiceConnection[phoneId] = null;
-                    broadcastConfigChangedIntent(phoneId);
+                    broadcastConfigChangedIntent(phoneId, false);
                     break;
                 }
 
@@ -512,10 +512,20 @@
     }
 
     private void broadcastConfigChangedIntent(int phoneId) {
+        broadcastConfigChangedIntent(phoneId, true);
+    }
+
+    private void broadcastConfigChangedIntent(int phoneId, boolean addSubIdExtra) {
         Intent intent = new Intent(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
         intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT |
                 Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
-        SubscriptionManager.putPhoneIdAndSubIdExtra(intent, phoneId);
+        // Include subId extra only if SIM records are loaded
+        TelephonyManager telephonyManager = TelephonyManager.from(mContext);
+        int simApplicationState = telephonyManager.getSimApplicationState();
+        if (addSubIdExtra && (simApplicationState != TelephonyManager.SIM_STATE_UNKNOWN
+                && simApplicationState != TelephonyManager.SIM_STATE_NOT_READY)) {
+            SubscriptionManager.putPhoneIdAndSubIdExtra(intent, phoneId);
+        }
         intent.putExtra(CarrierConfigManager.EXTRA_SLOT_INDEX, phoneId);
         ActivityManager.broadcastStickyIntent(intent, UserHandle.USER_ALL);
         mHasSentConfigChange[phoneId] = true;
diff --git a/src/com/android/phone/CdmaOptions.java b/src/com/android/phone/CdmaOptions.java
index 7c09265..ff37c70 100644
--- a/src/com/android/phone/CdmaOptions.java
+++ b/src/com/android/phone/CdmaOptions.java
@@ -29,6 +29,7 @@
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.internal.telephony.Phone;
+import com.android.settingslib.RestrictedLockUtils;
 
 /**
  * List of Phone-specific settings screens.
@@ -38,7 +39,7 @@
 
     private CdmaSystemSelectListPreference mButtonCdmaSystemSelect;
     private CdmaSubscriptionListPreference mButtonCdmaSubscription;
-    private Preference mButtonAPNExpand;
+    private RestrictedPreference mButtonAPNExpand;
     private Preference mCategoryAPNExpand;
     private Preference mButtonCarrierSettings;
 
@@ -63,7 +64,7 @@
         mButtonCdmaSubscription = (CdmaSubscriptionListPreference) mPrefScreen
                 .findPreference(BUTTON_CDMA_SUBSCRIPTION_KEY);
         mButtonCarrierSettings = mPrefScreen.findPreference(BUTTON_CARRIER_SETTINGS_KEY);
-        mButtonAPNExpand = mPrefScreen.findPreference(BUTTON_APN_EXPAND_KEY);
+        mButtonAPNExpand = (RestrictedPreference) mPrefScreen.findPreference(BUTTON_APN_EXPAND_KEY);
         mCategoryAPNExpand = mPrefScreen.findPreference(CATEGORY_APN_EXPAND_KEY);
 
         update(phone);
@@ -93,6 +94,10 @@
         // Calling add or remove explicitly to make sure they are updated.
 
         if (addAPNExpand) {
+            mButtonAPNExpand.setDisabledByAdmin(
+                    MobileNetworkSettings.isDpcApnEnforced(mButtonAPNExpand.getContext())
+                            ? RestrictedLockUtils.getDeviceOwner(mButtonAPNExpand.getContext())
+                            : null);
             mButtonAPNExpand.setOnPreferenceClickListener(
                     new Preference.OnPreferenceClickListener() {
                         @Override
diff --git a/src/com/android/phone/GsmUmtsOptions.java b/src/com/android/phone/GsmUmtsOptions.java
index 5cf19ad..220cf34 100644
--- a/src/com/android/phone/GsmUmtsOptions.java
+++ b/src/com/android/phone/GsmUmtsOptions.java
@@ -28,6 +28,7 @@
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.PhoneFactory;
+import com.android.settingslib.RestrictedLockUtils;
 
 /**
  * List of Network-specific settings screens.
@@ -35,7 +36,7 @@
 public class GsmUmtsOptions {
     private static final String LOG_TAG = "GsmUmtsOptions";
 
-    private Preference mButtonAPNExpand;
+    private RestrictedPreference mButtonAPNExpand;
     private Preference mCategoryAPNExpand;
     Preference mCarrierSettingPref;
 
@@ -54,7 +55,7 @@
         mPrefFragment = prefFragment;
         mPrefScreen = prefScreen;
         mPrefFragment.addPreferencesFromResource(R.xml.gsm_umts_options);
-        mButtonAPNExpand = mPrefScreen.findPreference(BUTTON_APN_EXPAND_KEY);
+        mButtonAPNExpand = (RestrictedPreference) mPrefScreen.findPreference(BUTTON_APN_EXPAND_KEY);
         mCategoryAPNExpand = mPrefScreen.findPreference(CATEGORY_APN_EXPAND_KEY);
         mNetworkOperator = (NetworkOperators) mPrefScreen
                 .findPreference(NetworkOperators.CATEGORY_NETWORK_OPERATORS_KEY);
@@ -113,6 +114,10 @@
         // Calling add or remove explicitly to make sure they are updated.
 
         if (addAPNExpand) {
+            mButtonAPNExpand.setDisabledByAdmin(
+                    MobileNetworkSettings.isDpcApnEnforced(mButtonAPNExpand.getContext())
+                            ? RestrictedLockUtils.getDeviceOwner(mButtonAPNExpand.getContext())
+                            : null);
             mButtonAPNExpand.setOnPreferenceClickListener(
                     new Preference.OnPreferenceClickListener() {
                         @Override
diff --git a/src/com/android/phone/IccNetworkDepersonalizationPanel.java b/src/com/android/phone/IccNetworkDepersonalizationPanel.java
index 9dff461..8bd10a2 100644
--- a/src/com/android/phone/IccNetworkDepersonalizationPanel.java
+++ b/src/com/android/phone/IccNetworkDepersonalizationPanel.java
@@ -74,7 +74,7 @@
     /**
      * Shows the network depersonalization dialog, but only if it is not already visible.
      */
-    public static void showDialog() {
+    public static void showDialog(Phone phone) {
         if (sShowingDialog) {
             Log.i(TAG, "[IccNetworkDepersonalizationPanel] - showDialog; skipped already shown.");
             return;
@@ -82,7 +82,7 @@
         Log.i(TAG, "[IccNetworkDepersonalizationPanel] - showDialog; showing dialog.");
         sShowingDialog = true;
         IccNetworkDepersonalizationPanel ndpPanel =
-                new IccNetworkDepersonalizationPanel(PhoneGlobals.getInstance());
+                new IccNetworkDepersonalizationPanel(PhoneGlobals.getInstance(), phone);
         ndpPanel.show();
     }
 
@@ -133,6 +133,13 @@
     //constructor
     public IccNetworkDepersonalizationPanel(Context context) {
         super(context);
+        mPhone = PhoneGlobals.getPhone();
+    }
+
+    //constructor
+    public IccNetworkDepersonalizationPanel(Context context, Phone phone) {
+        super(context);
+        mPhone = phone == null ? PhoneGlobals.getPhone() : phone;
     }
 
     @Override
@@ -172,8 +179,6 @@
         //status panel is used since we're having problems with the alert dialog.
         mStatusPanel = (LinearLayout) findViewById(R.id.status_panel);
         mStatusText = (TextView) findViewById(R.id.status_text);
-
-        mPhone = PhoneGlobals.getPhone();
     }
 
     @Override
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 50a15d3..99950a8 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -16,6 +16,8 @@
 
 package com.android.phone;
 
+import static android.provider.Telephony.Carriers.ENFORCE_MANAGED_URI;
+
 import android.app.ActionBar;
 import android.app.Activity;
 import android.app.DialogFragment;
@@ -30,6 +32,8 @@
 import android.content.ServiceConnection;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
+import android.database.ContentObserver;
+import android.database.Cursor;
 import android.net.Uri;
 import android.os.AsyncResult;
 import android.os.Bundle;
@@ -172,6 +176,20 @@
         return true;
     }
 
+    /**
+     * Returns if DPC APNs are enforced.
+     */
+    public static boolean isDpcApnEnforced(Context context) {
+        try (Cursor enforceCursor = context.getContentResolver().query(ENFORCE_MANAGED_URI,
+                null, null, null, null)) {
+            if (enforceCursor == null || enforceCursor.getCount() != 1) {
+                return false;
+            }
+            enforceCursor.moveToFirst();
+            return enforceCursor.getInt(0) > 0;
+        }
+    }
+
     public static class MobileNetworkFragment extends PreferenceFragment implements
             Preference.OnPreferenceChangeListener, RoamingDialogFragment.RoamingDialogListener {
 
@@ -213,6 +231,7 @@
         private static final String BUTTON_CDMA_APN_EXPAND_KEY = "button_cdma_apn_key";
 
         private final BroadcastReceiver mPhoneChangeReceiver = new PhoneChangeReceiver();
+        private final ContentObserver mDpcEnforcedContentObserver = new DpcApnEnforcedObserver();
 
         static final int preferredNetworkMode = Phone.PREFERRED_NT_MODE;
 
@@ -266,12 +285,10 @@
         private boolean mIsGlobalCdma;
         private boolean mUnavailable;
 
-        private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
+        private class PhoneCallStateListener extends PhoneStateListener {
             /*
-             * Enable/disable the 'Enhanced 4G LTE Mode' and 'Carrier video calling'
-             * when in/out of a call. 'Enhanced 4G LTE Mode' depends on TTY mode
-             * and TTY support over VoLTE.
-             *
+             * Enable/disable the 'Enhanced 4G LTE Mode' when in/out of a call
+             * and depending on TTY mode and TTY support over VoLTE.
              * @see android.telephony.PhoneStateListener#onCallStateChanged(int,
              * java.lang.String)
              */
@@ -279,17 +296,31 @@
             public void onCallStateChanged(int state, String incomingNumber) {
                 if (DBG) log("PhoneStateListener.onCallStateChanged: state=" + state);
 
-                int subId = mPhone != null
-                        ? mPhone.getSubId() : SubscriptionManager.INVALID_SUBSCRIPTION_ID;
-                PersistableBundle carrierConfig =
-                        PhoneGlobals.getInstance().getCarrierConfigForSubId(subId);
-                boolean enabled = is4gLtePrefEnabled(carrierConfig);
-                Preference pref = getPreferenceScreen().findPreference(BUTTON_4G_LTE_KEY);
-                if (pref != null) pref.setEnabled(enabled && hasActiveSubscriptions());
-
+                updateEnhanced4gLteState();
+                updateWiFiCallState();
                 updateVideoCallState();
             }
-        };
+
+            /*
+             * Listen to different subId if mPhone is updated.
+             */
+            protected void updatePhone() {
+                int newSubId = (mPhone != null
+                        && SubscriptionManager.isValidSubscriptionId(mPhone.getSubId()))
+                        ? mPhone.getSubId()
+                        : SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+
+                // Now, listen to new subId if it's valid.
+                mTelephonyManager.listen(this, PhoneStateListener.LISTEN_NONE);
+
+                mSubId = newSubId;
+                if (SubscriptionManager.isValidSubscriptionId(mSubId)) {
+                    mTelephonyManager.listen(this, PhoneStateListener.LISTEN_CALL_STATE);
+                }
+            }
+        }
+
+        private final PhoneCallStateListener mPhoneStateListener = new PhoneCallStateListener();
 
         /**
          * Service connection code for the NetworkQueryService.
@@ -581,7 +612,6 @@
                 int phoneId = SubscriptionManager.getPhoneId(sir.getSubscriptionId());
                 if (SubscriptionManager.isValidPhoneId(phoneId)) {
                     mPhone = PhoneFactory.getPhone(phoneId);
-                    mImsMgr = ImsManager.getInstance(getContext(), phoneId);
                 }
             }
             if (mPhone == null) {
@@ -591,11 +621,14 @@
             Log.i(LOG_TAG, "updatePhone:- slotId=" + slotId + " sir=" + sir);
 
             mImsMgr = ImsManager.getInstance(mPhone.getContext(), mPhone.getPhoneId());
+            mTelephonyManager = new TelephonyManager(mPhone.getContext(), mPhone.getSubId());
             if (mImsMgr == null) {
                 log("updatePhone :: Could not get ImsManager instance!");
             } else if (DBG) {
                 log("updatePhone :: mImsMgr=" + mImsMgr);
             }
+
+            mPhoneStateListener.updatePhone();
         }
 
         private TabHost.TabContentFactory mEmptyTabContent = new TabHost.TabContentFactory() {
@@ -691,6 +724,9 @@
                     TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
             activity.registerReceiver(mPhoneChangeReceiver, intentFilter);
 
+            activity.getContentResolver().registerContentObserver(ENFORCE_MANAGED_URI, false,
+                    mDpcEnforcedContentObserver);
+
             Log.i(LOG_TAG, "onCreate:-");
         }
 
@@ -722,12 +758,26 @@
             }
         }
 
+        private class DpcApnEnforcedObserver extends ContentObserver {
+            DpcApnEnforcedObserver() {
+                super(null);
+            }
+
+            @Override
+            public void onChange(boolean selfChange) {
+                Log.i(LOG_TAG, "DPC enforced onChange:");
+                updateBody();
+            }
+        }
+
         @Override
         public void onDestroy() {
             unbindNetworkQueryService();
             super.onDestroy();
             if (getActivity() != null) {
                 getActivity().unregisterReceiver(mPhoneChangeReceiver);
+                getActivity().getContentResolver().unregisterContentObserver(
+                        mDpcEnforcedContentObserver);
             }
         }
 
@@ -1051,7 +1101,6 @@
              * but you do need to remember that this all needs to work when subscriptions
              * change dynamically such as when hot swapping sims.
              */
-            boolean canChange4glte = is4gLtePrefEnabled(carrierConfig);
             boolean useVariant4glteTitle = carrierConfig.getBoolean(
                     CarrierConfigManager.KEY_ENHANCED_4G_LTE_TITLE_VARIANT_BOOL);
             int enhanced4glteModeTitleId = useVariant4glteTitle ?
@@ -1061,7 +1110,6 @@
             mButtonPreferredNetworkMode.setEnabled(hasActiveSubscriptions);
             mButtonEnabledNetworks.setEnabled(hasActiveSubscriptions);
             mButton4glte.setTitle(enhanced4glteModeTitleId);
-            mButton4glte.setEnabled(hasActiveSubscriptions && canChange4glte);
             mLteDataServicePref.setEnabled(hasActiveSubscriptions);
             Preference ps;
             ps = findPreference(BUTTON_CELL_BROADCAST_SETTINGS);
@@ -1275,7 +1323,8 @@
         }
 
         private boolean is4gLtePrefEnabled(PersistableBundle carrierConfig) {
-            return (mTelephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE)
+            return (mTelephonyManager.getCallState(mPhone.getSubId())
+                    == TelephonyManager.CALL_STATE_IDLE)
                     && mImsMgr != null
                     && mImsMgr.isNonTtyOrTtyOnVolteEnabled()
                     && carrierConfig.getBoolean(
@@ -1665,6 +1714,8 @@
                 mCallingCategory.removePreference(mWiFiCallingPref);
             } else {
                 mCallingCategory.addPreference(mWiFiCallingPref);
+                mWiFiCallingPref.setEnabled(mTelephonyManager.getCallState(mPhone.getSubId())
+                        == TelephonyManager.CALL_STATE_IDLE && hasActiveSubscriptions());
             }
         }
 
@@ -1685,7 +1736,8 @@
                         CarrierConfigManager.KEY_HIDE_ENHANCED_4G_LTE_BOOL))) {
                     getPreferenceScreen().removePreference(mButton4glte);
                 } else {
-                    // NOTE: Buttons will be enabled/disabled in mPhoneStateListener
+                    mButton4glte.setEnabled(is4gLtePrefEnabled(carrierConfig)
+                            && hasActiveSubscriptions());
                     boolean enh4glteMode = mImsMgr.isEnhanced4gLteModeSettingEnabledByUser()
                             && mImsMgr.isNonTtyOrTtyOnVolteEnabled();
                     mButton4glte.setChecked(enh4glteMode);
@@ -1715,8 +1767,8 @@
                     mVideoCallingPref.setEnabled(false);
                     mVideoCallingPref.setChecked(false);
                 } else {
-                    mVideoCallingPref.setEnabled(
-                            mTelephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE);
+                    mVideoCallingPref.setEnabled(mTelephonyManager.getCallState(mPhone.getSubId())
+                            == TelephonyManager.CALL_STATE_IDLE && hasActiveSubscriptions());
                     mVideoCallingPref.setChecked(mImsMgr.isVtEnabledByUser());
                     mVideoCallingPref.setOnPreferenceChangeListener(this);
                 }
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index d36c761..13a4fc1 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -539,7 +539,7 @@
 
         final Notification.Builder builder = new Notification.Builder(mContext)
                 .setSmallIcon(android.R.drawable.stat_sys_warning)
-                .setContentTitle(mContext.getText(R.string.roaming))
+                .setContentTitle(mContext.getText(R.string.roaming_notification_title))
                 .setColor(mContext.getResources().getColor(R.color.dialer_theme_color))
                 .setContentText(contentText)
                 .setChannel(NotificationChannelController.CHANNEL_ID_MOBILE_DATA_STATUS)
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index 2d0b99d..3b65f40 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -199,7 +199,8 @@
                         // The user won't be able to do anything else until
                         // they enter a valid SIM network PIN.
                         Log.i(LOG_TAG, "show sim depersonal panel");
-                        IccNetworkDepersonalizationPanel.showDialog();
+                        Phone phone = (Phone) ((AsyncResult) msg.obj).userObj;
+                        IccNetworkDepersonalizationPanel.showDialog(phone);
                     }
                     break;
 
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index e8d48b8..84addf7 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1257,7 +1257,7 @@
     @Override
     public boolean isOffhookForSubscriber(int subId, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "isOffhookForSubscriber")) {
+                mApp, subId, callingPackage, "isOffhookForSubscriber")) {
             return false;
         }
 
@@ -1277,7 +1277,7 @@
     @Override
     public boolean isRingingForSubscriber(int subId, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "isRingingForSubscriber")) {
+                mApp, subId, callingPackage, "isRingingForSubscriber")) {
             return false;
         }
 
@@ -1297,7 +1297,7 @@
     @Override
     public boolean isIdleForSubscriber(int subId, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "isIdleForSubscriber")) {
+                mApp, subId, callingPackage, "isIdleForSubscriber")) {
             return false;
         }
 
@@ -1473,7 +1473,7 @@
     @Override
     public boolean isRadioOnForSubscriber(int subId, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "isRadioOnForSubscriber")) {
+                mApp, subId, callingPackage, "isRadioOnForSubscriber")) {
             return false;
         }
         return isRadioOnForSubscriber(subId);
@@ -1786,32 +1786,44 @@
 
     @Override
     public String getImeiForSlot(int slotIndex, String callingPackage) {
-        if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getImeiForSlot")) {
+        Phone phone = PhoneFactory.getPhone(slotIndex);
+        if (phone == null) {
             return null;
         }
-        Phone phone = PhoneFactory.getPhone(slotIndex);
-        return phone == null ? null : phone.getImei();
+        int subId = phone.getSubId();
+        if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+                mApp, subId, callingPackage, "getImeiForSlot")) {
+            return null;
+        }
+        return phone.getImei();
     }
 
     @Override
     public String getMeidForSlot(int slotIndex, String callingPackage) {
-        if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getMeidForSlot")) {
+        Phone phone = PhoneFactory.getPhone(slotIndex);
+        if (phone == null) {
             return null;
         }
-        Phone phone = PhoneFactory.getPhone(slotIndex);
-        return phone == null ? null : phone.getMeid();
+        int subId = phone.getSubId();
+        if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+                mApp, subId, callingPackage, "getMeidForSlot")) {
+            return null;
+        }
+        return phone.getMeid();
     }
 
     @Override
     public String getDeviceSoftwareVersionForSlot(int slotIndex, String callingPackage) {
-        if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getDeviceSoftwareVersionForSlot")) {
+        Phone phone = PhoneFactory.getPhone(slotIndex);
+        if (phone == null) {
             return null;
         }
-        Phone phone = PhoneFactory.getPhone(slotIndex);
-        return phone == null ? null : phone.getDeviceSvn();
+        int subId = phone.getSubId();
+        if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+                mApp, subId, callingPackage, "getDeviceSoftwareVersionForSlot")) {
+            return null;
+        }
+        return phone.getDeviceSvn();
     }
 
     @Override
@@ -1900,7 +1912,7 @@
     @Override
     public int getCdmaEriIconIndexForSubscriber(int subId, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getCdmaEriIconIndexForSubscriber")) {
+                mApp, subId, callingPackage, "getCdmaEriIconIndexForSubscriber")) {
             return -1;
         }
         final Phone phone = getPhone(subId);
@@ -1924,7 +1936,7 @@
     @Override
     public int getCdmaEriIconModeForSubscriber(int subId, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getCdmaEriIconModeForSubscriber")) {
+                mApp, subId, callingPackage, "getCdmaEriIconModeForSubscriber")) {
             return -1;
         }
         final Phone phone = getPhone(subId);
@@ -1946,7 +1958,7 @@
     @Override
     public String getCdmaEriTextForSubscriber(int subId, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getCdmaEriIconTextForSubscriber")) {
+                mApp, subId, callingPackage, "getCdmaEriIconTextForSubscriber")) {
             return null;
         }
         final Phone phone = getPhone(subId);
@@ -2023,7 +2035,7 @@
     public String getVisualVoicemailPackageName(String callingPackage, int subId) {
         mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getVisualVoicemailPackageName")) {
+                mApp, subId, callingPackage, "getVisualVoicemailPackageName")) {
             return null;
         }
         return RemoteVvmTaskManager.getRemotePackage(mPhone.getContext(), subId).getPackageName();
@@ -2118,7 +2130,7 @@
     @Override
     public int getVoiceActivationState(int subId, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getVoiceActivationStateForSubscriber")) {
+                mApp, subId, callingPackage, "getVoiceActivationStateForSubscriber")) {
             return TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
         }
         final Phone phone = getPhone(subId);
@@ -2135,7 +2147,7 @@
     @Override
     public int getDataActivationState(int subId, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getDataActivationStateForSubscriber")) {
+                mApp, subId, callingPackage, "getDataActivationStateForSubscriber")) {
             return TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
         }
         final Phone phone = getPhone(subId);
@@ -2214,7 +2226,7 @@
     @Override
     public int getNetworkTypeForSubscriber(int subId, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getNetworkTypeForSubscriber")) {
+                mApp, subId, callingPackage, "getNetworkTypeForSubscriber")) {
             return TelephonyManager.NETWORK_TYPE_UNKNOWN;
         }
 
@@ -2240,7 +2252,7 @@
     @Override
     public int getDataNetworkTypeForSubscriber(int subId, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getDataNetworkTypeForSubscriber")) {
+                mApp, subId, callingPackage, "getDataNetworkTypeForSubscriber")) {
             return TelephonyManager.NETWORK_TYPE_UNKNOWN;
         }
 
@@ -2258,7 +2270,7 @@
     @Override
     public int getVoiceNetworkTypeForSubscriber(int subId, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getDataNetworkTypeForSubscriber")) {
+                mApp, subId, callingPackage, "getDataNetworkTypeForSubscriber")) {
             return TelephonyManager.NETWORK_TYPE_UNKNOWN;
         }
 
@@ -2309,7 +2321,7 @@
     @Override
     public int getLteOnCdmaModeForSubscriber(int subId, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getLteOnCdmaModeForSubscriber")) {
+                mApp, subId, callingPackage, "getLteOnCdmaModeForSubscriber")) {
             return PhoneConstants.LTE_ON_CDMA_UNKNOWN;
         }
 
@@ -2508,6 +2520,7 @@
      * on a particular subscription
      */
     public String[] getForbiddenPlmns(int subId, int appType) {
+        // TODO(b/73884967): Migrate to TelephonyPermissions check.
         mApp.enforceCallingOrSelfPermission(android.Manifest.permission.READ_PHONE_STATE,
                 "Requires READ_PHONE_STATE");
         if (appType != TelephonyManager.APPTYPE_USIM && appType != TelephonyManager.APPTYPE_SIM) {
@@ -2610,18 +2623,9 @@
         return success;
     }
 
-    /**
-     * {@hide}
-     * Returns Default sim, 0 in the case of single standby.
-     */
-    public int getDefaultSim() {
-        //TODO Need to get it from Telephony Devcontroller
-        return 0;
-    }
-
     public String[] getPcscfAddress(String apnType, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getPcscfAddress")) {
+                mApp, mPhone.getSubId(), callingPackage, "getPcscfAddress")) {
             return new String[0];
         }
 
@@ -2687,6 +2691,15 @@
         return PhoneFactory.getImsResolver().getImsConfig(slotId, feature);
     }
 
+    /**
+     * @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();
+    }
+
     public void setImsRegistrationState(boolean registered) {
         enforceModifyPermission();
         mPhone.setImsRegistrationState(registered);
@@ -2775,7 +2788,7 @@
     @Override
     public int getCalculatedPreferredNetworkType(String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getCalculatedPreferredNetworkType")) {
+                mApp, mPhone.getSubId(), callingPackage, "getCalculatedPreferredNetworkType")) {
             return RILConstants.PREFERRED_NETWORK_MODE;
         }
 
@@ -3120,7 +3133,7 @@
     public String getLine1NumberForDisplay(int subId, String callingPackage) {
         // This is open to apps with WRITE_SMS.
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneNumber(
-                mApp, callingPackage, "getLine1NumberForDisplay")) {
+                mApp, subId, callingPackage, "getLine1NumberForDisplay")) {
             if (DBG_MERGE) log("getLine1NumberForDisplay returning null due to permission");
             return null;
         }
@@ -3141,7 +3154,7 @@
     @Override
     public String getLine1AlphaTagForDisplay(int subId, String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getLine1AlphaTagForDisplay")) {
+                mApp, subId, callingPackage, "getLine1AlphaTagForDisplay")) {
             return null;
         }
 
@@ -3155,8 +3168,11 @@
 
     @Override
     public String[] getMergedSubscriberIds(String callingPackage) {
+        // This API isn't public, so no need to provide a valid subscription ID - we're not worried
+        // about carrier-privileged callers not having access.
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getMergedSubscriberIds")) {
+                mApp, SubscriptionManager.INVALID_SUBSCRIPTION_ID, callingPackage,
+                "getMergedSubscriberIds")) {
             return null;
         }
         final Context context = mPhone.getContext();
@@ -3259,8 +3275,13 @@
 
     @Override
     public int getRadioAccessFamily(int phoneId, String callingPackage) {
+        Phone phone = PhoneFactory.getPhone(phoneId);
+        if (phone == null) {
+            return RadioAccessFamily.RAF_UNKNOWN;
+        }
+        int subId = phone.getSubId();
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getRadioAccessFamily")) {
+                mApp, subId, callingPackage, "getRadioAccessFamily")) {
             return RadioAccessFamily.RAF_UNKNOWN;
         }
 
@@ -3276,7 +3297,7 @@
     @Override
     public boolean isVideoCallingEnabled(String callingPackage) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "isVideoCallingEnabled")) {
+                mApp, mPhone.getSubId(), callingPackage, "isVideoCallingEnabled")) {
             return false;
         }
 
@@ -3330,17 +3351,16 @@
      */
     @Override
     public String getDeviceId(String callingPackage) {
-        if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getDeviceId")) {
-            return null;
-        }
-
         final Phone phone = PhoneFactory.getPhone(0);
-        if (phone != null) {
-            return phone.getDeviceId();
-        } else {
+        if (phone == null) {
             return null;
         }
+        int subId = phone.getSubId();
+        if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+                mApp, subId, callingPackage, "getDeviceId")) {
+            return null;
+        }
+        return phone.getDeviceId();
     }
 
     /**
@@ -3428,7 +3448,13 @@
                 // Set network selection mode to automatic
                 setNetworkSelectionModeAutomatic(subId);
                 // Set preferred mobile network type to the best available
-                setPreferredNetworkType(subId, Phone.PREFERRED_NT_MODE);
+                String defaultNetwork = TelephonyManager.getTelephonyProperty(
+                        mSubscriptionController.getPhoneId(subId),
+                        "ro.telephony.default_network",
+                        null);
+                int networkType = !TextUtils.isEmpty(defaultNetwork)
+                        ? Integer.parseInt(defaultNetwork) : Phone.PREFERRED_NT_MODE;
+                setPreferredNetworkType(subId, networkType);
                 // Turn off roaming
                 mPhone.setDataRoamingEnabled(false);
             }
@@ -3543,7 +3569,7 @@
     public ServiceState getServiceStateForSubscriber(int subId, String callingPackage) {
 
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getServiceStateForSubscriber")) {
+                mApp, subId, callingPackage, "getServiceStateForSubscriber")) {
             return null;
         }
 
@@ -3929,7 +3955,7 @@
     @Override
     public List<ClientRequestStats> getClientRequestStats(String callingPackage, int subId) {
         if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, callingPackage, "getClientRequestStats")) {
+                mApp, subId, callingPackage, "getClientRequestStats")) {
             return null;
         }
 
@@ -4049,7 +4075,12 @@
             }
 
             infos[i] = new UiccSlotInfo(
-                    slot.isActive(), slot.isEuicc(), cardId, cardState, slot.getPhoneId());
+                    slot.isActive(),
+                    slot.isEuicc(),
+                    cardId,
+                    cardState,
+                    slot.getPhoneId(),
+                    slot.isExtendedApduSupported());
         }
         return infos;
     }
@@ -4059,4 +4090,16 @@
         enforceModifyPermission();
         return (Boolean) sendRequest(CMD_SWITCH_SLOTS, physicalSlots);
     }
+
+    @Override
+    public void setRadioIndicationUpdateMode(int subId, int filters, int mode) {
+        enforceModifyPermission();
+        final Phone phone = getPhone(subId);
+        if (phone == null) {
+            loge("setRadioIndicationUpdateMode fails with invalid subId: " + subId);
+            return;
+        }
+
+        phone.setRadioIndicationUpdateMode(filters, mode);
+    }
 }
diff --git a/src/com/android/phone/PhoneSearchIndexablesProvider.java b/src/com/android/phone/PhoneSearchIndexablesProvider.java
index 9c5f354..75e6bab 100644
--- a/src/com/android/phone/PhoneSearchIndexablesProvider.java
+++ b/src/com/android/phone/PhoneSearchIndexablesProvider.java
@@ -99,8 +99,8 @@
         MatrixCursor cursor = new MatrixCursor(NON_INDEXABLES_KEYS_COLUMNS);
 
         if (!mUserManager.isAdminUser()) {
-            final String[] values = new String[]{"preferred_network_mode_key", "button_roaming_key",
-                    "cdma_lte_data_service_key", "enabled_networks_key", "enhanced_4g_lte",
+            final String[] values = new String[]{"preferred_network_mode_key",
+                    "button_roaming_key", "cdma_lte_data_service_key", "enhanced_4g_lte",
                     "button_apn_key", "button_network_select_key", "carrier_settings_key",
                     "cdma_system_select_key", "esim_list_profile", "mobile_data_enable",
                     "data_usage_summary", "wifi_calling_key", "video_calling_key"};
@@ -115,6 +115,11 @@
                 cursor.addRow(createNonIndexableRow("enhanced_4g_lte" /* key */));
             }
         }
+        // enabled_networks button and preferred_network_mode button share the same title
+        // "Preferred network type"and are mutual exclusive. Thus we remove one from search
+        // result to avoid duplicate search result.
+        // TODO: b/63381516 all hidden buttons should dynamically be removed from search result.
+        cursor.addRow(createNonIndexableRow("enabled_networks_key" /* key */));
         cursor.addRow(createNonIndexableRow("carrier_settings_euicc_key" /* key */));
         cursor.addRow(createNonIndexableRow("advanced_options" /* key */));
         return cursor;
diff --git a/src/com/android/phone/RestrictedPreference.java b/src/com/android/phone/RestrictedPreference.java
new file mode 100644
index 0000000..b8b6fe7
--- /dev/null
+++ b/src/com/android/phone/RestrictedPreference.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.phone;
+
+import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
+
+import android.content.Context;
+import android.preference.Preference;
+import android.preference.PreferenceScreen;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.TextView;
+
+import com.android.settingslib.RestrictedLockUtils;
+
+/**
+ * Preference class that supports being disabled by a device admin.
+ *
+ * <p>This class is a mimic of ../../../frameworks/base/packages/SettingsLib/src/com/android
+ * /settingslib/RestrictedPreference.java,
+ * but support framework {@link Preference}.
+ */
+public class RestrictedPreference extends Preference {
+    private final Context mContext;
+
+    private boolean mDisabledByAdmin;
+    private EnforcedAdmin mEnforcedAdmin;
+
+    public RestrictedPreference(Context context, AttributeSet attrs,
+            int defStyleAttr, int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+        mContext = context;
+
+        setLayoutResource(com.android.settingslib.R.layout.preference_two_target);
+        setWidgetLayoutResource(R.layout.restricted_icon);
+    }
+
+    public RestrictedPreference(Context context, AttributeSet attrs, int defStyleAttr) {
+        this(context, attrs, defStyleAttr, 0);
+    }
+
+    public RestrictedPreference(Context context, AttributeSet attrs) {
+        this(context, attrs, android.R.attr.preferenceStyle);
+    }
+
+    public RestrictedPreference(Context context) {
+        this(context, null);
+    }
+
+    @Override
+    public void performClick(PreferenceScreen preferenceScreen) {
+        if (mDisabledByAdmin) {
+            RestrictedLockUtils.sendShowAdminSupportDetailsIntent(mContext, mEnforcedAdmin);
+        } else {
+            super.performClick(preferenceScreen);
+        }
+    }
+
+    @Override
+    protected void onBindView(View view) {
+        super.onBindView(view);
+
+        final View divider = view.findViewById(com.android.settingslib.R.id.two_target_divider);
+        final View widgetFrame = view.findViewById(android.R.id.widget_frame);
+        final View restrictedIcon = view.findViewById(R.id.restricted_icon);
+        final TextView summaryView = view.findViewById(android.R.id.summary);
+        if (divider != null) {
+            divider.setVisibility(mDisabledByAdmin ? View.VISIBLE : View.GONE);
+        }
+        if (widgetFrame != null) {
+            widgetFrame.setVisibility(mDisabledByAdmin ? View.VISIBLE : View.GONE);
+        }
+        if (restrictedIcon != null) {
+            restrictedIcon.setVisibility(mDisabledByAdmin ? View.VISIBLE : View.GONE);
+        }
+        if (summaryView != null && mDisabledByAdmin) {
+            summaryView.setText(com.android.settingslib.R.string.disabled_by_admin_summary_text);
+            summaryView.setVisibility(View.VISIBLE);
+        }
+
+        if (mDisabledByAdmin) {
+            view.setEnabled(true);
+        }
+    }
+
+    @Override
+    public void setEnabled(boolean enabled) {
+        if (enabled && mDisabledByAdmin) {
+            setDisabledByAdmin(null);
+            return;
+        }
+        super.setEnabled(enabled);
+    }
+
+    /**
+     * Disable this preference based on the enforce admin.
+     *
+     * @param admin Details of the admin who enforced the restriction. If it is {@code null}, then
+     * this preference will be enabled. Otherwise, it will be disabled.
+     */
+    public void setDisabledByAdmin(EnforcedAdmin admin) {
+        final boolean disabled = admin != null;
+        mEnforcedAdmin = admin;
+        boolean changed = false;
+        if (mDisabledByAdmin != disabled) {
+            mDisabledByAdmin = disabled;
+            changed = true;
+        }
+        setEnabled(!disabled);
+        if (changed) {
+            notifyChanged();
+        }
+    }
+}
diff --git a/src/com/android/phone/vvm/RemoteVvmTaskManager.java b/src/com/android/phone/vvm/RemoteVvmTaskManager.java
index 4fc8c57..cf5011e 100644
--- a/src/com/android/phone/vvm/RemoteVvmTaskManager.java
+++ b/src/com/android/phone/vvm/RemoteVvmTaskManager.java
@@ -119,6 +119,8 @@
         TelecomManager telecomManager = context.getSystemService(TelecomManager.class);
         List<String> packages = new ArrayList<>();
         packages.add(telecomManager.getDefaultDialerPackage());
+        // TODO(b/73136824): Check permissions in the calling function and avoid relying on the
+        // binder caller's permissions to access the carrier config.
         PersistableBundle carrierConfig = context
                 .getSystemService(CarrierConfigManager.class).getConfigForSubId(subId);
         packages.add(
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index 3cf420a..dd74d28 100644
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -758,7 +758,8 @@
 
         participant.removeConnectionListener(mParticipantListener);
         synchronized(mUpdateSyncRoot) {
-            mConferenceParticipantConnections.remove(participant.getUserEntity());
+            mConferenceParticipantConnections.remove(new Pair<>(participant.getUserEntity(),
+                    participant.getEndpoint()));
         }
         mTelephonyConnectionService.removeConnection(participant);
     }
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 0fe6980..af9e9d5 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -1698,6 +1698,7 @@
     private boolean isRtt() {
         return mOriginalConnection != null
                 && mOriginalConnection.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS
+                && mOriginalConnection instanceof ImsPhoneConnection
                 && ((ImsPhoneConnection) mOriginalConnection).isRttEnabledForCall();
     }
 
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 6fd481b..b3369b5 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -726,7 +726,7 @@
         ImsPhoneConnection imsOriginalConnection = (ImsPhoneConnection) originalConnection;
         if (!request.isRequestingRtt()) {
             if (imsOriginalConnection.isRttEnabledForCall()) {
-                Log.i(this, "Incoming call requested RTT but was declined");
+                Log.w(this, "Incoming call requested RTT but we did not get a RttTextStream");
             }
             return;
         }
diff --git a/testapps/ImsTestService/AndroidManifest.xml b/testapps/ImsTestService/AndroidManifest.xml
index 4d81ffd..f47210e 100644
--- a/testapps/ImsTestService/AndroidManifest.xml
+++ b/testapps/ImsTestService/AndroidManifest.xml
@@ -40,9 +40,8 @@
                  android:enabled="true"
                  android:persistent="true"
                  android:permission="android.permission.BIND_IMS_SERVICE">
-            <meta-data android:name="android.telephony.ims.MMTEL_FEATURE" android:value="true"/>
-            <!--meta-data android:name="android.telephony.ims.EMERGENCY_MMTEL_FEATURE"
-                       android:value="true" /-->
+            <!--meta-data android:name="android.telephony.ims.MMTEL_FEATURE" android:value="true"/-->
+            <!-- No features means we will get queried for dynamic config. -->
             <intent-filter>
                 <action android:name="android.telephony.ims.ImsService" />
             </intent-filter>
diff --git a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsConfigImpl.java b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsConfigImpl.java
index 4b8842a..3269a5a 100644
--- a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsConfigImpl.java
+++ b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsConfigImpl.java
@@ -55,6 +55,10 @@
         return sTestImsConfigImpl;
     }
 
+    private TestImsConfigImpl() {
+        super();
+    }
+
     public void setConfigListener(ImsConfigListener listener) {
         mListener = listener;
     }
diff --git a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsService.java b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsService.java
index 434cdb5..71323d8 100644
--- a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsService.java
+++ b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/TestImsService.java
@@ -17,9 +17,11 @@
 package com.android.phone.testapps.imstestapp;
 
 import android.telephony.ims.ImsService;
+import android.telephony.ims.feature.ImsFeature;
 import android.telephony.ims.feature.MmTelFeature;
 import android.telephony.ims.feature.RcsFeature;
 import android.telephony.ims.stub.ImsConfigImplBase;
+import android.telephony.ims.stub.ImsFeatureConfiguration;
 import android.telephony.ims.stub.ImsRegistrationImplBase;
 import android.util.Log;
 
@@ -54,8 +56,16 @@
     }
 
     @Override
+    public ImsFeatureConfiguration querySupportedImsFeatures() {
+        return new ImsFeatureConfiguration.Builder()
+                .addFeature(0, ImsFeature.FEATURE_EMERGENCY_MMTEL)
+                .addFeature(0, ImsFeature.FEATURE_MMTEL)
+                .build();
+    }
+
+    @Override
     public MmTelFeature createMmTelFeature(int slotId) {
-        Log.i(LOG_TAG, "TestImsService: onCreateEmergencyMMTelImsFeature");
+        Log.i(LOG_TAG, "TestImsService: onCreateMmTelImsFeature");
         return mTestMmTelFeature;
     }
 
diff --git a/tests/src/com/android/phone/PhoneSearchIndexablesProviderTest.java b/tests/src/com/android/phone/PhoneSearchIndexablesProviderTest.java
index 2176d6b..6b7f825 100644
--- a/tests/src/com/android/phone/PhoneSearchIndexablesProviderTest.java
+++ b/tests/src/com/android/phone/PhoneSearchIndexablesProviderTest.java
@@ -124,16 +124,16 @@
         when(mUserManager.isAdminUser()).thenReturn(true);
         Cursor cursor2 = mProvider
                 .queryNonIndexableKeys(SearchIndexablesContract.NON_INDEXABLES_KEYS_COLUMNS);
-        assertThat(cursor2.getCount()).isEqualTo(2);
+        assertThat(cursor2.getCount()).isEqualTo(3);
 
         mProvider.setIsEuiccSettingsHidden(true /* isEuiccSettingsHidden */);
         Cursor cursor3 = mProvider
                 .queryNonIndexableKeys(SearchIndexablesContract.NON_INDEXABLES_KEYS_COLUMNS);
-        assertThat(cursor3.getCount()).isEqualTo(3);
+        assertThat(cursor3.getCount()).isEqualTo(4);
 
         mProvider.setIsEnhanced4gLteHidden(true /* isEnhanced4gLteHidden */);
         Cursor cursor4 = mProvider
                 .queryNonIndexableKeys(SearchIndexablesContract.NON_INDEXABLES_KEYS_COLUMNS);
-        assertThat(cursor4.getCount()).isEqualTo(4);
+        assertThat(cursor4.getCount()).isEqualTo(5);
     }
 }