Merge "Allow default phone to be used for per device API" into udc-dev
diff --git a/OWNERS b/OWNERS
index b4ef543..0fed2f0 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,11 +1,8 @@
-amitmahajan@google.com
 breadley@google.com
 fionaxu@google.com
 jackyu@google.com
 rgreenwalt@google.com
 tgunn@google.com
-jminjie@google.com
-shuoq@google.com
 sarahchin@google.com
 xiaotonj@google.com
 huiwang@google.com
@@ -13,5 +10,8 @@
 chinmayd@google.com
 amruthr@google.com
 sasindran@google.com
+tjstuart@google.com
+pmadapurmath@google.com
+grantmenke@google.com
 
 per-file *SimPhonebookProvider* = file:platform/packages/apps/Contacts:/OWNERS
diff --git a/ecc/input/eccdata.txt b/ecc/input/eccdata.txt
index 6988f14..3b860dd 100644
--- a/ecc/input/eccdata.txt
+++ b/ecc/input/eccdata.txt
@@ -114,6 +114,18 @@
     types: AMBULANCE
     types: FIRE
   }
+  eccs {
+    phone_number: "100"
+    types: FIRE
+  }
+  eccs {
+    phone_number: "101"
+    types: POLICE
+  }
+  eccs {
+    phone_number: "107"
+    types: AMBULANCE
+  }
   ecc_fallback: "911"
 }
 countries {
@@ -129,35 +141,35 @@
 countries {
   iso_code: "AT"
   eccs {
-      phone_number: "112"
-      types: POLICE
-      types: AMBULANCE
-      types: FIRE
+    phone_number: "112"
+    types: POLICE
+    types: AMBULANCE
+    types: FIRE
   }
   eccs {
-      phone_number: "122"
-      types: FIRE
-      routing: NORMAL
+    phone_number: "122"
+    types: FIRE
+    routing: NORMAL
   }
   eccs {
-      phone_number: "133"
-      types: POLICE
-      routing: NORMAL
+    phone_number: "133"
+    types: POLICE
+    routing: NORMAL
   }
   eccs {
-      phone_number: "144"
-      types: AMBULANCE
-      routing: NORMAL
+    phone_number: "144"
+    types: AMBULANCE
+    routing: NORMAL
   }
   eccs {
-      phone_number: "128"
-      types: MOUNTAIN_RESCUE
-      routing: NORMAL
+    phone_number: "128"
+    types: MOUNTAIN_RESCUE
+    routing: NORMAL
   }
   eccs {
-      phone_number: "140"
-      types: TYPE_UNSPECIFIED
-      routing: NORMAL
+    phone_number: "140"
+    types: TYPE_UNSPECIFIED
+    routing: NORMAL
   }
   ecc_fallback: "112"
 }
@@ -454,11 +466,11 @@
     types: FIRE
   }
   eccs {
-      phone_number: "112"
-      types: POLICE
-      types: AMBULANCE
-      types: FIRE
-   }
+    phone_number: "112"
+    types: POLICE
+    types: AMBULANCE
+    types: FIRE
+  }
   ecc_fallback: "911"
 }
 countries {
@@ -490,19 +502,19 @@
 countries {
   iso_code: "CH"
   eccs {
-      phone_number: "112"
-      types: POLICE
-      types: AMBULANCE
-      types: FIRE
-      routing: EMERGENCY
+    phone_number: "112"
+    types: POLICE
+    types: AMBULANCE
+    types: FIRE
+    routing: EMERGENCY
   }
   eccs {
-        phone_number: "911"
-        types: POLICE
-        types: AMBULANCE
-        types: FIRE
-        routing: EMERGENCY
-    }
+    phone_number: "911"
+    types: POLICE
+    types: AMBULANCE
+    types: FIRE
+    routing: EMERGENCY
+  }
   eccs {
     phone_number: "117"
     types: POLICE
@@ -519,28 +531,28 @@
     routing: EMERGENCY
   }
   eccs {
-      phone_number: "143"
-      types: TYPE_UNSPECIFIED
-      routing: NORMAL
+    phone_number: "143"
+    types: TYPE_UNSPECIFIED
+    routing: NORMAL
   }
   eccs {
-      phone_number: "145"
-      types: TYPE_UNSPECIFIED
-      routing: NORMAL
+    phone_number: "145"
+    types: TYPE_UNSPECIFIED
+    routing: NORMAL
   }
-   eccs {
-      phone_number: "147"
-      types: TYPE_UNSPECIFIED
-      routing: NORMAL
+  eccs {
+    phone_number: "147"
+    types: TYPE_UNSPECIFIED
+    routing: NORMAL
   }
-   eccs {
-      phone_number: "1414"
-      types: TYPE_UNSPECIFIED
+  eccs {
+    phone_number: "1414"
+    types: TYPE_UNSPECIFIED
   }
-   eccs {
-      phone_number: "0800117117"
-      types: TYPE_UNSPECIFIED
-      routing: NORMAL
+  eccs {
+    phone_number: "0800117117"
+    types: TYPE_UNSPECIFIED
+    routing: NORMAL
   }
   ecc_fallback: "112"
 }
@@ -742,6 +754,7 @@
     types: POLICE
     types: AMBULANCE
     types: FIRE
+    routing: EMERGENCY
   }
   ecc_fallback: "911"
 }
@@ -762,6 +775,12 @@
     types: POLICE
     types: AMBULANCE
     types: FIRE
+    routing: EMERGENCY
+  }
+  eccs {
+    phone_number: "115"
+    types: POLICE
+    routing: NORMAL
   }
   ecc_fallback: "911"
 }
@@ -818,44 +837,49 @@
     routing: EMERGENCY
   }
   eccs {
-      phone_number: "088"
-      types: POLICE
-      routing: EMERGENCY
+    phone_number: "088"
+    types: POLICE
+    routing: EMERGENCY
   }
   eccs {
-      phone_number: "085"
-      types: FIRE
-      routing: EMERGENCY
+    phone_number: "085"
+    types: FIRE
+    routing: EMERGENCY
   }
   eccs {
-      phone_number: "1006"
-      types: TYPE_UNSPECIFIED
-      routing: EMERGENCY
+    phone_number: "1006"
+    types: TYPE_UNSPECIFIED
+    routing: EMERGENCY
   }
   eccs {
-      phone_number: "061"
-      types: TYPE_UNSPECIFIED
-      routing: EMERGENCY
+    phone_number: "061"
+    types: TYPE_UNSPECIFIED
+    routing: EMERGENCY
   }
   eccs {
-      phone_number: "062"
-      types: TYPE_UNSPECIFIED
-      routing: EMERGENCY
+    phone_number: "062"
+    types: TYPE_UNSPECIFIED
+    routing: EMERGENCY
   }
   eccs {
-      phone_number: "080"
-      types: FIRE
-      routing: EMERGENCY
+    phone_number: "080"
+    types: FIRE
+    routing: EMERGENCY
   }
   eccs {
-       phone_number: "091"
-       types: POLICE
-       routing: EMERGENCY
+    phone_number: "091"
+    types: POLICE
+    routing: EMERGENCY
   }
   eccs {
-       phone_number: "092"
-       types: POLICE
-       routing: EMERGENCY
+    phone_number: "092"
+    types: POLICE
+    routing: EMERGENCY
+  }
+  eccs {
+    phone_number: "024"
+    types: TYPE_UNSPECIFIED
+    routing: NORMAL
   }
   ecc_fallback: "112"
 }
@@ -945,7 +969,7 @@
   eccs {
     phone_number: "18"
     types: FIRE
-    routing:NORMAL
+    routing: NORMAL
   }
   eccs {
     phone_number: "115"
@@ -1376,6 +1400,18 @@
     types: AMBULANCE
     types: FIRE
   }
+  eccs {
+    phone_number: "113"
+    types: POLICE
+  }
+  eccs {
+    phone_number: "115"
+    types: FIRE
+  }
+  eccs {
+    phone_number: "118"
+    types: AMBULANCE
+  }
   ecc_fallback: "112"
 }
 countries {
@@ -2358,6 +2394,7 @@
     types: POLICE
     types: AMBULANCE
     types: FIRE
+    routing: EMERGENCY
   }
   ecc_fallback: "911"
 }
@@ -2451,7 +2488,7 @@
     phone_number: "123"
     types: TYPE_UNSPECIFIED
     routing: EMERGENCY
-    }
+  }
   ecc_fallback: "112"
 }
 countries {
@@ -2962,6 +2999,18 @@
     types: AMBULANCE
     types: FIRE
   }
