Check for Service state (VoiceRegState) only before placing call over CS domain

Bug: 359081823
Flag: EXEMPT bugfix
Test: atest TeleServiceTests:NormalCallDomainSelectorTest
Test: Manually verified in VZ, JIO and TMO networks
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:41fa3d1e6357dd336315d5c6bb8a0ffce68628a4)
Merged-In: Ib91a6be06be8784c14880a539fb570064dffd199
Change-Id: Ib91a6be06be8784c14880a539fb570064dffd199
diff --git a/src/com/android/services/telephony/domainselection/NormalCallDomainSelector.java b/src/com/android/services/telephony/domainselection/NormalCallDomainSelector.java
index bf6c647..a8ac047 100644
--- a/src/com/android/services/telephony/domainselection/NormalCallDomainSelector.java
+++ b/src/com/android/services/telephony/domainselection/NormalCallDomainSelector.java
@@ -263,6 +263,12 @@
     }
 
     private void notifyCsSelected() {
+        if (isOutOfService()) {
+            loge("Cannot place call in current ServiceState: " + mServiceState.getState());
+            notifySelectionTerminated(DisconnectCause.OUT_OF_SERVICE);
+            return;
+        }
+
         logd("notifyCsSelected");
         mSelectorState = SelectorState.INACTIVE;
         if (mWwanSelectorCallback == null) {
@@ -317,13 +323,8 @@
             logd("WPS call placed over PS");
             notifyPsSelected();
         } else {
-            if (isOutOfService()) {
-                loge("Cannot place call in current ServiceState: " + mServiceState.getState());
-                notifySelectionTerminated(DisconnectCause.OUT_OF_SERVICE);
-            } else {
-                logd("WPS call placed over CS");
-                notifyCsSelected();
-            }
+            logd("WPS call placed over CS");
+            notifyCsSelected();
         }
     }
 
@@ -367,14 +368,6 @@
         if (mReselectDomain) {
             mReselectDomain = false;
 
-            // Out of service
-            if (isOutOfService()) {
-                loge("Cannot place call in current ServiceState: " + mServiceState.getState());
-                notifySelectionTerminated(DisconnectCause.OUT_OF_SERVICE);
-
-                return;
-            }
-
             // IMS -> CS
             if (imsReasonInfo != null) {
                 logd("PsDisconnectCause:" + imsReasonInfo.getCode());
@@ -412,12 +405,7 @@
 
         if (!mImsStateTracker.isMmTelFeatureAvailable()) {
             logd("MmTelFeatureAvailable unavailable");
-            if (isOutOfService()) {
-                loge("Cannot place call in current ServiceState: " + mServiceState.getState());
-                notifySelectionTerminated(DisconnectCause.OUT_OF_SERVICE);
-            } else {
-                notifyCsSelected();
-            }
+            notifyCsSelected();
             return;
         }
 
@@ -433,23 +421,13 @@
         // Check IMS registration state.
         if (!mImsStateTracker.isImsRegistered()) {
             logd("IMS is NOT registered");
-            if (isOutOfService()) {
-                loge("Cannot place call in current ServiceState: " + mServiceState.getState());
-                notifySelectionTerminated(DisconnectCause.OUT_OF_SERVICE);
-            } else {
-                notifyCsSelected();
-            }
+            notifyCsSelected();
             return;
         }
 
         // Check TTY
         if (isTtyModeEnabled() && !isTtySupportedByIms()) {
-            if (isOutOfService()) {
-                loge("Cannot place call in current ServiceState: " + mServiceState.getState());
-                notifySelectionTerminated(DisconnectCause.OUT_OF_SERVICE);
-            } else {
-                notifyCsSelected();
-            }
+            notifyCsSelected();
             return;
         }
 
@@ -478,12 +456,7 @@
         } else {
             logd("IMS is not voice capable");
             // Voice call CS fallback
-            if (isOutOfService()) {
-                loge("Cannot place call in current ServiceState: " + mServiceState.getState());
-                notifySelectionTerminated(DisconnectCause.OUT_OF_SERVICE);
-            } else {
-                notifyCsSelected();
-            }
+            notifyCsSelected();
         }
     }