Merge "Merge TP1A.211206.001" into t-keystone-qcom-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e852c40..81012a0 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -252,6 +252,8 @@
 
     <!-- Needed to listen to changes in projection state. -->
     <uses-permission android:name="android.permission.READ_PROJECTION_STATE"/>
+    <!-- Needed to access TelephonyProvider SIMINFO table. -->
+    <uses-permission android:name="android.permission.ACCESS_TELEPHONY_SIMINFO_DB"/>
 
     <uses-permission android:name="com.qti.permission.BIND_QTI_IMS_SERVICE" />
     <uses-permission android:name="com.qualcomm.qti.permission.USE_EXT_TELEPHONY_SERVICE" />
diff --git a/res/values-es-rUS/strings.xml b/res/values-es-rUS/strings.xml
index 54a2c7b..9d9971c 100644
--- a/res/values-es-rUS/strings.xml
+++ b/res/values-es-rUS/strings.xml
@@ -518,7 +518,7 @@
     <string name="puk2_locked" msgid="6497760825455461057">"SIM bloqueada con PUK2. Comunícate con el proveedor para desbloquearla."</string>
     <string name="pin2_unblocked" msgid="4481107908727789303">"El PIN2 ya no está bloqueado."</string>
     <string name="pin2_error_exception" msgid="8116103864600823641">"Error en la red o en la tarjeta SIM"</string>
-    <string name="doneButton" msgid="7371209609238460207">"Finalizado"</string>
+    <string name="doneButton" msgid="7371209609238460207">"Listo"</string>
     <string name="voicemail_settings_number_label" msgid="1265118640154688162">"Número de buzón de voz"</string>
     <string name="card_title_dialing" msgid="8742182654254431781">"Marcando"</string>
     <string name="card_title_redialing" msgid="18130232613559964">"Volviendo a marcar"</string>
diff --git a/res/values-hi/strings.xml b/res/values-hi/strings.xml
index c941be2..22aa185 100644
--- a/res/values-hi/strings.xml
+++ b/res/values-hi/strings.xml
@@ -890,14 +890,14 @@
     <string name="radio_info_ppp_resets_label" msgid="9131901102339077661">"चालू करने के बाद से पीपीपी रीसेट की संख्या:"</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">"Voice की सेवा:"</string>
+    <string name="radio_info_gsm_service_label" msgid="6443348321714241328">"वॉइस सेवा:"</string>
     <string name="radio_info_signal_strength_label" msgid="5545444702102543260">"सिग्नल कितना अच्छा है:"</string>
-    <string name="radio_info_call_status_label" msgid="7693575431923095487">"Voice कॉल की स्थिति:"</string>
+    <string name="radio_info_call_status_label" msgid="7693575431923095487">"वॉइस कॉल की स्थिति:"</string>
     <string name="radio_info_ppp_sent_label" msgid="6542208429356199695">"भेजा गया डेटा :"</string>
     <string name="radio_info_message_waiting_label" msgid="1886549432566952078">"मैसेज वेटिंग:"</string>
     <string name="radio_info_phone_number_label" msgid="2533852539562512203">"फ़ोन नंबर:"</string>
     <string name="radio_info_band_mode_label" msgid="23480556225515290">"रेडियो का बैंड चुनें"</string>
-    <string name="radio_info_voice_network_type_label" msgid="2395347336419593265">"Voice के नेटवर्क प्रकार:"</string>
+    <string name="radio_info_voice_network_type_label" msgid="2395347336419593265">"वॉइस नेटवर्क टाइप:"</string>
     <string name="radio_info_data_network_type_label" msgid="8886597029237501929">"डेटा नेटवर्क प्रकार:"</string>
     <string name="phone_index_label" msgid="6222406512768964268">"फ़ोन इंडेक्स चुनें"</string>
     <string name="radio_info_set_perferred_label" msgid="7408131389363136210">"पसंदीदा नेटवर्क प्रकार सेट करें:"</string>
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index 18ee718..738a019 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -297,7 +297,7 @@
     <string name="sip_accounts_removed_notification_title" msgid="3528076957535736095">"Account SIP deprecati trovati e rimossi"</string>
     <string name="sip_accounts_removed_notification_message" msgid="1916856744869791592">"Le chiamate SIP non sono più supportate dalla piattaforma Android.\nI tuoi account SIP esistenti (<xliff:g id="REMOVED_SIP_ACCOUNTS">%s</xliff:g>) sono stati rimossi.\nConferma l\'impostazione del tuo account predefinito per le chiamate."</string>
     <string name="sip_accounts_removed_notification_action" msgid="3772778402370555562">"Vai alle impostazioni"</string>
-    <string name="data_usage_title" msgid="8438592133893837464">"Utilizzo dei dati delle app"</string>
+    <string name="data_usage_title" msgid="8438592133893837464">"Utilizzo dati delle app"</string>
     <string name="data_usage_template" msgid="6287906680674061783">"Dati mobili usati: <xliff:g id="ID_1">%1$s</xliff:g> nel periodo <xliff:g id="ID_2">%2$s</xliff:g>"</string>
     <string name="advanced_options_title" msgid="9208195294513520934">"Avanzate"</string>
     <string name="carrier_settings_euicc" msgid="1190237227261337749">"Operatore"</string>
@@ -638,12 +638,12 @@
     <string name="phone_in_ecm_call_notification_text" msgid="653972232922670335">"Connessione dati disabilitata"</string>
     <string name="phone_in_ecm_notification_complete_time" msgid="7341624337163082759">"Nessuna connessione dati fino alle ore <xliff:g id="COMPLETETIME">%s</xliff:g>"</string>
     <plurals name="alert_dialog_exit_ecm" formatted="false" msgid="5425906903766466743">
+      <item quantity="one">The phone will be in Emergency Callback mode for <xliff:g id="COUNT_1">%s</xliff:g> minutes. While in this mode no applications using a data connection can be used. Do you want to exit now?</item>
       <item quantity="other">Il telefono sarà in modalità Richiamata di emergenza per <xliff:g id="COUNT_1">%s</xliff:g> minuti. In questa modalità non è possibile utilizzare applicazioni che impiegano una connessione dati. Vuoi uscire ora?</item>
-      <item quantity="one">Il telefono sarà in modalità Richiamata di emergenza per <xliff:g id="COUNT_0">%s</xliff:g> minuto. In questa modalità non è possibile utilizzare app che impiegano una connessione dati. Vuoi uscire ora?</item>
     </plurals>
     <plurals name="alert_dialog_not_avaialble_in_ecm" formatted="false" msgid="1152682528741457004">
+      <item quantity="one">The selected action isn\'t available while in the Emergency Callback mode. The phone will be in this mode for <xliff:g id="COUNT_1">%s</xliff:g> minutes. Do you want to exit now?</item>
       <item quantity="other">L\'azione selezionata non è disponibile in modalità Richiamata di emergenza. Il telefono sarà in questa modalità per <xliff:g id="COUNT_1">%s</xliff:g> minuti. Vuoi uscire ora?</item>
-      <item quantity="one">L\'azione selezionata non è disponibile in modalità Richiamata di emergenza. Il telefono sarà in questa modalità per <xliff:g id="COUNT_0">%s</xliff:g> minuto. Vuoi uscire ora?</item>
     </plurals>
     <string name="alert_dialog_in_ecm_call" msgid="1207545603149771978">"L\'azione selezionata non è disponibile in modalità di chiamata di emergenza."</string>
     <string name="progress_dialog_exiting_ecm" msgid="9159080081676927217">"Uscita dalla modalità di richiamata di emergenza"</string>
@@ -653,8 +653,8 @@
     <string name="phone_in_ecm_call_notification_text_without_data_restriction_hint" msgid="3747860785153531225">"Il telefono è in modalità di richiamata di emergenza"</string>
     <string name="phone_in_ecm_notification_complete_time_without_data_restriction_hint" msgid="3690292264812050858">"Fino alle ore <xliff:g id="COMPLETETIME">%s</xliff:g>"</string>
     <plurals name="alert_dialog_exit_ecm_without_data_restriction_hint" formatted="false" msgid="6477733043040328640">
+      <item quantity="one">Il telefono sarà in modalità di richiamata di emergenza per <xliff:g id="COUNT_1">%s</xliff:g> minuti.\nVuoi uscire ora?</item>
       <item quantity="other">Il telefono sarà in modalità di richiamata di emergenza per <xliff:g id="COUNT_1">%s</xliff:g> minuti.\nVuoi uscire ora?</item>
-      <item quantity="one">Il telefono sarà in modalità di richiamata di emergenza per <xliff:g id="COUNT_0">%s</xliff:g> minuto.\nVuoi uscire ora?</item>
     </plurals>
     <string name="voicemail_provider" msgid="4158806657253745294">"Servizio"</string>
     <string name="voicemail_settings" msgid="4451045613238972776">"Configurazione"</string>
diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml
index 850bfbb..226dc72 100644
--- a/res/values-nl/strings.xml
+++ b/res/values-nl/strings.xml
@@ -846,9 +846,9 @@
     <string name="dsds_dialog_confirm" msgid="9032004888134129885">"Opnieuw opstarten"</string>
     <string name="dsds_dialog_cancel" msgid="3245958947099586655">"Annuleren"</string>
     <string name="radio_info_radio_power" msgid="8805595022160471587">"Mobiel radiovermogen"</string>
-    <string name="radioInfo_menu_viewADN" msgid="4533179730908559846">"Adresboek op simkaart weergeven"</string>
-    <string name="radioInfo_menu_viewFDN" msgid="1847236480527032061">"Vaste nummers weergeven"</string>
-    <string name="radioInfo_menu_viewSDN" msgid="2613431584522392842">"Servicenummers weergeven"</string>
+    <string name="radioInfo_menu_viewADN" msgid="4533179730908559846">"Adresboek op simkaart bekijken"</string>
+    <string name="radioInfo_menu_viewFDN" msgid="1847236480527032061">"Vaste nummers bekijken"</string>
+    <string name="radioInfo_menu_viewSDN" msgid="2613431584522392842">"Servicenummers bekijken"</string>
     <string name="radioInfo_menu_getIMS" msgid="1950869267853198232">"IMS-servicestatus"</string>
     <string name="radio_info_ims_reg_status_title" msgid="6875885401313992007">"IMS-status"</string>
     <string name="radio_info_ims_reg_status_registered" msgid="7095182114078864326">"Geregistreerd"</string>
diff --git a/res/values-pa/strings.xml b/res/values-pa/strings.xml
index a63243f..7340540 100644
--- a/res/values-pa/strings.xml
+++ b/res/values-pa/strings.xml
@@ -338,24 +338,24 @@
     <string name="enable_disable_maintenance" msgid="3824817751053035017">"ਪ੍ਰਬੰਧਨ"</string>
     <string name="maintenance_enable" msgid="2646784483222342290">"ਪ੍ਰਬੰਧਨ ਸਮਰਥਿਤ"</string>
     <string name="maintenance_disable" msgid="2121032601497725602">"ਪ੍ਰਬੰਧਨ ਅਸਮਰਥਿਤ"</string>