+  eccs {
+    phone_number: "104"
+    types: FIRE
+  }
+  eccs {
+    phone_number: "105"
+    types: AMBULANCE
+  }
+  eccs {
+    phone_number: "106"
+    types: MARINE_GUARD
+  }
   ecc_fallback: "911"
 }
 countries {
diff --git a/ecc/output/eccdata b/ecc/output/eccdata
index 8b4f49b..e34e47b 100644
--- a/ecc/output/eccdata
+++ b/ecc/output/eccdata
Binary files differ
diff --git a/res/layout/band_mode.xml b/res/layout/band_mode.xml
deleted file mode 100644
index b43dd1d..0000000
--- a/res/layout/band_mode.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:orientation="vertical"
-              android:padding="4dip"
-              android:gravity="center_horizontal"
-              android:layout_width="match_parent"
-              android:layout_height="wrap_content">
-
-    <ListView android:id="@+id/band"
-              android:layout_width="match_parent"
-              android:layout_height="match_parent"
-              android:textSize="7sp">
-    </ListView>
-
-</LinearLayout>
diff --git a/res/layout/radio_info.xml b/res/layout/radio_info.xml
index c414fe1..2efa1d4 100644
--- a/res/layout/radio_info.xml
+++ b/res/layout/radio_info.xml
@@ -92,6 +92,12 @@
             <TextView android:id="@+id/data_network" style="@style/info_value" />
         </LinearLayout>
 
+        <!-- Data Raw Registration State -->
+        <LinearLayout style="@style/RadioInfo_entry_layout">
+            <TextView android:text="@string/radio_info_data_raw_registration_state_label" style="@style/info_label" />
+            <TextView android:id="@+id/data_raw_registration_state" style="@style/info_value" />
+        </LinearLayout>
+
         <!-- Override Network Type -->
         <LinearLayout style="@style/RadioInfo_entry_layout">
             <TextView android:text="@string/radio_info_override_network_type_label" style="@style/info_label" />
@@ -110,6 +116,18 @@
             <TextView android:id="@+id/voice_network" style="@style/info_value" />
         </LinearLayout>
 
+        <!-- Voice Raw Registration State -->
+        <LinearLayout style="@style/RadioInfo_entry_layout">
+            <TextView android:text="@string/radio_info_voice_raw_registration_state_label" style="@style/info_label" />
+            <TextView android:id="@+id/voice_raw_registration_state" style="@style/info_value" />
+        </LinearLayout>
+
+        <!-- PS IWLAN Raw Registration State -->
+        <LinearLayout style="@style/RadioInfo_entry_layout">
+            <TextView android:text="@string/radio_info_wlan_data_raw_registration_state_label" style="@style/info_label" />
+            <TextView android:id="@+id/wlan_data_raw_registration_state" style="@style/info_value" />
+        </LinearLayout>
+
         <!-- Signal Strength -->
         <LinearLayout style="@style/RadioInfo_entry_layout">
             <TextView android:text="@string/radio_info_signal_strength_label" style="@style/info_label" />
diff --git a/res/values-b+sr+Latn/strings.xml b/res/values-b+sr+Latn/strings.xml
index 7d900e4..2341b3a 100644
--- a/res/values-b+sr+Latn/strings.xml
+++ b/res/values-b+sr+Latn/strings.xml
@@ -285,7 +285,7 @@
     <string name="roaming_enable" msgid="6853685214521494819">"Poveži sa uslugom za podatke u romingu"</string>
     <string name="roaming_disable" msgid="8856224638624592681">"Poveži sa uslugom za podatke u romingu"</string>
     <string name="roaming_reenable_message" msgid="1951802463885727915">"Prenos podataka u romingu je isključen. Dodirnite da biste ga uključili."</string>
-    <string name="roaming_enabled_message" msgid="9022249120750897">"Važe naknade za roming. Dodirnite da biste izmenili."</string>
+    <string name="roaming_enabled_message" msgid="9022249120750897">"Mogu da važe naknade za roming. Dodirnite da biste izmenili."</string>
     <string name="roaming_notification_title" msgid="3590348480688047320">"Izgubili ste vezu za prenos mobilnih podataka"</string>
     <string name="roaming_on_notification_title" msgid="7451473196411559173">"Prenos podataka u romingu je uključen"</string>
     <string name="roaming_warning" msgid="7855681468067171971">"Mogu da nastanu značajni troškovi."</string>
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index 9bb7b23..df18d5f 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -672,7 +672,7 @@
     <string name="sim_description_emergency_calls" msgid="5146872803938897296">"Nur Notrufe"</string>
     <string name="sim_description_default" msgid="7474671114363724971">"SIM-Karte, Schacht: <xliff:g id="SLOT_ID">%s</xliff:g>"</string>
     <string name="accessibility_settings_activity_title" msgid="7883415189273700298">"Bedienungshilfen"</string>
-    <string name="status_hint_label_incoming_wifi_call" msgid="2606052595898044071">"WLAN-Anruf von"</string>
+    <string name="status_hint_label_incoming_wifi_call" msgid="2606052595898044071">"WiFi-Anruf von"</string>
     <string name="status_hint_label_wifi_call" msgid="942993035689809853">"WLAN-Anruf"</string>
     <string name="message_decode_error" msgid="1061856591500290887">"Beim Entschlüsseln der Nachricht ist ein Fehler aufgetreten."</string>
     <string name="callFailed_cdma_activation" msgid="5392057031552253550">"Eine SIM-Karte hat deinen Dienst aktiviert und die Roamingfunktionen deines Smartphones aktualisiert."</string>
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index 8189edf..11da8d6 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -924,5 +924,5 @@
     <string name="send_from_work_profile_title" msgid="9201528838448432473">"Impossibile inviare messaggi da questo profilo"</string>
     <string name="send_from_work_profile_description" msgid="5002701841936861636">"Le norme di lavoro ti consentono di inviare messaggi solo dal profilo di lavoro"</string>
     <string name="send_from_work_profile_cancel" msgid="177746511030381711">"Annulla"</string>
-    <string name="send_from_work_profile_action_str" msgid="6892775562934243337">"Passa a profilo di lavoro"</string>
+    <string name="send_from_work_profile_action_str" msgid="6892775562934243337">"Passa al profilo di lavoro"</string>
 </resources>
diff --git a/res/values-pa/strings.xml b/res/values-pa/strings.xml
index 1e35145..e906af6 100644
--- a/res/values-pa/strings.xml
+++ b/res/values-pa/strings.xml
@@ -881,7 +881,7 @@
     <string name="radio_info_imei_label" msgid="8947899706930120368">"IMEI:"</string>
     <string name="radio_info_call_redirect_label" msgid="4526480903023362276">"ਇਸ \'ਤੇ ਕਾਲ ਰੀਡਾਇਰੈਕਟ ਕਰੋ:"</string>
     <string name="radio_info_ppp_resets_label" msgid="9131901102339077661">"ਬੂਟ ਤੋਂ ਬਾਅਦ PPP ਰੀਸੈੱਟ ਦੀ ਗਿਣਤੀ:"</string>
-    <string name="radio_info_current_network_label" msgid="3052098695239642450">"ਵਰਤਮਾਨ ਨੈੱਟਵਰਕ:"</string>
+    <string name="radio_info_current_network_label" msgid="3052098695239642450">"ਮੌਜੂਦਾ ਨੈੱਟਵਰਕ:"</string>
     <string name="radio_info_ppp_received_label" msgid="5753592451640644889">"ਡਾਟਾ ਪ੍ਰਾਪਤ ਹੋਇਆ:"</string>
     <string name="radio_info_gsm_service_label" msgid="6443348321714241328">"ਵੌਇਸ ਸੇਵਾ:"</string>
     <string name="radio_info_signal_strength_label" msgid="5545444702102543260">"ਸਿਗਨਲ ਦੀ ਤੀਬਰਤਾ:"</string>
diff --git a/res/values-pt-rPT/strings.xml b/res/values-pt-rPT/strings.xml
index f65c8b7..ff2d090 100644
--- a/res/values-pt-rPT/strings.xml
+++ b/res/values-pt-rPT/strings.xml
@@ -96,7 +96,7 @@
     <string name="sum_loading_settings" msgid="434063780286688775">"A carregar as definições..."</string>
     <string name="sum_hide_caller_id" msgid="131100328602371933">"Ocultar o número em chamadas efectuadas"</string>
     <string name="sum_show_caller_id" msgid="3571854755324664591">"Número apresentado em chamadas efectuadas"</string>
-    <string name="sum_default_caller_id" msgid="1767070797135682959">"Utilizar as predefinições do operador para apresentar o meu número nas chamadas efetuadas"</string>
+    <string name="sum_default_caller_id" msgid="1767070797135682959">"Usar as predefinições do operador para apresentar o meu número nas chamadas efetuadas"</string>
     <string name="labelCW" msgid="8449327023861428622">"Chamada em espera"</string>
     <string name="sum_cw_enabled" msgid="3977308526187139996">"Notificar-me de chamadas em espera durante uma chamada"</string>
     <string name="sum_cw_disabled" msgid="3658094589461768637">"Notificar-me de chamadas em espera durante uma chamada"</string>
@@ -273,8 +273,8 @@
     <string name="network_operator_category" msgid="4992217193732304680">"Rede"</string>
     <string name="enhanced_4g_lte_mode_title" msgid="4213420368777080540">"Modo 4G LTE avançado"</string>
     <!-- no translation found for enhanced_4g_lte_mode_title_variant:0 (7240155150166394308) -->
-    <string name="enhanced_4g_lte_mode_summary" msgid="7725708511804143638">"Utilizar os serviços LTE para melhorar a voz e outras comunicações (recomendado)"</string>
-    <string name="enhanced_4g_lte_mode_summary_o2" msgid="2521108446409016542">"Utilizar os serviços 4G para melhorar a voz e outras comunicações (recomendado)"</string>
+    <string name="enhanced_4g_lte_mode_summary" msgid="7725708511804143638">"Usar os serviços LTE para melhorar a voz e outras comunicações (recomendado)"</string>
+    <string name="enhanced_4g_lte_mode_summary_o2" msgid="2521108446409016542">"Usar os serviços 4G para melhorar a voz e outras comunicações (recomendado)"</string>
     <!-- no translation found for enhanced_4g_lte_mode_sumary_variant:0 (2943982616649705147) -->
     <!-- no translation found for enhanced_4g_lte_mode_sumary_variant:1 (5262249464504131443) -->
     <!-- no translation found for enhanced_4g_lte_mode_sumary_variant:2 (6356974241850241718) -->
@@ -574,7 +574,7 @@
     <string name="ambulance_type_description" msgid="6798237503553180461">"Ambulância"</string>
     <string name="fire_type_description" msgid="6565200468934914930">"Fogo"</string>
     <string name="description_concat_format" msgid="2014471565101724088">"%1$s, %2$s"</string>
-    <string name="dialerKeyboardHintText" msgid="1115266533703764049">"Utilizar o teclado para marcar"</string>
+    <string name="dialerKeyboardHintText" msgid="1115266533703764049">"Usar o teclado para marcar"</string>
     <string name="onscreenHoldText" msgid="4025348842151665191">"Suspender"</string>
     <string name="onscreenEndCallText" msgid="6138725377654842757">"Terminar"</string>
     <string name="onscreenShowDialpadText" msgid="658465753816164079">"Teclado de marcação"</string>
diff --git a/res/values-sr/strings.xml b/res/values-sr/strings.xml
index e8376b6..ab739eb 100644
--- a/res/values-sr/strings.xml
+++ b/res/values-sr/strings.xml
@@ -285,7 +285,7 @@
     <string name="roaming_enable" msgid="6853685214521494819">"Повежи са услугом за податке у ромингу"</string>
     <string name="roaming_disable" msgid="8856224638624592681">"Повежи са услугом за податке у ромингу"</string>
     <string name="roaming_reenable_message" msgid="1951802463885727915">"Пренос података у ромингу је искључен. Додирните да бисте га укључили."</string>
-    <string name="roaming_enabled_message" msgid="9022249120750897">"Важе накнаде за роминг. Додирните да бисте изменили."</string>
+    <string name="roaming_enabled_message" msgid="9022249120750897">"Могу да важе накнаде за роминг. Додирните да бисте изменили."</string>
     <string name="roaming_notification_title" msgid="3590348480688047320">"Изгубили сте везу за пренос мобилних података"</string>
     <string name="roaming_on_notification_title" msgid="7451473196411559173">"Пренос података у ромингу је укључен"</string>
     <string name="roaming_warning" msgid="7855681468067171971">"Могу да настану значајни трошкови."</string>
diff --git a/res/values-sv/strings.xml b/res/values-sv/strings.xml
index a3c6e2c..a914be4 100644
--- a/res/values-sv/strings.xml
+++ b/res/values-sv/strings.xml
@@ -827,7 +827,7 @@
     <string name="radio_info_data_connection_disable" msgid="6404751291511368706">"Inaktivera dataanslutning"</string>
     <string name="volte_provisioned_switch_string" msgid="4812874990480336178">"VoLTE-administrerad"</string>
     <string name="vt_provisioned_switch_string" msgid="8295542122512195979">"Videosamtal tillhandahålls"</string>
-    <string name="wfc_provisioned_switch_string" msgid="3835004640321078988">"wifi-samtal tillhandahålls"</string>
+    <string name="wfc_provisioned_switch_string" msgid="3835004640321078988">"Wifi-samtal tillhandahålls"</string>
     <string name="eab_provisioned_switch_string" msgid="4449676720736033035">"EAB/Presence tillhandahålls"</string>
     <string name="cbrs_data_switch_string" msgid="6060356430838077653">"Data via CBRS"</string>
     <string name="dsds_switch_string" msgid="7564769822086764796">"Aktivera DSDS"</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e21f761..680eb22 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2129,14 +2129,18 @@
     <!-- Radio Info screen. Label for a status item.  Used for diagnostic info screens, precise translation isn't needed -->
     <string name="radio_info_phone_number_label">Phone Number:</string>
     <!-- Radio Info screen. Label for a status item.  Used for diagnostic info screens, precise translation isn't needed -->
-    <string name="radio_info_band_mode_label">Select Radio Band</string>
-    <!-- Radio Info screen. Label for a status item.  Used for diagnostic info screens, precise translation isn't needed -->
     <string name="radio_info_voice_network_type_label">Voice Network Type:</string>
     <!-- Radio Info screen. Label for a status item.  Used for diagnostic info screens, precise translation isn't needed -->
     <string name="radio_info_data_network_type_label">Data Network Type:</string>
     <!-- Radio Info screen. Label for a status item.  Used for diagnostic info screens, precise translation isn't needed -->
     <string name="radio_info_override_network_type_label">Override Network Type:</string>
     <!-- Radio Info screen. Label for a status item.  Used for diagnostic info screens, precise translation isn't needed -->
+    <string name="radio_info_voice_raw_registration_state_label">Voice Raw Registration State:</string>
+    <!-- Radio Info screen. Label for a status item.  Used for diagnostic info screens, precise translation isn't needed -->
+    <string name="radio_info_data_raw_registration_state_label">Data Raw Registration State:</string>
+    <!-- Radio Info screen. Label for a status item.  Used for diagnostic info screens, precise translation isn't needed -->
+    <string name="radio_info_wlan_data_raw_registration_state_label">WLAN Data Raw Registration State:</string>
+    <!-- Radio Info screen. Label for a status item.  Used for diagnostic info screens, precise translation isn't needed -->
     <string name="phone_index_label">Select phone index</string>
     <!-- Radio Info screen. Label for a status item.  Used for diagnostic info screens, precise translation isn't needed -->
     <string name="radio_info_set_perferred_label">Set Preferred Network Type:</string>
diff --git a/src/com/android/phone/CallForwardEditPreference.java b/src/com/android/phone/CallForwardEditPreference.java
index 96915d4..d1c8303 100644
--- a/src/com/android/phone/CallForwardEditPreference.java
+++ b/src/com/android/phone/CallForwardEditPreference.java
@@ -210,8 +210,9 @@
         // 3gpp spec. This can cause us to receive "numbers" that are sequences of letters. In this
         // case, we must detect these series of characters and replace them with "Voicemail".
         // PhoneNumberUtils#formatNumber returns null if the number is not valid.
-        if (mReplaceInvalidCFNumber && (PhoneNumberUtils.formatNumber(callForwardInfo.number,
-                getCurrentCountryIso()) == null)) {
+        if (mReplaceInvalidCFNumber && !TextUtils.isEmpty(callForwardInfo.number)
+                && (PhoneNumberUtils.formatNumber(callForwardInfo.number, getCurrentCountryIso())
+                == null)) {
             callForwardInfo.number = getContext().getString(R.string.voicemail);
             Log.i(LOG_TAG, "handleGetCFResponse: Overridding CF number");
         }
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index d2c0e6b..b28bd5c 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -365,10 +365,16 @@
                                 null));
                 intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle);
             }
