Add missing fields to ApnSetting#toContentValues

- ApnSetting#toContentValues is missing important fields for
  connectivity and identifying carriers. Added the mcc,mnc and the MVNO
  match data.

Bug: 264916634
Test: atest CtsTelephonyTestCases
Test: Validated no issues on local device (C10).
Change-Id: I71d58247ccc4fe577eec93243fb16399ebbef993
This commit is contained in:
Rayan Osseiran
2023-04-19 17:04:23 -07:00
parent cb5bc8ee43
commit 78f838255a

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);