-    <string name="general_news_settings" msgid="2670499575962080411">"ਸਧਾਰਨ ਖ਼ਬਰਾਂ"</string>
-    <string name="bf_news_settings" msgid="8571709425370794221">"ਵਪਾਰਕ ਅਤੇ ਵਿੱਤੀ ਖ਼ਬਰਾਂ"</string>
-    <string name="sports_news_settings" msgid="2684364556989168438">"ਖੇਡ ਦੀਆਂ ਖ਼ਬਰਾਂ"</string>
-    <string name="entertainment_news_settings" msgid="4228527702346305543">"ਮਨੋਰੰਜਕ ਖ਼ਬਰਾਂ"</string>
+    <string name="general_news_settings" msgid="2670499575962080411">"ਸਧਾਰਨ ਖਬਰਾਂ"</string>
+    <string name="bf_news_settings" msgid="8571709425370794221">"ਕਾਰੋਬਾਰੀ ਅਤੇ ਵਿੱਤੀ ਖਬਰਾਂ"</string>
+    <string name="sports_news_settings" msgid="2684364556989168438">"ਖੇਡਾਂ ਨਾਲ ਸੰਬੰਧਿਤ ਖਬਰਾਂ"</string>
+    <string name="entertainment_news_settings" msgid="4228527702346305543">"ਮਨੋਰੰਜਨ ਸੰਬੰਧੀ ਖਬਰਾਂ"</string>
     <string name="enable_disable_local" msgid="7654175079979415572">"ਸਥਾਨਕ"</string>
-    <string name="local_enable" msgid="790606890868710629">"ਸਥਾਨਕ ਖ਼ਬਰਾਂ ਸਮਰਥਿਤ"</string>
-    <string name="local_disable" msgid="7649945293198602877">"ਸਥਾਨਕ ਖ਼ਬਰਾਂ ਅਸਮਰਥਿਤ"</string>
+    <string name="local_enable" msgid="790606890868710629">"ਸਥਾਨਕ ਖਬਰਾਂ ਚਾਲੂ ਕੀਤੀਆਂ ਗਈਆਂ"</string>
+    <string name="local_disable" msgid="7649945293198602877">"ਸਥਾਨਕ ਖਬਰਾਂ ਬੰਦ ਕੀਤੀਆਂ ਗਈਆਂ"</string>
     <string name="enable_disable_regional" msgid="5783403191376564638">"ਖੇਤਰੀ"</string>
-    <string name="regional_enable" msgid="7730109417536296079">"ਖੇਤਰੀ ਖ਼ਬਰਾਂ ਸਮਰਥਿਤ"</string>
-    <string name="regional_disable" msgid="3781951818157772545">"ਖੇਤਰੀ ਖ਼ਬਰਾਂ ਅਸਮਰਥਿਤ"</string>
+    <string name="regional_enable" msgid="7730109417536296079">"ਖੇਤਰੀ ਖਬਰਾਂ ਚਾਲੂ ਕੀਤੀਆਂ ਗਈਆਂ"</string>
+    <string name="regional_disable" msgid="3781951818157772545">"ਖੇਤਰੀ ਖਬਰਾਂ ਬੰਦ ਕੀਤੀਆਂ ਗਈਆਂ"</string>
     <string name="enable_disable_national" msgid="6198481711934897632">"ਰਾਸ਼ਟਰੀ"</string>
-    <string name="national_enable" msgid="5159683504138239304">"ਰਾਸ਼ਟਰੀ ਖ਼ਬਰਾਂ ਸਮਰਥਿਤ"</string>
-    <string name="national_disable" msgid="8484356368757118987">"ਰਾਸ਼ਟਰੀ ਖ਼ਬਰਾਂ ਅਸਮਰਥਿਤ"</string>
+    <string name="national_enable" msgid="5159683504138239304">"ਰਾਸ਼ਟਰੀ ਖਬਰਾਂ ਚਾਲੂ ਕੀਤੀਆਂ ਗਈਆਂ"</string>
+    <string name="national_disable" msgid="8484356368757118987">"ਰਾਸ਼ਟਰੀ ਖਬਰਾਂ ਬੰਦ ਕੀਤੀਆਂ ਗਈਆਂ"</string>
     <string name="enable_disable_international" msgid="4204334217211198792">"ਅੰਤਰਰਾਸ਼ਟਰੀ"</string>
-    <string name="international_enable" msgid="8943466745792690340">"ਅੰਤਰਰਾਸ਼ਟਰੀ ਖ਼ਬਰਾਂ ਸਮਰਥਿਤ"</string>
-    <string name="international_disable" msgid="4803498658100318265">"ਅੰਤਰਰਾਸ਼ਟਰੀ ਖ਼ਬਰਾਂ ਅਸਮਰਥਿਤ"</string>
+    <string name="international_enable" msgid="8943466745792690340">"ਅੰਤਰਰਾਸ਼ਟਰੀ ਖਬਰਾਂ ਚਾਲੂ ਕੀਤੀਆਂ ਗਈਆਂ"</string>
+    <string name="international_disable" msgid="4803498658100318265">"ਅੰਤਰਰਾਸ਼ਟਰੀ ਖਬਰਾਂ ਬੰਦ ਕੀਤੀਆਂ ਗਈਆਂ"</string>
     <string name="list_language_title" msgid="1850167908665485738">"ਭਾਸ਼ਾ"</string>
-    <string name="list_language_summary" msgid="7921756070782277559">"ਖ਼ਬਰਾਂ ਦੀ ਭਾਸ਼ਾ ਚੁਣੋ"</string>
+    <string name="list_language_summary" msgid="7921756070782277559">"ਖਬਰਾਂ ਦੀ ਭਾਸ਼ਾ ਚੁਣੋ"</string>
   <string-array name="list_language_entries">
     <item msgid="2347238508726934281">"ਅੰਗ੍ਰੇਜ਼ੀ"</item>
     <item msgid="5172468397620875174">"ਫਰਾਂਸੀਸੀ"</item>
@@ -405,9 +405,9 @@
     <string name="enable_disable_mhh" msgid="715930476289202466">"ਚਿਕਿਤਸਾ, ਸਿਹਤ ਅਤੇ ਹਸਪਤਾਲ"</string>
     <string name="mhh_enable" msgid="7224396815285147008">"ਚਿਕਿਤਸਾ, ਸਿਹਤ ਅਤੇ ਹਸਪਤਾਲ ਸਮਰਥਿਤ"</string>
     <string name="mhh_disable" msgid="5503643028885686265">"ਚਿਕਿਤਸਾ, ਸਿਹਤ ਅਤੇ ਹਸਪਤਾਲ ਅਸਮਰਥਿਤ"</string>
-    <string name="enable_disable_technology_news" msgid="2794845609698078400">"ਟੈਕਨਾਲੋਜੀ ਖ਼ਬਰਾਂ"</string>
-    <string name="technology_news_enable" msgid="1908991199492598311">"ਟੈਕਨਾਲੋਜੀ ਖ਼ਬਰਾਂ ਸਮਰਥਿਤ"</string>
-    <string name="technology_news_disable" msgid="8388582607149800889">"ਟੈਕਨਾਲੋਜੀ ਖ਼ਬਰਾਂ ਅਸਮਰਥਿਤ"</string>
+    <string name="enable_disable_technology_news" msgid="2794845609698078400">"ਤਕਨਾਲੋਜੀ ਖਬਰਾਂ"</string>
+    <string name="technology_news_enable" msgid="1908991199492598311">"ਤਕਨਾਲੋਜੀ ਖਬਰਾਂ ਚਾਲੂ ਕੀਤੀਆਂ ਗਈਆਂ"</string>
+    <string name="technology_news_disable" msgid="8388582607149800889">"ਤਕਨਾਲੋਜੀ ਖਬਰਾਂ ਬੰਦ ਕੀਤੀਆਂ ਗਈਆਂ"</string>
     <string name="enable_disable_multi_category" msgid="5958248155437940625">"ਮਲਟੀ-ਸ਼੍ਰੇਣੀ"</string>
     <string name="multi_category_enable" msgid="4531915767817483960">"ਮਲਟੀ-ਸ਼੍ਰੇਣੀ ਸਮਰਥਿਤ"</string>
     <string name="multi_category_disable" msgid="6325934413701238104">"ਮਲਟੀ-ਸ਼੍ਰੇਣੀ ਅਸਮਰਥਿਤ"</string>
diff --git a/res/values-pt-rPT/strings.xml b/res/values-pt-rPT/strings.xml
index bed887f..9b6d5df 100644
--- a/res/values-pt-rPT/strings.xml
+++ b/res/values-pt-rPT/strings.xml
@@ -638,12 +638,12 @@
     <string name="phone_in_ecm_call_notification_text" msgid="653972232922670335">"Ligação de dados desativada"</string>
     <string name="phone_in_ecm_notification_complete_time" msgid="7341624337163082759">"Sem ligação de dados até à(s) <xliff:g id="COMPLETETIME">%s</xliff:g>"</string>
     <plurals name="alert_dialog_exit_ecm" formatted="false" msgid="5425906903766466743">
-      <item quantity="other">O telemóvel fica no modo de Chamada de emergência durante <xliff:g id="COUNT_1">%s</xliff:g> minutos. Neste modo, não é possível utilizar aplicações com uma ligação de dados. Pretende sair agora?</item>
       <item quantity="one">O telemóvel fica no modo de Chamada de emergência durante <xliff:g id="COUNT_0">%s</xliff:g> minuto. Neste modo, não é possível utilizar aplicações com uma ligação de dados. Pretende sair agora?</item>
+      <item quantity="other">O telemóvel fica no modo de Chamada de emergência durante <xliff:g id="COUNT_1">%s</xliff:g> minutos. Neste modo, não é possível utilizar aplicações com uma ligação de dados. Pretende sair agora?</item>
     </plurals>
     <plurals name="alert_dialog_not_avaialble_in_ecm" formatted="false" msgid="1152682528741457004">
-      <item quantity="other">A ação selecionada não está disponível no modo de Chamada de emergência. O telemóvel fica neste modo durante <xliff:g id="COUNT_1">%s</xliff:g> minutos. Pretende sair agora?</item>
       <item quantity="one">A ação selecionada não está disponível no modo de Chamada de emergência. O telemóvel fica neste modo durante <xliff:g id="COUNT_0">%s</xliff:g> minuto. Pretende sair agora?</item>
+      <item quantity="other">A ação selecionada não está disponível no modo de Chamada de emergência. O telemóvel fica neste modo durante <xliff:g id="COUNT_1">%s</xliff:g> minutos. Pretende sair agora?</item>
     </plurals>
     <string name="alert_dialog_in_ecm_call" msgid="1207545603149771978">"A ação selecionada não está disponível durante uma chamada de emergência."</string>
     <string name="progress_dialog_exiting_ecm" msgid="9159080081676927217">"A sair do modo de chamada de retorno de emergência"</string>
@@ -653,8 +653,8 @@
     <string name="phone_in_ecm_call_notification_text_without_data_restriction_hint" msgid="3747860785153531225">"O telemóvel está no modo de chamada de retorno de emergência."</string>
     <string name="phone_in_ecm_notification_complete_time_without_data_restriction_hint" msgid="3690292264812050858">"Até à(s) <xliff:g id="COMPLETETIME">%s</xliff:g>."</string>
     <plurals name="alert_dialog_exit_ecm_without_data_restriction_hint" formatted="false" msgid="6477733043040328640">
-      <item quantity="other">O telemóvel ficará no modo de chamada de retorno de emergência durante <xliff:g id="COUNT_1">%s</xliff:g> minutos.\nPretende sair agora?</item>
       <item quantity="one">O telemóvel ficará no modo de chamada de retorno de emergência durante <xliff:g id="COUNT_0">%s</xliff:g> minuto.\nPretende sair agora?</item>
+      <item quantity="other">O telemóvel ficará no modo de chamada de retorno de emergência durante <xliff:g id="COUNT_1">%s</xliff:g> minutos.\nPretende sair agora?</item>
     </plurals>
     <string name="voicemail_provider" msgid="4158806657253745294">"Serviço"</string>
     <string name="voicemail_settings" msgid="4451045613238972776">"Configuração"</string>