-
-            PendingIntent pendingIntent =
-                    PendingIntent.getActivity(mContext, subId /* requestCode */, intent,
-                            PendingIntent.FLAG_IMMUTABLE);
+            PendingIntent pendingIntent;
+            UserHandle subAssociatedUserHandle =
+                    mSubscriptionManager.getSubscriptionUserHandle(subId);
+            if (subAssociatedUserHandle == null) {
+                pendingIntent = PendingIntent.getActivity(mContext, subId /* requestCode */, intent,
+                        PendingIntent.FLAG_IMMUTABLE);
+            } else {
+                pendingIntent = PendingIntent.getActivityAsUser(mContext, subId /* requestCode */,
+                        intent, PendingIntent.FLAG_IMMUTABLE, null, subAssociatedUserHandle);
+            }
 
             Resources res = mContext.getResources();
             PersistableBundle carrierConfig = PhoneGlobals.getInstance().getCarrierConfigForSubId(
@@ -389,34 +395,21 @@
             final Notification notification = builder.build();
             List<UserHandle> users = getUsersExcludeDying();
             for (UserHandle userHandle : users) {
-                if (!hasUserRestriction(
-                        UserManager.DISALLOW_OUTGOING_CALLS, userHandle)
-                        && !mUserManager.isManagedProfile(userHandle.getIdentifier())) {
-                    if (!maybeSendVoicemailNotificationUsingDefaultDialer(phone, vmCount, vmNumber,
-                            pendingIntent, isSettingsIntent, userHandle, isRefresh)) {
-                        notifyAsUser(
-                                Integer.toString(subId) /* tag */,
-                                VOICEMAIL_NOTIFICATION,
-                                notification,
-                                userHandle);
-                    }
+                boolean isManagedUser = mUserManager.isManagedProfile(userHandle.getIdentifier());
+                if (!hasUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS, userHandle)
+                        && (userHandle.equals(subAssociatedUserHandle)
+                            || (subAssociatedUserHandle == null && !isManagedUser))
+                        && !maybeSendVoicemailNotificationUsingDefaultDialer(phone, vmCount,
+                        vmNumber, pendingIntent, isSettingsIntent, userHandle, isRefresh)) {
+                    notifyAsUser(
+                            Integer.toString(subId) /* tag */,
+                            VOICEMAIL_NOTIFICATION,
+                            notification,
+                            userHandle);
                 }
             }
         } else {
-            List<UserHandle> users = getUsersExcludeDying();
-            for (UserHandle userHandle : users) {
-                if (!hasUserRestriction(
-                        UserManager.DISALLOW_OUTGOING_CALLS, userHandle)
-                        && !mUserManager.isManagedProfile(userHandle.getIdentifier())) {
-                    if (!maybeSendVoicemailNotificationUsingDefaultDialer(phone, 0, null, null,
-                            false, userHandle, isRefresh)) {
-                        cancelAsUser(
-                                Integer.toString(subId) /* tag */,
-                                VOICEMAIL_NOTIFICATION,
-                                userHandle);
-                    }
-                }
-            }
+            cancelAsUser(Integer.toString(subId) /* tag */, VOICEMAIL_NOTIFICATION, UserHandle.ALL);
         }
     }
 
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index f84157f..642250b 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -145,9 +145,9 @@
 import android.telephony.ims.stub.ImsConfigImplBase;
 import android.telephony.ims.stub.ImsRegistrationImplBase;
 import android.telephony.satellite.ISatelliteDatagramCallback;
-import android.telephony.satellite.ISatellitePositionUpdateCallback;
 import android.telephony.satellite.ISatelliteProvisionStateCallback;
 import android.telephony.satellite.ISatelliteStateCallback;
+import android.telephony.satellite.ISatelliteTransmissionUpdateCallback;
 import android.telephony.satellite.SatelliteCapabilities;
 import android.telephony.satellite.SatelliteDatagram;
 import android.telephony.satellite.SatelliteDatagramCallback;
