Merge "services.net: Add a static library needed by wifi module" am: 488efe3350
Change-Id: I9088ccdec461145b16597d50834d231c9ea771d5
This commit is contained in:
13
Android.bp
13
Android.bp
@@ -620,6 +620,7 @@ gensrcs {
|
||||
filegroup {
|
||||
name: "framework-annotations",
|
||||
srcs: [
|
||||
"core/java/android/annotation/Hide.java",
|
||||
"core/java/android/annotation/NonNull.java",
|
||||
"core/java/android/annotation/Nullable.java",
|
||||
"core/java/android/annotation/IntDef.java",
|
||||
@@ -673,6 +674,18 @@ filegroup {
|
||||
],
|
||||
}
|
||||
|
||||
filegroup {
|
||||
name: "framework-services-net-module-wifi-shared-srcs",
|
||||
srcs: [
|
||||
"core/java/android/net/DhcpResults.java",
|
||||
"core/java/android/net/shared/Inet4AddressUtils.java",
|
||||
"core/java/android/net/shared/InetAddressUtils.java",
|
||||
"core/java/android/net/util/IpUtils.java",
|
||||
"core/java/android/util/LocalLog.java",
|
||||
"core/java/com/android/internal/util/Preconditions.java",
|
||||
],
|
||||
}
|
||||
|
||||
// keep these files in sync with the package/Tethering/jarjar-rules.txt for the tethering module.
|
||||
filegroup {
|
||||
name: "framework-tethering-shared-srcs",
|
||||
|
||||
@@ -22,7 +22,6 @@ import static android.net.InvalidPacketException.ERROR_INVALID_PORT;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.SystemApi;
|
||||
import android.net.util.IpUtils;
|
||||
import android.os.Parcel;
|
||||
import android.util.Log;
|
||||
|
||||
import java.net.InetAddress;
|
||||
@@ -30,7 +29,6 @@ import java.net.InetAddress;
|
||||
/**
|
||||
* Represents the actual packets that are sent by the
|
||||
* {@link android.net.SocketKeepalive} API.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@@ -54,6 +52,9 @@ public class KeepalivePacketData {
|
||||
/** Packet data. A raw byte string of packet data, not including the link-layer header. */
|
||||
private final byte[] mPacket;
|
||||
|
||||
// Note: If you add new fields, please modify the parcelling code in the child classes.
|
||||
|
||||
|
||||
// This should only be constructed via static factory methods, such as
|
||||
// nattKeepalivePacket.
|
||||
/**
|
||||
@@ -87,21 +88,4 @@ public class KeepalivePacketData {
|
||||
return mPacket.clone();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeString(srcAddress.getHostAddress());
|
||||
out.writeString(dstAddress.getHostAddress());
|
||||
out.writeInt(srcPort);
|
||||
out.writeInt(dstPort);
|
||||
out.writeByteArray(mPacket);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
protected KeepalivePacketData(Parcel in) {
|
||||
srcAddress = NetworkUtils.numericToInetAddress(in.readString());
|
||||
dstAddress = NetworkUtils.numericToInetAddress(in.readString());
|
||||
srcPort = in.readInt();
|
||||
dstPort = in.readInt();
|
||||
mPacket = in.createByteArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,44 @@ java_library_static {
|
||||
],
|
||||
}
|
||||
|
||||
// Version of services.net for usage by the wifi mainline module.
|
||||
// Note: This is compiled against module_current.
|
||||
// TODO(b/145825329): This should be moved to networkstack-client,
|
||||
// with dependencies moved to frameworks/libs/net right.
|
||||
java_library {
|
||||
name: "services.net-module-wifi",
|
||||
srcs: [
|
||||
":framework-services-net-module-wifi-shared-srcs",
|
||||
":net-module-utils-srcs",
|
||||
"java/android/net/ip/IpClientCallbacks.java",
|
||||
"java/android/net/ip/IpClientManager.java",
|
||||
"java/android/net/ip/IpClientUtil.java",
|
||||
"java/android/net/util/KeepalivePacketDataUtil.java",
|
||||
"java/android/net/util/NetworkConstants.java",
|
||||
"java/android/net/IpMemoryStore.java",
|
||||
"java/android/net/NetworkMonitorManager.java",
|
||||
"java/android/net/TcpKeepalivePacketData.java",
|
||||
],
|
||||
sdk_version: "module_current",
|
||||
libs: [
|
||||
"unsupportedappusage",
|
||||
],
|
||||
static_libs: [
|
||||
"dnsresolver_aidl_interface-V2-java",
|
||||
"netd_aidl_interface-unstable-java",
|
||||
"netlink-client",
|
||||
"networkstack-client",
|
||||
"net-utils-services-common",
|
||||
],
|
||||
apex_available: [
|
||||
"com.android.wifi",
|
||||
],
|
||||
visibility: [
|
||||
"//frameworks/opt/net/wifi/service",
|
||||
"//frameworks/opt/net/wifi/tests/wifitests",
|
||||
],
|
||||
}
|
||||
|
||||
filegroup {
|
||||
name: "services-tethering-shared-srcs",
|
||||
srcs: [
|
||||
|
||||
@@ -74,6 +74,19 @@ public class TcpKeepalivePacketData extends KeepalivePacketData implements Parce
|
||||
ipTtl = tcpDetails.ttl;
|
||||
}
|
||||
|
||||
private TcpKeepalivePacketData(final InetAddress srcAddress, int srcPort,
|
||||
final InetAddress dstAddress, int dstPort, final byte[] data, int tcpSeq,
|
||||
int tcpAck, int tcpWnd, int tcpWndScale, int ipTos, int ipTtl)
|
||||
throws InvalidPacketException {
|
||||
super(srcAddress, srcPort, dstAddress, dstPort, data);
|
||||
this.tcpSeq = tcpSeq;
|
||||
this.tcpAck = tcpAck;
|
||||
this.tcpWnd = tcpWnd;
|
||||
this.tcpWndScale = tcpWndScale;
|
||||
this.ipTos = ipTos;
|
||||
this.ipTtl = ipTtl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method to create tcp keepalive packet structure.
|
||||
*/
|
||||
@@ -169,7 +182,11 @@ public class TcpKeepalivePacketData extends KeepalivePacketData implements Parce
|
||||
|
||||
/** Write to parcel. */
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
super.writeToParcel(out, flags);
|
||||
out.writeString(srcAddress.getHostAddress());
|
||||
out.writeString(dstAddress.getHostAddress());
|
||||
out.writeInt(srcPort);
|
||||
out.writeInt(dstPort);
|
||||
out.writeByteArray(getPacket());
|
||||
out.writeInt(tcpSeq);
|
||||
out.writeInt(tcpAck);
|
||||
out.writeInt(tcpWnd);
|
||||
@@ -178,21 +195,32 @@ public class TcpKeepalivePacketData extends KeepalivePacketData implements Parce
|
||||
out.writeInt(ipTtl);
|
||||
}
|
||||
|
||||
private TcpKeepalivePacketData(Parcel in) {
|
||||
super(in);
|
||||
tcpSeq = in.readInt();
|
||||
tcpAck = in.readInt();
|
||||
tcpWnd = in.readInt();
|
||||
tcpWndScale = in.readInt();
|
||||
ipTos = in.readInt();
|
||||
ipTtl = in.readInt();
|
||||
private static TcpKeepalivePacketData readFromParcel(Parcel in) throws InvalidPacketException {
|
||||
InetAddress srcAddress = InetAddresses.parseNumericAddress(in.readString());
|
||||
InetAddress dstAddress = InetAddresses.parseNumericAddress(in.readString());
|
||||
int srcPort = in.readInt();
|
||||
int dstPort = in.readInt();
|
||||
byte[] packet = in.createByteArray();
|
||||
int tcpSeq = in.readInt();
|
||||
int tcpAck = in.readInt();
|
||||
int tcpWnd = in.readInt();
|
||||
int tcpWndScale = in.readInt();
|
||||
int ipTos = in.readInt();
|
||||
int ipTtl = in.readInt();
|
||||
return new TcpKeepalivePacketData(srcAddress, srcPort, dstAddress, dstPort, packet, tcpSeq,
|
||||
tcpAck, tcpWnd, tcpWndScale, ipTos, ipTtl);
|
||||
}
|
||||
|
||||
/** Parcelable Creator. */
|
||||
public static final @NonNull Parcelable.Creator<TcpKeepalivePacketData> CREATOR =
|
||||
new Parcelable.Creator<TcpKeepalivePacketData>() {
|
||||
public TcpKeepalivePacketData createFromParcel(Parcel in) {
|
||||
return new TcpKeepalivePacketData(in);
|
||||
try {
|
||||
return readFromParcel(in);
|
||||
} catch (InvalidPacketException e) {
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid NAT-T keepalive data: " + e.error);
|
||||
}
|
||||
}
|
||||
|
||||
public TcpKeepalivePacketData[] newArray(int size) {
|
||||
|
||||
Reference in New Issue
Block a user