Change to not cache user entered apn type as user may change it.

Test: manual
Bug: 64263412
Change-Id: Idc49109926e123eddec7f6553f3c493b1ed22212
This commit is contained in:
Amit Mahajan
2017-08-02 09:59:03 -07:00
parent 937e2d5a8e
commit efe090ec60

View File

@@ -118,7 +118,6 @@ public class ApnEditor extends SettingsPreferenceFragment
private String[] mReadOnlyApnTypes; private String[] mReadOnlyApnTypes;
private String[] mReadOnlyApnFields; private String[] mReadOnlyApnFields;
private boolean mReadOnlyApn; private boolean mReadOnlyApn;
private String mUserEnteredApnType;
/** /**
* Standard projection for the interesting columns of a normal note. * Standard projection for the interesting columns of a normal note.
@@ -214,7 +213,6 @@ public class ApnEditor extends SettingsPreferenceFragment
mReadOnlyApn = false; mReadOnlyApn = false;
mReadOnlyApnTypes = null; mReadOnlyApnTypes = null;
mReadOnlyApnFields = null; mReadOnlyApnFields = null;
mUserEnteredApnType = null;
CarrierConfigManager configManager = (CarrierConfigManager) CarrierConfigManager configManager = (CarrierConfigManager)
getSystemService(Context.CARRIER_CONFIG_SERVICE); getSystemService(Context.CARRIER_CONFIG_SERVICE);
@@ -1117,15 +1115,11 @@ public class ApnEditor extends SettingsPreferenceFragment
} }
private String getUserEnteredApnType() { private String getUserEnteredApnType() {
if (mUserEnteredApnType != null) {
return mUserEnteredApnType;
}
// if user has not specified a type, map it to "ALL APN TYPES THAT ARE NOT READ-ONLY" // if user has not specified a type, map it to "ALL APN TYPES THAT ARE NOT READ-ONLY"
mUserEnteredApnType = mApnType.getText(); String userEnteredApnType = mApnType.getText();
if (mUserEnteredApnType != null) mUserEnteredApnType = mUserEnteredApnType.trim(); if (userEnteredApnType != null) userEnteredApnType = userEnteredApnType.trim();
if ((TextUtils.isEmpty(mUserEnteredApnType) if ((TextUtils.isEmpty(userEnteredApnType)
|| PhoneConstants.APN_TYPE_ALL.equals(mUserEnteredApnType)) || PhoneConstants.APN_TYPE_ALL.equals(userEnteredApnType))
&& !ArrayUtils.isEmpty(mReadOnlyApnTypes)) { && !ArrayUtils.isEmpty(mReadOnlyApnTypes)) {
StringBuilder editableApnTypes = new StringBuilder(); StringBuilder editableApnTypes = new StringBuilder();
List<String> readOnlyApnTypes = Arrays.asList(mReadOnlyApnTypes); List<String> readOnlyApnTypes = Arrays.asList(mReadOnlyApnTypes);
@@ -1143,12 +1137,12 @@ public class ApnEditor extends SettingsPreferenceFragment
editableApnTypes.append(apnType); editableApnTypes.append(apnType);
} }
} }
mUserEnteredApnType = editableApnTypes.toString(); userEnteredApnType = editableApnTypes.toString();
Log.d(TAG, "getUserEnteredApnType: changed apn type to editable apn types: " Log.d(TAG, "getUserEnteredApnType: changed apn type to editable apn types: "
+ mUserEnteredApnType); + userEnteredApnType);
} }
return mUserEnteredApnType; return userEnteredApnType;
} }
public static class ErrorDialog extends InstrumentedDialogFragment { public static class ErrorDialog extends InstrumentedDialogFragment {