Merge changes from topic "API_REVIEW_NTN_SIGNAL_STRENGTH" into main

* changes:
  Added handling exception while invoking ntn signal strength APIs
  Modify error handling for registerForNtnSignalSterngthChanged API
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index 39b16ce..7378480 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -598,7 +598,7 @@
     <string name="hac_mode_summary" msgid="7774989500136009881">"Hörhilfekompatibilität aktivieren"</string>
     <string name="rtt_mode_title" msgid="3075948111362818043">"RTT-Anruf"</string>
     <string name="rtt_mode_summary" msgid="8631541375609989562">"Nachrichten in Sprachanrufen erlauben"</string>
-    <string name="rtt_mode_more_information" msgid="587500128658756318">"Echtzeittext (Real-Time Text, RTT) dient als Unterstützung für Anrufer, die gehörlos, schwerhörig oder sprachgeschädigt sind oder zusätzlich zur gesprochenen Sprache weitere Informationen benötigen.&lt;br&gt; &lt;a href=<xliff:g id="URL">http://support.google.com/mobile?p=telephony_rtt</xliff:g>&gt;Weitere Informationen&lt;/a&gt;\n       &lt;br&gt;&lt;br&gt; – RTT-Anrufe werden als Nachrichtentranskripte gespeichert\n       &lt;br&gt; – RTT ist nicht für Videoanrufe verfügbar"</string>
+    <string name="rtt_mode_more_information" msgid="587500128658756318">"Echtzeittext (Real-Time Text, RTT) dient als Unterstützung für Anrufer mit Hör- oder Sprachbehinderung oder Anrufer, die zusätzlich zur gesprochenen Sprache weitere Informationen benötigen.&lt;br&gt; &lt;a href=<xliff:g id="URL">http://support.google.com/mobile?p=telephony_rtt</xliff:g>&gt;Weitere Informationen&lt;/a&gt;\n       &lt;br&gt;&lt;br&gt; – RTT-Anrufe werden als Nachrichtentranskripte gespeichert\n       &lt;br&gt; – RTT ist nicht für Videoanrufe verfügbar"</string>
     <string name="no_rtt_when_roaming" msgid="5268008247378355389">"Hinweis: RTT ist während des Roamings nicht verfügbar"</string>
   <string-array name="tty_mode_entries">
     <item msgid="3238070884803849303">"TTY aus"</item>
diff --git a/res/values-in/strings.xml b/res/values-in/strings.xml
index 25e1414..9484f54 100644
--- a/res/values-in/strings.xml
+++ b/res/values-in/strings.xml
@@ -289,7 +289,7 @@
     <string name="roaming_enabled_message" msgid="9022249120750897">"Biaya roaming dapat berlaku. Ketuk untuk mengubah."</string>
     <string name="roaming_notification_title" msgid="3590348480688047320">"Koneksi data seluler terputus"</string>
     <string name="roaming_on_notification_title" msgid="7451473196411559173">"Roaming data aktif"</string>
-    <string name="roaming_warning" msgid="7855681468067171971">"Anda dapat dikenakan biaya yang cukup besar."</string>
+    <string name="roaming_warning" msgid="7855681468067171971">"Anda dapat dikenai biaya yang cukup besar."</string>
     <string name="roaming_check_price_warning" msgid="8212484083990570215">"Hubungi penyedia jaringan untuk mengetahui harganya."</string>
     <string name="roaming_alert_title" msgid="5689615818220960940">"Izinkan roaming data?"</string>
     <string name="limited_sim_function_notification_title" msgid="612715399099846281">"Fungsi SIM terbatas"</string>
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index faff77e..3bd29e3 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -401,6 +401,8 @@
 
     // Toggling null cipher and integrity support was added in IRadioNetwork 2.1
     private static final int MIN_NULL_CIPHER_AND_INTEGRITY_VERSION = 201;
+    // Cellular identifier disclosure transparency was added in IRadioNetwork 2.2
+    private static final int MIN_IDENTIFIER_DISCLOSURE_VERSION = 202;
 
     /** The singleton instance. */
     private static PhoneInterfaceManager sInstance;
@@ -11938,6 +11940,18 @@
         }
     }
 
