Show password dialog when setting Call Barring without UT

Password dialog might be missing when setting Calling Barring when UT is
disabled. This will cause the Call Barring request to fail since
password dialog should always be shown when setting Calling Barring
without UT.

Correct by changing logic to verify that password dialog is shown if
UT is disabled.

Bug: 119216347
Test: atest TeleServiceTests
Change-Id: I9031c2206591b04309dac474309eee6530ea2a3e
diff --git a/src/com/android/phone/CallBarringDeselectAllPreference.java b/src/com/android/phone/CallBarringDeselectAllPreference.java
index 153bc0c..e9310f8 100644
--- a/src/com/android/phone/CallBarringDeselectAllPreference.java
+++ b/src/com/android/phone/CallBarringDeselectAllPreference.java
@@ -18,7 +18,6 @@
 
 import android.content.Context;
 import android.os.Bundle;
-import android.telephony.ServiceState;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.view.View;
@@ -52,9 +51,7 @@
     protected void showDialog(Bundle state) {
         // Finds out if the password field should be shown or not.
         ImsPhone imsPhone = mPhone != null ? (ImsPhone) mPhone.getImsPhone() : null;
-        mShowPassword = !(imsPhone != null
-                && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE)
-                        || imsPhone.isUtEnabled()));
+        mShowPassword = !(imsPhone != null && imsPhone.isUtEnabled());
 
         // Selects dialog message depending on if the password field is shown or not.
         setDialogMessage(getContext().getString(mShowPassword
diff --git a/src/com/android/phone/CallBarringEditPreference.java b/src/com/android/phone/CallBarringEditPreference.java
index 72b3ea5..edff1e3 100644
--- a/src/com/android/phone/CallBarringEditPreference.java
+++ b/src/com/android/phone/CallBarringEditPreference.java
@@ -26,7 +26,6 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
-import android.telephony.ServiceState;
 import android.text.method.DigitsKeyListener;
 import android.text.method.PasswordTransformationMethod;
 import android.util.AttributeSet;
@@ -257,9 +256,7 @@
 
     private void setShowPassword() {
         ImsPhone imsPhone = mPhone != null ? (ImsPhone) mPhone.getImsPhone() : null;
-        mShowPassword = !(imsPhone != null
-                && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE)
-                        || imsPhone.isUtEnabled()));
+        mShowPassword = !(imsPhone != null && imsPhone.isUtEnabled());
     }
 
     @Override
diff --git a/src/com/android/phone/GsmUmtsCallBarringOptions.java b/src/com/android/phone/GsmUmtsCallBarringOptions.java
index a6f9844..3c9cd84 100644
--- a/src/com/android/phone/GsmUmtsCallBarringOptions.java
+++ b/src/com/android/phone/GsmUmtsCallBarringOptions.java
@@ -27,7 +27,6 @@
 import android.preference.Preference;
 import android.preference.PreferenceScreen;
 import android.telephony.CarrierConfigManager;
-import android.telephony.ServiceState;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 import android.util.Log;
@@ -423,9 +422,7 @@
         boolean useDisableaAll = true;
 
         ImsPhone imsPhone = mPhone != null ? (ImsPhone) mPhone.getImsPhone() : null;
-        if (imsPhone != null
-                && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE)
-                        || imsPhone.isUtEnabled())) {
+        if (imsPhone != null && imsPhone.isUtEnabled()) {
             usePassword = false;
             useDisableaAll = false;
         }