Merge "Add missing fields to ApnSetting#toContentValues" into udc-dev

This commit is contained in:
Rayan Osseiran
2023-04-25 17:12:47 +00:00
committed by Android (Google) Code Review

View File

@@ -1337,6 +1337,14 @@ public class ApnSetting implements Parcelable {
public ContentValues toContentValues() {
ContentValues apnValue = new ContentValues();
apnValue.put(Telephony.Carriers.NUMERIC, nullToEmpty(mOperatorNumeric));
// If the APN is editable, the user may be able to set an invalid numeric. The numeric must
// always be 5 or 6 characters (depending on the length of the MNC), so skip if it is
// potentially invalid.
if (!TextUtils.isEmpty(mOperatorNumeric)
&& (mOperatorNumeric.length() == 5 || mOperatorNumeric.length() == 6)) {
apnValue.put(Telephony.Carriers.MCC, mOperatorNumeric.substring(0, 3));
apnValue.put(Telephony.Carriers.MNC, mOperatorNumeric.substring(3));
}
apnValue.put(Telephony.Carriers.NAME, nullToEmpty(mEntryName));
apnValue.put(Telephony.Carriers.APN, nullToEmpty(mApnName));
apnValue.put(Telephony.Carriers.PROXY, nullToEmpty(mProxyAddress));
@@ -1356,6 +1364,7 @@ public class ApnSetting implements Parcelable {
getProtocolStringFromInt(mRoamingProtocol));
apnValue.put(Telephony.Carriers.CARRIER_ENABLED, mCarrierEnabled);
apnValue.put(Telephony.Carriers.MVNO_TYPE, getMvnoTypeStringFromInt(mMvnoType));
apnValue.put(Telephony.Carriers.MVNO_MATCH_DATA, nullToEmpty(mMvnoMatchData));
apnValue.put(Telephony.Carriers.NETWORK_TYPE_BITMASK, mNetworkTypeBitmask);
apnValue.put(Telephony.Carriers.LINGERING_NETWORK_TYPE_BITMASK,
mLingeringNetworkTypeBitmask);