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/CallBarringEditPreference.java b/src/com/android/phone/CallBarringEditPreference.java
index edff1e3..d54b89b 100644
--- a/src/com/android/phone/CallBarringEditPreference.java
+++ b/src/com/android/phone/CallBarringEditPreference.java
@@ -38,7 +38,6 @@
import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
-import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.phone.settings.fdn.EditPinPreference;
import java.lang.ref.WeakReference;
@@ -57,10 +56,7 @@
private CharSequence mDisableText;
private CharSequence mSummaryOn;
private CharSequence mSummaryOff;
- private CharSequence mDialogMessageEnabled;
- private CharSequence mDialogMessageDisabled;
private int mButtonClicked;
- private boolean mShowPassword;
private final MyHandler mHandler = new MyHandler(this);
private Phone mPhone;
private TimeConsumingPreferenceListener mTcpListener;
@@ -90,10 +86,6 @@
typedArray = context.obtainStyledAttributes(attrs,
R.styleable.CallBarringEditPreference, 0, R.style.EditPhoneNumberPreference);
mFacility = typedArray.getString(R.styleable.CallBarringEditPreference_facility);
- mDialogMessageEnabled = typedArray.getString(
- R.styleable.CallBarringEditPreference_dialogMessageEnabledNoPwd);
- mDialogMessageDisabled = typedArray.getString(
- R.styleable.CallBarringEditPreference_dialogMessageDisabledNoPwd);
typedArray.recycle();
}
@@ -130,29 +122,8 @@
}
@Override
- protected boolean needInputMethod() {
- // Input method should only be displayed if the password-field is shown.
- return mShowPassword;
- }
-
- void setInputMethodNeeded(boolean needed) {
- mShowPassword = needed;
- }
-
- @Override
protected void showDialog(Bundle state) {
- setShowPassword();
- if (mShowPassword) {
- setDialogMessage(getContext().getString(R.string.messageCallBarring));
- } else {
- setDialogMessage(mIsActivated ? mDialogMessageEnabled : mDialogMessageDisabled);
- }
-
- if (DBG) {
- Log.d(LOG_TAG, "showDialog: mShowPassword: " + mShowPassword
- + ", mIsActivated: " + mIsActivated);
- }
-
+ setDialogMessage(getContext().getString(R.string.messageCallBarring));
super.showDialog(state);
}
@@ -204,8 +175,7 @@
editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
editText.setKeyListener(DigitsKeyListener.getInstance());
- // Hide the input-text-line if the password is not shown.
- editText.setVisibility(mShowPassword ? View.VISIBLE : View.GONE);
+ editText.setVisibility(View.VISIBLE);
}
}
@@ -217,17 +187,14 @@
+ positiveResult);
}
if (mButtonClicked != DialogInterface.BUTTON_NEGATIVE) {
- String password = null;
- if (mShowPassword) {
- password = getEditText().getText().toString();
+ String password = getEditText().getText().toString();
- // Check if the password is valid.
- if (password == null || password.length() != PW_LENGTH) {
- Toast.makeText(getContext(),
- getContext().getString(R.string.call_barring_right_pwd_number),
- Toast.LENGTH_SHORT).show();
- return;
- }
+ // Check if the password is valid.
+ if (password == null || password.length() != PW_LENGTH) {
+ Toast.makeText(getContext(),
+ getContext().getString(R.string.call_barring_right_pwd_number),
+ Toast.LENGTH_SHORT).show();
+ return;
}
if (DBG) {
@@ -254,11 +221,6 @@
notifyDependencyChange(shouldDisableDependents());
}
- private void setShowPassword() {
- ImsPhone imsPhone = mPhone != null ? (ImsPhone) mPhone.getImsPhone() : null;
- mShowPassword = !(imsPhone != null && imsPhone.isUtEnabled());
- }
-
@Override
public boolean shouldDisableDependents() {
return mIsActivated;
@@ -310,16 +272,6 @@
pref.mTcpListener.onFinished(pref, false);
} else {
pref.mTcpListener.onFinished(pref, true);
- ImsPhone imsPhone = pref.mPhone != null
- ? (ImsPhone) pref.mPhone.getImsPhone() : null;
- if (!pref.mShowPassword && (imsPhone == null || !imsPhone.isUtEnabled())) {
- // Re-enable password when rejected from NW and modem would perform CSFB
- pref.mShowPassword = true;
- if (DBG) {
- Log.d(LOG_TAG,
- "handleGetCallBarringResponse: mShowPassword changed for CSFB");
- }
- }
}
// Unsuccessful query for call barring.