Add support to pass password in Call barring

- Adding password support for call barring over IMS

Test: Manual
Bug: 112248618
Change-Id: If86291fa3aa74e34fdb715cc4c6d832b5cc32600
diff --git a/src/com/android/phone/GsmUmtsCallBarringOptions.java b/src/com/android/phone/GsmUmtsCallBarringOptions.java
index 3c9cd84..30e9b5c 100644
--- a/src/com/android/phone/GsmUmtsCallBarringOptions.java
+++ b/src/com/android/phone/GsmUmtsCallBarringOptions.java
@@ -37,7 +37,6 @@
 import com.android.internal.telephony.CommandsInterface;
 import com.android.internal.telephony.GsmCdmaPhone;
 import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.imsphone.ImsPhone;
 import com.android.phone.settings.fdn.EditPinPreference;
 
 import java.util.ArrayList;
@@ -75,7 +74,6 @@
     private static final String DIALOG_PW_ENTRY_KEY = "dialog_pw_enter_key";
     private static final String KEY_STATUS = "toggle";
     private static final String PREFERENCE_ENABLED_KEY = "PREFERENCE_ENABLED";
-    private static final String PREFERENCE_SHOW_PASSWORD_KEY = "PREFERENCE_SHOW_PASSWORD";
     private static final String SAVED_BEFORE_LOAD_COMPLETED_KEY = "PROGRESS_SHOWING";
 
     private CallBarringEditPreference mButtonBAOC;
@@ -141,16 +139,13 @@
             return;
         }
 
-        String password = null;
-        if (mButtonDisableAll.isPasswordShown()) {
-            password = mButtonDisableAll.getText();
-            // Validate the length of password first, before submitting it to the
-            // RIL for CB disable.
-            if (!validatePassword(password)) {
-                mButtonDisableAll.setText("");
-                displayMessage(R.string.call_barring_right_pwd_number);
-                return;
-            }
+        String password = mButtonDisableAll.getText();
+        // Validate the length of password first, before submitting it to the
+        // RIL for CB disable.
+        if (!validatePassword(password)) {
+            mButtonDisableAll.setText("");
+            displayMessage(R.string.call_barring_right_pwd_number);
+            return;
         }
 
         // Submit the disable all request
@@ -417,34 +412,18 @@
         mPreferences.add(mButtonBAIC);
         mPreferences.add(mButtonBAICr);
 
-        // Find out if password is currently used.
-        boolean usePassword = true;
-        boolean useDisableaAll = true;
-
-        ImsPhone imsPhone = mPhone != null ? (ImsPhone) mPhone.getImsPhone() : null;
-        if (imsPhone != null && imsPhone.isUtEnabled()) {
-            usePassword = false;
-            useDisableaAll = false;
-        }
-
         // Find out if the sim card is ready.
         boolean isSimReady = TelephonyManager.from(this).getSimState(
                 SubscriptionManager.getSlotIndex(mPhone.getSubId()))
                         == TelephonyManager.SIM_STATE_READY;
 
-        // Deactivate all option is unavailable when sim card is not ready or Ut is enabled.
-        if (isSimReady && useDisableaAll) {
+        // Deactivate all option and Change password option are unavailable
+        // when sim card is not ready.
+        if (isSimReady) {
             mButtonDisableAll.setEnabled(true);
-            mButtonDisableAll.init(mPhone);
-        } else {
-            mButtonDisableAll.setEnabled(false);
-        }
-
-        // Change password option is unavailable when sim card is not ready or when the password is
-        // not used.
-        if (isSimReady && usePassword) {
             mButtonChangePW.setEnabled(true);
         } else {
+            mButtonDisableAll.setEnabled(false);
             mButtonChangePW.setEnabled(false);
             mButtonChangePW.setSummary(R.string.call_barring_change_pwd_description_disabled);
         }
@@ -472,8 +451,6 @@
                     pref.handleCallBarringResult(bundle.getBoolean(KEY_STATUS));
                     pref.init(this, true, mPhone);
                     pref.setEnabled(bundle.getBoolean(PREFERENCE_ENABLED_KEY, pref.isEnabled()));
-                    pref.setInputMethodNeeded(bundle.getBoolean(PREFERENCE_SHOW_PASSWORD_KEY,
-                            pref.needInputMethod()));
                 }
             }
             mPwChangeState = mIcicle.getInt(PW_CHANGE_STATE_KEY);
@@ -513,7 +490,6 @@
             Bundle bundle = new Bundle();
             bundle.putBoolean(KEY_STATUS, pref.mIsActivated);
             bundle.putBoolean(PREFERENCE_ENABLED_KEY, pref.isEnabled());
-            bundle.putBoolean(PREFERENCE_SHOW_PASSWORD_KEY, pref.needInputMethod());
             outState.putParcelable(pref.getKey(), bundle);
         }
         outState.putInt(PW_CHANGE_STATE_KEY, mPwChangeState);