diff --git a/res/values-te/strings.xml b/res/values-te/strings.xml
index 6353cb4..078a25b 100644
--- a/res/values-te/strings.xml
+++ b/res/values-te/strings.xml
@@ -849,8 +849,8 @@
     <string name="radioInfo_menu_viewADN" msgid="4533179730908559846">"SIM అడ్రస్‌ పుస్తకాన్ని చూడండి"</string>
     <string name="radioInfo_menu_viewFDN" msgid="1847236480527032061">"ఫిక్స్‌డ్ డయలింగ్ నంబర్‌లను చూడండి"</string>
     <string name="radioInfo_menu_viewSDN" msgid="2613431584522392842">"సర్వీస్ డయలింగ్ నంబర్‌లను చూడండి"</string>
-    <string name="radioInfo_menu_getIMS" msgid="1950869267853198232">"IMS సేవ స్థితి"</string>
-    <string name="radio_info_ims_reg_status_title" msgid="6875885401313992007">"IMS స్థితి"</string>
+    <string name="radioInfo_menu_getIMS" msgid="1950869267853198232">"IMS సేవ స్టేటస్‌"</string>
+    <string name="radio_info_ims_reg_status_title" msgid="6875885401313992007">"IMS స్టేటస్‌"</string>
     <string name="radio_info_ims_reg_status_registered" msgid="7095182114078864326">"నమోదు చేయబడింది"</string>
     <string name="radio_info_ims_reg_status_not_registered" msgid="8045821447288876085">"నమోదు కాలేదు"</string>
     <string name="radio_info_ims_feature_status_available" msgid="6493200914756969292">"అందుబాటులో ఉన్నారు"</string>
diff --git a/sip/res/values-te/strings.xml b/sip/res/values-te/strings.xml
index b646f9d..b821a60 100644
--- a/sip/res/values-te/strings.xml
+++ b/sip/res/values-te/strings.xml
@@ -36,7 +36,7 @@
     <string name="alert_dialog_close" msgid="1734746505531110706">"ప్రొఫైల్‌ను మూసివేయండి"</string>
     <string name="alert_dialog_ok" msgid="7806760618798687406">"సరే"</string>
     <string name="close_profile" msgid="3756064641769751774">"మూసివేయి"</string>
-    <string name="registration_status_checking_status" msgid="884179594507591180">"స్థితిని తనిఖీ చేస్తోంది..."</string>
+    <string name="registration_status_checking_status" msgid="884179594507591180">"స్టేటస్‌ని తనిఖీ చేస్తోంది..."</string>
     <string name="registration_status_registering" msgid="7986331597809521791">"నమోదు చేస్తోంది…"</string>
     <string name="registration_status_still_trying" msgid="7178623685868766282">"ఇప్పటికీ ప్రయత్నిస్తోంది..."</string>
     <string name="registration_status_not_receiving" msgid="3873074208531938401">"కాల్స్‌ను స్వీకరించడం లేదు."</string>
diff --git a/src/com/android/phone/CallForwardEditPreference.java b/src/com/android/phone/CallForwardEditPreference.java
index b33646b..906b09a 100644
--- a/src/com/android/phone/CallForwardEditPreference.java
+++ b/src/com/android/phone/CallForwardEditPreference.java
@@ -85,6 +85,7 @@
             CarrierXmlParser.SsEntry.SSAction.UNKNOWN;
     private int mAction;
     private HashMap<String, String> mCfInfo;
+    private long mDelayMillisAfterUssdSet = 1000;
 
     private boolean mExpectMore;
     private boolean mIsTimerEnabled;
@@ -931,8 +932,9 @@
                 mPhone.getCallForwardingOption(reason, mServiceClass,
                         obtainMessage(MESSAGE_GET_CF, msg.arg1, MESSAGE_SET_CF, ar.exception));
             } else {
-                mHandler.sendMessage(mHandler.obtainMessage(mHandler.MESSAGE_GET_CF_USSD,
-                        msg.arg1, MyHandler.MESSAGE_SET_CF, ar.exception));
+                mHandler.sendMessageDelayed(mHandler.obtainMessage(mHandler.MESSAGE_GET_CF_USSD,
+                        msg.arg1, MyHandler.MESSAGE_SET_CF, ar.exception),
+                        mDelayMillisAfterUssdSet);
             }
         }
 
diff --git a/src/com/android/phone/ImsRcsController.java b/src/com/android/phone/ImsRcsController.java
index 7d594d1..3618d58 100644
--- a/src/com/android/phone/ImsRcsController.java
+++ b/src/com/android/phone/ImsRcsController.java
@@ -582,6 +582,7 @@
             throw new SecurityException("Passed in PackageName can not be found on device");
         }
 
+        final int uid = Binder.getCallingUid();
         final long identity = Binder.clearCallingIdentity();
         SipTransportController transport = getRcsFeatureController(subId).getFeature(
                 SipTransportController.class);
@@ -590,7 +591,7 @@
                     "This subscription does not support the creation of SIP delegates");
         }
         try {
-            transport.createSipDelegate(subId, request, packageName, delegateState,
+            transport.createSipDelegate(subId, uid, request, packageName, delegateState,
                     delegateMessage);
         } catch (ImsException e) {
             throw new ServiceSpecificException(e.getCode(), e.getMessage());
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index b28806c..31e8792 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -28,10 +28,13 @@
 import android.Manifest.permission;
 import android.annotation.NonNull;
 import android.annotation.Nullable;
+import android.annotation.RequiresPermission;
 import android.app.AppOpsManager;
 import android.app.PendingIntent;
 import android.app.compat.CompatChanges;
 import android.app.role.RoleManager;
+import android.compat.annotation.ChangeId;
+import android.compat.annotation.EnabledSince;
 import android.content.ComponentName;
 import android.content.ContentResolver;
 import android.content.Context;
@@ -105,7 +108,9 @@
 import android.telephony.TelephonyScanManager;
 import android.telephony.ThermalMitigationRequest;
 import android.telephony.UiccCardInfo;
+import android.telephony.UiccPortInfo;
 import android.telephony.UiccSlotInfo;
+import android.telephony.UiccSlotMapping;
 import android.telephony.UssdResponse;
 import android.telephony.VisualVoicemailSmsFilterSettings;
 import android.telephony.data.ApnSetting;
@@ -218,6 +223,8 @@
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -404,6 +411,16 @@
             "reset_network_erase_modem_config_enabled";
 
     private static final int SET_NETWORK_SELECTION_MODE_AUTOMATIC_TIMEOUT_MS = 2000; // 2 seconds
+    /**
+     * With support for MEP(multiple enabled profile) in Android T, a SIM card can have more than
+     * one ICCID active at the same time.
+     * Apps should use below API signatures if targeting SDK is T and beyond.
+     *
+     * @hide
+     */
+    @ChangeId
+    @EnabledSince(targetSdkVersion = Build.VERSION_CODES.TIRAMISU)
+    public static final long GET_API_SIGNATURES_FROM_UICC_PORT_INFO = 202110963L;
 
     /**
      * A request object to use for transmitting data to an ICC.
@@ -1494,9 +1511,9 @@
 
                 case CMD_SWITCH_SLOTS:
                     request = (MainThreadRequest) msg.obj;
-                    int[] physicalSlots = (int[]) request.argument;
+                    List<UiccSlotMapping> slotMapping = (List<UiccSlotMapping>) request.argument;
                     onCompleted = obtainMessage(EVENT_SWITCH_SLOTS_DONE, request);
-                    UiccController.getInstance().switchSlots(physicalSlots, onCompleted);
+                    UiccController.getInstance().switchSlots(slotMapping, onCompleted);
                     break;
 
                 case EVENT_SWITCH_SLOTS_DONE:
@@ -2923,6 +2940,9 @@
         try {
             final Phone phone = getPhone(subId);
             if (phone != null) {
+                if (phone.isUsingNewDataStack()) {
+                    return phone.getDataNetworkController().getInternetDataNetworkState();
+                }
                 return PhoneConstantConversions.convertDataState(phone.getDataConnectionState());
             } else {
                 return PhoneConstantConversions.convertDataState(
@@ -5062,10 +5082,13 @@
     @Override
     public int getDataNetworkTypeForSubscriber(int subId, String callingPackage,
             String callingFeatureId) {
-        if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, subId, callingPackage, callingFeatureId,
-                "getDataNetworkTypeForSubscriber")) {
-            return TelephonyManager.NETWORK_TYPE_UNKNOWN;
+        String functionName = "getDataNetworkTypeForSubscriber";
+        if (!TelephonyPermissions.checkCallingOrSelfReadNonDangerousPhoneStateNoThrow(
+                mApp, functionName)) {
+            if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+                    mApp, subId, callingPackage, callingFeatureId, functionName)) {
+                return TelephonyManager.NETWORK_TYPE_UNKNOWN;
+            }
         }
 
         final long identity = Binder.clearCallingIdentity();
@@ -5087,10 +5110,13 @@
     @Override
     public int getVoiceNetworkTypeForSubscriber(int subId, String callingPackage,
             String callingFeatureId) {
-        if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, subId, callingPackage, callingFeatureId,
-                "getDataNetworkTypeForSubscriber")) {
-            return TelephonyManager.NETWORK_TYPE_UNKNOWN;
+        String functionName = "getVoiceNetworkTypeForSubscriber";
+        if (!TelephonyPermissions.checkCallingOrSelfReadNonDangerousPhoneStateNoThrow(
+                mApp, functionName)) {
+            if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+                    mApp, subId, callingPackage, callingFeatureId, functionName)) {
+                return TelephonyManager.NETWORK_TYPE_UNKNOWN;
+            }
         }
 
         final long identity = Binder.clearCallingIdentity();
@@ -6601,18 +6627,25 @@
      * There are other factors deciding whether mobile data is actually enabled, but they are
      * not considered here. See {@link #isDataEnabled(int)} for more details.
      *
-     * Accepts either ACCESS_NETWORK_STATE, MODIFY_PHONE_STATE or carrier privileges.
+     * Accepts either READ_BASIC_PHONE_STATE, ACCESS_NETWORK_STATE, MODIFY_PHONE_STATE
+     * or carrier privileges.
      *
      * @return {@code true} if data is enabled else {@code false}
      */
     @Override
     public boolean isUserDataEnabled(int subId) {
+        String functionName = "isUserDataEnabled";
         try {
-            mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
-                    null);
+            try {
+                mApp.enforceCallingOrSelfPermission(permission.READ_BASIC_PHONE_STATE,
+                        functionName);
+            } catch (Exception e) {
+                mApp.enforceCallingOrSelfPermission(permission.ACCESS_NETWORK_STATE, functionName);
+            }
         } catch (Exception e) {
             TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
-                    mApp, subId, "isUserDataEnabled");
+                    mApp, subId, functionName);
+
         }
 
         final long identity = Binder.clearCallingIdentity();