@@ -7571,7 +7571,12 @@
 
     @Override
     public int getRadioAccessFamily(int phoneId, String callingPackage) {
+        int raf = RadioAccessFamily.RAF_UNKNOWN;
         Phone phone = PhoneFactory.getPhone(phoneId);
+        if (phone == null) {
+            return raf;
+        }
+
         try {
             TelephonyPermissions
                     .enforceCallingOrSelfReadPrivilegedPhoneStatePermissionOrCarrierPrivilege(
@@ -7580,15 +7585,9 @@
             EventLog.writeEvent(0x534e4554, "150857259", -1, "Missing Permission");
             throw e;
         }
-        int raf = RadioAccessFamily.RAF_UNKNOWN;
-        if (phone == null) {
-            return raf;
-        }
+
         final long identity = Binder.clearCallingIdentity();
         try {
-            TelephonyPermissions
-                    .enforceCallingOrSelfReadPrivilegedPhoneStatePermissionOrCarrierPrivilege(
-                            mApp, phone.getSubId(), "getRadioAccessFamily");
             raf = ProxyController.getInstance().getRadioAccessFamily(phoneId);
         } finally {
             Binder.restoreCallingIdentity(identity);
@@ -12095,21 +12094,24 @@
     }
 
     /**
-     * Request to enable or disable the satellite modem. If the satellite modem is enabled, this
-     * will also disable the cellular modem, and if the satellite modem is disabled, this will also
-     * re-enable the cellular modem.
+     * Request to enable or disable the satellite modem and demo mode. If the satellite modem is
+     * enabled, this may also disable the cellular modem, and if the satellite modem is disabled,
+     * this may also re-enable the cellular modem.
      *
      * @param subId The subId of the subscription to set satellite enabled for.
-     * @param enable {@code true} to enable the satellite modem and {@code false} to disable.
-     * @param callback The callback to get the error code of the request.
+     * @param enableSatellite {@code true} to enable the satellite modem and
+     *                        {@code false} to disable.
+     * @param enableDemoMode {@code true} to enable demo mode and {@code false} to disable.
+     * @param callback The callback to get the result of the request.
      *
      * @throws SecurityException if the caller doesn't have the required permission.
      */
     @Override
-    public void requestSatelliteEnabled(
-            int subId, boolean enable, @NonNull IIntegerConsumer callback) {
+    public void requestSatelliteEnabled(int subId, boolean enableSatellite, boolean enableDemoMode,
+            @NonNull IIntegerConsumer callback) {
         enforceSatelliteCommunicationPermission("requestSatelliteEnabled");
-        mSatelliteController.requestSatelliteEnabled(subId, enable, callback);
+        mSatelliteController.requestSatelliteEnabled(subId, enableSatellite, enableDemoMode,
+                callback);
     }
 
     /**
@@ -12128,22 +12130,6 @@
     }
 
     /**
-     * Request to enable or disable the satellite service demo mode.
-     *
-     * @param subId The subId of the subscription to set the satellite demo mode enabled for.
-     * @param enable {@code true} to enable the satellite demo mode and {@code false} to disable.
-     * @param callback The callback to get the error code of the request.
-     *
-     * @throws SecurityException if the caller doesn't have the required permission.
-     */
-    @Override
-    public void requestSatelliteDemoModeEnabled(
-            int subId, boolean enable, @NonNull IIntegerConsumer callback) {
-        enforceSatelliteCommunicationPermission("requestSatelliteDemoModeEnabled");
-        mSatelliteController.requestSatelliteDemoModeEnabled(subId, enable, callback);
-    }
-
-    /**
      * Request to get whether the satellite service demo mode is enabled.
      *
      * @param subId The subId of the subscription to check whether the satellite demo mode
@@ -12154,9 +12140,9 @@
      * @throws SecurityException if the caller doesn't have the required permission.
      */
     @Override
-    public void requestIsSatelliteDemoModeEnabled(int subId, @NonNull ResultReceiver result) {
-        enforceSatelliteCommunicationPermission("requestIsSatelliteDemoModeEnabled");
-        mSatelliteController.requestIsSatelliteDemoModeEnabled(subId, result);
+    public void requestIsDemoModeEnabled(int subId, @NonNull ResultReceiver result) {
+        enforceSatelliteCommunicationPermission("requestIsDemoModeEnabled");
+        mSatelliteController.requestIsDemoModeEnabled(subId, result);
     }
 
     /**
@@ -12187,56 +12173,41 @@
     }
 
     /**
-     * Start receiving satellite position updates.
+     * Start receiving satellite transmission updates.
      * This can be called by the pointing UI when the user starts pointing to the satellite.
      * Modem should continue to report the pointing input as the device or satellite moves.
      *
-     * @param subId The subId of the subscription to start satellite position updates for.
-     * @param errorCallback The callback to get the error code of the request.
-     * @param callback The callback to notify of changes in satellite position.
+     * @param subId The subId of the subscription to start satellite transmission updates for.
+     * @param resultCallback The callback to get the result of the request.
+     * @param callback The callback to notify of satellite transmission updates.
      *
      * @throws SecurityException if the caller doesn't have the required permission.
      */
     @Override
-    public void startSatellitePositionUpdates(int subId, @NonNull IIntegerConsumer errorCallback,
-            @NonNull ISatellitePositionUpdateCallback callback) {
-        enforceSatelliteCommunicationPermission("startSatellitePositionUpdates");
-        mSatelliteController.startSatellitePositionUpdates(subId, errorCallback, callback);
+    public void startSatelliteTransmissionUpdates(int subId,
+            @NonNull IIntegerConsumer resultCallback,
+            @NonNull ISatelliteTransmissionUpdateCallback callback) {
+        enforceSatelliteCommunicationPermission("startSatelliteTransmissionUpdates");
+        mSatelliteController.startSatelliteTransmissionUpdates(subId, resultCallback, callback);
     }
 
     /**
-     * Stop receiving satellite position updates.
+     * Stop receiving satellite transmission updates.
      * This can be called by the pointing UI when the user stops pointing to the satellite.
      *
-     * @param subId The subId of the subscription to stop satellite position updates for.
-     * @param errorCallback The callback to get the error code of the request.
-     * @param callback The callback that was passed to {@link
-     * #startSatellitePositionUpdates(int, IIntegerConsumer, ISatellitePositionUpdateCallback)}
+     * @param subId The subId of the subscription to stop satellite transmission updates for.
+     * @param resultCallback The callback to get the result of the request.
+     * @param callback The callback that was passed to {@link #startSatelliteTransmissionUpdates(
+     *                 int, IIntegerConsumer, ISatelliteTransmissionUpdateCallback)}.
      *
      * @throws SecurityException if the caller doesn't have the required permission.
      */
     @Override
-    public void stopSatellitePositionUpdates(int subId, @NonNull IIntegerConsumer errorCallback,
-            @NonNull ISatellitePositionUpdateCallback callback) {
-        enforceSatelliteCommunicationPermission("stopSatellitePositionUpdates");
-        mSatelliteController.stopSatellitePositionUpdates(subId, errorCallback, callback);
-    }
-
-    /**
-     * Request to get the maximum number of bytes per datagram that can be sent to satellite.
-     *
-     * @param subId The subId of the subscription to get the maximum number of characters for.
-     * @param result The result receiver that returns the maximum number of bytes per datagram
-     *               message on satellite if the request is successful or an error code
-     *               if the request failed.
-     *
-     * @throws SecurityException if the caller doesn't have the required permission.
-     */
-    @Override
-    public void requestMaxSizePerSendingDatagram(int subId,
-            @NonNull ResultReceiver result) {
-        enforceSatelliteCommunicationPermission("requestMaxSizePerSendingDatagram");
-        mSatelliteController.requestMaxSizePerSendingDatagram(subId, result);
+    public void stopSatelliteTransmissionUpdates(int subId,
+            @NonNull IIntegerConsumer resultCallback,
+            @NonNull ISatelliteTransmissionUpdateCallback callback) {
+        enforceSatelliteCommunicationPermission("stopSatelliteTransmissionUpdates");
+        mSatelliteController.stopSatelliteTransmissionUpdates(subId, resultCallback, callback);
     }
 
     /**
@@ -12246,7 +12217,8 @@
      * @param subId The subId of the subscription to be provisioned.
      * @param token The token to be used as a unique identifier for provisioning with satellite
      *              gateway.
-     * @param callback The callback to get the error code of the request.
+     * @param regionId The region ID for the device's current location.
+     * @param callback The callback to get the result of the request.
      *
      * @return The signal transport used by the caller to cancel the provision request,
      *         or {@code null} if the request failed.
@@ -12255,9 +12227,9 @@
      */
     @Override
     @Nullable public ICancellationSignal provisionSatelliteService(int subId,
-            @NonNull String token, @NonNull IIntegerConsumer callback) {
+            @NonNull String token, @NonNull String regionId, @NonNull IIntegerConsumer callback) {
         enforceSatelliteCommunicationPermission("provisionSatelliteService");
-        return mSatelliteController.provisionSatelliteService(subId, token, callback);
+        return mSatelliteController.provisionSatelliteService(subId, token, regionId, callback);
     }
 
     /**
@@ -12268,7 +12240,7 @@
      *
      * @param subId The subId of the subscription to be deprovisioned.
      * @param token The token of the device/subscription to be deprovisioned.
-     * @param callback The callback to get the error code of the request.
+     * @param callback The callback to get the result of the request.
      *
      * @throws SecurityException if the caller doesn't have the required permission.
      */
@@ -12367,8 +12339,6 @@
      * Register to receive incoming datagrams over satellite.
      *
      * @param subId The subId of the subscription to register for incoming satellite datagrams.
-     * @param datagramType datagram type indicating whether the datagram is of type
-     *                     SOS_SMS or LOCATION_SHARING.
      * @param callback The callback to handle incoming datagrams over satellite.
      *
      * @return The {@link SatelliteManager.SatelliteError} result of the operation.
@@ -12377,10 +12347,9 @@
      */
     @Override
     @SatelliteManager.SatelliteError public int registerForSatelliteDatagram(int subId,
-            @SatelliteManager.DatagramType int datagramType,
             @NonNull ISatelliteDatagramCallback callback) {
         enforceSatelliteCommunicationPermission("registerForSatelliteDatagram");
-        return mSatelliteController.registerForSatelliteDatagram(subId, datagramType, callback);
+        return mSatelliteController.registerForSatelliteDatagram(subId, callback);
     }
 
     /**
@@ -12389,7 +12358,7 @@
      *
      * @param subId The subId of the subscription to unregister for incoming satellite datagrams.
      * @param callback The callback that was passed to
-     *                 {@link #registerForSatelliteDatagram(int, int, ISatelliteDatagramCallback)}.
+     *                 {@link #registerForSatelliteDatagram(int, ISatelliteDatagramCallback)}.
      *
      * @throws SecurityException if the caller doesn't have the required permission.
      */
diff --git a/src/com/android/phone/settings/BandMode.java b/src/com/android/phone/settings/BandMode.java
deleted file mode 100644
index 853075a..0000000
--- a/src/com/android/phone/settings/BandMode.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (C) 2019 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.settings;
-
-import android.app.Activity;
-import android.content.DialogInterface;
-import android.os.AsyncResult;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.view.View;
-import android.view.Window;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-
-import androidx.appcompat.app.AlertDialog;
-
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneFactory;
-import com.android.phone.R;
-
-/**
- * Radio Band Mode Selection Class
- *
- * It will query baseband about all available band modes and display them
- * in screen. It will display all six band modes if the query failed.
- *
- * After user select one band, it will send the selection to baseband.
- *
- * It will alter user the result of select operation and exit, no matter success
- * or not.
- *
- */
-public class BandMode extends Activity {
-    private static final String LOG_TAG = "phone";
-    private static final boolean DBG = false;
-
-    private static final int EVENT_BAND_SCAN_COMPLETED = 100;
-    private static final int EVENT_BAND_SELECTION_DONE = 200;
-
-    //Directly maps to RIL_RadioBandMode from ril.h
-    private static final String[] BAND_NAMES = new String[] {
-            "Automatic",
-            "Europe",
-            "United States",
-            "Japan",
-            "Australia",
-            "Australia 2",
-            "Cellular 800",
-            "PCS",
-            "Class 3 (JTACS)",
-            "Class 4 (Korea-PCS)",
-            "Class 5",
-            "Class 6 (IMT2000)",
-            "Class 7 (700Mhz-Upper)",
-            "Class 8 (1800Mhz-Upper)",
-            "Class 9 (900Mhz)",
-            "Class 10 (800Mhz-Secondary)",
-            "Class 11 (Europe PAMR 400Mhz)",
-            "Class 15 (US-AWS)",
-            "Class 16 (US-2500Mhz)"
-    };
-
-    private ListView mBandList;
-    private ArrayAdapter mBandListAdapter;
-    private BandListItem mTargetBand = null;
-    private DialogInterface mProgressPanel;
-
-    private Phone mPhone = null;
-
-    @Override
-    protected void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-
-        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
-        setContentView(R.layout.band_mode);
-
-        mPhone = PhoneFactory.getDefaultPhone();
-
-        mBandList = (ListView) findViewById(R.id.band);
-        mBandListAdapter = new ArrayAdapter<BandListItem>(this,
-                android.R.layout.simple_list_item_1);
-        mBandList.setAdapter(mBandListAdapter);
-        mBandList.setOnItemClickListener(mBandSelectionHandler);
-
-        loadBandList();
-    }
-
-    private AdapterView.OnItemClickListener mBandSelectionHandler =
-            new AdapterView.OnItemClickListener() {
-                public void onItemClick(AdapterView parent, View v,
-                        int position, long id) {
-
-                    getWindow().setFeatureInt(
-                            Window.FEATURE_INDETERMINATE_PROGRESS,
-                            Window.PROGRESS_VISIBILITY_ON);
-
-                    mTargetBand = (BandListItem) parent.getAdapter().getItem(position);
-
-                    if (DBG) log("Select band : " + mTargetBand.toString());
-
-                    Message msg =
-                            mHandler.obtainMessage(EVENT_BAND_SELECTION_DONE);
-                    mPhone.setBandMode(mTargetBand.getBand(), msg);
-                }
-            };
-
-    private static class BandListItem {
-        private int mBandMode = Phone.BM_UNSPECIFIED;
-
-        BandListItem(int bm) {
-            mBandMode = bm;
-        }
-
-        public int getBand() {
-            return mBandMode;
-        }
-
-        public String toString() {
-            if (mBandMode >= BAND_NAMES.length) return "Band mode " + mBandMode;
-            return BAND_NAMES[mBandMode];
-        }
-    }
-
-    private void loadBandList() {
-        String str = getString(R.string.band_mode_loading);
-
-        if (DBG) log(str);
-
-
-        //ProgressDialog.show(this, null, str, true, true, null);
-        mProgressPanel = new AlertDialog.Builder(this)
-            .setMessage(str)
-            .show();
-
-        Message msg = mHandler.obtainMessage(EVENT_BAND_SCAN_COMPLETED);
-        mPhone.queryAvailableBandMode(msg);
-
-    }
-
-    private void bandListLoaded(AsyncResult result) {
-        if (DBG) log("network list loaded");
-
-        if (mProgressPanel != null) mProgressPanel.dismiss();
-
-        clearList();
-
-        boolean addBandSuccess = false;
-        BandListItem item;
-
-        if (result.result != null) {
-            int [] bands = (int []) result.result;
-
-            if (bands.length == 0) {
-                Log.wtf(LOG_TAG, "No Supported Band Modes");
-                return;
-            }
-
-            int size = bands[0];
-
-            if (size > 0) {
-                mBandListAdapter.add(
-                        new BandListItem(Phone.BM_UNSPECIFIED)); //Always include AUTOMATIC
-                for (int i = 1; i <= size; i++) {
-                    if (bands[i] == Phone.BM_UNSPECIFIED) {
-                        continue;
-                    }
-                    item = new BandListItem(bands[i]);
-                    mBandListAdapter.add(item);
-                    if (DBG) log("Add " + item.toString());
-                }
-                addBandSuccess = true;
-            }
-        }
-
-        if (!addBandSuccess) {
-            if (DBG) log("Error in query, add default list");
-            for (int i = 0; i < Phone.BM_NUM_BAND_MODES; i++) {
-                item = new BandListItem(i);
-                mBandListAdapter.add(item);
-                if (DBG) log("Add default " + item.toString());
-            }
-        }
-        mBandList.requestFocus();
-    }
-
-    private void displayBandSelectionResult(Throwable ex) {
-        String status = getString(R.string.band_mode_set)
-                + " [" + mTargetBand.toString() + "] ";
-
-        if (ex != null) {
-            status = status + getString(R.string.band_mode_failed);
-        } else {
-            status = status + getString(R.string.band_mode_succeeded);
-        }
-
-        mProgressPanel = new AlertDialog.Builder(this)
-            .setMessage(status)
-            .setPositiveButton(android.R.string.ok, null).show();
-    }
-
-    private void clearList() {
-        while (mBandListAdapter.getCount() > 0) {
-            mBandListAdapter.remove(
-                    mBandListAdapter.getItem(0));
-        }
-    }
-
-    private void log(String msg) {
-        Log.d(LOG_TAG, "[BandsList] " + msg);
-    }
-
-    private Handler mHandler = new Handler() {
-        public void handleMessage(Message msg) {
-            AsyncResult ar;
-            switch (msg.what) {
-                case EVENT_BAND_SCAN_COMPLETED:
-                    ar = (AsyncResult) msg.obj;
-
-                    bandListLoaded(ar);
-                    break;
-
-                case EVENT_BAND_SELECTION_DONE:
-                    ar = (AsyncResult) msg.obj;
-
-                    getWindow().setFeatureInt(
-                            Window.FEATURE_INDETERMINATE_PROGRESS,
-                            Window.PROGRESS_VISIBILITY_OFF);
-
-                    if (!isFinishing()) {
-                        displayBandSelectionResult(ar.exception);
-                    }
-                    break;
-            }
-        }
-    };
-
-
-}
diff --git a/src/com/android/phone/settings/RadioInfo.java b/src/com/android/phone/settings/RadioInfo.java
index 574440a..124badf 100644
--- a/src/com/android/phone/settings/RadioInfo.java
+++ b/src/com/android/phone/settings/RadioInfo.java
@@ -204,12 +204,10 @@
         Log.d(TAG, s);
     }
 
-    private static final int EVENT_CFI_CHANGED = 302;
     private static final int EVENT_QUERY_SMSC_DONE = 1005;
     private static final int EVENT_UPDATE_SMSC_DONE = 1006;
     private static final int EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED = 1007;
 
-    private static final int MENU_ITEM_SELECT_BAND         = 0;
     private static final int MENU_ITEM_VIEW_ADN            = 1;
     private static final int MENU_ITEM_VIEW_FDN            = 2;
     private static final int MENU_ITEM_VIEW_SDN            = 3;
@@ -236,6 +234,9 @@
     private TextView mGprsState;
     private TextView mVoiceNetwork;
     private TextView mDataNetwork;
+    private TextView mVoiceRawReg;
+    private TextView mDataRawReg;
+    private TextView mWlanDataRawReg;
     private TextView mOverrideNetwork;
     private TextView mDBm;
     private TextView mMwi;
@@ -259,7 +260,6 @@
     private EditText mSmsc;
     private Switch mRadioPowerOnSwitch;
     private Switch mSimulateOutOfServiceSwitch;
-    private Button mCellInfoRefreshRateButton;
     private Button mDnsCheckToggleButton;
     private Button mPingTestButton;
     private Button mUpdateSmscButton;
@@ -377,6 +377,7 @@
             updateServiceState(serviceState);
             updateRadioPowerState();
             updateNetworkType();
+            updateRawRegistrationState(serviceState);
             updateImsProvisionedState();
             updateNrStats(serviceState);
         }
@@ -514,6 +515,9 @@
         mGprsState = (TextView) findViewById(R.id.gprs);
         mVoiceNetwork = (TextView) findViewById(R.id.voice_network);
         mDataNetwork = (TextView) findViewById(R.id.data_network);
+        mVoiceRawReg = (TextView) findViewById(R.id.voice_raw_registration_state);
+        mDataRawReg = (TextView) findViewById(R.id.data_raw_registration_state);
+        mWlanDataRawReg = (TextView) findViewById(R.id.wlan_data_raw_registration_state);
         mOverrideNetwork = (TextView) findViewById(R.id.override_network);
         mDBm = (TextView) findViewById(R.id.dbm);
         mMwi = (TextView) findViewById(R.id.mwi);
@@ -788,9 +792,7 @@
 
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
-        menu.add(0, MENU_ITEM_SELECT_BAND, 0, R.string.radio_info_band_mode_label)
-                .setOnMenuItemClickListener(mSelectBandCallback)
-                .setAlphabeticShortcut('b');
+        // Removed "select Radio band". If need it back, use setSystemSelectionChannels()
         menu.add(1, MENU_ITEM_VIEW_ADN, 0,
                 R.string.radioInfo_menu_viewADN).setOnMenuItemClickListener(mViewADNCallback);
         menu.add(1, MENU_ITEM_VIEW_FDN, 0,
@@ -855,8 +857,11 @@
         mOperatorName.setText("");
         mGprsState.setText("");
         mDataNetwork.setText("");
+        mDataRawReg.setText("");
         mOverrideNetwork.setText("");
         mVoiceNetwork.setText("");
+        mVoiceRawReg.setText("");
+        mWlanDataRawReg.setText("");
         mSent.setText("");
         mReceived.setText("");
         mCallState.setText("");
@@ -1204,6 +1209,32 @@
         }
     }
 
+    private String getRawRegistrationStateText(ServiceState ss, int domain, int transportType) {
+        if (ss != null) {
+            NetworkRegistrationInfo nri = ss.getNetworkRegistrationInfo(domain, transportType);
+            if (nri != null) {
+                return NetworkRegistrationInfo.registrationStateToString(
+                        nri.getNetworkRegistrationState())
+                        + (nri.isEmergencyEnabled() ? "_EM" : "");
+            }
+        }
+        return "";
+    }
+
+    private void updateRawRegistrationState(ServiceState serviceState) {
+        ServiceState ss = serviceState;
+        if (ss == null && mPhone != null) {
+            ss = mPhone.getServiceState();
+        }
+
+        mVoiceRawReg.setText(getRawRegistrationStateText(ss, NetworkRegistrationInfo.DOMAIN_CS,
+                    AccessNetworkConstants.TRANSPORT_TYPE_WWAN));
+        mDataRawReg.setText(getRawRegistrationStateText(ss, NetworkRegistrationInfo.DOMAIN_PS,
+                    AccessNetworkConstants.TRANSPORT_TYPE_WWAN));
+        mWlanDataRawReg.setText(getRawRegistrationStateText(ss, NetworkRegistrationInfo.DOMAIN_PS,
+                    AccessNetworkConstants.TRANSPORT_TYPE_WLAN));
+    }
+
     private void updateNrStats(ServiceState serviceState) {
         if ((mTelephonyManager.getSupportedRadioAccessFamily()
                 & TelephonyManager.NETWORK_TYPE_BITMASK_NR) == 0) {
@@ -1488,16 +1519,6 @@
         }
     };
 
-    private MenuItem.OnMenuItemClickListener mSelectBandCallback =
-            new MenuItem.OnMenuItemClickListener() {
-        public boolean onMenuItemClick(MenuItem item) {
-            Intent intent = new Intent();
-            intent.setClass(RadioInfo.this, BandMode.class);
-            startActivity(intent);
-            return true;
-        }
-    };
-
     private MenuItem.OnMenuItemClickListener mToggleData =
             new MenuItem.OnMenuItemClickListener() {
         public boolean onMenuItemClick(MenuItem item) {
diff --git a/src/com/android/phone/slice/SlicePurchaseController.java b/src/com/android/phone/slice/SlicePurchaseController.java
index e36325e..4166b1e 100644
--- a/src/com/android/phone/slice/SlicePurchaseController.java
+++ b/src/com/android/phone/slice/SlicePurchaseController.java
@@ -300,8 +300,7 @@
             mSlicePurchaseControllerBroadcastReceivers = new HashMap<>();
     /** The current network slicing configuration. */
     @Nullable private NetworkSlicingConfig mSlicingConfig;
-    /** Premium network entitlement query API. */
-    @NonNull private final PremiumNetworkEntitlementApi mPremiumNetworkEntitlementApi;
+
     /** LocalDate to use when resetting notification counts. {@code null} except when testing. */
     @Nullable private LocalDate mLocalDate;
     /** The number of times the performance boost notification has been shown today. */
@@ -452,8 +451,6 @@
         mPhone = phone;
         // TODO: Create a cached value for slicing config in DataIndication and initialize here
         mPhone.mCi.registerForSlicingConfigChanged(this, EVENT_SLICING_CONFIG_CHANGED, null);
-        mPremiumNetworkEntitlementApi =
-                new PremiumNetworkEntitlementApi(mPhone, getCarrierConfigs());
         mIsSlicingUpsellEnabled = DeviceConfig.getBoolean(
                 DeviceConfig.NAMESPACE_TELEPHONY, KEY_ENABLE_SLICING_UPSELL, false);
         DeviceConfig.addOnPropertiesChangedListener(
@@ -682,10 +679,20 @@
         }
     }
 
+    /*
+      return a new PremiumNetworkEntitlementApi object.
+     */
+    @VisibleForTesting
+    public PremiumNetworkEntitlementApi getPremiumNetworkEntitlementApi() {
+        return new PremiumNetworkEntitlementApi(mPhone, getCarrierConfigs());
+    }
+
     private void onStartSlicePurchaseApplication(
             @TelephonyManager.PremiumCapability int capability) {
+        final PremiumNetworkEntitlementApi premiumNetworkEntitlementApi =
+                getPremiumNetworkEntitlementApi();
         PremiumNetworkEntitlementResponse premiumNetworkEntitlementResponse =
-                mPremiumNetworkEntitlementApi.checkEntitlementStatus(capability);
+                premiumNetworkEntitlementApi.checkEntitlementStatus(capability);
 
         // invalid response for entitlement check
         if (premiumNetworkEntitlementResponse == null) {
@@ -777,7 +784,8 @@
         filter.addAction(ACTION_SLICE_PURCHASE_APP_RESPONSE_SUCCESS);
         filter.addAction(ACTION_SLICE_PURCHASE_APP_RESPONSE_NOTIFICATION_SHOWN);
         mPhone.getContext().registerReceiver(
-                mSlicePurchaseControllerBroadcastReceivers.get(capability), filter);
+                mSlicePurchaseControllerBroadcastReceivers.get(capability), filter,
+                Context.RECEIVER_NOT_EXPORTED);
     }
 
     /**
diff --git a/src/com/android/phone/vvm/RemoteVvmTaskManager.java b/src/com/android/phone/vvm/RemoteVvmTaskManager.java
index 6b60303..7329854 100644
--- a/src/com/android/phone/vvm/RemoteVvmTaskManager.java
+++ b/src/com/android/phone/vvm/RemoteVvmTaskManager.java
@@ -32,6 +32,7 @@
 import android.os.Messenger;
 import android.os.PersistableBundle;
 import android.os.RemoteException;
+import android.os.UserHandle;
 import android.telecom.PhoneAccountHandle;
 import android.telecom.TelecomManager;
 import android.telephony.CarrierConfigManager;
@@ -239,6 +240,7 @@
         PhoneAccountHandle phoneAccountHandle = intent.getExtras()
                 .getParcelable(VisualVoicemailService.DATA_PHONE_ACCOUNT_HANDLE);
         int subId = PhoneAccountHandleConverter.toSubId(phoneAccountHandle);
+        UserHandle userHandle = phoneAccountHandle.getUserHandle();
         ComponentName remotePackage = getRemotePackage(this, subId,
                 intent.getStringExtra(EXTRA_TARGET_PACKAGE));
         if (remotePackage == null) {
@@ -250,13 +252,15 @@
         switch (intent.getAction()) {
             case ACTION_START_CELL_SERVICE_CONNECTED:
                 send(remotePackage, VisualVoicemailService.MSG_ON_CELL_SERVICE_CONNECTED,
-                        intent.getExtras());
+                        intent.getExtras(), userHandle);
                 break;
             case ACTION_START_SMS_RECEIVED:
-                send(remotePackage, VisualVoicemailService.MSG_ON_SMS_RECEIVED, intent.getExtras());
+                send(remotePackage, VisualVoicemailService.MSG_ON_SMS_RECEIVED, intent.getExtras(),
+                        userHandle);
                 break;
             case ACTION_START_SIM_REMOVED:
-                send(remotePackage, VisualVoicemailService.MSG_ON_SIM_REMOVED, intent.getExtras());
+                send(remotePackage, VisualVoicemailService.MSG_ON_SIM_REMOVED, intent.getExtras(),
+                        userHandle);
                 break;
             default:
                 Assert.fail("Unexpected action +" + intent.getAction());
@@ -335,7 +339,7 @@
         }
     }
 
-    private void send(ComponentName remotePackage, int what, Bundle extras) {
+    private void send(ComponentName remotePackage, int what, Bundle extras, UserHandle userHandle) {
         Assert.isMainThread();
 
         if (getBroadcastPackage(this) != null) {
@@ -351,7 +355,7 @@
             intent.putExtras(extras);
             intent.putExtra(EXTRA_WHAT, what);
             intent.setComponent(remotePackage);
-            sendBroadcast(intent);
+            sendBroadcastAsUser(intent, userHandle);
             return;
         }
 
@@ -367,7 +371,7 @@
             Intent intent = newBindIntent(this);
             intent.setComponent(remotePackage);
             VvmLog.i(TAG, "Binding to " + intent.getComponent());
-            bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
+            bindServiceAsUser(intent, mConnection, Context.BIND_AUTO_CREATE, userHandle);
         }
     }
 
diff --git a/src/com/android/services/telephony/RadioOnHelper.java b/src/com/android/services/telephony/RadioOnHelper.java
deleted file mode 100644
index 63a648f..0000000
--- a/src/com/android/services/telephony/RadioOnHelper.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2014 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.services.telephony;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.UserHandle;
-import android.provider.Settings;
-import android.telephony.TelephonyManager;
-
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Helper class that implements special behavior related to emergency calls or making phone calls
- * when the radio is in the POWER_OFF STATE. Specifically, this class handles the case of the user
- * trying to dial an emergency number while the radio is off (i.e. the device is in airplane mode)
- * or a normal number while the radio is off (because of the device is on Bluetooth), by turning the
- * radio back on, waiting for it to come up, and then retrying the call.
- */
-public class RadioOnHelper implements RadioOnStateListener.Callback {
-
-    private final Context mContext;
-    private RadioOnStateListener.Callback mCallback;
-    private List<RadioOnStateListener> mListeners;
-    private List<RadioOnStateListener> mInProgressListeners;
-    private boolean mIsRadioOnCallingEnabled;
-
-    public RadioOnHelper(Context context) {
-        mContext = context;
-        mInProgressListeners = new ArrayList<>(2);
-    }
-
-    private void setupListeners() {
-        if (mListeners == null) {
-            mListeners = new ArrayList<>(2);
-        }
-        int activeModems = TelephonyManager.from(mContext).getActiveModemCount();
-        // Add new listeners if active modem count increased.
-        while (mListeners.size() < activeModems) {
-            mListeners.add(new RadioOnStateListener());
-        }
-        // Clean up listeners if active modem count decreased.
-        while (mListeners.size() > activeModems) {
-            mListeners.get(mListeners.size() - 1).cleanup();
-            mListeners.remove(mListeners.size() - 1);
-        }
-    }
-    /**
-     * Starts the "turn on radio" sequence. This is the (single) external API of the
-     * RadioOnHelper class.
-     *
-     * This method kicks off the following sequence:
-     * - Power on the radio for each Phone
-     * - Listen for radio events telling us the radio has come up.
-     * - Retry if we've gone a significant amount of time without any response from the radio.
-     * - Finally, clean up any leftover state.
-     *
-     * This method is safe to call from any thread, since it simply posts a message to the
-     * RadioOnHelper's handler (thus ensuring that the rest of the sequence is entirely
-     * serialized, and runs on the main looper.)
-     */
-    public void triggerRadioOnAndListen(RadioOnStateListener.Callback callback,
-            boolean forEmergencyCall, Phone phoneForEmergencyCall, boolean isTestEmergencyNumber) {
-        setupListeners();
-        mCallback = callback;
-        mInProgressListeners.clear();
-        mIsRadioOnCallingEnabled = false;
-        for (int i = 0; i < TelephonyManager.from(mContext).getActiveModemCount(); i++) {
-            Phone phone = PhoneFactory.getPhone(i);
-            if (phone == null) {
-                continue;
-            }
-
-            mInProgressListeners.add(mListeners.get(i));
-            mListeners.get(i).waitForRadioOn(phone, this, forEmergencyCall, forEmergencyCall
-                    && phone == phoneForEmergencyCall);
-        }
-        powerOnRadio(forEmergencyCall, phoneForEmergencyCall, isTestEmergencyNumber);
-    }
-    /**
-     * Attempt to power on the radio (i.e. take the device out of airplane mode). We'll eventually
-     * get an onServiceStateChanged() callback when the radio successfully comes up.
-     */
-    private void powerOnRadio(boolean forEmergencyCall, Phone phoneForEmergencyCall,
-            boolean isTestEmergencyNumber) {
-
-        // Always try to turn on the radio here independent of APM setting - if we got here in the
-        // first place, the radio is off independent of APM setting.
-        for (Phone phone : PhoneFactory.getPhones()) {
-            Log.d(this, "powerOnRadio, enabling Radio");
-            if (isTestEmergencyNumber) {
-                phone.setRadioPowerOnForTestEmergencyCall(phone == phoneForEmergencyCall);
-            } else {
-                phone.setRadioPower(true, forEmergencyCall, phone == phoneForEmergencyCall,
-                        false);
-            }
-        }
-
-        // If airplane mode is on, we turn it off the same way that the Settings activity turns it
-        // off to keep the setting in sync.
-        if (Settings.Global.getInt(mContext.getContentResolver(),
-                Settings.Global.AIRPLANE_MODE_ON, 0) > 0) {
-            Log.d(this, "==> Turning off airplane mode for emergency call.");
-
-            // Change the system setting
-            Settings.Global.putInt(mContext.getContentResolver(),
-                    Settings.Global.AIRPLANE_MODE_ON, 0);
-
-            // Post the broadcast intend for change in airplane mode
-            // TODO: We really should not be in charge of sending this broadcast.
-            // If changing the setting is sufficient to trigger all of the rest of the logic,
-            // then that should also trigger the broadcast intent.
-            Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
-            intent.putExtra("state", false);
-            mContext.sendBroadcastAsUser(intent, UserHandle.ALL);
-        }
-    }
-
-    /**
-     * This method is called from multiple Listeners on the Main Looper.
-     * Synchronization is not necessary.
-     */
-    @Override
-    public void onComplete(RadioOnStateListener listener, boolean isRadioReady) {
-        mIsRadioOnCallingEnabled |= isRadioReady;
-        mInProgressListeners.remove(listener);
-        if (mCallback != null && mInProgressListeners.isEmpty()) {
-            mCallback.onComplete(null, mIsRadioOnCallingEnabled);
-        }
-    }
-
-    @Override
-    public boolean isOkToCall(Phone phone, int serviceState) {
-        return (mCallback == null) ? false : mCallback.isOkToCall(phone, serviceState);
-    }
-}
diff --git a/src/com/android/services/telephony/RadioOnStateListener.java b/src/com/android/services/telephony/RadioOnStateListener.java
deleted file mode 100644
index 93e1e3c..0000000
--- a/src/com/android/services/telephony/RadioOnStateListener.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Copyright (C) 2016 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.services.telephony;
-
-import android.os.AsyncResult;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.telephony.ServiceState;
-
-import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.os.SomeArgs;
-import com.android.internal.telephony.Phone;
-
-/**
- * Helper class that listens to a Phone's radio state and sends an onComplete callback when we
- * return true for isOkToCall.
- */
-public class RadioOnStateListener {
-
-    interface Callback {
-        /**
-         * Receives the result of the RadioOnStateListener's attempt to turn on the radio.
-         */
-        void onComplete(RadioOnStateListener listener, boolean isRadioReady);
-
-        /**
-         * Given the Phone and the new service state of that phone, return whether or not this
-         * phone is ok to call. If it is, onComplete will be called shortly after.
-         */
-        boolean isOkToCall(Phone phone, int serviceState);
-    }
-
-    // Number of times to retry the call, and time between retry attempts.
-    // not final for testing
-    private static int MAX_NUM_RETRIES = 5;
-    // not final for testing
-    private static long TIME_BETWEEN_RETRIES_MILLIS = 5000;  // msec
-
-    // Handler message codes; see handleMessage()
-    private static final int MSG_START_SEQUENCE = 1;
-    @VisibleForTesting
-    public static final int MSG_SERVICE_STATE_CHANGED = 2;
-    private static final int MSG_RETRY_TIMEOUT = 3;
-    @VisibleForTesting
-    public static final int MSG_RADIO_ON = 4;
-    public static final int MSG_RADIO_OFF_OR_NOT_AVAILABLE = 5;
-
-    private final Handler mHandler = new Handler(Looper.getMainLooper()) {
-        @Override
-        public void handleMessage(Message msg) {
-            switch (msg.what) {
-                case MSG_START_SEQUENCE:
-                    SomeArgs args = (SomeArgs) msg.obj;
-                    try {
-                        Phone phone = (Phone) args.arg1;
-                        RadioOnStateListener.Callback callback =
-                                (RadioOnStateListener.Callback) args.arg2;
-                        boolean forEmergencyCall = (boolean) args.arg3;
-                        boolean isSelectedPhoneForEmergencyCall = (boolean) args.arg4;
-                        startSequenceInternal(phone, callback, forEmergencyCall,
-                                isSelectedPhoneForEmergencyCall);
-                    } finally {
-                        args.recycle();
-                    }
-                    break;
-                case MSG_SERVICE_STATE_CHANGED:
-                    onServiceStateChanged((ServiceState) ((AsyncResult) msg.obj).result);
-                    break;
-                case MSG_RADIO_ON:
-                    onRadioOn();
-                    break;
-                case MSG_RADIO_OFF_OR_NOT_AVAILABLE:
-                    registerForRadioOn();
-                    break;
-                case MSG_RETRY_TIMEOUT:
-                    onRetryTimeout();
-                    break;
-                default:
-                    Log.wtf(this, "handleMessage: unexpected message: %d.", msg.what);
-                    break;
-            }
-        }
-    };
-
-
-    private Callback mCallback;  // The callback to notify upon completion.
-    private Phone mPhone;  // The phone that will attempt to place the call.
-    private boolean mForEmergencyCall; // Whether radio is being turned on for emergency call.
-    // Whether this phone is selected to place emergency call. Can be true only if
-    // mForEmergencyCall is true.
-    private boolean mSelectedPhoneForEmergencyCall;
-    private int mNumRetriesSoFar;
-
-    /**
-     * Starts the "wait for radio" sequence. This is the (single) external API of the
-     * RadioOnStateListener class.
-     *
-     * This method kicks off the following sequence:
-     * - Listen for the service state change event telling us the radio has come up.
-     * - Retry if we've gone {@link #TIME_BETWEEN_RETRIES_MILLIS} without any response from the
-     *   radio.
-     * - Finally, clean up any leftover state.
-     *
-     * This method is safe to call from any thread, since it simply posts a message to the
-     * RadioOnStateListener's handler (thus ensuring that the rest of the sequence is entirely
-     * serialized, and runs only on the handler thread.)
-     */
-    public void waitForRadioOn(Phone phone, Callback callback,
-            boolean forEmergencyCall, boolean isSelectedPhoneForEmergencyCall) {
-        Log.d(this, "waitForRadioOn: Phone " + phone.getPhoneId());
-
-        if (mPhone != null) {
-            // If there already is an ongoing request, ignore the new one!
-            return;
-        }
-
-        SomeArgs args = SomeArgs.obtain();
-        args.arg1 = phone;
-        args.arg2 = callback;
-        args.arg3 = forEmergencyCall;
-        args.arg4 = isSelectedPhoneForEmergencyCall;
-        mHandler.obtainMessage(MSG_START_SEQUENCE, args).sendToTarget();
-    }
-
-    /**
-     * Actual implementation of waitForRadioOn(), guaranteed to run on the handler thread.
-     *
-     * @see #waitForRadioOn
-     */
-    private void startSequenceInternal(Phone phone, Callback callback,
-            boolean forEmergencyCall, boolean isSelectedPhoneForEmergencyCall) {
-        Log.d(this, "startSequenceInternal: Phone " + phone.getPhoneId());
-
-        // First of all, clean up any state left over from a prior RadioOn call sequence. This
-        // ensures that we'll behave sanely if another startTurnOnRadioSequence() comes in while
-        // we're already in the middle of the sequence.
-        cleanup();
-
-        mPhone = phone;
-        mCallback = callback;
-        mForEmergencyCall = forEmergencyCall;
-        mSelectedPhoneForEmergencyCall = isSelectedPhoneForEmergencyCall;
-
-        registerForServiceStateChanged();
-        // Register for RADIO_OFF to handle cases where emergency call is dialed before
-        // we receive UNSOL_RESPONSE_RADIO_STATE_CHANGED with RADIO_OFF.
-        registerForRadioOff();
-        // Next step: when the SERVICE_STATE_CHANGED event comes in, we'll retry the call; see
-        // onServiceStateChanged(). But also, just in case, start a timer to make sure we'll retry
-        // the call even if the SERVICE_STATE_CHANGED event never comes in for some reason.
-        startRetryTimer();
-    }
-
-    /**
-     * Handles the SERVICE_STATE_CHANGED event. This event tells us that the radio state has changed
-     * and is probably coming up. We can now check to see if the conditions are met to place the
-     * call with {@link Callback#isOkToCall}
-     */
-    private void onServiceStateChanged(ServiceState state) {
-        if (mPhone == null) return;
-        Log.d(this, "onServiceStateChanged(), new state = %s, Phone = %s", state,
-                mPhone.getPhoneId());
-
-        // Possible service states:
-        // - STATE_IN_SERVICE        // Normal operation
-        // - STATE_OUT_OF_SERVICE    // Still searching for an operator to register to,
-        //                           // or no radio signal
-        // - STATE_EMERGENCY_ONLY    // Only emergency numbers are allowed; currently not used
-        // - STATE_POWER_OFF         // Radio is explicitly powered off (airplane mode)
-
-        if (isOkToCall(state.getState())) {
-            // Woo hoo!  It's OK to actually place the call.
-            Log.d(this, "onServiceStateChanged: ok to call!");
-
-            onComplete(true);
-            cleanup();
-        } else {
-            // The service state changed, but we're still not ready to call yet.
-            Log.d(this, "onServiceStateChanged: not ready to call yet, keep waiting.");
-        }
-    }
-
-    private void onRadioOn() {
-        if (mPhone == null) return;
-        ServiceState state =  mPhone.getServiceState();
-        Log.d(this, "onRadioOn, state = %s, Phone = %s", state,
-                mPhone.getPhoneId());
-        if (isOkToCall(state.getState())) {
-            onComplete(true);
-            cleanup();
-        } else {
-            Log.d(this, "onRadioOn: not ready to call yet, keep waiting.");
-        }
-    }
-    /**
-     * Callback to see if it is okay to call yet, given the current conditions.
-     */
-    private boolean isOkToCall(int serviceState) {
-        return (mCallback == null) ? false : mCallback.isOkToCall(mPhone, serviceState);
-    }
-
-    /**
-     * Handles the retry timer expiring.
-     */
-    private void onRetryTimeout() {
-        if (mPhone == null) return;
-        int serviceState = mPhone.getServiceState().getState();
-        Log.d(this, "onRetryTimeout():  phone state = %s, service state = %d, retries = %d.",
-                mPhone.getState(), serviceState, mNumRetriesSoFar);
-
-        // - If we're actually in a call, we've succeeded.
-        // - Otherwise, if the radio is now on, that means we successfully got out of airplane mode
-        //   but somehow didn't get the service state change event.  In that case, try to place the
-        //   call.
-        // - If the radio is still powered off, try powering it on again.
-
-        if (isOkToCall(serviceState)) {
-            Log.d(this, "onRetryTimeout: Radio is on. Cleaning up.");
-
-            // Woo hoo -- we successfully got out of airplane mode.
-            onComplete(true);
-            cleanup();
-        } else {
-            // Uh oh; we've waited the full TIME_BETWEEN_RETRIES_MILLIS and the radio is still not
-            // powered-on.  Try again.
-
-            mNumRetriesSoFar++;
-            Log.d(this, "mNumRetriesSoFar is now " + mNumRetriesSoFar);
-
-            if (mNumRetriesSoFar > MAX_NUM_RETRIES) {
-                Log.w(this, "Hit MAX_NUM_RETRIES; giving up.");
-                cleanup();
-            } else {
-                Log.d(this, "Trying (again) to turn on the radio.");
-                mPhone.setRadioPower(true, mForEmergencyCall, mSelectedPhoneForEmergencyCall,
-                        false);
-                startRetryTimer();
-            }
-        }
-    }
-
-    /**
-     * Clean up when done with the whole sequence: either after successfully turning on the radio,
-     * or after bailing out because of too many failures.
-     *
-     * The exact cleanup steps are:
-     * - Notify callback if we still hadn't sent it a response.
-     * - Double-check that we're not still registered for any telephony events
-     * - Clean up any extraneous handler messages (like retry timeouts) still in the queue
-     *
-     * Basically this method guarantees that there will be no more activity from the
-     * RadioOnStateListener until someone kicks off the whole sequence again with another call
-     * to {@link #waitForRadioOn}
-     *
-     * TODO: Do the work for the comment below:
-     * Note we don't call this method simply after a successful call to placeCall(), since it's
-     * still possible the call will disconnect very quickly with an OUT_OF_SERVICE error.
-     */
-    public void cleanup() {
-        Log.d(this, "cleanup()");
-
-        // This will send a failure call back if callback has yet to be invoked.  If the callback
-        // was already invoked, it's a no-op.
-        onComplete(false);
-
-        unregisterForServiceStateChanged();
-        unregisterForRadioOff();
-        unregisterForRadioOn();
-        cancelRetryTimer();
-
-        // Used for unregisterForServiceStateChanged() so we null it out here instead.
-        mPhone = null;
-        mNumRetriesSoFar = 0;
-    }
-
-    private void startRetryTimer() {
-        cancelRetryTimer();
-        mHandler.sendEmptyMessageDelayed(MSG_RETRY_TIMEOUT, TIME_BETWEEN_RETRIES_MILLIS);
-    }
-
-    private void cancelRetryTimer() {
-        mHandler.removeMessages(MSG_RETRY_TIMEOUT);
-    }
-
-    private void registerForServiceStateChanged() {
-        // Unregister first, just to make sure we never register ourselves twice.  (We need this
-        // because Phone.registerForServiceStateChanged() does not prevent multiple registration of
-        // the same handler.)
-        unregisterForServiceStateChanged();
-        mPhone.registerForServiceStateChanged(mHandler, MSG_SERVICE_STATE_CHANGED, null);
-    }
-
-    private void unregisterForServiceStateChanged() {
-        // This method is safe to call even if we haven't set mPhone yet.
-        if (mPhone != null) {
-            mPhone.unregisterForServiceStateChanged(mHandler);  // Safe even if unnecessary
-        }
-        mHandler.removeMessages(MSG_SERVICE_STATE_CHANGED);  // Clean up any pending messages too
-    }
-
-    private void registerForRadioOff() {
-        mPhone.mCi.registerForOffOrNotAvailable(mHandler, MSG_RADIO_OFF_OR_NOT_AVAILABLE, null);
-    }
-
-    private void unregisterForRadioOff() {
-        // This method is safe to call even if we haven't set mPhone yet.
-        if (mPhone != null) {
-            mPhone.mCi.unregisterForOffOrNotAvailable(mHandler);  // Safe even if unnecessary
-        }
-        mHandler.removeMessages(MSG_RADIO_OFF_OR_NOT_AVAILABLE);  // Clean up any pending messages
-    }
-
-    private void registerForRadioOn() {
-        unregisterForRadioOff();
-        mPhone.mCi.registerForOn(mHandler, MSG_RADIO_ON, null);
-    }
-
-    private void unregisterForRadioOn() {
-        // This method is safe to call even if we haven't set mPhone yet.
-        if (mPhone != null) {
-            mPhone.mCi.unregisterForOn(mHandler);  // Safe even if unnecessary
-        }
-        mHandler.removeMessages(MSG_RADIO_ON);  // Clean up any pending messages too
-    }
-
-    private void onComplete(boolean isRadioReady) {
-        if (mCallback != null) {
-            Callback tempCallback = mCallback;
-            mCallback = null;
-            tempCallback.onComplete(this, isRadioReady);
-        }
-    }
-
-    @VisibleForTesting
-    public Handler getHandler() {
-        return mHandler;
-    }
-
-    @VisibleForTesting
-    public void setMaxNumRetries(int retries) {
-        MAX_NUM_RETRIES = retries;
-    }
-
-    @VisibleForTesting
-    public void setTimeBetweenRetriesMillis(long timeMs) {
-        TIME_BETWEEN_RETRIES_MILLIS = timeMs;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || !getClass().equals(o.getClass())) return false;
-
-        RadioOnStateListener that = (RadioOnStateListener) o;
-
-        if (mNumRetriesSoFar != that.mNumRetriesSoFar) {
-            return false;
-        }
-        if (mCallback != null ? !mCallback.equals(that.mCallback) : that.mCallback != null) {
-            return false;
-        }
-        return mPhone != null ? mPhone.equals(that.mPhone) : that.mPhone == null;
-
-    }
-}
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 7311113..1852ed7 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -79,6 +79,8 @@
 import com.android.internal.telephony.domainselection.EmergencyCallDomainSelectionConnection;
 import com.android.internal.telephony.domainselection.NormalCallDomainSelectionConnection;
 import com.android.internal.telephony.emergency.EmergencyStateTracker;
+import com.android.internal.telephony.emergency.RadioOnHelper;
+import com.android.internal.telephony.emergency.RadioOnStateListener;
 import com.android.internal.telephony.imsphone.ImsExternalCallTracker;
 import com.android.internal.telephony.imsphone.ImsPhone;
 import com.android.internal.telephony.imsphone.ImsPhoneConnection;
diff --git a/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelector.java b/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelector.java
index cd588e1..aef193b 100644
--- a/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelector.java
+++ b/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelector.java
@@ -111,7 +111,7 @@
              * when {@link CarrierConfigManager#KEY_SUPPORT_EMERGENCY_SMS_OVER_IMS_BOOL} is set
              * to true.
              */
-            if (isEmergencySmsOverImsSupportedByConfig()) {
+            if (isEmergencySmsOverImsSupportedIfLteLimitedOrInService()) {
                 /**
                  * Emergency SMS should be supported via emergency PDN.
                  * If this condition is false, then need to fallback to CS network
@@ -142,22 +142,30 @@
         logi("selectDomain: " + mImsStateTracker.imsStateToString());
 
         if (isSmsOverImsAvailable()) {
-            if (mImsStateTracker.isImsRegisteredOverWlan()) {
-                if (!isEmergencySmsOverImsSupportedByConfig()) {
-                    notifyWlanSelected();
-                    return;
-                }
+            boolean isEmergencySmsOverImsSupportedIfLteLimitedOrInService =
+                    isEmergencySmsOverImsSupportedIfLteLimitedOrInService();
 
+            if (mImsStateTracker.isImsRegisteredOverWlan()) {
                 /**
                  * When {@link CarrierConfigManager#KEY_SUPPORT_EMERGENCY_SMS_OVER_IMS_BOOL}
                  * is set to true, the emergency SMS supports on the LTE network using the
-                 * emergency PDN. So, considering EUTRAN only at this point.
+                 * emergency PDN. As of now, since the emergency SMS doesn't use the emergency PDN
+                 * over WLAN, the domain selector reports the domain as WLAN only if
+                 * {@code isEmergencySmsOverImsSupportedIfLteLimitedOrInService} is set to false
+                 * and IMS is registered over WLAN.
+                 * Otherwise, the domain selector reports the domain as WWAN.
                  */
+                if (!isEmergencySmsOverImsSupportedIfLteLimitedOrInService) {
+                    notifyWlanSelected(false);
+                    return;
+                }
+
                 logi("DomainSelected: WLAN >> WWAN");
             }
-            notifyWwanSelected(NetworkRegistrationInfo.DOMAIN_PS);
+            notifyWwanSelected(NetworkRegistrationInfo.DOMAIN_PS,
+                    isEmergencySmsOverImsSupportedIfLteLimitedOrInService);
         } else {
-            notifyWwanSelected(NetworkRegistrationInfo.DOMAIN_CS);
+            notifyWwanSelected(NetworkRegistrationInfo.DOMAIN_CS, false);
         }
     }
 
@@ -166,15 +174,16 @@
      * configuration and the current network states.
      */
     private boolean isImsEmergencySmsAvailable() {
-        boolean emergencySmsOverImsSupportedByConfig = isEmergencySmsOverImsSupportedByConfig();
+        boolean isEmergencySmsOverImsSupportedIfLteLimitedOrInService =
+                isEmergencySmsOverImsSupportedIfLteLimitedOrInService();
         boolean networkAvailable = isNetworkAvailableForImsEmergencySms();
 
         logi("isImsEmergencySmsAvailable: "
-                + "emergencySmsOverIms=" + emergencySmsOverImsSupportedByConfig
+                + "emergencySmsOverIms=" + isEmergencySmsOverImsSupportedIfLteLimitedOrInService
                 + ", mmTelFeatureAvailable=" + mImsStateTracker.isMmTelFeatureAvailable()
                 + ", networkAvailable=" + networkAvailable);
 
-        return emergencySmsOverImsSupportedByConfig
+        return isEmergencySmsOverImsSupportedIfLteLimitedOrInService
                 && mImsStateTracker.isMmTelFeatureAvailable()
                 && networkAvailable;
     }
@@ -183,7 +192,7 @@
      * Checks if sending emergency SMS messages over IMS is supported when in LTE/limited LTE
      * (Emergency only) service mode from the carrier configuration.
      */
-    private boolean isEmergencySmsOverImsSupportedByConfig() {
+    private boolean isEmergencySmsOverImsSupportedIfLteLimitedOrInService() {
         if (mEmergencySmsOverImsSupportedByConfig == null) {
             CarrierConfigManager ccm = mContext.getSystemService(CarrierConfigManager.class);
 
diff --git a/src/com/android/services/telephony/domainselection/SmsDomainSelector.java b/src/com/android/services/telephony/domainselection/SmsDomainSelector.java
index 6930b13..95b04e2 100644
--- a/src/com/android/services/telephony/domainselection/SmsDomainSelector.java
+++ b/src/com/android/services/telephony/domainselection/SmsDomainSelector.java
@@ -147,12 +147,12 @@
 
         if (isSmsOverImsAvailable()) {
             if (mImsStateTracker.isImsRegisteredOverWlan()) {
-                notifyWlanSelected();
+                notifyWlanSelected(false);
                 return;
             }
-            notifyWwanSelected(NetworkRegistrationInfo.DOMAIN_PS);
+            notifyWwanSelected(NetworkRegistrationInfo.DOMAIN_PS, false);
         } else {
-            notifyWwanSelected(NetworkRegistrationInfo.DOMAIN_CS);
+            notifyWwanSelected(NetworkRegistrationInfo.DOMAIN_CS, false);
         }
     }
 
@@ -176,30 +176,33 @@
         }
     }
 
-    protected void notifyWlanSelected() {
-        logi("DomainSelected: WLAN");
-        mTransportSelectorCallback.onWlanSelected(false);
+    protected void notifyWlanSelected(boolean useEmergencyPdn) {
+        logi("DomainSelected: WLAN, E-PDN=" + useEmergencyPdn);
+        mTransportSelectorCallback.onWlanSelected(useEmergencyPdn);
         setDomainSelectionRequested(false);
     }
 
-    protected void notifyWwanSelected(@NetworkRegistrationInfo.Domain int domain) {
+    protected void notifyWwanSelected(@NetworkRegistrationInfo.Domain int domain,
+            boolean useEmergencyPdn) {
         if (mWwanSelectorCallback == null) {
             mTransportSelectorCallback.onWwanSelected((callback) -> {
                 mWwanSelectorCallback = callback;
-                notifyWwanSelectedInternal(domain);
+                notifyWwanSelectedInternal(domain, useEmergencyPdn);
             });
         } else {
-            notifyWwanSelectedInternal(domain);
+            notifyWwanSelectedInternal(domain, useEmergencyPdn);
         }
 
         setDomainSelectionRequested(false);
     }
 
-    protected void notifyWwanSelectedInternal(@NetworkRegistrationInfo.Domain int domain) {
-        logi("DomainSelected: WWAN/" + DomainSelectionService.getDomainName(domain));
+    protected void notifyWwanSelectedInternal(@NetworkRegistrationInfo.Domain int domain,
+            boolean useEmergencyPdn) {
+        logi("DomainSelected: WWAN/" + DomainSelectionService.getDomainName(domain)
+                + ", E-PDN=" + useEmergencyPdn);
 
         if (mWwanSelectorCallback != null) {
-            mWwanSelectorCallback.onDomainSelected(domain, false);
+            mWwanSelectorCallback.onDomainSelected(domain, useEmergencyPdn);
         } else {
             mTransportSelectorCallback.onSelectionTerminated(DisconnectCause.LOCAL);
         }
diff --git a/tests/src/com/android/phone/slice/SlicePurchaseControllerTest.java b/tests/src/com/android/phone/slice/SlicePurchaseControllerTest.java
index 544d7ea..a29ed09 100644
--- a/tests/src/com/android/phone/slice/SlicePurchaseControllerTest.java
+++ b/tests/src/com/android/phone/slice/SlicePurchaseControllerTest.java
@@ -151,11 +151,11 @@
         doReturn(CARRIER).when(mSlicePurchaseController).getSimOperator();
         replaceInstance(SlicePurchaseController.class, "sInstances", mSlicePurchaseController,
                 Map.of(PHONE_ID, mSlicePurchaseController));
-        replaceInstance(SlicePurchaseController.class, "mPremiumNetworkEntitlementApi",
-                mSlicePurchaseController, mPremiumNetworkEntitlementApi);
         replaceInstance(SlicePurchaseController.class, "mIsSlicingUpsellEnabled",
                 mSlicePurchaseController, true);
         mEntitlementResponse = new PremiumNetworkEntitlementResponse();
+        doReturn(mPremiumNetworkEntitlementApi).when(mSlicePurchaseController)
+                .getPremiumNetworkEntitlementApi();
         doReturn(mEntitlementResponse).when(mPremiumNetworkEntitlementApi)
                 .checkEntitlementStatus(anyInt());
     }
@@ -728,7 +728,8 @@
                 mContext.getBroadcast().getAction());
         assertTrue(mSlicePurchaseController.hasMessages(4 /* EVENT_PURCHASE_TIMEOUT */,
                 TelephonyManager.PREMIUM_CAPABILITY_PRIORITIZE_LATENCY));
-        verify(mContext).registerReceiver(any(BroadcastReceiver.class), any(IntentFilter.class));
+        verify(mContext).registerReceiver(any(BroadcastReceiver.class), any(IntentFilter.class),
+                eq(Context.RECEIVER_NOT_EXPORTED));
     }
 
     private void sendNetworkSlicingConfig(int capability, boolean configActive) {
diff --git a/tests/src/com/android/services/telephony/RadioOnStateListenerTest.java b/tests/src/com/android/services/telephony/RadioOnStateListenerTest.java
deleted file mode 100644
index d55a2fa..0000000
--- a/tests/src/com/android/services/telephony/RadioOnStateListenerTest.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (C) 2016 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.services.telephony;
-
-import static org.mockito.ArgumentMatchers.anyBoolean;
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Matchers.isNull;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.eq;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.os.AsyncResult;
-import android.os.Handler;
-import android.telephony.ServiceState;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import androidx.test.runner.AndroidJUnit4;
-
-import com.android.TelephonyTestBase;
-import com.android.internal.telephony.CommandsInterface;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneConstants;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-
-/**
- * Tests the RadioOnStateListener, which listens to one Phone and waits until its service
- * state changes to accepting emergency calls or in service. If it can not find a tower to camp onto
- * for emergency calls, then it will fail after a timeout period.
- */
-@RunWith(AndroidJUnit4.class)
-public class RadioOnStateListenerTest extends TelephonyTestBase {
-
-    private static final long TIMEOUT_MS = 1000;
-
-    @Mock Phone mMockPhone;
-    @Mock RadioOnStateListener.Callback mCallback;
-    @Mock CommandsInterface mMockCi;
-    RadioOnStateListener mListener;
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-        mListener = new RadioOnStateListener();
-    }
-
-    @Override
-    @After
-    public void tearDown() throws Exception {
-        mListener.setTimeBetweenRetriesMillis(5000);
-        mListener.setMaxNumRetries(5);
-        mListener.getHandler().removeCallbacksAndMessages(null);
-        // Wait for the queue to clear...
-        waitForHandlerAction(mListener.getHandler(), TIMEOUT_MS /*ms timeout*/);
-        mListener = null;
-        super.tearDown();
-    }
-
-    /**
-     * Ensure that we successfully register for the ServiceState changed messages in Telephony.
-     */
-    @Test
-    @SmallTest
-    public void testRegisterForCallback() {
-        mMockPhone.mCi = mMockCi;
-        mListener.waitForRadioOn(mMockPhone, mCallback, false, false);
-
-        waitForHandlerAction(mListener.getHandler(), TIMEOUT_MS);
-
-        verify(mMockPhone).unregisterForServiceStateChanged(any(Handler.class));
-        verify(mMockPhone).registerForServiceStateChanged(any(Handler.class),
-                eq(RadioOnStateListener.MSG_SERVICE_STATE_CHANGED), isNull());
-
-        verify(mMockCi).registerForOffOrNotAvailable(any(Handler.class),
-                eq(RadioOnStateListener.MSG_RADIO_OFF_OR_NOT_AVAILABLE), isNull());
-    }
-
-    /**
-     *  {@link RadioOnStateListener.Callback#isOkToCall(Phone, int)} returns true, so we are
-     *  expecting {@link RadioOnStateListener.Callback#onComplete(RadioOnStateListener, boolean)} to
-     *  return true.
-     */
-    @Test
-    @SmallTest
-    public void testPhoneChangeState_OkToCallTrue() {
-        ServiceState state = new ServiceState();
-        state.setState(ServiceState.STATE_IN_SERVICE);
-        when(mMockPhone.getServiceState()).thenReturn(state);
-        when(mMockPhone.getState()).thenReturn(PhoneConstants.State.IDLE);
-        when(mCallback.isOkToCall(eq(mMockPhone), anyInt())).thenReturn(true);
-        mMockPhone.mCi = mMockCi;
-        mListener.waitForRadioOn(mMockPhone, mCallback, false, false);
-        waitForHandlerAction(mListener.getHandler(), TIMEOUT_MS);
-
-        mListener.getHandler().obtainMessage(RadioOnStateListener.MSG_SERVICE_STATE_CHANGED,
-                new AsyncResult(null, state, null)).sendToTarget();
-
-        waitForHandlerAction(mListener.getHandler(), TIMEOUT_MS);
-        verify(mCallback).onComplete(eq(mListener), eq(true));
-    }
-
-    /**
-     * We never receive a
-     * {@link RadioOnStateListener.Callback#onComplete(RadioOnStateListener, boolean)} because
-     * {@link RadioOnStateListener.Callback#isOkToCall(Phone, int)} returns false.
-     */
-    @Test
-    @SmallTest
-    public void testPhoneChangeState_NoOkToCall_Timeout() {
-        ServiceState state = new ServiceState();
-        state.setState(ServiceState.STATE_OUT_OF_SERVICE);
-        when(mMockPhone.getState()).thenReturn(PhoneConstants.State.IDLE);
-        when(mCallback.isOkToCall(eq(mMockPhone), anyInt())).thenReturn(false);
-        when(mMockPhone.getServiceState()).thenReturn(state);
-        mMockPhone.mCi = mMockCi;
-        mListener.waitForRadioOn(mMockPhone, mCallback, false, false);
-        waitForHandlerAction(mListener.getHandler(), TIMEOUT_MS);
-
-        mListener.getHandler().obtainMessage(RadioOnStateListener.MSG_SERVICE_STATE_CHANGED,
-                new AsyncResult(null, state, null)).sendToTarget();
-
-        waitForHandlerAction(mListener.getHandler(), TIMEOUT_MS);
-        verify(mCallback, never()).onComplete(any(RadioOnStateListener.class), anyBoolean());
-    }
-
-    /**
-     * Tests {@link RadioOnStateListener.Callback#isOkToCall(Phone, int)} returning false and
-     * hitting the max number of retries. This should result in
-     * {@link RadioOnStateListener.Callback#onComplete(RadioOnStateListener, boolean)} returning
-     * false.
-     */
-    @Test
-    @SmallTest
-    public void testTimeout_RetryFailure() {
-        ServiceState state = new ServiceState();
-        state.setState(ServiceState.STATE_POWER_OFF);
-        when(mMockPhone.getState()).thenReturn(PhoneConstants.State.IDLE);
-        when(mMockPhone.getServiceState()).thenReturn(state);
-        when(mCallback.isOkToCall(eq(mMockPhone), anyInt())).thenReturn(false);
-        mListener.setTimeBetweenRetriesMillis(0/*ms*/);
-        mListener.setMaxNumRetries(2);
-
-        // Wait for the timer to expire and check state manually in onRetryTimeout
-        mMockPhone.mCi = mMockCi;
-        mListener.waitForRadioOn(mMockPhone, mCallback, false, false);
-        waitForHandlerActionDelayed(mListener.getHandler(), TIMEOUT_MS, TIMEOUT_MS /*delay*/);
-
-        verify(mCallback).onComplete(eq(mListener), eq(false));
-        verify(mMockPhone, times(2)).setRadioPower(eq(true),
-                eq(false), eq(false), eq(false));
-    }
-
-    @Test
-    @SmallTest
-    public void testTimeout_RetryFailure_ForEmergency() {
-        ServiceState state = new ServiceState();
-        state.setState(ServiceState.STATE_POWER_OFF);
-        when(mMockPhone.getState()).thenReturn(PhoneConstants.State.IDLE);
-        when(mMockPhone.getServiceState()).thenReturn(state);
-        when(mCallback.isOkToCall(eq(mMockPhone), anyInt())).thenReturn(false);
-        mListener.setTimeBetweenRetriesMillis(0/*ms*/);
-        mListener.setMaxNumRetries(2);
-
-        // Wait for the timer to expire and check state manually in onRetryTimeout
-        mMockPhone.mCi = mMockCi;
-        mListener.waitForRadioOn(mMockPhone, mCallback, true, true);
-        waitForHandlerActionDelayed(mListener.getHandler(), TIMEOUT_MS, TIMEOUT_MS /*delay*/);
-
-        verify(mCallback).onComplete(eq(mListener), eq(false));
-        verify(mMockPhone, times(2)).setRadioPower(eq(true),
-                eq(true), eq(true), eq(false));
-    }
-}
diff --git a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
index f115a43..49b9c98 100644
--- a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
+++ b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
@@ -91,6 +91,8 @@
 import com.android.internal.telephony.domainselection.NormalCallDomainSelectionConnection;
 import com.android.internal.telephony.emergency.EmergencyNumberTracker;
 import com.android.internal.telephony.emergency.EmergencyStateTracker;
+import com.android.internal.telephony.emergency.RadioOnHelper;
+import com.android.internal.telephony.emergency.RadioOnStateListener;
 import com.android.internal.telephony.gsm.SuppServiceNotification;
 import com.android.internal.telephony.imsphone.ImsPhone;
 import com.android.internal.telephony.satellite.SatelliteSOSMessageRecommender;
diff --git a/tests/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelectorTest.java b/tests/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelectorTest.java
index 1d89071..ed064cb 100644
--- a/tests/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelectorTest.java
+++ b/tests/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelectorTest.java
@@ -89,7 +89,6 @@
     private NetworkRegistrationInfo mNetworkRegistrationInfo;
     private boolean mCarrierConfigManagerNullTest = false;
     private BarringInfo mBarringInfo = new BarringInfo();
-    private ImsStateTracker.ImsStateListener mImsStateListener;
     private ImsStateTracker.BarringInfoListener mBarringInfoListener;
     private ImsStateTracker.ServiceStateListener mServiceStateListener;
     private EmergencySmsDomainSelector mDomainSelector;
@@ -415,7 +414,7 @@
         // onDomainSelected will be invoked only once
         // even though the domain selection was requested twice.
         verify(mWwanSelectorCallback).onDomainSelected(eq(NetworkRegistrationInfo.DOMAIN_PS),
-                eq(false));
+                eq(true));
         assertFalse(mDomainSelector.isDomainSelectionRequested());
     }
 
@@ -484,7 +483,7 @@
 
         // Expected: PS network
         verify(mWwanSelectorCallback).onDomainSelected(eq(NetworkRegistrationInfo.DOMAIN_PS),
-                eq(false));
+                eq(true));
     }
 
     @Test