+    private void checkForIdentifierDisclosureNotificationSupport() {
+        if (getHalVersion(HAL_SERVICE_NETWORK) < MIN_IDENTIFIER_DISCLOSURE_VERSION) {
+            throw new UnsupportedOperationException(
+                    "Cellular identifier disclosure transparency operations require HAL 2.2 or "
+                            + "above");
+        }
+        if (!getDefaultPhone().isIdentifierDisclosureTransparencySupported()) {
+            throw new UnsupportedOperationException(
+                    "Cellular identifier disclosure transparency operations unsupported by modem");
+        }
+    }
+
     /**
      * Get the SIM state for the slot index.
      * For Remote-SIMs, this method returns {@link IccCardConstants.State#UNKNOWN}
@@ -12777,6 +12791,46 @@
     }
 
     /**
+     * Enable or disable notifications sent for cellular identifier disclosure events.
+     *
+     * Disclosure events are defined as instances where a device has sent a cellular identifier
+     * on the Non-access stratum (NAS) before a security context is established. As a result the
+     * identifier is sent in the clear, which has privacy implications for the user.
+     *
+     * @param enable if notifications about disclosure events should be enabled
+     * @throws SecurityException             if the caller does not have the required privileges
+     * @throws UnsupportedOperationException if the modem does not support this feature.
+     */
+    @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
+    public void enableCellularIdentifierDisclosureNotifications(boolean enable) {
+        enforceModifyPermission();
+        checkForIdentifierDisclosureNotificationSupport();
+
+        SharedPreferences.Editor editor = mTelephonySharedPreferences.edit();
+        editor.putBoolean(Phone.PREF_IDENTIFIER_DISCLOSURE_NOTIFICATIONS_ENABLED, enable);
+        editor.apply();
+
+        // Each phone instance is responsible for updating its respective modem immediately
+        // after we've made a preference change.
+        for (Phone phone : PhoneFactory.getPhones()) {
+            phone.handleIdentifierDisclosureNotificationPreferenceChange();
+        }
+    }
+
+    /**
+     * Get whether or not cellular identifier disclosure notifications are enabled.
+     *
+     * @throws SecurityException             if the caller does not have the required privileges
+     * @throws UnsupportedOperationException if the modem does not support this feature.
+     */
+    @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+    public boolean isCellularIdentifierDisclosureNotificationEnabled() {
+        enforceReadPrivilegedPermission("isCellularIdentifierDisclosureNotificationEnabled");
+        checkForIdentifierDisclosureNotificationSupport();
+        return getDefaultPhone().getIdentifierDisclosureNotificationsPreferenceEnabled();
+    }
+
+    /**
      * Check whether the caller (or self, if not processing an IPC) can read device identifiers.
      *
      * <p>This method behaves in one of the following ways:
diff --git a/src/com/android/phone/SimPhonebookProvider.java b/src/com/android/phone/SimPhonebookProvider.java
index 8952865..3917d83 100644
--- a/src/com/android/phone/SimPhonebookProvider.java
+++ b/src/com/android/phone/SimPhonebookProvider.java
@@ -50,6 +50,7 @@
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.telephony.IIccPhoneBook;
+import com.android.internal.telephony.flags.Flags;
 import com.android.internal.telephony.uicc.AdnRecord;
 import com.android.internal.telephony.uicc.IccConstants;
 
@@ -173,17 +174,21 @@
     @Override
     public boolean onCreate() {
         ContentResolver resolver = getContext().getContentResolver();
-        return onCreate(getContext().getSystemService(SubscriptionManager.class),
+
+        SubscriptionManager sm = getContext().getSystemService(SubscriptionManager.class);
+        if (sm == null) {
+            return false;
+        } else if (Flags.workProfileApiSplit()) {
+            sm = sm.createForAllUserProfiles();
+        }
+        return onCreate(sm,
                 SimPhonebookProvider::getIccPhoneBook,
                 uri -> resolver.notifyChange(uri, null));
     }
 
     @TestApi
-    boolean onCreate(SubscriptionManager subscriptionManager,
+    boolean onCreate(@NonNull SubscriptionManager subscriptionManager,
             Supplier<IIccPhoneBook> iccPhoneBookSupplier, ContentNotifier notifier) {
-        if (subscriptionManager == null) {
-            return false;
-        }
         mSubscriptionManager = subscriptionManager;
         mIccPhoneBookSupplier = iccPhoneBookSupplier;
         mContentNotifier = notifier;
diff --git a/src/com/android/phone/SpecialCharSequenceMgr.java b/src/com/android/phone/SpecialCharSequenceMgr.java
index 3bf0e1a..8fe084b 100644
--- a/src/com/android/phone/SpecialCharSequenceMgr.java
+++ b/src/com/android/phone/SpecialCharSequenceMgr.java
@@ -33,6 +33,7 @@
 import com.android.internal.telephony.IccCardConstants;
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.TelephonyCapabilities;
+import com.android.internal.telephony.flags.Flags;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -208,6 +209,9 @@
 
     private static int getNextSubIdForState(IccCardConstants.State state, Context context) {
         SubscriptionManager subscriptionManager = SubscriptionManager.from(context);
+        if (Flags.workProfileApiSplit()) {
+            subscriptionManager = subscriptionManager.createForAllUserProfiles();
+        }
         List<SubscriptionInfo> list = subscriptionManager.getActiveSubscriptionInfoList();
         if (list == null) {
             // getActiveSubscriptionInfoList was null callers expect an empty list.
diff --git a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
index 7cc9235..976afd4 100644
--- a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
+++ b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
@@ -24,6 +24,7 @@
 import android.util.Log;
 
 import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.flags.Flags;
 import com.android.phone.PhoneUtils;
 import com.android.phone.R;
 import com.android.phone.SubscriptionInfoHelper;
@@ -94,6 +95,9 @@
         mTelecomManager = getActivity().getSystemService(TelecomManager.class);
         mTelephonyManager = TelephonyManager.from(getActivity());
         mSubscriptionManager = SubscriptionManager.from(getActivity());
+        if (Flags.workProfileApiSplit()) {
+            mSubscriptionManager = mSubscriptionManager.createForAllUserProfiles();
+        }
     }
 
     @Override
diff --git a/src/com/android/phone/settings/RadioInfo.java b/src/com/android/phone/settings/RadioInfo.java
index 8dfb787..f6cd0d1 100644
--- a/src/com/android/phone/settings/RadioInfo.java
+++ b/src/com/android/phone/settings/RadioInfo.java
@@ -104,6 +104,8 @@
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneFactory;
 import com.android.internal.telephony.euicc.EuiccConnector;
+import com.android.internal.telephony.flags.FeatureFlags;
+import com.android.internal.telephony.flags.FeatureFlagsImpl;
 import com.android.internal.telephony.util.TelephonyUtils;
 import com.android.phone.R;
 
@@ -303,6 +305,8 @@
     private int mCellInfoRefreshRateIndex;
     private int mSelectedPhoneIndex;
 
+    private FeatureFlags mFeatureFlags;
+
     private final NetworkRequest mDefaultNetworkRequest = new NetworkRequest.Builder()
             .addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
             .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
@@ -508,6 +512,8 @@
 
         log("Started onCreate");
 
+        mFeatureFlags = new FeatureFlagsImpl();
+
         mQueuedWork = new ThreadPoolExecutor(1, 1, RUNNABLE_TIMEOUT_MS, TimeUnit.MICROSECONDS,
                 new LinkedBlockingDeque<Runnable>());
         mConnectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
@@ -1567,6 +1573,9 @@
     };
 
     private boolean isRadioOn() {
+        if (mFeatureFlags.radioInfoIsRadioOn()) {
+            return mTelephonyManager.getRadioPowerState() == TelephonyManager.RADIO_POWER_ON;
+        }
         //FIXME: Replace with a TelephonyManager call
         return mPhone.getServiceState().getState() != ServiceState.STATE_POWER_OFF;
     }
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 86770a1..f96e6bd 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -2523,8 +2523,8 @@
                             }
                         }
 
-                        if (mTelephonyConnectionService.maybeReselectDomain(this,
-                                  mOriginalConnection.getPreciseDisconnectCause(), reasonInfo)) {
+                        if (mTelephonyConnectionService.maybeReselectDomain(this, reasonInfo,
+                                mShowPreciseFailedCause, mHangupDisconnectCause)) {
                             clearOriginalConnection();
                             break;
                         }
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 48169a2..8ab2723 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -71,6 +71,7 @@
 import com.android.ims.ImsManager;
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.telephony.Call;
+import com.android.internal.telephony.CallFailCause;
 import com.android.internal.telephony.CallStateException;
 import com.android.internal.telephony.GsmCdmaPhone;
 import com.android.internal.telephony.IccCard;
@@ -749,35 +750,45 @@
                 public void onSelectionTerminated(@DisconnectCauses int cause) {
                     mDomainSelectionMainExecutor.execute(new Runnable() {
                         int mCause = cause;
+
                         @Override
                         public void run() {
                             Log.v(this, "Call domain selection terminated.");
                             if (mDomainSelectionConnection != null) {
-                                mDomainSelectionConnection = null;
-                            }
-                            if (mNormalCallConnection != null) {
-                                // TODO: To support ShowPreciseFailedCause, TelephonyConnection
-                                //  .getShowPreciseFailedCause API should be added.
+                                if (mNormalCallConnection != null) {
 
-                                // If cause is NOT_VALID then, it's a redial cancellation and
-                                // use cause code from original connection.
-                                com.android.internal.telephony.Connection connection =
-                                        mNormalCallConnection.getOriginalConnection();
-                                if (connection != null) {
+                                    NormalCallDomainSelectionConnection ncdsConn =
+                                            (NormalCallDomainSelectionConnection)
+                                                    mDomainSelectionConnection;
+
+                                    // If cause is NOT_VALID then, it's a redial cancellation
                                     if (mCause == android.telephony.DisconnectCause.NOT_VALID) {
-                                        mCause = connection.getDisconnectCause();
+                                        mCause = ncdsConn.getDisconnectCause();
                                     }
 
-                                    String reason = connection.getVendorDisconnectCause();
-                                    int phoneId = mNormalCallConnection.getPhone().getPhoneId();
+                                    Log.d(this, "Call connection closed. PreciseCause: "
+                                            + ncdsConn.getPreciseDisconnectCause()
+                                            + " DisconnectCause: " + ncdsConn.getDisconnectCause()
+                                            + " Reason: " + ncdsConn.getReasonMessage());
+
                                     mNormalCallConnection.setTelephonyConnectionDisconnected(
-                                            mDisconnectCauseFactory.toTelecomDisconnectCause(
-                                                    mCause, reason, phoneId));
-                                    Log.d(this, "Call connection closed. Cause: " + mCause
-                                            + " Reason: " + reason);
+                                            DisconnectCauseUtil.toTelecomDisconnectCause(mCause,
+                                                    ncdsConn.getPreciseDisconnectCause(),
+                                                    ncdsConn.getReasonMessage(),
+                                                    ncdsConn.getPhoneId(),
+                                                    ncdsConn.getImsReasonInfo(),
+                                                    new FlagsAdapterImpl()));
+
+                                    mNormalCallConnection.close();
+                                    mNormalCallConnection = null;
+                                } else {
+                                    Log.v(this, "NormalCallConnection is null.");
                                 }
-                                mNormalCallConnection.close();
-                                mNormalCallConnection = null;
+
+                                mDomainSelectionConnection = null;
+
+                            } else {
+                                Log.v(this, "DomainSelectionConnection is null.");
                             }
                         }
                     });
@@ -2514,15 +2525,19 @@
     /**
      * Determine whether reselection of domain is required or not.
      * @param c the {@link Connection} instance.
-     * @param callFailCause the reason why CS call is disconnected. Allowed values are defined in
      * {@link com.android.internal.telephony.CallFailCause}.
      * @param reasonInfo the reason why PS call is disconnected.
+     * @param showPreciseCause Indicates whether this connection supports showing precise
+     *                         call failed cause.
+     * @param overrideCause Provides a DisconnectCause associated with a hang up request.
      * @return {@code true} if reselection of domain is required.
      */
