services.net: Add a static library needed by wifi module
Add a new static library that compiles against system_current which includes all the parts needed by the wifi mainline module. Also, a) Refactored TcpKeepalivePacketData to use public APIs. The parcel read/write methods in the base class are @hide and they're not used by the other child class (NatKeepalivePacketData). So, remove the @hide method from base class and use it direcly in the child class. b) Add jar-jar rules for all the statically linked dependencies in wifi service jar rules. Exempt-From-Owner-Approval: Minor change on top of owner's approval. Bug: 145825329 Test: Device boots up & connects to wifi networks. Change-Id: Ifde69b579cfe5b813766f676acb10e436e64a44c
This commit is contained in:
14
Android.bp
14
Android.bp
@@ -694,6 +694,7 @@ filegroup {
|
||||
"core/java/android/annotation/CallbackExecutor.java",
|
||||
"core/java/android/annotation/CheckResult.java",
|
||||
"core/java/android/annotation/CurrentTimeMillisLong.java",
|
||||
"core/java/android/annotation/Hide.java",
|
||||
"core/java/android/annotation/IntDef.java",
|
||||
"core/java/android/annotation/IntRange.java",
|
||||
"core/java/android/annotation/LongDef.java",
|
||||
@@ -753,6 +754,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",
|
||||
@@ -1241,7 +1254,6 @@ filegroup {
|
||||
"core/java/android/net/InterfaceConfiguration.java",
|
||||
"core/java/android/os/BasicShellCommandHandler.java",
|
||||
"core/java/android/util/BackupUtils.java",
|
||||
"core/java/android/util/LocalLog.java",
|
||||
"core/java/android/util/Rational.java",
|
||||
"core/java/com/android/internal/util/FastXmlSerializer.java",
|
||||
"core/java/com/android/internal/util/HexDump.java",
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -1,7 +1,32 @@
|
||||
# used by wifi-service
|
||||
rule android.net.DhcpResultsParcelable* @0
|
||||
rule android.net.DhcpResults* com.android.server.x.wifi.net.DhcpResults@1
|
||||
rule android.net.InterfaceConfigurationParcel* @0
|
||||
rule android.net.InterfaceConfiguration* com.android.server.x.wifi.net.InterfaceConfiguration@1
|
||||
rule android.net.IpMemoryStore* com.android.server.x.wifi.net.IpMemoryStore@1
|
||||
rule android.net.NetworkMonitorManager* com.android.server.x.wifi.net.NetworkMonitorManager@1
|
||||
rule android.net.TcpKeepalivePacketData* com.android.server.x.wifi.net.TcpKeepalivePacketData@1
|
||||
rule android.net.NetworkFactory* com.android.server.x.wifi.net.NetworkFactory@1
|
||||
rule android.net.ip.IpClientCallbacks* com.android.server.x.wifi.net.ip.IpClientCallbacks@1
|
||||
rule android.net.ip.IpClientManager* com.android.server.x.wifi.net.ip.IpClientManager@1
|
||||
rule android.net.ip.IpClientUtil* com.android.server.x.wifi.net.ip.IpClientUtil@1
|
||||
rule android.net.shared.InetAddressUtils* com.android.server.x.wifi.net.shared.InetAddressUtils@1
|
||||
rule android.net.shared.InitialConfiguration* com.android.server.x.wifi.net.shared.InitialConfiguration@1
|
||||
rule android.net.shared.IpConfigurationParcelableUtil* com.android.server.x.wifi.net.shared.IpConfigurationParcelableUtil@1
|
||||
rule android.net.shared.LinkPropertiesParcelableUtil* com.android.server.x.wifi.net.shared.LinkPropertiesParcelableUtil@1
|
||||
rule android.net.shared.ParcelableUtil* com.android.server.x.wifi.net.shared.ParcelableUtil@1
|
||||
rule android.net.shared.NetdUtils* com.android.server.x.wifi.net.shared.NetdUtils@1
|
||||
rule android.net.shared.NetworkMonitorUtils* com.android.server.x.wifi.net.shared.NetworkMonitorUtils@1
|
||||
rule android.net.shared.ParcelableUtil* com.android.server.x.wifi.net.shared.ParcelableUtil@1
|
||||
rule android.net.shared.PrivateDnsConfig* com.android.server.x.wifi.net.shared.PrivateDnsConfig@1
|
||||
rule android.net.shared.ProvisioningConfiguration* com.android.server.x.wifi.net.shared.ProvisioningConfiguration@1
|
||||
rule android.net.shared.RouteUtils* com.android.server.x.wifi.net.shared.RouteUtils@1
|
||||
rule android.net.util.KeepalivePacketDataUtil* com.android.server.x.wifi.net.util.KeepalivePacketDataUtil@1
|
||||
rule android.net.util.NetworkConstants* com.android.server.x.wifi.net.util.NetworkConstants@1
|
||||
rule android.net.util.InterfaceParams* com.android.server.x.wifi.net.util.InterfaceParams@1
|
||||
rule android.net.util.SharedLog* com.android.server.x.wifi.net.util.SharedLog@1
|
||||
rule android.net.util.NetUtils* com.android.server.x.wifi.net.util.NetUtils@1
|
||||
rule android.net.util.IpUtils* com.android.server.x.wifi.net.util.IpUtils@1
|
||||
|
||||
# We don't jar-jar the entire package because, we still use some classes (like
|
||||
# AsyncChannel in com.android.internal.util) from these packages which are not
|
||||
@@ -29,7 +54,6 @@ rule com.android.internal.messages.SystemMessageProto* com.android.server.x.wifi
|
||||
# Use our statically linked PlatformProperties library
|
||||
rule android.sysprop.** com.android.server.x.wifi.sysprop.@1
|
||||
|
||||
|
||||
# used by both framework-wifi and wifi-service
|
||||
rule android.content.pm.BaseParceledListSlice* android.x.net.wifi.util.BaseParceledListSlice@1
|
||||
rule android.content.pm.ParceledListSlice* android.x.net.wifi.util.ParceledListSlice@1
|
||||
|
||||
Reference in New Issue
Block a user