Merge "Add Carriers.SKIP_464XLAT and includes ApnSetting"
am: a11fb3bafe
Change-Id: Ib07c5eac15c97168d0085470c564d967cd0ada6d
This commit is contained in:
@@ -3765,6 +3765,42 @@ public final class Telephony {
|
||||
*/
|
||||
public static final String CARRIER_ID = "carrier_id";
|
||||
|
||||
/**
|
||||
* The skip 464xlat flag. Flag works as follows.
|
||||
* {@link #SKIP_464XLAT_DEFAULT}: the APN will skip only APN is IMS and no internet.
|
||||
* {@link #SKIP_464XLAT_DISABLE}: the APN will NOT skip 464xlat
|
||||
* {@link #SKIP_464XLAT_ENABLE}: the APN will skip 464xlat
|
||||
* <p>Type: INTEGER</p>
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final String SKIP_464XLAT = "skip_464xlat";
|
||||
|
||||
/**
|
||||
* Possible value for the {@link #SKIP_464XLAT} field.
|
||||
* <p>Type: INTEGER</p>
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int SKIP_464XLAT_DEFAULT = -1;
|
||||
|
||||
/**
|
||||
* Possible value for the {@link #SKIP_464XLAT} field.
|
||||
* <p>Type: INTEGER</p>
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int SKIP_464XLAT_DISABLE = 0;
|
||||
|
||||
/**
|
||||
* Possible value for the {@link #SKIP_464XLAT} field.
|
||||
* <p>Type: INTEGER</p>
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int SKIP_464XLAT_ENABLE = 1;
|
||||
|
||||
|
||||
/** @hide */
|
||||
@IntDef({
|
||||
UNEDITED,
|
||||
@@ -3775,6 +3811,16 @@ public final class Telephony {
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface EditStatus {}
|
||||
|
||||
/** @hide */
|
||||
@IntDef({
|
||||
SKIP_464XLAT_DEFAULT,
|
||||
SKIP_464XLAT_DISABLE,
|
||||
SKIP_464XLAT_ENABLE,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Skip464XlatStatus {}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,6 +61,7 @@ public class ApnSetting implements Parcelable {
|
||||
private static final String V4_FORMAT_REGEX = "^\\[ApnSettingV4\\]\\s*";
|
||||
private static final String V5_FORMAT_REGEX = "^\\[ApnSettingV5\\]\\s*";
|
||||
private static final String V6_FORMAT_REGEX = "^\\[ApnSettingV6\\]\\s*";
|
||||
private static final String V7_FORMAT_REGEX = "^\\[ApnSettingV7\\]\\s*";
|
||||
|
||||
/**
|
||||
* Default value for mtu if it's not set. Moved from PhoneConstants.
|
||||
@@ -286,6 +287,8 @@ public class ApnSetting implements Parcelable {
|
||||
private boolean mPermanentFailed = false;
|
||||
private final int mCarrierId;
|
||||
|
||||
private final int mSkip464Xlat;
|
||||
|
||||
/**
|
||||
* Returns the MTU size of the mobile interface to which the APN connected.
|
||||
*
|
||||
@@ -623,6 +626,17 @@ public class ApnSetting implements Parcelable {
|
||||
return mCarrierId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the skip464xlat flag for this APN.
|
||||
*
|
||||
* @return SKIP_464XLAT_DEFAULT, SKIP_464XLAT_DISABLE or SKIP_464XLAT_ENABLE
|
||||
* @hide
|
||||
*/
|
||||
@Carriers.Skip464XlatStatus
|
||||
public int getSkip464Xlat() {
|
||||
return mSkip464Xlat;
|
||||
}
|
||||
|
||||
private ApnSetting(Builder builder) {
|
||||
this.mEntryName = builder.mEntryName;
|
||||
this.mApnName = builder.mApnName;
|
||||
@@ -651,6 +665,7 @@ public class ApnSetting implements Parcelable {
|
||||
this.mMvnoMatchData = builder.mMvnoMatchData;
|
||||
this.mApnSetId = builder.mApnSetId;
|
||||
this.mCarrierId = builder.mCarrierId;
|
||||
this.mSkip464Xlat = builder.mSkip464Xlat;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -662,7 +677,7 @@ public class ApnSetting implements Parcelable {
|
||||
int authType, int mApnTypeBitmask, int protocol, int roamingProtocol,
|
||||
boolean carrierEnabled, int networkTypeBitmask, int profileId,
|
||||
boolean modemCognitive, int maxConns, int waitTime, int maxConnsTime, int mtu,
|
||||
int mvnoType, String mvnoMatchData, int apnSetId, int carrierId) {
|
||||
int mvnoType, String mvnoMatchData, int apnSetId, int carrierId, int skip464xlat) {
|
||||
return new Builder()
|
||||
.setId(id)
|
||||
.setOperatorNumeric(operatorNumeric)
|
||||
@@ -691,6 +706,7 @@ public class ApnSetting implements Parcelable {
|
||||
.setMvnoMatchData(mvnoMatchData)
|
||||
.setApnSetId(apnSetId)
|
||||
.setCarrierId(carrierId)
|
||||
.setSkip464Xlat(skip464xlat)
|
||||
.buildWithoutCheck();
|
||||
}
|
||||
|
||||
@@ -708,7 +724,8 @@ public class ApnSetting implements Parcelable {
|
||||
mmsc, mmsProxyAddress, mmsProxyPort, user, password, authType, mApnTypeBitmask,
|
||||
protocol, roamingProtocol, carrierEnabled, networkTypeBitmask, profileId,
|
||||
modemCognitive, maxConns, waitTime, maxConnsTime, mtu, mvnoType, mvnoMatchData,
|
||||
Carriers.NO_APN_SET_ID, TelephonyManager.UNKNOWN_CARRIER_ID);
|
||||
Carriers.NO_APN_SET_ID, TelephonyManager.UNKNOWN_CARRIER_ID,
|
||||
Carriers.SKIP_464XLAT_DEFAULT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -767,7 +784,8 @@ public class ApnSetting implements Parcelable {
|
||||
cursor.getString(cursor.getColumnIndexOrThrow(
|
||||
Telephony.Carriers.MVNO_MATCH_DATA)),
|
||||
cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.APN_SET_ID)),
|
||||
cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.CARRIER_ID)));
|
||||
cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.CARRIER_ID)),
|
||||
cursor.getInt(cursor.getColumnIndexOrThrow(Carriers.SKIP_464XLAT)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -780,7 +798,7 @@ public class ApnSetting implements Parcelable {
|
||||
apn.mProtocol, apn.mRoamingProtocol, apn.mCarrierEnabled, apn.mNetworkTypeBitmask,
|
||||
apn.mProfileId, apn.mPersistent, apn.mMaxConns, apn.mWaitTime,
|
||||
apn.mMaxConnsTime, apn.mMtu, apn.mMvnoType, apn.mMvnoMatchData, apn.mApnSetId,
|
||||
apn.mCarrierId);
|
||||
apn.mCarrierId, apn.mSkip464Xlat);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -829,6 +847,13 @@ public class ApnSetting implements Parcelable {
|
||||
* <profileId>, <modemCognitive>, <maxConns>, <waitTime>, <maxConnsTime>, <mtu>,
|
||||
* <mvnoType>, <mvnoMatchData>, <networkTypeBitmask>, <apnSetId>, <carrierId>
|
||||
*
|
||||
* v7 format:
|
||||
* [ApnSettingV7] <carrier>, <apn>, <proxy>, <port>, <user>, <password>, <server>,
|
||||
* <mmsc>, <mmsproxy>, <mmsport>, <mcc>, <mnc>, <authtype>,
|
||||
* <type>[| <type>...], <protocol>, <roaming_protocol>, <carrierEnabled>, <bearerBitmask>,
|
||||
* <profileId>, <modemCognitive>, <maxConns>, <waitTime>, <maxConnsTime>, <mtu>,
|
||||
* <mvnoType>, <mvnoMatchData>, <networkTypeBitmask>, <apnSetId>, <carrierId>, <skip464xlat>
|
||||
*
|
||||
* Note that the strings generated by {@link #toString()} do not contain the username
|
||||
* and password and thus cannot be read by this method.
|
||||
*
|
||||
@@ -841,7 +866,10 @@ public class ApnSetting implements Parcelable {
|
||||
|
||||
int version;
|
||||
// matches() operates on the whole string, so append .* to the regex.
|
||||
if (data.matches(V6_FORMAT_REGEX + ".*")) {
|
||||
if (data.matches(V7_FORMAT_REGEX + ".*")) {
|
||||
version = 7;
|
||||
data = data.replaceFirst(V7_FORMAT_REGEX, "");
|
||||
} else if (data.matches(V6_FORMAT_REGEX + ".*")) {
|
||||
version = 6;
|
||||
data = data.replaceFirst(V6_FORMAT_REGEX, "");
|
||||
} else if (data.matches(V5_FORMAT_REGEX + ".*")) {
|
||||
@@ -887,6 +915,7 @@ public class ApnSetting implements Parcelable {
|
||||
String mvnoMatchData = "";
|
||||
int apnSetId = Carriers.NO_APN_SET_ID;
|
||||
int carrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
|
||||
int skip464xlat = Carriers.SKIP_464XLAT_DEFAULT;
|
||||
if (version == 1) {
|
||||
typeArray = new String[a.length - 13];
|
||||
System.arraycopy(a, 13, typeArray, 0, a.length - 13);
|
||||
@@ -933,6 +962,12 @@ public class ApnSetting implements Parcelable {
|
||||
if (a.length > 28) {
|
||||
carrierId = Integer.parseInt(a[28]);
|
||||
}
|
||||
if (a.length > 29) {
|
||||
try {
|
||||
skip464xlat = Integer.parseInt(a[29]);
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If both bearerBitmask and networkTypeBitmask were specified, bearerBitmask would be
|
||||
@@ -948,7 +983,7 @@ public class ApnSetting implements Parcelable {
|
||||
getProtocolIntFromString(protocol), getProtocolIntFromString(roamingProtocol),
|
||||
carrierEnabled, networkTypeBitmask, profileId, modemCognitive, maxConns, waitTime,
|
||||
maxConnsTime, mtu, getMvnoTypeIntFromString(mvnoType), mvnoMatchData, apnSetId,
|
||||
carrierId);
|
||||
carrierId, skip464xlat);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -984,7 +1019,7 @@ public class ApnSetting implements Parcelable {
|
||||
*/
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("[ApnSettingV6] ")
|
||||
sb.append("[ApnSettingV7] ")
|
||||
.append(mEntryName)
|
||||
.append(", ").append(mId)
|
||||
.append(", ").append(mOperatorNumeric)
|
||||
@@ -1012,6 +1047,7 @@ public class ApnSetting implements Parcelable {
|
||||
sb.append(", ").append(mNetworkTypeBitmask);
|
||||
sb.append(", ").append(mApnSetId);
|
||||
sb.append(", ").append(mCarrierId);
|
||||
sb.append(", ").append(mSkip464Xlat);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -1105,7 +1141,8 @@ public class ApnSetting implements Parcelable {
|
||||
&& Objects.equals(mMvnoMatchData, other.mMvnoMatchData)
|
||||
&& Objects.equals(mNetworkTypeBitmask, other.mNetworkTypeBitmask)
|
||||
&& Objects.equals(mApnSetId, other.mApnSetId)
|
||||
&& Objects.equals(mCarrierId, other.mCarrierId);
|
||||
&& Objects.equals(mCarrierId, other.mCarrierId)
|
||||
&& Objects.equals(mSkip464Xlat, other.mSkip464Xlat);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1151,7 +1188,8 @@ public class ApnSetting implements Parcelable {
|
||||
&& Objects.equals(mMvnoType, other.mMvnoType)
|
||||
&& Objects.equals(mMvnoMatchData, other.mMvnoMatchData)
|
||||
&& Objects.equals(mApnSetId, other.mApnSetId)
|
||||
&& Objects.equals(mCarrierId, other.mCarrierId);
|
||||
&& Objects.equals(mCarrierId, other.mCarrierId)
|
||||
&& Objects.equals(mSkip464Xlat, other.mSkip464Xlat);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1179,7 +1217,8 @@ public class ApnSetting implements Parcelable {
|
||||
&& xorEqualsInt(this.mMmsProxyPort, other.mMmsProxyPort))
|
||||
&& Objects.equals(this.mNetworkTypeBitmask, other.mNetworkTypeBitmask)
|
||||
&& Objects.equals(mApnSetId, other.mApnSetId)
|
||||
&& Objects.equals(mCarrierId, other.mCarrierId);
|
||||
&& Objects.equals(mCarrierId, other.mCarrierId)
|
||||
&& Objects.equals(mSkip464Xlat, other.mSkip464Xlat);
|
||||
}
|
||||
|
||||
// Equal or one is null.
|
||||
@@ -1226,6 +1265,7 @@ public class ApnSetting implements Parcelable {
|
||||
apnValue.put(Telephony.Carriers.MVNO_TYPE, getMvnoTypeStringFromInt(mMvnoType));
|
||||
apnValue.put(Telephony.Carriers.NETWORK_TYPE_BITMASK, mNetworkTypeBitmask);
|
||||
apnValue.put(Telephony.Carriers.CARRIER_ID, mCarrierId);
|
||||
apnValue.put(Telephony.Carriers.SKIP_464XLAT, mSkip464Xlat);
|
||||
|
||||
return apnValue;
|
||||
}
|
||||
@@ -1385,6 +1425,7 @@ public class ApnSetting implements Parcelable {
|
||||
dest.writeInt(mNetworkTypeBitmask);
|
||||
dest.writeInt(mApnSetId);
|
||||
dest.writeInt(mCarrierId);
|
||||
dest.writeInt(mSkip464Xlat);
|
||||
}
|
||||
|
||||
private static ApnSetting readFromParcel(Parcel in) {
|
||||
@@ -1408,11 +1449,12 @@ public class ApnSetting implements Parcelable {
|
||||
final int networkTypeBitmask = in.readInt();
|
||||
final int apnSetId = in.readInt();
|
||||
final int carrierId = in.readInt();
|
||||
final int skip464xlat = in.readInt();
|
||||
|
||||
return makeApnSetting(id, operatorNumeric, entryName, apnName,
|
||||
proxy, port, mmsc, mmsProxy, mmsPort, user, password, authType, apnTypesBitmask,
|
||||
protocol, roamingProtocol, carrierEnabled, networkTypeBitmask, 0, false,
|
||||
0, 0, 0, 0, mvnoType, null, apnSetId, carrierId);
|
||||
proxy, port, mmsc, mmsProxy, mmsPort, user, password, authType, apnTypesBitmask,
|
||||
protocol, roamingProtocol, carrierEnabled, networkTypeBitmask, 0, false,
|
||||
0, 0, 0, 0, mvnoType, null, apnSetId, carrierId, skip464xlat);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ApnSetting> CREATOR =
|
||||
@@ -1489,6 +1531,7 @@ public class ApnSetting implements Parcelable {
|
||||
private String mMvnoMatchData;
|
||||
private int mApnSetId;
|
||||
private int mCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
|
||||
private int mSkip464Xlat = Carriers.SKIP_464XLAT_DEFAULT;
|
||||
|
||||
/**
|
||||
* Default constructor for Builder.
|
||||
@@ -1830,6 +1873,17 @@ public class ApnSetting implements Parcelable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets skip464xlat flag for this APN.
|
||||
*
|
||||
* @param skip464xlat skip464xlat for this APN
|
||||
* @hide
|
||||
*/
|
||||
public Builder setSkip464Xlat(@Carriers.Skip464XlatStatus int skip464xlat) {
|
||||
this.mSkip464Xlat = skip464xlat;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds {@link ApnSetting} from this builder.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user