Merge "API changes for IPv6 MTU support"
am: 6c1ee55b63
Change-Id: I80f206245b9340a9df8b65c0e42413617eecadfb
This commit is contained in:
@@ -4668,6 +4668,8 @@ package android.net {
|
|||||||
|
|
||||||
public final class RouteInfo implements android.os.Parcelable {
|
public final class RouteInfo implements android.os.Parcelable {
|
||||||
ctor public RouteInfo(@Nullable android.net.IpPrefix, @Nullable java.net.InetAddress, @Nullable String, int);
|
ctor public RouteInfo(@Nullable android.net.IpPrefix, @Nullable java.net.InetAddress, @Nullable String, int);
|
||||||
|
ctor public RouteInfo(@Nullable android.net.IpPrefix, @Nullable java.net.InetAddress, @Nullable String, int, int);
|
||||||
|
method public int getMtu();
|
||||||
method public int getType();
|
method public int getType();
|
||||||
field public static final int RTN_THROW = 9; // 0x9
|
field public static final int RTN_THROW = 9; // 0x9
|
||||||
field public static final int RTN_UNICAST = 1; // 0x1
|
field public static final int RTN_UNICAST = 1; // 0x1
|
||||||
@@ -9732,7 +9734,9 @@ package android.telephony.data {
|
|||||||
method public int getId();
|
method public int getId();
|
||||||
method @NonNull public String getInterfaceName();
|
method @NonNull public String getInterfaceName();
|
||||||
method public int getLinkStatus();
|
method public int getLinkStatus();
|
||||||
method public int getMtu();
|
method @Deprecated public int getMtu();
|
||||||
|
method public int getMtuV4();
|
||||||
|
method public int getMtuV6();
|
||||||
method @NonNull public java.util.List<java.net.InetAddress> getPcscfAddresses();
|
method @NonNull public java.util.List<java.net.InetAddress> getPcscfAddresses();
|
||||||
method public int getProtocolType();
|
method public int getProtocolType();
|
||||||
method public int getSuggestedRetryTime();
|
method public int getSuggestedRetryTime();
|
||||||
@@ -9754,7 +9758,9 @@ package android.telephony.data {
|
|||||||
method @NonNull public android.telephony.data.DataCallResponse.Builder setId(int);
|
method @NonNull public android.telephony.data.DataCallResponse.Builder setId(int);
|
||||||
method @NonNull public android.telephony.data.DataCallResponse.Builder setInterfaceName(@NonNull String);
|
method @NonNull public android.telephony.data.DataCallResponse.Builder setInterfaceName(@NonNull String);
|
||||||
method @NonNull public android.telephony.data.DataCallResponse.Builder setLinkStatus(int);
|
method @NonNull public android.telephony.data.DataCallResponse.Builder setLinkStatus(int);
|
||||||
method @NonNull public android.telephony.data.DataCallResponse.Builder setMtu(int);
|
method @Deprecated @NonNull public android.telephony.data.DataCallResponse.Builder setMtu(int);
|
||||||
|
method @NonNull public android.telephony.data.DataCallResponse.Builder setMtuV4(int);
|
||||||
|
method @NonNull public android.telephony.data.DataCallResponse.Builder setMtuV6(int);
|
||||||
method @NonNull public android.telephony.data.DataCallResponse.Builder setPcscfAddresses(@NonNull java.util.List<java.net.InetAddress>);
|
method @NonNull public android.telephony.data.DataCallResponse.Builder setPcscfAddresses(@NonNull java.util.List<java.net.InetAddress>);
|
||||||
method @NonNull public android.telephony.data.DataCallResponse.Builder setProtocolType(int);
|
method @NonNull public android.telephony.data.DataCallResponse.Builder setProtocolType(int);
|
||||||
method @NonNull public android.telephony.data.DataCallResponse.Builder setSuggestedRetryTime(int);
|
method @NonNull public android.telephony.data.DataCallResponse.Builder setSuggestedRetryTime(int);
|
||||||
@@ -9765,7 +9771,9 @@ package android.telephony.data {
|
|||||||
method @NonNull public String getApn();
|
method @NonNull public String getApn();
|
||||||
method public int getAuthType();
|
method public int getAuthType();
|
||||||
method public int getBearerBitmask();
|
method public int getBearerBitmask();
|
||||||
method public int getMtu();
|
method @Deprecated public int getMtu();
|
||||||
|
method public int getMtuV4();
|
||||||
|
method public int getMtuV6();
|
||||||
method @Nullable public String getPassword();
|
method @Nullable public String getPassword();
|
||||||
method public int getProfileId();
|
method public int getProfileId();
|
||||||
method public int getProtocolType();
|
method public int getProtocolType();
|
||||||
@@ -9790,7 +9798,9 @@ package android.telephony.data {
|
|||||||
method @NonNull public android.telephony.data.DataProfile.Builder setApn(@NonNull String);
|
method @NonNull public android.telephony.data.DataProfile.Builder setApn(@NonNull String);
|
||||||
method @NonNull public android.telephony.data.DataProfile.Builder setAuthType(int);
|
method @NonNull public android.telephony.data.DataProfile.Builder setAuthType(int);
|
||||||
method @NonNull public android.telephony.data.DataProfile.Builder setBearerBitmask(int);
|
method @NonNull public android.telephony.data.DataProfile.Builder setBearerBitmask(int);
|
||||||
method @NonNull public android.telephony.data.DataProfile.Builder setMtu(int);
|
method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setMtu(int);
|
||||||
|
method @NonNull public android.telephony.data.DataProfile.Builder setMtuV4(int);
|
||||||
|
method @NonNull public android.telephony.data.DataProfile.Builder setMtuV6(int);
|
||||||
method @NonNull public android.telephony.data.DataProfile.Builder setPassword(@NonNull String);
|
method @NonNull public android.telephony.data.DataProfile.Builder setPassword(@NonNull String);
|
||||||
method @NonNull public android.telephony.data.DataProfile.Builder setPersistent(boolean);
|
method @NonNull public android.telephony.data.DataProfile.Builder setPersistent(boolean);
|
||||||
method @NonNull public android.telephony.data.DataProfile.Builder setPreferred(boolean);
|
method @NonNull public android.telephony.data.DataProfile.Builder setPreferred(boolean);
|
||||||
|
|||||||
@@ -104,6 +104,11 @@ public final class RouteInfo implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
private final int mType;
|
private final int mType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum transmission unit size for this route.
|
||||||
|
*/
|
||||||
|
private final int mMtu;
|
||||||
|
|
||||||
// Derived data members.
|
// Derived data members.
|
||||||
// TODO: remove these.
|
// TODO: remove these.
|
||||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
|
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
|
||||||
@@ -132,6 +137,31 @@ public final class RouteInfo implements Parcelable {
|
|||||||
@TestApi
|
@TestApi
|
||||||
public RouteInfo(@Nullable IpPrefix destination, @Nullable InetAddress gateway,
|
public RouteInfo(@Nullable IpPrefix destination, @Nullable InetAddress gateway,
|
||||||
@Nullable String iface, @RouteType int type) {
|
@Nullable String iface, @RouteType int type) {
|
||||||
|
this(destination, gateway, iface, type, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a RouteInfo object.
|
||||||
|
*
|
||||||
|
* If destination is null, then gateway must be specified and the
|
||||||
|
* constructed route is either the IPv4 default route <code>0.0.0.0</code>
|
||||||
|
* if the gateway is an instance of {@link Inet4Address}, or the IPv6 default
|
||||||
|
* route <code>::/0</code> if gateway is an instance of
|
||||||
|
* {@link Inet6Address}.
|
||||||
|
* <p>
|
||||||
|
* destination and gateway may not both be null.
|
||||||
|
*
|
||||||
|
* @param destination the destination prefix
|
||||||
|
* @param gateway the IP address to route packets through
|
||||||
|
* @param iface the interface name to send packets on
|
||||||
|
* @param type the type of this route
|
||||||
|
* @param mtu the maximum transmission unit size for this route
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
public RouteInfo(@Nullable IpPrefix destination, @Nullable InetAddress gateway,
|
||||||
|
@Nullable String iface, @RouteType int type, int mtu) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case RTN_UNICAST:
|
case RTN_UNICAST:
|
||||||
case RTN_UNREACHABLE:
|
case RTN_UNREACHABLE:
|
||||||
@@ -161,7 +191,7 @@ public final class RouteInfo implements Parcelable {
|
|||||||
} else {
|
} else {
|
||||||
// no destination, no gateway. invalid.
|
// no destination, no gateway. invalid.
|
||||||
throw new IllegalArgumentException("Invalid arguments passed in: " + gateway + "," +
|
throw new IllegalArgumentException("Invalid arguments passed in: " + gateway + "," +
|
||||||
destination);
|
destination);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: set mGateway to null if there is no gateway. This is more correct, saves space, and
|
// TODO: set mGateway to null if there is no gateway. This is more correct, saves space, and
|
||||||
@@ -176,10 +206,10 @@ public final class RouteInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
mHasGateway = (!gateway.isAnyLocalAddress());
|
mHasGateway = (!gateway.isAnyLocalAddress());
|
||||||
|
|
||||||
if ((destination.getAddress() instanceof Inet4Address &&
|
if ((destination.getAddress() instanceof Inet4Address
|
||||||
(gateway instanceof Inet4Address == false)) ||
|
&& !(gateway instanceof Inet4Address))
|
||||||
(destination.getAddress() instanceof Inet6Address &&
|
|| (destination.getAddress() instanceof Inet6Address
|
||||||
(gateway instanceof Inet6Address == false))) {
|
&& !(gateway instanceof Inet6Address))) {
|
||||||
throw new IllegalArgumentException("address family mismatch in RouteInfo constructor");
|
throw new IllegalArgumentException("address family mismatch in RouteInfo constructor");
|
||||||
}
|
}
|
||||||
mDestination = destination; // IpPrefix objects are immutable.
|
mDestination = destination; // IpPrefix objects are immutable.
|
||||||
@@ -187,6 +217,7 @@ public final class RouteInfo implements Parcelable {
|
|||||||
mInterface = iface; // Strings are immutable.
|
mInterface = iface; // Strings are immutable.
|
||||||
mType = type;
|
mType = type;
|
||||||
mIsHost = isHost();
|
mIsHost = isHost();
|
||||||
|
mMtu = mtu;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -372,6 +403,17 @@ public final class RouteInfo implements Parcelable {
|
|||||||
return mType;
|
return mType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the MTU size for this route.
|
||||||
|
*
|
||||||
|
* @return The MTU size, or 0 if it has not been set.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
public int getMtu() {
|
||||||
|
return mMtu;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if this route is a default route (ie, has no destination specified).
|
* Indicates if this route is a default route (ie, has no destination specified).
|
||||||
*
|
*
|
||||||
@@ -476,6 +518,7 @@ public final class RouteInfo implements Parcelable {
|
|||||||
val += " unknown type " + mType;
|
val += " unknown type " + mType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val += " mtu " + mMtu;
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,7 +536,7 @@ public final class RouteInfo implements Parcelable {
|
|||||||
return Objects.equals(mDestination, target.getDestination()) &&
|
return Objects.equals(mDestination, target.getDestination()) &&
|
||||||
Objects.equals(mGateway, target.getGateway()) &&
|
Objects.equals(mGateway, target.getGateway()) &&
|
||||||
Objects.equals(mInterface, target.getInterface()) &&
|
Objects.equals(mInterface, target.getInterface()) &&
|
||||||
mType == target.getType();
|
mType == target.getType() && mMtu == target.getMtu();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -503,7 +546,7 @@ public final class RouteInfo implements Parcelable {
|
|||||||
return (mDestination.hashCode() * 41)
|
return (mDestination.hashCode() * 41)
|
||||||
+ (mGateway == null ? 0 :mGateway.hashCode() * 47)
|
+ (mGateway == null ? 0 :mGateway.hashCode() * 47)
|
||||||
+ (mInterface == null ? 0 :mInterface.hashCode() * 67)
|
+ (mInterface == null ? 0 :mInterface.hashCode() * 67)
|
||||||
+ (mType * 71);
|
+ (mType * 71) + (mMtu * 89);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -522,6 +565,7 @@ public final class RouteInfo implements Parcelable {
|
|||||||
dest.writeByteArray(gatewayBytes);
|
dest.writeByteArray(gatewayBytes);
|
||||||
dest.writeString(mInterface);
|
dest.writeString(mInterface);
|
||||||
dest.writeInt(mType);
|
dest.writeInt(mType);
|
||||||
|
dest.writeInt(mMtu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -540,8 +584,9 @@ public final class RouteInfo implements Parcelable {
|
|||||||
|
|
||||||
String iface = in.readString();
|
String iface = in.readString();
|
||||||
int type = in.readInt();
|
int type = in.readInt();
|
||||||
|
int mtu = in.readInt();
|
||||||
|
|
||||||
return new RouteInfo(dest, gateway, iface, type);
|
return new RouteInfo(dest, gateway, iface, type, mtu);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RouteInfo[] newArray(int size) {
|
public RouteInfo[] newArray(int size) {
|
||||||
|
|||||||
@@ -78,6 +78,9 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
private final List<InetAddress> mGatewayAddresses;
|
private final List<InetAddress> mGatewayAddresses;
|
||||||
private final List<InetAddress> mPcscfAddresses;
|
private final List<InetAddress> mPcscfAddresses;
|
||||||
private final int mMtu;
|
private final int mMtu;
|
||||||
|
private final int mMtuV4;
|
||||||
|
private final int mMtuV6;
|
||||||
|
private final int mVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cause Data call fail cause. {@link DataFailCause#NONE} indicates no error.
|
* @param cause Data call fail cause. {@link DataFailCause#NONE} indicates no error.
|
||||||
@@ -97,9 +100,8 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
* "192.0.1.11 2001:db8::1". When null, the addresses represent point to point connections.
|
* "192.0.1.11 2001:db8::1". When null, the addresses represent point to point connections.
|
||||||
* @param pcscfAddresses A list of Proxy Call State Control Function address via PCO (Protocol
|
* @param pcscfAddresses A list of Proxy Call State Control Function address via PCO (Protocol
|
||||||
* Configuration Option) for IMS client.
|
* Configuration Option) for IMS client.
|
||||||
* @param mtu MTU (maximum transmission unit) in bytes received from network. Zero or negative
|
* @param mtu MTU (maximum transmission unit) in bytes received from network.
|
||||||
* values means network has either not sent a value or sent an invalid value.
|
* Zero or negative values means network has either not sent a value or sent an invalid value.
|
||||||
* either not sent a value or sent an invalid value.
|
|
||||||
*
|
*
|
||||||
* @removed Use the {@link Builder()} instead.
|
* @removed Use the {@link Builder()} instead.
|
||||||
*/
|
*/
|
||||||
@@ -125,6 +127,34 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
mPcscfAddresses = (pcscfAddresses == null)
|
mPcscfAddresses = (pcscfAddresses == null)
|
||||||
? new ArrayList<>() : new ArrayList<>(pcscfAddresses);
|
? new ArrayList<>() : new ArrayList<>(pcscfAddresses);
|
||||||
mMtu = mtu;
|
mMtu = mtu;
|
||||||
|
mMtuV4 = mMtuV6 = 0;
|
||||||
|
mVersion = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
private DataCallResponse(@DataFailureCause int cause, int suggestedRetryTime, int id,
|
||||||
|
@LinkStatus int linkStatus, @ProtocolType int protocolType,
|
||||||
|
@Nullable String interfaceName, @Nullable List<LinkAddress> addresses,
|
||||||
|
@Nullable List<InetAddress> dnsAddresses, @Nullable List<InetAddress> gatewayAddresses,
|
||||||
|
@Nullable List<InetAddress> pcscfAddresses, int mtuV4, int mtuV6, int version) {
|
||||||
|
mCause = cause;
|
||||||
|
mSuggestedRetryTime = suggestedRetryTime;
|
||||||
|
mId = id;
|
||||||
|
mLinkStatus = linkStatus;
|
||||||
|
mProtocolType = protocolType;
|
||||||
|
mInterfaceName = (interfaceName == null) ? "" : interfaceName;
|
||||||
|
mAddresses = (addresses == null)
|
||||||
|
? new ArrayList<>() : new ArrayList<>(addresses);
|
||||||
|
mDnsAddresses = (dnsAddresses == null)
|
||||||
|
? new ArrayList<>() : new ArrayList<>(dnsAddresses);
|
||||||
|
mGatewayAddresses = (gatewayAddresses == null)
|
||||||
|
? new ArrayList<>() : new ArrayList<>(gatewayAddresses);
|
||||||
|
mPcscfAddresses = (pcscfAddresses == null)
|
||||||
|
? new ArrayList<>() : new ArrayList<>(pcscfAddresses);
|
||||||
|
mMtu = 0;
|
||||||
|
mMtuV4 = mtuV4;
|
||||||
|
mMtuV6 = mtuV6;
|
||||||
|
mVersion = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@@ -145,6 +175,9 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
mPcscfAddresses = new ArrayList<>();
|
mPcscfAddresses = new ArrayList<>();
|
||||||
source.readList(mPcscfAddresses, InetAddress.class.getClassLoader());
|
source.readList(mPcscfAddresses, InetAddress.class.getClassLoader());
|
||||||
mMtu = source.readInt();
|
mMtu = source.readInt();
|
||||||
|
mMtuV4 = source.readInt();
|
||||||
|
mMtuV6 = source.readInt();
|
||||||
|
mVersion = source.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -210,8 +243,29 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
/**
|
/**
|
||||||
* @return MTU (maximum transmission unit) in bytes received from network. Zero or negative
|
* @return MTU (maximum transmission unit) in bytes received from network. Zero or negative
|
||||||
* values means network has either not sent a value or sent an invalid value.
|
* values means network has either not sent a value or sent an invalid value.
|
||||||
|
* @deprecated For IRadio 1.5 and up, use {@link #getMtuV4} or {@link #getMtuV6} instead.
|
||||||
*/
|
*/
|
||||||
public int getMtu() { return mMtu; }
|
@Deprecated
|
||||||
|
public int getMtu() {
|
||||||
|
return mVersion < 5 ? mMtu : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This replaces the deprecated method getMtu.
|
||||||
|
* @return MTU (maximum transmission unit) in bytes received from network, for IPv4.
|
||||||
|
* Zero or negative values means network has either not sent a value or sent an invalid value.
|
||||||
|
*/
|
||||||
|
public int getMtuV4() {
|
||||||
|
return mVersion < 5 ? 0 : mMtuV4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return MTU (maximum transmission unit) in bytes received from network, for IPv6.
|
||||||
|
* Zero or negative values means network has either not sent a value or sent an invalid value.
|
||||||
|
*/
|
||||||
|
public int getMtuV6() {
|
||||||
|
return mVersion < 5 ? 0 : mMtuV6;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@@ -229,6 +283,9 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
.append(" gateways=").append(mGatewayAddresses)
|
.append(" gateways=").append(mGatewayAddresses)
|
||||||
.append(" pcscf=").append(mPcscfAddresses)
|
.append(" pcscf=").append(mPcscfAddresses)
|
||||||
.append(" mtu=").append(mMtu)
|
.append(" mtu=").append(mMtu)
|
||||||
|
.append(" mtuV4=").append(mMtuV4)
|
||||||
|
.append(" mtuV6=").append(mMtuV6)
|
||||||
|
.append(" version=").append(mVersion)
|
||||||
.append("}");
|
.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
@@ -256,14 +313,17 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
&& mGatewayAddresses.containsAll(other.mGatewayAddresses)
|
&& mGatewayAddresses.containsAll(other.mGatewayAddresses)
|
||||||
&& mPcscfAddresses.size() == other.mPcscfAddresses.size()
|
&& mPcscfAddresses.size() == other.mPcscfAddresses.size()
|
||||||
&& mPcscfAddresses.containsAll(other.mPcscfAddresses)
|
&& mPcscfAddresses.containsAll(other.mPcscfAddresses)
|
||||||
&& mMtu == other.mMtu;
|
&& mMtu == other.mMtu
|
||||||
|
&& mMtuV4 == other.mMtuV4
|
||||||
|
&& mMtuV6 == other.mMtuV6
|
||||||
|
&& mVersion == other.mVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mCause, mSuggestedRetryTime, mId, mLinkStatus, mProtocolType,
|
return Objects.hash(mCause, mSuggestedRetryTime, mId, mLinkStatus, mProtocolType,
|
||||||
mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses, mPcscfAddresses,
|
mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses, mPcscfAddresses,
|
||||||
mMtu);
|
mMtu, mMtuV4, mMtuV6, mVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -284,6 +344,9 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
dest.writeList(mGatewayAddresses);
|
dest.writeList(mGatewayAddresses);
|
||||||
dest.writeList(mPcscfAddresses);
|
dest.writeList(mPcscfAddresses);
|
||||||
dest.writeInt(mMtu);
|
dest.writeInt(mMtu);
|
||||||
|
dest.writeInt(mMtuV4);
|
||||||
|
dest.writeInt(mMtuV6);
|
||||||
|
dest.writeInt(mVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final @android.annotation.NonNull Parcelable.Creator<DataCallResponse> CREATOR =
|
public static final @android.annotation.NonNull Parcelable.Creator<DataCallResponse> CREATOR =
|
||||||
@@ -336,6 +399,12 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
|
|
||||||
private int mMtu;
|
private int mMtu;
|
||||||
|
|
||||||
|
private int mMtuV4;
|
||||||
|
|
||||||
|
private int mMtuV6;
|
||||||
|
|
||||||
|
private int mVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for Builder.
|
* Default constructor for Builder.
|
||||||
*/
|
*/
|
||||||
@@ -460,21 +529,63 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
* negative values means network has either not sent a value or sent an invalid value.
|
* negative values means network has either not sent a value or sent an invalid value.
|
||||||
*
|
*
|
||||||
* @return The same instance of the builder.
|
* @return The same instance of the builder.
|
||||||
|
* @deprecated For IRadio 1.5 and up, use {@link #setMtuV4} or {@link #setMtuV6} instead.
|
||||||
*/
|
*/
|
||||||
public @NonNull Builder setMtu(int mtu) {
|
public @NonNull Builder setMtu(int mtu) {
|
||||||
mMtu = mtu;
|
mMtu = mtu;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set maximum transmission unit of the data connection, for IPv4.
|
||||||
|
*
|
||||||
|
* @param mtu MTU (maximum transmission unit) in bytes received from network. Zero or
|
||||||
|
* negative values means network has either not sent a value or sent an invalid value.
|
||||||
|
*
|
||||||
|
* @return The same instance of the builder.
|
||||||
|
*/
|
||||||
|
public @NonNull Builder setMtuV4(int mtu) {
|
||||||
|
mMtuV4 = mtu;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set maximum transmission unit of the data connection, for IPv6.
|
||||||
|
*
|
||||||
|
* @param mtu MTU (maximum transmission unit) in bytes received from network. Zero or
|
||||||
|
* negative values means network has either not sent a value or sent an invalid value.
|
||||||
|
*
|
||||||
|
* @return The same instance of the builder.
|
||||||
|
*/
|
||||||
|
public @NonNull Builder setMtuV6(int mtu) {
|
||||||
|
mMtuV6 = mtu;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the IRadio version for this DataCallResponse
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public @NonNull Builder setVersion(int version) {
|
||||||
|
mVersion = version;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the DataCallResponse.
|
* Build the DataCallResponse.
|
||||||
*
|
*
|
||||||
* @return the DataCallResponse object.
|
* @return the DataCallResponse object.
|
||||||
*/
|
*/
|
||||||
public @NonNull DataCallResponse build() {
|
public @NonNull DataCallResponse build() {
|
||||||
return new DataCallResponse(mCause, mSuggestedRetryTime, mId, mLinkStatus,
|
if (mVersion >= 5) {
|
||||||
mProtocolType, mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses,
|
return new DataCallResponse(mCause, mSuggestedRetryTime, mId, mLinkStatus,
|
||||||
mPcscfAddresses, mMtu);
|
mProtocolType, mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses,
|
||||||
|
mPcscfAddresses, mMtuV4, mMtuV6, mVersion);
|
||||||
|
} else {
|
||||||
|
return new DataCallResponse(mCause, mSuggestedRetryTime, mId, mLinkStatus,
|
||||||
|
mProtocolType, mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses,
|
||||||
|
mPcscfAddresses, mMtu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,9 @@ public final class DataProfile implements Parcelable {
|
|||||||
@NetworkTypeBitMask
|
@NetworkTypeBitMask
|
||||||
private final int mBearerBitmask;
|
private final int mBearerBitmask;
|
||||||
|
|
||||||
private final int mMtu;
|
private final int mMtuV4;
|
||||||
|
|
||||||
|
private final int mMtuV6;
|
||||||
|
|
||||||
private final boolean mPersistent;
|
private final boolean mPersistent;
|
||||||
|
|
||||||
@@ -104,12 +106,11 @@ public final class DataProfile implements Parcelable {
|
|||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
private DataProfile(int profileId, String apn, @ProtocolType int protocolType, int authType,
|
private DataProfile(int profileId, String apn, @ProtocolType int protocolType, int authType,
|
||||||
String userName, String password, int type, int maxConnectionsTime,
|
String userName, String password, int type, int maxConnectionsTime,
|
||||||
int maxConnections, int waitTime, boolean enabled,
|
int maxConnections, int waitTime, boolean enabled,
|
||||||
@ApnType int supportedApnTypesBitmask,
|
@ApnType int supportedApnTypesBitmask, @ProtocolType int roamingProtocolType,
|
||||||
@ProtocolType int roamingProtocolType,
|
@NetworkTypeBitMask int bearerBitmask, int mtuV4, int mtuV6, boolean persistent,
|
||||||
@NetworkTypeBitMask int bearerBitmask, int mtu, boolean persistent,
|
boolean preferred) {
|
||||||
boolean preferred) {
|
|
||||||
this.mProfileId = profileId;
|
this.mProfileId = profileId;
|
||||||
this.mApn = apn;
|
this.mApn = apn;
|
||||||
this.mProtocolType = protocolType;
|
this.mProtocolType = protocolType;
|
||||||
@@ -128,7 +129,8 @@ public final class DataProfile implements Parcelable {
|
|||||||
this.mSupportedApnTypesBitmask = supportedApnTypesBitmask;
|
this.mSupportedApnTypesBitmask = supportedApnTypesBitmask;
|
||||||
this.mRoamingProtocolType = roamingProtocolType;
|
this.mRoamingProtocolType = roamingProtocolType;
|
||||||
this.mBearerBitmask = bearerBitmask;
|
this.mBearerBitmask = bearerBitmask;
|
||||||
this.mMtu = mtu;
|
this.mMtuV4 = mtuV4;
|
||||||
|
this.mMtuV6 = mtuV6;
|
||||||
this.mPersistent = persistent;
|
this.mPersistent = persistent;
|
||||||
this.mPreferred = preferred;
|
this.mPreferred = preferred;
|
||||||
}
|
}
|
||||||
@@ -148,7 +150,8 @@ public final class DataProfile implements Parcelable {
|
|||||||
mSupportedApnTypesBitmask = source.readInt();
|
mSupportedApnTypesBitmask = source.readInt();
|
||||||
mRoamingProtocolType = source.readInt();
|
mRoamingProtocolType = source.readInt();
|
||||||
mBearerBitmask = source.readInt();
|
mBearerBitmask = source.readInt();
|
||||||
mMtu = source.readInt();
|
mMtuV4 = source.readInt();
|
||||||
|
mMtuV6 = source.readInt();
|
||||||
mPersistent = source.readBoolean();
|
mPersistent = source.readBoolean();
|
||||||
mPreferred = source.readBoolean();
|
mPreferred = source.readBoolean();
|
||||||
}
|
}
|
||||||
@@ -237,8 +240,21 @@ public final class DataProfile implements Parcelable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The maximum transmission unit (MTU) size in bytes.
|
* @return The maximum transmission unit (MTU) size in bytes.
|
||||||
|
* @deprecated use {@link #getMtuV4} or {@link #getMtuV6} instead.
|
||||||
*/
|
*/
|
||||||
public int getMtu() { return mMtu; }
|
@Deprecated
|
||||||
|
public int getMtu() { return mMtuV4; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This replaces the deprecated method getMtu.
|
||||||
|
* @return The maximum transmission unit (MTU) size in bytes, for IPv4.
|
||||||
|
*/
|
||||||
|
public int getMtuV4() { return mMtuV4; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The maximum transmission unit (MTU) size in bytes, for IPv6.
|
||||||
|
*/
|
||||||
|
public int getMtuV6() { return mMtuV6; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if modem must persist this data profile.
|
* @return {@code true} if modem must persist this data profile.
|
||||||
@@ -265,8 +281,8 @@ public final class DataProfile implements Parcelable {
|
|||||||
(mApn + "/" + mUserName + "/" + mPassword)) + "/" + mType + "/"
|
(mApn + "/" + mUserName + "/" + mPassword)) + "/" + mType + "/"
|
||||||
+ mMaxConnectionsTime + "/" + mMaxConnections + "/"
|
+ mMaxConnectionsTime + "/" + mMaxConnections + "/"
|
||||||
+ mWaitTime + "/" + mEnabled + "/" + mSupportedApnTypesBitmask + "/"
|
+ mWaitTime + "/" + mEnabled + "/" + mSupportedApnTypesBitmask + "/"
|
||||||
+ mRoamingProtocolType + "/" + mBearerBitmask + "/" + mMtu + "/" + mPersistent + "/"
|
+ mRoamingProtocolType + "/" + mBearerBitmask + "/" + mMtuV4 + "/" + mMtuV6 + "/"
|
||||||
+ mPreferred;
|
+ mPersistent + "/" + mPreferred;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -285,7 +301,8 @@ public final class DataProfile implements Parcelable {
|
|||||||
dest.writeInt(mSupportedApnTypesBitmask);
|
dest.writeInt(mSupportedApnTypesBitmask);
|
||||||
dest.writeInt(mRoamingProtocolType);
|
dest.writeInt(mRoamingProtocolType);
|
||||||
dest.writeInt(mBearerBitmask);
|
dest.writeInt(mBearerBitmask);
|
||||||
dest.writeInt(mMtu);
|
dest.writeInt(mMtuV4);
|
||||||
|
dest.writeInt(mMtuV6);
|
||||||
dest.writeBoolean(mPersistent);
|
dest.writeBoolean(mPersistent);
|
||||||
dest.writeBoolean(mPreferred);
|
dest.writeBoolean(mPreferred);
|
||||||
}
|
}
|
||||||
@@ -319,7 +336,8 @@ public final class DataProfile implements Parcelable {
|
|||||||
&& mSupportedApnTypesBitmask == that.mSupportedApnTypesBitmask
|
&& mSupportedApnTypesBitmask == that.mSupportedApnTypesBitmask
|
||||||
&& mRoamingProtocolType == that.mRoamingProtocolType
|
&& mRoamingProtocolType == that.mRoamingProtocolType
|
||||||
&& mBearerBitmask == that.mBearerBitmask
|
&& mBearerBitmask == that.mBearerBitmask
|
||||||
&& mMtu == that.mMtu
|
&& mMtuV4 == that.mMtuV4
|
||||||
|
&& mMtuV6 == that.mMtuV6
|
||||||
&& mPersistent == that.mPersistent
|
&& mPersistent == that.mPersistent
|
||||||
&& mPreferred == that.mPreferred
|
&& mPreferred == that.mPreferred
|
||||||
&& Objects.equals(mApn, that.mApn)
|
&& Objects.equals(mApn, that.mApn)
|
||||||
@@ -331,8 +349,8 @@ public final class DataProfile implements Parcelable {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mProfileId, mApn, mProtocolType, mAuthType, mUserName, mPassword, mType,
|
return Objects.hash(mProfileId, mApn, mProtocolType, mAuthType, mUserName, mPassword, mType,
|
||||||
mMaxConnectionsTime, mMaxConnections, mWaitTime, mEnabled,
|
mMaxConnectionsTime, mMaxConnections, mWaitTime, mEnabled,
|
||||||
mSupportedApnTypesBitmask, mRoamingProtocolType, mBearerBitmask, mMtu, mPersistent,
|
mSupportedApnTypesBitmask, mRoamingProtocolType, mBearerBitmask, mMtuV4, mMtuV6,
|
||||||
mPreferred);
|
mPersistent, mPreferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -384,7 +402,9 @@ public final class DataProfile implements Parcelable {
|
|||||||
@NetworkTypeBitMask
|
@NetworkTypeBitMask
|
||||||
private int mBearerBitmask;
|
private int mBearerBitmask;
|
||||||
|
|
||||||
private int mMtu;
|
private int mMtuV4;
|
||||||
|
|
||||||
|
private int mMtuV6;
|
||||||
|
|
||||||
private boolean mPersistent;
|
private boolean mPersistent;
|
||||||
|
|
||||||
@@ -567,9 +587,33 @@ public final class DataProfile implements Parcelable {
|
|||||||
*
|
*
|
||||||
* @param mtu The maximum transmission unit (MTU) size in bytes.
|
* @param mtu The maximum transmission unit (MTU) size in bytes.
|
||||||
* @return The same instance of the builder.
|
* @return The same instance of the builder.
|
||||||
|
* @deprecated use {@link #setMtuV4} or {@link #setMtuV6} instead.
|
||||||
*/
|
*/
|
||||||
public @NonNull Builder setMtu(int mtu) {
|
public @NonNull Builder setMtu(int mtu) {
|
||||||
mMtu = mtu;
|
mMtuV4 = mMtuV6 = mtu;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the maximum transmission unit (MTU) size in bytes, for IPv4.
|
||||||
|
* This replaces the deprecated method setMtu.
|
||||||
|
*
|
||||||
|
* @param mtu The maximum transmission unit (MTU) size in bytes.
|
||||||
|
* @return The same instance of the builder.
|
||||||
|
*/
|
||||||
|
public @NonNull Builder setMtuV4(int mtu) {
|
||||||
|
mMtuV4 = mtu;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the maximum transmission unit (MTU) size in bytes, for IPv6.
|
||||||
|
*
|
||||||
|
* @param mtu The maximum transmission unit (MTU) size in bytes.
|
||||||
|
* @return The same instance of the builder.
|
||||||
|
*/
|
||||||
|
public @NonNull Builder setMtuV6(int mtu) {
|
||||||
|
mMtuV6 = mtu;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -606,7 +650,7 @@ public final class DataProfile implements Parcelable {
|
|||||||
public @NonNull DataProfile build() {
|
public @NonNull DataProfile build() {
|
||||||
return new DataProfile(mProfileId, mApn, mProtocolType, mAuthType, mUserName, mPassword,
|
return new DataProfile(mProfileId, mApn, mProtocolType, mAuthType, mUserName, mPassword,
|
||||||
mType, mMaxConnectionsTime, mMaxConnections, mWaitTime, mEnabled,
|
mType, mMaxConnectionsTime, mMaxConnections, mWaitTime, mEnabled,
|
||||||
mSupportedApnTypesBitmask, mRoamingProtocolType, mBearerBitmask, mMtu,
|
mSupportedApnTypesBitmask, mRoamingProtocolType, mBearerBitmask, mMtuV4, mMtuV6,
|
||||||
mPersistent, mPreferred);
|
mPersistent, mPreferred);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -258,6 +258,16 @@ public class RouteInfoTest extends TestCase {
|
|||||||
assertParcelingIsLossless(r);
|
assertParcelingIsLossless(r);
|
||||||
|
|
||||||
r = new RouteInfo(Prefix("192.0.2.0/24"), null, "wlan0");
|
r = new RouteInfo(Prefix("192.0.2.0/24"), null, "wlan0");
|
||||||
assertParcelSane(r, 6);
|
assertParcelSane(r, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMtu() {
|
||||||
|
RouteInfo r;
|
||||||
|
r = new RouteInfo(Prefix("0.0.0.0/0"), Address("0.0.0.0"), "wlan0",
|
||||||
|
RouteInfo.RTN_UNICAST, 1500);
|
||||||
|
assertEquals(1500, r.getMtu());
|
||||||
|
|
||||||
|
r = new RouteInfo(Prefix("0.0.0.0/0"), Address("0.0.0.0"), "wlan0");
|
||||||
|
assertEquals(0, r.getMtu());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user