-    public boolean maybeReselectDomain(final TelephonyConnection c,
-            int callFailCause, ImsReasonInfo reasonInfo) {
+    public boolean maybeReselectDomain(final TelephonyConnection c, ImsReasonInfo reasonInfo,
+                                       boolean showPreciseCause, int overrideCause) {
         if (!mDomainSelectionResolver.isDomainSelectionSupported()) return false;
 
+        int callFailCause = c.getOriginalConnection().getPreciseDisconnectCause();
+
         Log.i(this, "maybeReselectDomain csCause=" +  callFailCause + ", psCause=" + reasonInfo);
         if (TextUtils.equals(mEmergencyCallId, c.getTelecomCallId())) {
             if (mEmergencyCallDomainSelectionConnection != null) {
@@ -2554,7 +2569,7 @@
             }
         }
 
-        return maybeReselectDomainForNormalCall(c, callFailCause, reasonInfo);
+        return maybeReselectDomainForNormalCall(c, reasonInfo, showPreciseCause, overrideCause);
     }
 
     private boolean maybeReselectDomainForEmergencyCall(final TelephonyConnection c,
@@ -2695,25 +2710,45 @@
     }
 
     private boolean maybeReselectDomainForNormalCall(
-            final TelephonyConnection c, int callFailCause, ImsReasonInfo reasonInfo) {
+            final TelephonyConnection c, ImsReasonInfo reasonInfo,
+            boolean showPreciseCause, int overrideCause) {
 
-        Log.i(LOG_TAG, "maybeReselectDomainForNormalCall " + "csCause:" +  callFailCause
-                + ", psCause:" + reasonInfo);
+        Log.i(LOG_TAG, "maybeReselectDomainForNormalCall");
 
-        if (mDomainSelectionConnection != null && c.getOriginalConnection() != null) {
+        com.android.internal.telephony.Connection originalConn = c.getOriginalConnection();
+        if (mDomainSelectionConnection != null && originalConn != null) {
             Phone phone = c.getPhone().getDefaultPhone();
             final String number = c.getAddress().getSchemeSpecificPart();
-            int videoState = c.getOriginalConnection().getVideoState();
+            int videoState = originalConn.getVideoState();
+
             SelectionAttributes selectionAttributes = NormalCallDomainSelectionConnection
                     .getSelectionAttributes(phone.getPhoneId(), phone.getSubId(),
                             c.getTelecomCallId(), number, VideoProfile.isVideo(videoState),
-                            callFailCause, reasonInfo);
+                            originalConn.getPreciseDisconnectCause(), reasonInfo);
 
-            Log.d(LOG_TAG, "Reselecting the domain for call");
-            mNormalCallConnection = c;
             CompletableFuture<Integer> future = mDomainSelectionConnection
                     .reselectDomain(selectionAttributes);
             if (future != null) {
+                int preciseDisconnectCause = CallFailCause.NOT_VALID;
+                if (showPreciseCause) {
+                    preciseDisconnectCause = originalConn.getPreciseDisconnectCause();
+                }
+
+                int disconnectCause = originalConn.getDisconnectCause();
+                if ((overrideCause != android.telephony.DisconnectCause.NOT_VALID)
+                        && (overrideCause != disconnectCause)) {
+                    Log.i(LOG_TAG, "setDisconnected: override cause: " + disconnectCause
+                            + " -> " + overrideCause);
+                    disconnectCause = overrideCause;
+                }
+
+                ((NormalCallDomainSelectionConnection) mDomainSelectionConnection)
+                        .setDisconnectCause(disconnectCause, preciseDisconnectCause,
+                                originalConn.getVendorDisconnectCause());
+
+                Log.d(LOG_TAG, "Reselecting the domain for call");
+                mNormalCallConnection = c;
+
                 future.thenAcceptAsync((result) -> {
                     onNormalCallRedial(c, phone, result, videoState);
                 }, mDomainSelectionMainExecutor);
diff --git a/src/com/android/services/telephony/domainselection/NormalCallDomainSelector.java b/src/com/android/services/telephony/domainselection/NormalCallDomainSelector.java
index 32c05fa..f85dabe 100644
--- a/src/com/android/services/telephony/domainselection/NormalCallDomainSelector.java
+++ b/src/com/android/services/telephony/domainselection/NormalCallDomainSelector.java
@@ -238,7 +238,8 @@
 
         PersistableBundle config = null;
         if (configManager != null) {
-            config = configManager.getConfigForSubId(mSelectionAttributes.getSubId());
+            config = configManager.getConfigForSubId(mSelectionAttributes.getSubId(),
+                    new String[] {CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL});
         }
 
         return (config != null)
@@ -265,7 +266,8 @@
 
         PersistableBundle config = null;
         if (configManager != null) {
-            config = configManager.getConfigForSubId(mSelectionAttributes.getSubId());
+            config = configManager.getConfigForSubId(mSelectionAttributes.getSubId(),
+                    new String[] {CarrierConfigManager.KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL});
         }
 
         return (config != null)
@@ -297,9 +299,9 @@
         // IMS -> CS
         ImsReasonInfo imsReasonInfo = mSelectionAttributes.getPsDisconnectCause();
         if (mReselectDomain && imsReasonInfo != null) {
-            logd("PsDisconnectCause:" + imsReasonInfo.mCode);
+            logd("PsDisconnectCause:" + imsReasonInfo.getCode());
             mReselectDomain = false;
-            if (imsReasonInfo.mCode == ImsReasonInfo.CODE_LOCAL_CALL_CS_RETRY_REQUIRED) {
+            if (imsReasonInfo.getCode() == ImsReasonInfo.CODE_LOCAL_CALL_CS_RETRY_REQUIRED) {
                 if (isOutOfService()) {
                     loge("Cannot place call in current ServiceState: " + mServiceState.getState());
                     notifySelectionTerminated(DisconnectCause.OUT_OF_SERVICE);
diff --git a/src/com/android/services/telephony/domainselection/TelephonyDomainSelectionService.java b/src/com/android/services/telephony/domainselection/TelephonyDomainSelectionService.java
index de2d752..66894f7 100644
--- a/src/com/android/services/telephony/domainselection/TelephonyDomainSelectionService.java
+++ b/src/com/android/services/telephony/domainselection/TelephonyDomainSelectionService.java
@@ -38,6 +38,7 @@
 import android.util.SparseArray;
 
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.telephony.flags.Flags;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
@@ -384,6 +385,9 @@
      */
     private void handleSubscriptionsChanged() {
         SubscriptionManager sm = mContext.getSystemService(SubscriptionManager.class);
+        if (Flags.workProfileApiSplit()) {
+            sm = sm.createForAllUserProfiles();
+        }
         List<SubscriptionInfo> subsInfoList =
                 (sm != null) ? sm.getActiveSubscriptionInfoList() : null;
 
diff --git a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
index 653b492..f0a5220 100644
--- a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
+++ b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
@@ -2216,7 +2216,8 @@
         TestTelephonyConnection c = setupForReDialForDomainSelection(
                 mPhone0, selectedDomain, preciseDisconnectCause, disconnectCause, true);
 
-        assertTrue(mTestConnectionService.maybeReselectDomain(c, preciseDisconnectCause, null));
+        assertTrue(mTestConnectionService.maybeReselectDomain(c, null, true,
+                android.telephony.DisconnectCause.NOT_VALID));
         verify(mEmergencyCallDomainSelectionConnection).reselectDomain(any());
 
         ArgumentCaptor<DialArgs> argsCaptor = ArgumentCaptor.forClass(DialArgs.class);
@@ -2244,7 +2245,8 @@
         TestTelephonyConnection c = setupForReDialForDomainSelection(
                 mPhone0, selectedDomain, preciseDisconnectCause, disconnectCause, true);
 
-        assertTrue(mTestConnectionService.maybeReselectDomain(c, preciseDisconnectCause, null));
+        assertTrue(mTestConnectionService.maybeReselectDomain(c, null, true,
+                android.telephony.DisconnectCause.NOT_VALID));
         verify(mEmergencyCallDomainSelectionConnection).reselectDomain(any());
 
         ArgumentCaptor<DialArgs> argsCaptor = ArgumentCaptor.forClass(DialArgs.class);
@@ -2657,8 +2659,8 @@
         c.setAddress(TEST_ADDRESS, TelecomManager.PRESENTATION_ALLOWED);
 
         ImsReasonInfo reasonInfo = new ImsReasonInfo(CODE_SIP_ALTERNATE_EMERGENCY_CALL, 0, null);
-        assertTrue(mTestConnectionService.maybeReselectDomain(c,
-                  preciseDisconnectCause, reasonInfo));
+        assertTrue(mTestConnectionService.maybeReselectDomain(c, reasonInfo, true,
+                android.telephony.DisconnectCause.NOT_VALID));
 
         verify(mDomainSelectionResolver)
                 .getDomainSelectionConnection(eq(mPhone0), eq(SELECTOR_TYPE_CALLING), eq(true));
@@ -2698,8 +2700,8 @@
         c.setAddress(TEST_ADDRESS, TelecomManager.PRESENTATION_ALLOWED);
 
         ImsReasonInfo reasonInfo = new ImsReasonInfo(CODE_SIP_ALTERNATE_EMERGENCY_CALL, 0, null);
-        assertTrue(mTestConnectionService.maybeReselectDomain(c,
-                  preciseDisconnectCause, reasonInfo));
+        assertTrue(mTestConnectionService.maybeReselectDomain(c, reasonInfo, true,
+                android.telephony.DisconnectCause.NOT_VALID));
 
         verify(mDomainSelectionResolver)
                 .getDomainSelectionConnection(eq(mPhone0), eq(SELECTOR_TYPE_CALLING), eq(true));
@@ -2927,7 +2929,8 @@
         doReturn(future).when(mEmergencyCallDomainSelectionConnection)
                 .reselectDomain(any());
 
-        assertTrue(mTestConnectionService.maybeReselectDomain(c, preciseDisconnectCause, null));
+        assertTrue(mTestConnectionService.maybeReselectDomain(c, null, true,
+                android.telephony.DisconnectCause.NOT_VALID));
         verify(mEmergencyCallDomainSelectionConnection).reselectDomain(any());
 
         // dialing is canceled
@@ -2964,8 +2967,8 @@
                 .startEmergencyCall(any(), anyString(), eq(false));
 
         ImsReasonInfo reasonInfo = new ImsReasonInfo(CODE_SIP_ALTERNATE_EMERGENCY_CALL, 0, null);
-        assertTrue(mTestConnectionService.maybeReselectDomain(c,
-                  preciseDisconnectCause, reasonInfo));
+        assertTrue(mTestConnectionService.maybeReselectDomain(c, reasonInfo, true,
+                android.telephony.DisconnectCause.NOT_VALID));
 
         verify(mEmergencyStateTracker)
                 .startEmergencyCall(eq(mPhone0), eq(TELECOM_CALL_ID1), eq(false));
@@ -3006,8 +3009,8 @@
                 .createEmergencyConnection(any(), any());
 
         ImsReasonInfo reasonInfo = new ImsReasonInfo(CODE_SIP_ALTERNATE_EMERGENCY_CALL, 0, null);
-        assertTrue(mTestConnectionService.maybeReselectDomain(c,
-                  preciseDisconnectCause, reasonInfo));
+        assertTrue(mTestConnectionService.maybeReselectDomain(c, reasonInfo, true,
+                android.telephony.DisconnectCause.NOT_VALID));
 
         verify(mEmergencyCallDomainSelectionConnection).createEmergencyConnection(any(), any());
 
@@ -3182,7 +3185,8 @@
         doReturn(new CompletableFuture()).when(mEmergencyCallDomainSelectionConnection)
                 .reselectDomain(any());
 
-        assertTrue(mTestConnectionService.maybeReselectDomain(c, preciseDisconnectCause, null));
+        assertTrue(mTestConnectionService.maybeReselectDomain(c, null, true,
+                android.telephony.DisconnectCause.NOT_VALID));
         verify(mEmergencyCallDomainSelectionConnection).reselectDomain(any());
     }
 
@@ -3201,7 +3205,8 @@
         doReturn(new CompletableFuture()).when(mEmergencyCallDomainSelectionConnection)
                 .reselectDomain(any());
 
-        assertTrue(mTestConnectionService.maybeReselectDomain(c, preciseDisconnectCause, null));
+        assertTrue(mTestConnectionService.maybeReselectDomain(c, null, true,
+                android.telephony.DisconnectCause.NOT_VALID));
         verify(mEmergencyCallDomainSelectionConnection).reselectDomain(any());
     }
 
diff --git a/tests/src/com/android/services/telephony/TelephonyConnectionTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionTest.java
index bf9fa01..c659d5e 100644
--- a/tests/src/com/android/services/telephony/TelephonyConnectionTest.java
+++ b/tests/src/com/android/services/telephony/TelephonyConnectionTest.java
@@ -14,6 +14,7 @@
 
 import static org.junit.Assert.assertNotEquals;
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.doReturn;
@@ -280,7 +281,7 @@
         c.updateState();
 
         verify(mTelephonyConnectionService)
-                .maybeReselectDomain(any(), anyInt(), any());
+                .maybeReselectDomain(any(), any(), anyBoolean(), anyInt());
     }
 
     @Test
@@ -291,7 +292,7 @@
                 .getState();
         c.setTelephonyConnectionService(mTelephonyConnectionService);
         doReturn(false).when(mTelephonyConnectionService)
-                .maybeReselectDomain(any(), anyInt(), any());
+                .maybeReselectDomain(any(), any(), anyBoolean(), anyInt());
         c.updateState();
 
         assertEquals(STATE_DISCONNECTED, c.getState());
@@ -306,7 +307,7 @@
                 .getState();
         c.setTelephonyConnectionService(mTelephonyConnectionService);
         doReturn(true).when(mTelephonyConnectionService)
-                .maybeReselectDomain(any(), anyInt(), any());
+                .maybeReselectDomain(any(), any(), anyBoolean(), anyInt());
         c.resetOriginalConnectionCleared();
         c.updateState();
 
@@ -327,7 +328,7 @@
                 .when(mImsPhoneConnection).getEmergencyNumberInfo();
         c.setTelephonyConnectionService(mTelephonyConnectionService);
         doReturn(true).when(mTelephonyConnectionService)
-                .maybeReselectDomain(any(), anyInt(), any());
+                .maybeReselectDomain(any(), any(), anyBoolean(), anyInt());
         c.updateState();
 
         Integer serviceCategory = c.getEmergencyServiceCategory();
@@ -351,7 +352,7 @@
                 .when(mImsPhoneConnection).getEmergencyNumberInfo();
         c.setTelephonyConnectionService(mTelephonyConnectionService);
         doReturn(true).when(mTelephonyConnectionService)
-                .maybeReselectDomain(any(), anyInt(), any());
+                .maybeReselectDomain(any(), any(), anyBoolean(), anyInt());
         c.updateState();
 
         Integer serviceCategory = c.getEmergencyServiceCategory();
diff --git a/tests/src/com/android/services/telephony/domainselection/NormalCallDomainSelectorTest.java b/tests/src/com/android/services/telephony/domainselection/NormalCallDomainSelectorTest.java
index 4dd1f3c..002c7d5 100644
--- a/tests/src/com/android/services/telephony/domainselection/NormalCallDomainSelectorTest.java
+++ b/tests/src/com/android/services/telephony/domainselection/NormalCallDomainSelectorTest.java
@@ -344,7 +344,8 @@
         //Case 1: WPS not supported by IMS
         PersistableBundle config = new PersistableBundle();
         config.putBoolean(CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL, false);
-        doReturn(config).when(mMockCarrierConfigMgr).getConfigForSubId(SUB_ID_1);
+        doReturn(config).when(mMockCarrierConfigMgr).getConfigForSubId(SUB_ID_1,
+                new String[]{CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL});
         ServiceState serviceState = new ServiceState();
         serviceState.setState(ServiceState.STATE_IN_SERVICE);
         initialize(serviceState, true, true, true, true);
@@ -387,7 +388,8 @@
         doReturn(TelecomManager.TTY_MODE_FULL).when(mMockTelecomManager).getCurrentTtyMode();
         PersistableBundle config = new PersistableBundle();
         config.putBoolean(CarrierConfigManager.KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL, false);
-        doReturn(config).when(mMockCarrierConfigMgr).getConfigForSubId(SUB_ID_1);
+        doReturn(config).when(mMockCarrierConfigMgr).getConfigForSubId(SUB_ID_1,
+                new String[]{CarrierConfigManager.KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL});
         ServiceState serviceState = new ServiceState();
         serviceState.setState(ServiceState.STATE_IN_SERVICE);
         initialize(serviceState, true, false, true, true);
diff --git a/tests/src/com/android/services/telephony/domainselection/TelephonyDomainSelectionServiceTest.java b/tests/src/com/android/services/telephony/domainselection/TelephonyDomainSelectionServiceTest.java
index 647ef41..f4d2732 100644
--- a/tests/src/com/android/services/telephony/domainselection/TelephonyDomainSelectionServiceTest.java
+++ b/tests/src/com/android/services/telephony/domainselection/TelephonyDomainSelectionServiceTest.java
@@ -20,6 +20,7 @@
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
@@ -44,6 +45,7 @@
 import androidx.test.runner.AndroidJUnit4;
 
 import com.android.TestContext;
+import com.android.internal.telephony.flags.Flags;
 
 import org.junit.After;
 import org.junit.Before;
@@ -135,6 +137,9 @@
         mTestableLooper = new TestableLooper(mDomainSelectionService.getLooper());
 
         mSubscriptionManager = mContext.getSystemService(SubscriptionManager.class);
+        if (Flags.workProfileApiSplit()) {
+            doReturn(mSubscriptionManager).when(mSubscriptionManager).createForAllUserProfiles();
+        }
         ArgumentCaptor<OnSubscriptionsChangedListener> listenerCaptor =
                 ArgumentCaptor.forClass(OnSubscriptionsChangedListener.class);
         verify(mSubscriptionManager).addOnSubscriptionsChangedListener(