@@ -535,7 +534,7 @@
 
         // Expected: PS network
         verify(mWwanSelectorCallback).onDomainSelected(eq(NetworkRegistrationInfo.DOMAIN_PS),
-                eq(false));
+                eq(true));
     }
 
     @Test
@@ -586,7 +585,7 @@
 
         // Expected: PS network
         verify(mWwanSelectorCallback).onDomainSelected(eq(NetworkRegistrationInfo.DOMAIN_PS),
-                eq(false));
+                eq(true));
     }
 
     @Test
@@ -673,7 +672,7 @@
 
         // Expected: PS network
         verify(mWwanSelectorCallback).onDomainSelected(eq(NetworkRegistrationInfo.DOMAIN_PS),
-                eq(false));
+                eq(true));
     }
 
     private void setUpCarrierConfig(boolean supported) {
diff --git a/tests/src/com/android/services/telephony/domainselection/SmsDomainSelectorTest.java b/tests/src/com/android/services/telephony/domainselection/SmsDomainSelectorTest.java
index 785127c..8f78a58 100644
--- a/tests/src/com/android/services/telephony/domainselection/SmsDomainSelectorTest.java
+++ b/tests/src/com/android/services/telephony/domainselection/SmsDomainSelectorTest.java
@@ -58,10 +58,8 @@
  */
 @RunWith(AndroidJUnit4.class)
 public class SmsDomainSelectorTest {
-    private static final String LOG_TAG = "DomainSelector-SMS";
     private static final int SLOT_0 = 0;
     private static final int SUB_1 = 1;
-    private static final int SUB_2 = 2;
 
     @Mock private TransportSelectorCallback mTransportSelectorCallback;
     @Mock private WwanSelectorCallback mWwanSelectorCallback;