Move TapPacketReader into its own utility class.
This class is generally useful for tests that manipulate packets
using a TestNetworkInterface. It will be used in upcoming
tethering tests. Also make it take a FileDescriptor instead of a
ParcelFileDescriptor, since that is more generally more useful.
As part of this change, create a filegroup of files that the test
utilities can depend on.
Bug: 150644681
Test: atest NetworkStackIntegrationTests:IpClientIntegrationTest
Change-Id: I73e9c1919956aa665a8cccec11d3444e486426ec
diff --git a/common/moduleutils/Android.bp b/common/moduleutils/Android.bp
index d0dd584..81475d2 100644
--- a/common/moduleutils/Android.bp
+++ b/common/moduleutils/Android.bp
@@ -62,3 +62,15 @@
],
visibility: ["//frameworks/base/packages/Tethering"],
}
+
+// Utility sources used by test libraries.
+// This is its own group to limit indiscriminate dependency of test code on production code.
+// TODO: move these classes and NetworkStack/tests/lib to frameworks/libs/net, and remove this.
+filegroup {
+ name: "net-module-utils-srcs-for-tests",
+ visibility: ["//packages/modules/NetworkStack/tests/lib"],
+ srcs: [
+ "src/android/net/util/FdEventsReader.java",
+ "src/android/net/util/PacketReader.java",
+ ],
+}