@@ -6642,27 +6675,39 @@
      */
     @Override
     public boolean isDataEnabled(int subId) {
+        String functionName = "isDataEnabled";
         try {
             try {
                 mApp.enforceCallingOrSelfPermission(
                         android.Manifest.permission.ACCESS_NETWORK_STATE,
-                        null);
+                        functionName);
             } catch (Exception e) {
-                mApp.enforceCallingOrSelfPermission(android.Manifest.permission.READ_PHONE_STATE,
-                        "isDataEnabled");
+                try {
+                    mApp.enforceCallingOrSelfPermission(
+                            android.Manifest.permission.READ_PHONE_STATE,
+                            functionName);
+                } catch (Exception e2) {
+                    mApp.enforceCallingOrSelfPermission(
+                            permission.READ_BASIC_PHONE_STATE, functionName);
+                }
             }
         } catch (Exception e) {
-            enforceReadPrivilegedPermission("isDataEnabled");
+            enforceReadPrivilegedPermission(functionName);
         }
 
         final long identity = Binder.clearCallingIdentity();
         try {
             int phoneId = mSubscriptionController.getPhoneId(subId);
-            if (DBG) log("isDataEnabled: subId=" + subId + " phoneId=" + phoneId);
             Phone phone = PhoneFactory.getPhone(phoneId);
             if (phone != null) {
-                boolean retVal = phone.getDataEnabledSettings().isDataEnabled();
-                if (DBG) log("isDataEnabled: subId=" + subId + " retVal=" + retVal);
+                boolean retVal;
+                if (phone.isUsingNewDataStack()) {
+                    retVal = phone.getDataNetworkController().getDataSettingsManager()
+                            .isDataEnabled();
+                } else {
+                    retVal = phone.getDataEnabledSettings().isDataEnabled();
+                }
+                if (DBG) log("isDataEnabled: " + retVal + ", subId=" + subId);
                 return retVal;
             } else {
                 if (DBG) loge("isDataEnabled: no phone subId=" + subId + " retVal=false");
@@ -6682,12 +6727,24 @@
     @Override
     public boolean isDataEnabledForReason(int subId,
             @TelephonyManager.DataEnabledReason int reason) {
+        String functionName = "isDataEnabledForReason";
         try {
-            mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
-                    null);
+            try {
+                mApp.enforceCallingOrSelfPermission(
+                        android.Manifest.permission.ACCESS_NETWORK_STATE,
+                        functionName);
+            } catch (Exception e) {
+                mApp.enforceCallingOrSelfPermission(permission.READ_BASIC_PHONE_STATE,
+                        functionName);
+            }
         } catch (Exception e) {
-            mApp.enforceCallingOrSelfPermission(android.Manifest.permission.READ_PHONE_STATE,
-                    "isDataEnabledForReason");
+            try {
+                mApp.enforceCallingOrSelfPermission(android.Manifest.permission.READ_PHONE_STATE,
+                        functionName);
+            } catch (Exception e2) {
+                TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+                        mApp, subId, functionName);
+            }
         }
 
 
@@ -8628,6 +8685,7 @@
      *
      * <p>Requires one of the following permissions:
      * {@link android.Manifest.permission#ACCESS_NETWORK_STATE},
+     * {@link android.Manifest.permission#READ_BASIC_PHONE_STATE},
      * {@link android.Manifest.permission#READ_PHONE_STATE} or that the calling app has carrier
      * privileges.
      *
@@ -8637,12 +8695,19 @@
      */
     @Override
     public boolean isDataRoamingEnabled(int subId) {
+        String functionName = "isDataRoamingEnabled";
         try {
-            mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
-                    null);
+            try {
+                mApp.enforceCallingOrSelfPermission(
+                        android.Manifest.permission.ACCESS_NETWORK_STATE,
+                        functionName);
+            } catch (Exception e) {
+                mApp.enforceCallingOrSelfPermission(
+                        permission.READ_BASIC_PHONE_STATE, functionName);
+            }
         } catch (Exception e) {
             TelephonyPermissions.enforceCallingOrSelfReadPhoneStatePermissionOrCarrierPrivilege(
-                    mApp, subId, "isDataRoamingEnabled");
+                    mApp, subId, functionName);
         }
 
         boolean isEnabled = false;
@@ -8702,29 +8767,24 @@
         return isAllowed;
     }
 
-    private boolean haveCarrierPrivilegeAccess(UiccCard card, String callingPackage) {
-        // TODO once MEP API refactoring CL is merged, loop port list from UiccCardInfo,
-        //  and if find the matching UiccPort by UiccController.getUiccPortForSlot(slot, portIdx)
-        //  Update each UiccPort object based on privilege access
-        UiccPort[] uiccPorts = card.getUiccPortList();
-        for (UiccPort port : uiccPorts) {
-            UiccProfile profile = port.getUiccProfile();
-            if (profile == null ||
-                    profile.getCarrierPrivilegeStatus(mApp.getPackageManager(), callingPackage)
-                    != TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
-                return false;
-            }
+    private boolean haveCarrierPrivilegeAccess(UiccPort port, String callingPackage) {
+        UiccProfile profile = port.getUiccProfile();
+        if (profile == null ||
+                profile.getCarrierPrivilegeStatus(mApp.getPackageManager(), callingPackage)
+                != TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
+            return false;
         }
         return true;
     }
 
     @Override
     public List<UiccCardInfo> getUiccCardsInfo(String callingPackage) {
-        // Verify that tha callingPackage belongs to the calling UID
+        // Verify that the callingPackage belongs to the calling UID
         mApp.getSystemService(AppOpsManager.class)
                 .checkPackage(Binder.getCallingUid(), callingPackage);
 
         boolean hasReadPermission = false;
+        boolean isIccIdAccessRestricted = false;
         try {
             enforceReadPrivilegedPermission("getUiccCardsInfo");
             hasReadPermission = true;
@@ -8736,7 +8796,11 @@
                 throw new SecurityException("Caller does not have permission.");
             }
         }
-
+        // checking compatibility, if calling app's target SDK is T and beyond.
+        if (CompatChanges.isChangeEnabled(GET_API_SIGNATURES_FROM_UICC_PORT_INFO,
+                Binder.getCallingUid())) {
+            isIccIdAccessRestricted = true;
+        }
         final long identity = Binder.clearCallingIdentity();
         try {
             UiccController uiccController = UiccController.getInstance();
@@ -8748,22 +8812,44 @@
             // Remove private info if the caller doesn't have access
             ArrayList<UiccCardInfo> filteredInfos = new ArrayList<>();
             for (UiccCardInfo cardInfo : cardInfos) {
+                //setting the value after compatibility check
+                cardInfo.setIccIdAccessRestricted(isIccIdAccessRestricted);
                 // For an inactive eUICC, the UiccCard will be null even though the UiccCardInfo
                 // is available
-                UiccCard card = uiccController.getUiccCardForSlot(cardInfo.getSlotIndex());
-                // TODO remove card.getUiccPortList().length once MEP API refactoring CL is merged
-                //  Get UiccPortInfo from CardInfo and process further based on each UiccPort
-                if (card == null || card.getUiccPortList().length == 0) {
-                    // assume no access if the card or ports are unavailable
-                    filteredInfos.add(cardInfo.getUnprivileged());
+                UiccCard card = uiccController.getUiccCardForSlot(cardInfo.getPhysicalSlotIndex());
+                if (card == null) {
+                    // assume no access if the card is unavailable
+                    filteredInfos.add(getUiccCardInfoUnPrivileged(cardInfo));
                     continue;
                 }
-
-                if (haveCarrierPrivilegeAccess(card, callingPackage)) {
-                    filteredInfos.add(cardInfo);
-                } else {
-                    filteredInfos.add(cardInfo.getUnprivileged());
+                Collection<UiccPortInfo> portInfos = cardInfo.getPorts();
+                if (portInfos.isEmpty()) {
+                    filteredInfos.add(getUiccCardInfoUnPrivileged(cardInfo));
+                    continue;
                 }
+                List<UiccPortInfo> uiccPortInfos = new  ArrayList<>();
+                for (UiccPortInfo portInfo : portInfos) {
+                    UiccPort port = uiccController.getUiccPortForSlot(
+                            cardInfo.getPhysicalSlotIndex(), portInfo.getPortIndex());
+                    if (port == null) {
+                        // assume no access if port is null
+                        uiccPortInfos.add(getUiccPortInfoUnPrivileged(portInfo));
+                        continue;
+                    }
+                    if (haveCarrierPrivilegeAccess(port, callingPackage)) {
+                        uiccPortInfos.add(portInfo);
+                    } else {
+                        uiccPortInfos.add(getUiccPortInfoUnPrivileged(portInfo));
+                    }
+                }
+                filteredInfos.add(new UiccCardInfo(
+                        cardInfo.isEuicc(),
+                        cardInfo.getCardId(),
+                        null,
+                        cardInfo.getPhysicalSlotIndex(),
+                        cardInfo.isRemovable(),
+                        cardInfo.isMultipleEnabledProfilesSupported(),
+                        uiccPortInfos));
             }
             return filteredInfos;
         } finally {
@@ -8771,10 +8857,69 @@
         }
     }
 
-    @Override
-    public UiccSlotInfo[] getUiccSlotsInfo() {
-        enforceReadPrivilegedPermission("getUiccSlotsInfo");
+    /**
+     * Returns a copy of the UiccCardinfo with the EID and ICCID set to null. These values are
+     * generally private and require carrier privileges to view.
+     *
+     * @hide
+     */
+    @NonNull
+    public UiccCardInfo getUiccCardInfoUnPrivileged(UiccCardInfo cardInfo) {
+        List<UiccPortInfo> portinfo = new  ArrayList<>();
+        for (UiccPortInfo portinfos : cardInfo.getPorts()) {
+            portinfo.add(getUiccPortInfoUnPrivileged(portinfos));
+        }
+        return new UiccCardInfo(
+                cardInfo.isEuicc(),
+                cardInfo.getCardId(),
+                null,
+                cardInfo.getPhysicalSlotIndex(),
+                cardInfo.isRemovable(),
+                cardInfo.isMultipleEnabledProfilesSupported(),
+                portinfo
+        );
+    }
 
+    /**
+     * @hide
+     * @return a copy of the UiccPortInfo with ICCID set to {@link UiccPortInfo#ICCID_REDACTED}.
+     * These values are generally private and require carrier privileges to view.
+     */
+    @NonNull
+    public UiccPortInfo getUiccPortInfoUnPrivileged(UiccPortInfo portInfo) {
+        return new UiccPortInfo(
+                UiccPortInfo.ICCID_REDACTED,
+                portInfo.getPortIndex(),
+                portInfo.getLogicalSlotIndex(),
+                portInfo.isActive()
+        );
+    }
+    @Override
+    public UiccSlotInfo[] getUiccSlotsInfo(String callingPackage) {
+        // Verify that the callingPackage belongs to the calling UID
+        mApp.getSystemService(AppOpsManager.class)
+                .checkPackage(Binder.getCallingUid(), callingPackage);
+
+        boolean hasReadPermission = false;
+        boolean isLogicalSlotAccessRestricted = false;
+
+        try {
+            enforceReadPrivilegedPermission("getUiccSlotsInfo");
+            hasReadPermission = true;
+        } catch (SecurityException e) {
+            // even without READ_PRIVILEGED_PHONE_STATE, we allow the call to continue if the caller
+            // has carrier privileges on an active UICC
+            if (checkCarrierPrivilegesForPackageAnyPhone(callingPackage)
+                    == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
+                hasReadPermission = true;
+            }
+        }
+
+        // checking compatibility, if calling app's target SDK is T and beyond.
+        if (CompatChanges.isChangeEnabled(GET_API_SIGNATURES_FROM_UICC_PORT_INFO,
+                Binder.getCallingUid())) {
+            isLogicalSlotAccessRestricted  = true;
+        }
         final long identity = Binder.clearCallingIdentity();
         try {
             UiccSlot[] slots = UiccController.getInstance().getUiccSlots();
@@ -8782,7 +8927,6 @@
                 Rlog.i(LOG_TAG, "slots is null.");
                 return null;
             }
-
             UiccSlotInfo[] infos = new UiccSlotInfo[slots.length];
             for (int i = 0; i < slots.length; i++) {
                 UiccSlot slot = slots[i];
@@ -8797,7 +8941,11 @@
                 } else {
                     cardId = slot.getEid();
                     if (TextUtils.isEmpty(cardId)) {
-                        cardId = slot.getIccId();
+                        // If cardId is null, use iccId of default port as cardId. Check if has
+                        // read permission otherwise set to null.(card is null which means no
+                        // carrier permission)
+                       cardId = hasReadPermission ? slot.getIccId(
+                               TelephonyManager.DEFAULT_PORT_INDEX) : null;
                     }
                 }
 
@@ -8825,15 +8973,27 @@
                         break;
 
                 }
-
+                List<UiccPortInfo> portInfos = new ArrayList<>();
+                int[] portIndexes = slot.getPortList();
+                for (int portIdx : portIndexes) {
+                    String iccId = IccUtils.stripTrailingFs(getIccId(slot, portIdx,
+                            callingPackage, hasReadPermission));
+                    if (slot.isPortActive(portIdx)) {
+                        UiccPort port = slot.getUiccCard().getUiccPort(portIdx);
+                        portInfos.add(new UiccPortInfo(iccId, port.getPortIdx(),
+                                port.getPhoneId(), true));
+                    } else {
+                        portInfos.add(new UiccPortInfo(iccId, portIdx, -1, false));
+                    }
+                }
                 infos[i] = new UiccSlotInfo(
-                        slot.isActive(),
                         slot.isEuicc(),
                         cardId,
                         cardState,
-                        slot.getPhoneId(),
                         slot.isExtendedApduSupported(),
-                        slot.isRemovable());
+                        slot.isRemovable(), portInfos);
+                //setting the value after compatibility check
+                infos[i].setLogicalSlotAccessRestricted(isLogicalSlotAccessRestricted);
             }
             return infos;
         } finally {
@@ -8841,13 +9001,52 @@
         }
     }
 
+    /* Returns null if doesn't have read permission or carrier privilege access. */
+    private String getIccId(UiccSlot slot, int portIndex, String callingPackage,
+            boolean hasReadPermission) {
+        String iccId = slot.getIccId(portIndex);
+        if (hasReadPermission) { // if has read permission
+            return iccId;
+        } else {
+            if (slot.getUiccCard() != null && slot.getUiccCard().getUiccPort(portIndex) != null) {
+                UiccPort port = slot.getUiccCard().getUiccPort(portIndex);
+                // if no read permission, checking carrier privilege access
+                if (haveCarrierPrivilegeAccess(port, callingPackage)) {
+                    return iccId;
+                }
+            }
+        }
+        // No read permission or carrier privilege access.
+        return UiccPortInfo.ICCID_REDACTED;
+    }
+
     @Override
+    @Deprecated
     public boolean switchSlots(int[] physicalSlots) {
         enforceModifyPermission();
 
         final long identity = Binder.clearCallingIdentity();
         try {
-            return (Boolean) sendRequest(CMD_SWITCH_SLOTS, physicalSlots);
+            List<UiccSlotMapping> slotMappings = new ArrayList<>();
+            for (int i = 0; i < physicalSlots.length; i++) {
+                // Deprecated API, hence MEP is not supported. Adding default portIndex 0.
+                slotMappings.add(new UiccSlotMapping(TelephonyManager.DEFAULT_PORT_INDEX,
+                        physicalSlots[i], i));
+            }
+            return (Boolean) sendRequest(CMD_SWITCH_SLOTS, slotMappings);
+        } finally {
+            Binder.restoreCallingIdentity(identity);
+        }
+    }
+
+    @Override
+    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
+    public boolean setSimSlotMapping(@NonNull List<UiccSlotMapping> slotMapping) {
+        enforceModifyPermission();
+
+        final long identity = Binder.clearCallingIdentity();
+        try {
+            return (Boolean) sendRequest(CMD_SWITCH_SLOTS, slotMapping);
         } finally {
             Binder.restoreCallingIdentity(identity);
         }
@@ -9436,21 +9635,26 @@
     }
 
     @Override
-    public int[] getSlotsMapping() {
+    public List<UiccSlotMapping> getSlotsMapping(String callingPackage) {
         enforceReadPrivilegedPermission("getSlotsMapping");
-
+        // Verify that the callingPackage belongs to the calling UID
+        mApp.getSystemService(AppOpsManager.class)
+                .checkPackage(Binder.getCallingUid(), callingPackage);
         final long identity = Binder.clearCallingIdentity();
+        List<UiccSlotMapping> slotMap = new ArrayList<>();
         try {
-            int phoneCount = TelephonyManager.getDefault().getPhoneCount();
-            // All logical slots should have a mapping to a physical slot.
-            int[] logicalSlotsMapping = new int[phoneCount];
-            UiccSlotInfo[] slotInfos = getUiccSlotsInfo();
-            for (int i = 0; i < slotInfos.length; i++) {
-                if (SubscriptionManager.isValidPhoneId(slotInfos[i].getLogicalSlotIdx())) {
-                    logicalSlotsMapping[slotInfos[i].getLogicalSlotIdx()] = i;
+            UiccSlotInfo[] slotInfos = getUiccSlotsInfo(mApp.getOpPackageName());
+            if (slotInfos != null) {
+                for (int i = 0; i < slotInfos.length; i++) {
+                    for (UiccPortInfo portInfo : slotInfos[i].getPorts()) {
+                        if (SubscriptionManager.isValidPhoneId(portInfo.getLogicalSlotIndex())) {
+                            slotMap.add(new UiccSlotMapping(portInfo.getPortIndex(), i,
+                                    portInfo.getLogicalSlotIndex()));
+                        }
+                    }
                 }
             }
-            return logicalSlotsMapping;
+            return slotMap;
         } finally {
             Binder.restoreCallingIdentity(identity);
         }
diff --git a/src/com/android/phone/settings/RadioInfo.java b/src/com/android/phone/settings/RadioInfo.java
index f678262..78fdb2e 100644
--- a/src/com/android/phone/settings/RadioInfo.java
+++ b/src/com/android/phone/settings/RadioInfo.java
@@ -17,6 +17,7 @@
 package com.android.phone.settings;
 
 import static android.net.ConnectivityManager.NetworkCallback;
+
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import android.content.ComponentName;
@@ -60,7 +61,6 @@
 import android.telephony.CellSignalStrengthNr;
 import android.telephony.CellSignalStrengthWcdma;
 import android.telephony.DataSpecificRegistrationInfo;
-import android.telephony.data.NetworkSlicingConfig;
 import android.telephony.NetworkRegistrationInfo;
 import android.telephony.PhysicalChannelConfig;
 import android.telephony.RadioAccessFamily;
@@ -69,6 +69,7 @@
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyCallback;
 import android.telephony.TelephonyManager;
+import android.telephony.data.NetworkSlicingConfig;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.Menu;
@@ -105,8 +106,8 @@
 import java.util.concurrent.Executor;
 import java.util.concurrent.LinkedBlockingDeque;
 import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeoutException;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 
 /**
  * Radio Information Class
@@ -1202,9 +1203,16 @@
         if (s == null) s = r.getString(R.string.radioInfo_unknown);
         mSubscriberId.setText(s);
 
-        //FIXME: Replace with a TelephonyManager call
-        s = mPhone.getLine1Number();
-        if (s == null) s = r.getString(R.string.radioInfo_unknown);
+        SubscriptionManager subMgr = getSystemService(SubscriptionManager.class);
+        int subId = mPhone.getSubId();
+        s = subMgr.getPhoneNumber(subId)
+                + " { CARRIER:"
+                + subMgr.getPhoneNumber(subId, SubscriptionManager.PHONE_NUMBER_SOURCE_CARRIER)
+                + ", UICC:"
+                + subMgr.getPhoneNumber(subId, SubscriptionManager.PHONE_NUMBER_SOURCE_UICC)
+                + ", IMS:"
+                + subMgr.getPhoneNumber(subId, SubscriptionManager.PHONE_NUMBER_SOURCE_IMS)
+                + " }";
         mLine1Number.setText(s);
     }
 
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index cf5b8b9..937680f 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -2590,8 +2590,7 @@
             if (phone.getEmergencyNumberTracker() != null) {
                 if (phone.getEmergencyNumberTracker().isEmergencyNumber(
                         emergencyNumberAddress, true)) {
-                    if (phone.getHalVersion().greaterOrEqual(RIL.RADIO_HAL_VERSION_1_4)
-                            || isAvailableForEmergencyCalls(phone)) {
+                    if (isAvailableForEmergencyCalls(phone)) {
                         // a)
                         if (phone.getPhoneId() == defaultVoicePhoneId) {
                             Log.i(this, "getPhoneForEmergencyCall, Phone Id that supports"
@@ -2714,12 +2713,6 @@
                 // Only sort if there are enough elements to do so.
                 if (phoneSlotStatus.size() > 1) {
                     Collections.sort(phoneSlotStatus, (o1, o2) -> {
-                        if (!o1.hasDialedEmergencyNumber && o2.hasDialedEmergencyNumber) {
-                            return -1;
-                        }
-                        if (o1.hasDialedEmergencyNumber && !o2.hasDialedEmergencyNumber) {
-                            return 1;
-                        }
                         // Sort by non-absent SIM.
                         if (o1.simState == TelephonyManager.SIM_STATE_ABSENT
                                 && o2.simState != TelephonyManager.SIM_STATE_ABSENT) {
@@ -2738,6 +2731,13 @@
                         if (o2.isLocked && !o1.isLocked) {
                             return 1;
                         }
+                        // Prefer slots where the number is considered emergency.
+                        if (!o1.hasDialedEmergencyNumber && o2.hasDialedEmergencyNumber) {
+                            return -1;
+                        }
+                        if (o1.hasDialedEmergencyNumber && !o2.hasDialedEmergencyNumber) {
+                            return 1;
+                        }
                         // sort by number of RadioAccessFamily Capabilities.
                         int compare = RadioAccessFamily.compare(o1.capabilities, o2.capabilities);
                         if (compare == 0) {
diff --git a/src/com/android/services/telephony/rcs/DelegateStateTracker.java b/src/com/android/services/telephony/rcs/DelegateStateTracker.java
index 18aab88..29b8121 100644
--- a/src/com/android/services/telephony/rcs/DelegateStateTracker.java
+++ b/src/com/android/services/telephony/rcs/DelegateStateTracker.java
@@ -16,6 +16,10 @@
 
 package com.android.services.telephony.rcs;
 
+import android.app.compat.CompatChanges;
+import android.compat.annotation.ChangeId;
+import android.compat.annotation.EnabledAfter;
+import android.os.Build;
 import android.os.RemoteException;
 import android.telephony.ims.DelegateRegistrationState;
 import android.telephony.ims.FeatureTagState;
@@ -28,6 +32,7 @@
 import android.util.LocalLog;
 import android.util.Log;
 
+import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.telephony.metrics.RcsStats;
 
 import java.io.PrintWriter;
@@ -43,25 +48,69 @@
     private static final String LOG_TAG = "DelegateST";
 
     private final int mSubId;
+    private final int mUid;
     private final ISipDelegateConnectionStateCallback mAppStateCallback;
     private final ISipDelegate mLocalDelegateImpl;
 
     private final LocalLog mLocalLog = new LocalLog(SipTransportController.LOG_SIZE);
 
+    private final RcsStats mRcsStats;
+
     private List<FeatureTagState> mDelegateDeniedTags;
     private DelegateRegistrationState mLastRegState;
     private boolean mCreatedCalled = false;
     private int mRegistrationStateOverride = -1;
-
+    private CompatChangesFactory mCompatChangesFactory;
     private Set<String> mDelegateSupportedTags;
-    private final RcsStats mRcsStats;
 
-    public DelegateStateTracker(int subId, ISipDelegateConnectionStateCallback appStateCallback,
+    /**
+     * Interface for checking compatibility of apps
+     */
+    public interface CompatChangesFactory {
+        /**
+         *  @param changeId The ID of the compatibility change.
+         *  @param uid      The UID of the app.
+         *  @return {@code true} if the change is enabled for the current app.
+         */
+        boolean isChangeEnabled(long changeId, int uid);
+    }
+
+    /**
+     * For apps targeting Android T and above, support the REGISTERING state on APIs, such as
+     * {@code DelegateRegistrationState#addRegisteringFeatureTags} and
+     * {@code DelegateRegistrationState#getRegisteringFeatureTags}
+     * @hide
+     */
+    @ChangeId
+    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.S)
+    @VisibleForTesting
+    public static final long SUPPORT_REGISTERING_DELEGATE_STATE = 205194548;
+
+    /**
+     * For apps targeting Android T and above, support the DEREGISTERING_REASON_LOSING_PDN state
+     * on APIs, such as {@code DelegateRegistrationState#addDeregisteringFeatureTag} and
+     * {@code DelegateRegistrationState#getDeregisteringFeatureTags}
+     * @hide
+     */
+    @ChangeId
+    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.S)
+    @VisibleForTesting
+    public static final long SUPPORT_DEREGISTERING_LOSING_PDN_STATE = 201522903;
+
+    public DelegateStateTracker(int subId, int uid,
+            ISipDelegateConnectionStateCallback appStateCallback,
             ISipDelegate localDelegateImpl, RcsStats rcsStats) {
         mSubId = subId;
+        mUid = uid;
         mAppStateCallback = appStateCallback;
         mLocalDelegateImpl = localDelegateImpl;
         mRcsStats = rcsStats;
+        setCompatChangesFactory((changeId, uid1) -> CompatChanges.isChangeEnabled(changeId, uid1));
+    }
+
+    @VisibleForTesting
+    protected void setCompatChangesFactory(CompatChangesFactory factory) {
+        mCompatChangesFactory = factory;
     }
 
     /**
@@ -140,6 +189,13 @@
      */
     @Override
     public void onRegistrationStateChanged(DelegateRegistrationState registrationState) {
+        if (!mCompatChangesFactory.isChangeEnabled(SUPPORT_DEREGISTERING_LOSING_PDN_STATE, mUid)) {
+            registrationState = overrideDeregisteringStateForCompatibility(registrationState);
+        }
+        if (!mCompatChangesFactory.isChangeEnabled(SUPPORT_REGISTERING_DELEGATE_STATE, mUid)) {
+            registrationState = overrideRegistrationForCompatibility(registrationState);
+        }
+
         if (mRegistrationStateOverride > DelegateRegistrationState.DEREGISTERED_REASON_UNKNOWN) {
             logi("onRegistrationStateChanged: overriding registered state to "
                     + mRegistrationStateOverride);
@@ -204,6 +260,7 @@
     private DelegateRegistrationState overrideRegistrationForDelegateChange(
             int registerOverrideReason, DelegateRegistrationState state) {
         Set<String> registeredFeatures = state.getRegisteredFeatureTags();
+        Set<String> registeringFeatures = state.getRegisteringFeatureTags();
         DelegateRegistrationState.Builder overriddenState = new DelegateRegistrationState.Builder();
         // keep other deregistering/deregistered tags the same.
         for (FeatureTagState dereging : state.getDeregisteringFeatureTags()) {
@@ -214,13 +271,78 @@
             overriddenState.addDeregisteredFeatureTag(dereged.getFeatureTag(),
                     dereged.getState());
         }
-        // Override REGISTERED only
+        // Override REGISTERING/REGISTERED
+        for (String ft : registeringFeatures) {
+            overriddenState.addDeregisteringFeatureTag(ft, registerOverrideReason);
+        }
         for (String ft : registeredFeatures) {
             overriddenState.addDeregisteringFeatureTag(ft, registerOverrideReason);
         }
         return overriddenState.build();
     }
 
+    private DelegateRegistrationState overrideRegistrationForCompatibility(
+            DelegateRegistrationState state) {
+        Set<String> registeredFeatures = state.getRegisteredFeatureTags();
+        Set<String> registeringFeatures = state.getRegisteringFeatureTags();
+        DelegateRegistrationState.Builder overriddenState = new DelegateRegistrationState.Builder();
+        // keep other registered/deregistering/deregistered tags the same.
+        for (FeatureTagState dereging : state.getDeregisteringFeatureTags()) {
+            overriddenState.addDeregisteringFeatureTag(dereging.getFeatureTag(),
+                    dereging.getState());
+        }
+        for (FeatureTagState dereged : state.getDeregisteredFeatureTags()) {
+            overriddenState.addDeregisteredFeatureTag(dereged.getFeatureTag(),
+                    dereged.getState());
+        }
+        overriddenState.addRegisteredFeatureTags(registeredFeatures);
+
+        // move the REGISTERING state to the DEREGISTERED state.
+        for (String tag : registeringFeatures) {
+            overriddenState.addDeregisteredFeatureTag(tag,
+                    DelegateRegistrationState.DEREGISTERED_REASON_NOT_REGISTERED);
+        }
+
+        return overriddenState.build();
+    }
+
+    /**
+     * @param state The RegistrationState reported by the SipDelegate to be sent to the
+     *              IMS application .
+     * @return DEREGISTERING_REASON_PDN_CHANGE instead of DEREGISTERING_REASON_LOSING_PDN
+     * if the SUPPORT_DEREGISTERING_LOSING_PDN_STATE compat key is not enabled for the application
+     * consuming the registration change events.
+     */
+    private DelegateRegistrationState overrideDeregisteringStateForCompatibility(
+            DelegateRegistrationState state) {
+        Set<String> registeredFeatures = state.getRegisteredFeatureTags();
+        Set<String> registeringFeatures = state.getRegisteringFeatureTags();
+        DelegateRegistrationState.Builder overriddenState = new DelegateRegistrationState.Builder();
+
+        // keep other registered/registering/deregistered tags the same.
+        for (FeatureTagState dereged : state.getDeregisteredFeatureTags()) {
+            overriddenState.addDeregisteredFeatureTag(dereged.getFeatureTag(),
+                    dereged.getState());
+        }
+        overriddenState.addRegisteredFeatureTags(registeredFeatures);
+        overriddenState.addRegisteringFeatureTags(registeringFeatures);
+
+        // change DEREGISTERING_REASON_LOSING_PDN to DEREGISTERING_REASON_PDN_CHANGE
+        for (FeatureTagState dereging : state.getDeregisteringFeatureTags()) {
+            overriddenState.addDeregisteringFeatureTag(dereging.getFeatureTag(),
+                    getDeregisteringReasonForCompatibility(dereging.getState()));
+        }
+
+        return overriddenState.build();
+    }
+
+    private int getDeregisteringReasonForCompatibility(int reason) {
+        if (reason == DelegateRegistrationState.DEREGISTERING_REASON_LOSING_PDN) {
+            reason = DelegateRegistrationState.DEREGISTERING_REASON_PDN_CHANGE;
+        }
+        return reason;
+    }
+
     private void notifySipDelegateCreated() {
         try {
             mAppStateCallback.onCreated(mLocalDelegateImpl);
diff --git a/src/com/android/services/telephony/rcs/SipDelegateController.java b/src/com/android/services/telephony/rcs/SipDelegateController.java
index c728141..860a6d9 100644
--- a/src/com/android/services/telephony/rcs/SipDelegateController.java
+++ b/src/com/android/services/telephony/rcs/SipDelegateController.java
@@ -78,6 +78,7 @@
     }
 
     private final int mSubId;
+    private final int mUid;
     private final String mPackageName;
     private final DelegateRequest mInitialRequest;
     private final ScheduledExecutorService mExecutorService;
@@ -89,12 +90,13 @@
     private DelegateBinderStateManager mBinderConnection;
     private Set<String> mTrackedFeatureTags;
 
-    public SipDelegateController(int subId, DelegateRequest initialRequest, String packageName,
-            ISipTransport transportImpl, IImsRegistration registrationImpl,
+    public SipDelegateController(int subId, int uid, DelegateRequest initialRequest,
+            String packageName, ISipTransport transportImpl, IImsRegistration registrationImpl,
             ScheduledExecutorService executorService,
             ISipDelegateConnectionStateCallback stateCallback,
             ISipDelegateMessageCallback messageCallback) {
         mSubId = subId;
+        mUid = uid;
         mPackageName = packageName;
         mInitialRequest = initialRequest;
         mExecutorService = executorService;
@@ -102,7 +104,8 @@
 
         mMessageTransportWrapper = new MessageTransportWrapper(mSubId, executorService,
                 messageCallback);
-        mDelegateStateTracker = new DelegateStateTracker(mSubId, stateCallback,
+
+        mDelegateStateTracker = new DelegateStateTracker(mSubId, mUid, stateCallback,
                 mMessageTransportWrapper.getDelegateConnection(), RcsStats.getInstance());
     }
 
@@ -110,12 +113,13 @@
      * Inject dependencies for testing only.
      */
     @VisibleForTesting
-    public SipDelegateController(int subId, DelegateRequest initialRequest, String packageName,
-            ScheduledExecutorService executorService,
+    public SipDelegateController(int subId, int uid, DelegateRequest initialRequest,
+            String packageName, ScheduledExecutorService executorService,
             MessageTransportWrapper messageTransportWrapper,
             DelegateStateTracker delegateStateTracker,
             DelegateBinderStateManager.Factory connectionFactory) {
         mSubId = subId;
+        mUid = uid;
         mInitialRequest = initialRequest;
         mPackageName = packageName;
         mExecutorService = executorService;
diff --git a/src/com/android/services/telephony/rcs/SipTransportController.java b/src/com/android/services/telephony/rcs/SipTransportController.java
index 709e142..0aa3aa0 100644
--- a/src/com/android/services/telephony/rcs/SipTransportController.java
+++ b/src/com/android/services/telephony/rcs/SipTransportController.java
@@ -243,9 +243,9 @@
     @VisibleForTesting
     public interface SipDelegateControllerFactory {
         /** See {@link SipDelegateController} */
-        SipDelegateController create(int subId, DelegateRequest initialRequest, String packageName,
-                ISipTransport sipTransportImpl,  IImsRegistration registrationImpl,
-                ScheduledExecutorService executorService,
+        SipDelegateController create(int subId, int uid, DelegateRequest initialRequest,
+                String packageName, ISipTransport sipTransportImpl,
+                IImsRegistration registrationImpl, ScheduledExecutorService executorService,
                 ISipDelegateConnectionStateCallback stateCallback,
                 ISipDelegateMessageCallback messageCallback);
     }
@@ -364,17 +364,18 @@
      * {@link ISipDelegateConnectionStateCallback#onCreated(ISipDelegate)} must be called with
      * the AIDL instance corresponding to the remote {@link SipDelegate}.
      * @param subId the subId associated with the request.
+     * @param uid the uid associated with the request
      * @param request The request parameters used to create the {@link SipDelegate}.
      * @param delegateState The {@link DelegateConnectionStateCallback} Binder connection.
      * @param delegateMessage The {@link DelegateConnectionMessageCallback} Binder Connection
      * @throws ImsException if the request to create the {@link SipDelegate} did not complete.
      */
-    public void createSipDelegate(int subId, DelegateRequest request, String packageName,
+    public void createSipDelegate(int subId, int uid, DelegateRequest request, String packageName,
             ISipDelegateConnectionStateCallback delegateState,
             ISipDelegateMessageCallback delegateMessage) throws ImsException {
         logi("createSipDelegate: request= " + request + ", packageName= " + packageName);
         CompletableFuture<ImsException> result = new CompletableFuture<>();
-        mExecutorService.submit(() -> createSipDelegateInternal(subId, request, packageName,
+        mExecutorService.submit(() -> createSipDelegateInternal(subId, uid, request, packageName,
                 delegateState,
                 // Capture any ImsExceptions generated during the process.
                 delegateMessage, result::complete));
@@ -423,8 +424,8 @@
         return result;
     }
 
-    private void createSipDelegateInternal(int subId, DelegateRequest request, String packageName,
-            ISipDelegateConnectionStateCallback delegateState,
+    private void createSipDelegateInternal(int subId, int uid, DelegateRequest request,
+            String packageName, ISipDelegateConnectionStateCallback delegateState,
             ISipDelegateMessageCallback delegateMessage,
             Consumer<ImsException> startedErrorConsumer) {
         ISipTransport transport;
@@ -450,8 +451,9 @@
             return;
         }
 
-        SipDelegateController c = mDelegateControllerFactory.create(subId, request, packageName,
-                transport, registration, mExecutorService, delegateState, delegateMessage);
+        SipDelegateController c = mDelegateControllerFactory.create(subId, uid, request,
+                packageName, transport, registration, mExecutorService, delegateState,
+                delegateMessage);
         logi("createSipDelegateInternal: request= " + request + ", packageName= " + packageName
                 + ", controller created: " + c);
         addPendingCreateAndEvaluate(c);
diff --git a/tests/src/com/android/services/telephony/rcs/DelegateStateTrackerTest.java b/tests/src/com/android/services/telephony/rcs/DelegateStateTrackerTest.java
index 25b5339..ffbe5ce 100644
--- a/tests/src/com/android/services/telephony/rcs/DelegateStateTrackerTest.java
+++ b/tests/src/com/android/services/telephony/rcs/DelegateStateTrackerTest.java
@@ -16,6 +16,8 @@
 
 package com.android.services.telephony.rcs;
 
+import static com.android.services.telephony.rcs.DelegateStateTracker.SUPPORT_REGISTERING_DELEGATE_STATE;
+
 import static org.junit.Assert.assertEquals;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
@@ -24,7 +26,9 @@
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
+import android.app.compat.CompatChanges;
 import android.net.InetAddresses;
+import android.os.Binder;
 import android.telephony.ims.DelegateRegistrationState;
 import android.telephony.ims.FeatureTagState;
 import android.telephony.ims.SipDelegateConfiguration;
@@ -33,8 +37,8 @@
 import android.telephony.ims.aidl.ISipDelegateConnectionStateCallback;
 import android.util.ArraySet;
 
+import androidx.test.ext.junit.runners.AndroidJUnit4;
 import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
 
 import com.android.TelephonyTestBase;
 import com.android.internal.telephony.metrics.RcsStats;
@@ -77,8 +81,8 @@
     @SmallTest
     @Test
     public void testDelegateCreated() throws Exception {
-        DelegateStateTracker stateTracker = new DelegateStateTracker(TEST_SUB_ID, mAppCallback,
-                mSipDelegate, mRcsStats);
+        DelegateStateTracker stateTracker = new DelegateStateTracker(TEST_SUB_ID,
+                Binder.getCallingUid(), mAppCallback, mSipDelegate, mRcsStats);
         Set<FeatureTagState> deniedTags = getMmTelDeniedTag();
         Set<String> supportedTags = getSupportedTags();
         stateTracker.sipDelegateConnected(supportedTags, deniedTags);
@@ -114,8 +118,8 @@
     @SmallTest
     @Test
     public void testDelegateDestroyed() throws Exception {
-        DelegateStateTracker stateTracker = new DelegateStateTracker(TEST_SUB_ID, mAppCallback,
-                mSipDelegate, mRcsStats);
+        DelegateStateTracker stateTracker = new DelegateStateTracker(TEST_SUB_ID,
+                Binder.getCallingUid(), mAppCallback, mSipDelegate, mRcsStats);
         Set<FeatureTagState> deniedTags = getMmTelDeniedTag();
         Set<String> supportedTags = getSupportedTags();
         stateTracker.sipDelegateConnected(supportedTags, deniedTags);
@@ -139,39 +143,75 @@
     @SmallTest
     @Test
     public void testDelegateChangingRegisteredTagsOverride() throws Exception {
-        DelegateStateTracker stateTracker = new DelegateStateTracker(TEST_SUB_ID, mAppCallback,
-                mSipDelegate, mRcsStats);
+        DelegateStateTracker stateTracker = new DelegateStateTracker(TEST_SUB_ID,
+                Binder.getCallingUid(), mAppCallback, mSipDelegate, mRcsStats);
         Set<FeatureTagState> deniedTags = getMmTelDeniedTag();
         Set<String> supportedTags = getSupportedTags();
+        Set<String> registeringTags = getRegisteringTag();
         stateTracker.sipDelegateConnected(supportedTags, deniedTags);
+
         // SipDelegate created
         verify(mAppCallback).onCreated(mSipDelegate);
+
         DelegateRegistrationState regState = new DelegateRegistrationState.Builder()
                 .addRegisteredFeatureTag(ImsSignallingUtils.ONE_TO_ONE_CHAT_TAG)
+                .addRegisteringFeatureTags(registeringTags)
                 .addDeregisteringFeatureTag(ImsSignallingUtils.FILE_TRANSFER_HTTP_TAG,
                         DelegateRegistrationState.DEREGISTERING_REASON_PROVISIONING_CHANGE)
                 .addDeregisteredFeatureTag(ImsSignallingUtils.GROUP_CHAT_TAG,
                         DelegateRegistrationState.DEREGISTERED_REASON_NOT_PROVISIONED)
                 .build();
+
         stateTracker.onRegistrationStateChanged(regState);
         // Simulate underlying SipDelegate switch
         stateTracker.sipDelegateChanging(
                 DelegateRegistrationState.DEREGISTERING_REASON_FEATURE_TAGS_CHANGING);
         // onFeatureTagStatusChanged should now be called with registered features overridden with
         // DEREGISTERING_REASON_FEATURE_TAGS_CHANGING
-        DelegateRegistrationState overrideRegState = new DelegateRegistrationState.Builder()
+        DelegateRegistrationState.Builder overrideBuilder =
+                new DelegateRegistrationState.Builder()
                 .addDeregisteringFeatureTag(ImsSignallingUtils.ONE_TO_ONE_CHAT_TAG,
                         DelegateRegistrationState.DEREGISTERING_REASON_FEATURE_TAGS_CHANGING)
                 // Already Deregistering/Deregistered tags should not be overridden.
                 .addDeregisteringFeatureTag(ImsSignallingUtils.FILE_TRANSFER_HTTP_TAG,
                         DelegateRegistrationState.DEREGISTERING_REASON_PROVISIONING_CHANGE)
                 .addDeregisteredFeatureTag(ImsSignallingUtils.GROUP_CHAT_TAG,
-                        DelegateRegistrationState.DEREGISTERED_REASON_NOT_PROVISIONED)
-                .build();
+                        DelegateRegistrationState.DEREGISTERED_REASON_NOT_PROVISIONED);
+        if (CompatChanges.isChangeEnabled(SUPPORT_REGISTERING_DELEGATE_STATE,
+                Binder.getCallingUid())) {
+            for (String tag : registeringTags) {
+                overrideBuilder.addDeregisteringFeatureTag(tag,
+                        DelegateRegistrationState.DEREGISTERING_REASON_FEATURE_TAGS_CHANGING);
+            }
+        } else {
+            for (String tag : registeringTags) {
+                overrideBuilder.addDeregisteredFeatureTag(tag,
+                        DelegateRegistrationState.DEREGISTERED_REASON_NOT_REGISTERED);
+            }
+        }
+
+        DelegateRegistrationState overrideRegState = overrideBuilder.build();
+
         // new underlying SipDelegate created
         stateTracker.sipDelegateConnected(supportedTags, deniedTags);
         stateTracker.onRegistrationStateChanged(regState);
 
+        DelegateRegistrationState.Builder builder = new DelegateRegistrationState.Builder()
+                .addRegisteredFeatureTag(ImsSignallingUtils.ONE_TO_ONE_CHAT_TAG)
+                .addDeregisteringFeatureTag(ImsSignallingUtils.FILE_TRANSFER_HTTP_TAG,
+                        DelegateRegistrationState.DEREGISTERING_REASON_PROVISIONING_CHANGE)
+                .addDeregisteredFeatureTag(ImsSignallingUtils.GROUP_CHAT_TAG,
+                        DelegateRegistrationState.DEREGISTERED_REASON_NOT_PROVISIONED);
+        if (CompatChanges.isChangeEnabled(SUPPORT_REGISTERING_DELEGATE_STATE,
+                Binder.getCallingUid())) {
+            builder.addRegisteringFeatureTags(registeringTags);
+        } else {
+            for (String tag : registeringTags) {
+                builder.addDeregisteredFeatureTag(tag,
+                        DelegateRegistrationState.DEREGISTERED_REASON_NOT_REGISTERED);
+            }
+        }
+        DelegateRegistrationState regStateResult = builder.build();
         // Verify registration state through the process:
         ArgumentCaptor<DelegateRegistrationState> regCaptor =
                 ArgumentCaptor.forClass(DelegateRegistrationState.class);
@@ -179,11 +219,11 @@
                 regCaptor.capture(), eq(new ArrayList<>(deniedTags)));
         List<DelegateRegistrationState> testStates = regCaptor.getAllValues();
         // feature tags should first be registered
-        assertEquals(regState, testStates.get(0));
+        assertEquals(regStateResult, testStates.get(0));
         // registered feature tags should have moved to deregistering
         assertEquals(overrideRegState, testStates.get(1));
         // and then moved back to registered after underlying FT change done.
-        assertEquals(regState, testStates.get(2));
+        assertEquals(regStateResult, testStates.get(2));
 
         //onCreate should only have been called once and onDestroy should have never been called.
         verify(mAppCallback).onCreated(mSipDelegate);
@@ -191,14 +231,108 @@
     }
 
     /**
+     * When registration states are changed in a case that an application doesn't support the new
+     * 'registering' state the 'registering' state will be moved to the 'registered' state
+     * as the old behavior.
+     *
+     * This method tests the case where the application doesn't support consuming the
+     * DEREGISTERING_REASON_LOSING_PDN reason.
+     */
+    @Test
+    public void testDelegateChangingRegisteredTagsRegisteringDisable() throws Exception {
+        DelegateStateTracker stateTracker = new DelegateStateTracker(TEST_SUB_ID,
+                Binder.getCallingUid(), mAppCallback, mSipDelegate, mRcsStats);
+        stateTracker.setCompatChangesFactory((changeId, uid) -> false);
+        Set<FeatureTagState> deniedTags = getMmTelDeniedTag();
+        Set<String> supportedTags = getSupportedTags();
+        Set<String> registeringTags = getRegisteringTag();
+        stateTracker.sipDelegateConnected(supportedTags, deniedTags);
+        // SipDelegate created
+        verify(mAppCallback).onCreated(mSipDelegate);
+        DelegateRegistrationState regState = new DelegateRegistrationState.Builder()
+                .addRegisteredFeatureTag(ImsSignallingUtils.ONE_TO_ONE_CHAT_TAG)
+                .addRegisteringFeatureTags(registeringTags)
+                .addDeregisteringFeatureTag(ImsSignallingUtils.FILE_TRANSFER_HTTP_TAG,
+                        DelegateRegistrationState.DEREGISTERING_REASON_LOSING_PDN)
+                .addDeregisteredFeatureTag(ImsSignallingUtils.GROUP_CHAT_TAG,
+                        DelegateRegistrationState.DEREGISTERED_REASON_NOT_PROVISIONED)
+                .build();
+        stateTracker.onRegistrationStateChanged(regState);
+
+        DelegateRegistrationState.Builder builder = new DelegateRegistrationState.Builder()
+                .addRegisteredFeatureTag(ImsSignallingUtils.ONE_TO_ONE_CHAT_TAG)
+                .addDeregisteringFeatureTag(ImsSignallingUtils.FILE_TRANSFER_HTTP_TAG,
+                        DelegateRegistrationState.DEREGISTERING_REASON_PDN_CHANGE)
+                .addDeregisteredFeatureTag(ImsSignallingUtils.GROUP_CHAT_TAG,
+                        DelegateRegistrationState.DEREGISTERED_REASON_NOT_PROVISIONED);
+        for (String tag : registeringTags) {
+            builder.addDeregisteredFeatureTag(tag,
+                    DelegateRegistrationState.DEREGISTERED_REASON_NOT_REGISTERED);
+        }
+        DelegateRegistrationState overrideRegState = builder.build();
+
+
+        // Verify registration state through the process:
+        ArgumentCaptor<DelegateRegistrationState> regCaptor =
+                ArgumentCaptor.forClass(DelegateRegistrationState.class);
+        verify(mAppCallback, times(1)).onFeatureTagStatusChanged(
+                regCaptor.capture(), eq(new ArrayList<>(deniedTags)));
+        List<DelegateRegistrationState> testStates = regCaptor.getAllValues();
+
+        assertEquals(overrideRegState, testStates.get(0));
+        verify(mAppCallback).onCreated(mSipDelegate);
+    }
+
+    /**
+     * When registration states are changed in a case that an application supports the new
+     * 'registering' state the state will be kept.
+     *
+     *  This method tests the case where the application supports consuming the
+     *  DEREGISTERING_REASON_LOSING_PDN reason.
+     */
+    @Test
+    public void testDelegateChangingRegisteredTagsRegisteringEnable() throws Exception {
+        DelegateStateTracker stateTracker = new DelegateStateTracker(TEST_SUB_ID,
+                Binder.getCallingUid(), mAppCallback, mSipDelegate, mRcsStats);
+        stateTracker.setCompatChangesFactory((changeId, uid) -> true);
+        Set<FeatureTagState> deniedTags = getMmTelDeniedTag();
+        Set<String> supportedTags = getSupportedTags();
+        Set<String> registeringTags = getRegisteringTag();
+        stateTracker.sipDelegateConnected(supportedTags, deniedTags);
+        // SipDelegate created
+        verify(mAppCallback).onCreated(mSipDelegate);
+
+        DelegateRegistrationState regState = new DelegateRegistrationState.Builder()
+                .addRegisteredFeatureTag(ImsSignallingUtils.ONE_TO_ONE_CHAT_TAG)
+                .addRegisteringFeatureTags(registeringTags)
+                .addDeregisteringFeatureTag(ImsSignallingUtils.FILE_TRANSFER_HTTP_TAG,
+                        DelegateRegistrationState.DEREGISTERING_REASON_LOSING_PDN)
+                .addDeregisteredFeatureTag(ImsSignallingUtils.GROUP_CHAT_TAG,
+                        DelegateRegistrationState.DEREGISTERED_REASON_NOT_PROVISIONED)
+                .build();
+        stateTracker.onRegistrationStateChanged(regState);
+
+        // Verify registration state through the process:
+        ArgumentCaptor<DelegateRegistrationState> regCaptor =
+                ArgumentCaptor.forClass(DelegateRegistrationState.class);
+        verify(mAppCallback, times(1)).onFeatureTagStatusChanged(
+                regCaptor.capture(), eq(new ArrayList<>(deniedTags)));
+        List<DelegateRegistrationState> testStates = regCaptor.getAllValues();
+
+        assertEquals(regState, testStates.get(0));
+        verify(mAppCallback).onCreated(mSipDelegate);
+    }
+
+
+    /**
      * Test the case that when the underlying Denied tags change in the SipDelegate, the change is
      * properly shown in the registration update event.
      */
     @SmallTest
     @Test
     public void testDelegateChangingDeniedTagsChanged() throws Exception {
-        DelegateStateTracker stateTracker = new DelegateStateTracker(TEST_SUB_ID, mAppCallback,
-                mSipDelegate, mRcsStats);
+        DelegateStateTracker stateTracker = new DelegateStateTracker(TEST_SUB_ID,
+                Binder.getCallingUid(), mAppCallback, mSipDelegate, mRcsStats);
         Set<FeatureTagState> deniedTags = getMmTelDeniedTag();
         Set<String> supportedTags = getSupportedTags();
         stateTracker.sipDelegateConnected(supportedTags, deniedTags);
@@ -255,8 +389,8 @@
     @SmallTest
     @Test
     public void testDelegateChangingDeniedTagsChangingToDestroy() throws Exception {
-        DelegateStateTracker stateTracker = new DelegateStateTracker(TEST_SUB_ID, mAppCallback,
-                mSipDelegate, mRcsStats);
+        DelegateStateTracker stateTracker = new DelegateStateTracker(TEST_SUB_ID,
+                Binder.getCallingUid(), mAppCallback, mSipDelegate, mRcsStats);
         Set<FeatureTagState> deniedTags = getMmTelDeniedTag();
         Set<String> supportedTags = getSupportedTags();
         stateTracker.sipDelegateConnected(supportedTags, deniedTags);
@@ -316,4 +450,11 @@
         supportedTags.add(ImsSignallingUtils.GROUP_CHAT_TAG);
         return supportedTags;
     }
+
+    private Set<String> getRegisteringTag() {
+        Set<String> registeringTags = new ArraySet<>();
+        registeringTags.add(ImsSignallingUtils.CHATBOT_COMMUNICATION_USING_SESSION_TAG);
+        return registeringTags;
+
+    }
 }
diff --git a/tests/src/com/android/services/telephony/rcs/ImsSignallingUtils.java b/tests/src/com/android/services/telephony/rcs/ImsSignallingUtils.java
index d607f6d..0e725e0 100644
--- a/tests/src/com/android/services/telephony/rcs/ImsSignallingUtils.java
+++ b/tests/src/com/android/services/telephony/rcs/ImsSignallingUtils.java
@@ -28,4 +28,6 @@
             "+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gppservice.ims.icsi.oma.cpm.session\"";
     public static final String FILE_TRANSFER_HTTP_TAG =
             "+g.3gpp.iari-ref=\"urn%3Aurn-7%3A3gppapplication.ims.iari.rcs.fthttp\"";
+    public static final String CHATBOT_COMMUNICATION_USING_SESSION_TAG =
+            "+g.3gpp.iari-ref=\"urn%3Aurn-7%3A3gpp-application.ims.iari.rcs.chatbot\"";
 }
diff --git a/tests/src/com/android/services/telephony/rcs/SipDelegateControllerTest.java b/tests/src/com/android/services/telephony/rcs/SipDelegateControllerTest.java
index 78f6894..575b81e 100644
--- a/tests/src/com/android/services/telephony/rcs/SipDelegateControllerTest.java
+++ b/tests/src/com/android/services/telephony/rcs/SipDelegateControllerTest.java
@@ -30,6 +30,7 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import android.os.Binder;
 import android.telephony.ims.DelegateRegistrationState;
 import android.telephony.ims.DelegateRequest;
 import android.telephony.ims.FeatureTagState;
@@ -291,8 +292,8 @@
 
     private SipDelegateController getTestDelegateController(DelegateRequest request,
             Set<FeatureTagState> deniedSet) {
-        return new SipDelegateController(TEST_SUB_ID, request, "", mExecutorService,
-                mMockMessageTracker, mMockDelegateStateTracker,
+        return new SipDelegateController(TEST_SUB_ID, Binder.getCallingUid(), request, "",
+                mExecutorService, mMockMessageTracker, mMockDelegateStateTracker,
                 (a, b, deniedFeatureSet, d, e) ->  {
                     assertEquals(deniedSet, deniedFeatureSet);
                     return mMockBinderConnection;
diff --git a/tests/src/com/android/services/telephony/rcs/SipTransportControllerTest.java b/tests/src/com/android/services/telephony/rcs/SipTransportControllerTest.java
index 0f139f8..42a45f4 100644
--- a/tests/src/com/android/services/telephony/rcs/SipTransportControllerTest.java
+++ b/tests/src/com/android/services/telephony/rcs/SipTransportControllerTest.java
@@ -78,6 +78,7 @@
 @RunWith(AndroidJUnit4.class)
 public class SipTransportControllerTest extends TelephonyTestBase {
     private static final int TEST_SUB_ID = 1;
+    private static final int TEST_UID = 1001;
     private static final String TEST_PACKAGE_NAME = "com.test_pkg";
     private static final String TEST_PACKAGE_NAME_2 = "com.test_pkg2";
     private static final int TIMEOUT_MS = 200;
@@ -132,13 +133,13 @@
         mSmsPackageName.add(TEST_PACKAGE_NAME);
         doAnswer(invocation -> {
             Integer subId = invocation.getArgument(0);
-            String packageName = invocation.getArgument(2);
-            DelegateRequest request = invocation.getArgument(1);
+            String packageName = invocation.getArgument(3);
+            DelegateRequest request = invocation.getArgument(2);
             SipDelegateController c = getMockDelegateController(subId, packageName, request);
             assertNotNull("create called with no corresponding controller set up", c);
             return c;
-        }).when(mMockDelegateControllerFactory).create(anyInt(), any(), anyString(), any(), any(),
-                any(), any(), any());
+        }).when(mMockDelegateControllerFactory).create(anyInt(), anyInt(), any(), anyString(),
+                any(), any(), any(), any(), any());
         setFeatureAllowedConfig(TEST_SUB_ID, new String[]{ImsSignallingUtils.MMTEL_TAG,
                 ImsSignallingUtils.ONE_TO_ONE_CHAT_TAG, ImsSignallingUtils.GROUP_CHAT_TAG,
                 ImsSignallingUtils.FILE_TRANSFER_HTTP_TAG});
@@ -254,7 +255,7 @@
         doReturn(mSipTransport).when(mRcsManager).getSipTransport();
         controller.onRcsConnected(mRcsManager);
         try {
-            controller.createSipDelegate(TEST_SUB_ID + 1,
+            controller.createSipDelegate(TEST_SUB_ID + 1, TEST_UID,
                     new DelegateRequest(Collections.emptySet()), TEST_PACKAGE_NAME,
                     mock(ISipDelegateConnectionStateCallback.class),
                     mock(ISipDelegateMessageCallback.class));
@@ -271,7 +272,7 @@
         doReturn(null).when(mRcsManager).getSipTransport();
         controller.onRcsConnected(mRcsManager);
         try {
-            controller.createSipDelegate(TEST_SUB_ID,
+            controller.createSipDelegate(TEST_SUB_ID, TEST_UID,
                     new DelegateRequest(Collections.emptySet()), TEST_PACKAGE_NAME,
                     mock(ISipDelegateConnectionStateCallback.class),
                     mock(ISipDelegateMessageCallback.class));
@@ -289,7 +290,7 @@
                 .when(mRcsManager).getSipTransport();
         // No RCS connected message
         try {
-            controller.createSipDelegate(TEST_SUB_ID,
+            controller.createSipDelegate(TEST_SUB_ID, TEST_UID,
                     new DelegateRequest(Collections.emptySet()), TEST_PACKAGE_NAME,
                     mock(ISipDelegateConnectionStateCallback.class),
                     mock(ISipDelegateMessageCallback.class));
@@ -812,7 +813,7 @@
         CompletableFuture<Boolean> pendingChange = setChangeSupportedFeatureTagsFuture(
                 delegateControllerContainer.delegateController, allowedTags, deniedTags);
         try {
-            controller.createSipDelegate(delegateControllerContainer.subId,
+            controller.createSipDelegate(delegateControllerContainer.subId, TEST_UID,
                     delegateControllerContainer.delegateRequest,
                     delegateControllerContainer.packageName,
                     delegateControllerContainer.mockDelegateConnectionCallback,