Merge "Add ETHER_BROADCAST and DEFAULT_LINK_MTU constants."
diff --git a/staticlibs/Android.bp b/staticlibs/Android.bp
index a1a998e..4e78d20 100644
--- a/staticlibs/Android.bp
+++ b/staticlibs/Android.bp
@@ -49,6 +49,8 @@
"//frameworks/opt/net/ike",
"//frameworks/opt/net/wifi/service",
"//frameworks/opt/net/telephony",
+ "//frameworks/base/packages/Connectivity:__subpackages__",
+ "//packages/modules/Connectivity:__subpackages__",
"//packages/modules/NetworkStack:__subpackages__",
"//packages/modules/CaptivePortalLogin",
"//frameworks/libs/net/common/tests:__subpackages__",
@@ -99,6 +101,7 @@
],
static_libs: [
"androidx.test.ext.junit",
+ "kotlin-reflect",
"libnanohttpd",
"net-tests-utils-host-device-common",
"net-utils-device-common",
@@ -124,6 +127,7 @@
jarjar_rules: "jarjar-rules-shared.txt",
visibility: [
"//cts/tests/tests/net",
+ "//cts/tests/tests/wifi",
"//packages/modules/Connectivity/tests/cts/net",
"//frameworks/base/packages/Tethering",
"//packages/modules/Connectivity/Tethering",
@@ -131,9 +135,12 @@
"//frameworks/opt/net/ike",
"//frameworks/opt/telephony",
"//frameworks/base/wifi:__subpackages__",
+ "//frameworks/base/packages/Connectivity:__subpackages__",
+ "//packages/modules/Connectivity:__subpackages__",
"//packages/modules/NetworkStack:__subpackages__",
"//packages/modules/CaptivePortalLogin",
"//frameworks/libs/net/common/tests:__subpackages__",
+ "//packages/modules/Wifi/framework/tests:__subpackages__",
]
}
@@ -179,8 +186,6 @@
filegroup {
name: "net-utils-framework-wifi-common-srcs",
srcs: [
- "framework/android/net/util/nsd/DnsSdTxtRecord.java",
- "framework/android/net/util/MacAddressUtils.java",
"framework/com/android/net/module/util/**/*.java",
],
path: "framework",
@@ -196,7 +201,7 @@
name: "net-utils-wifi-service-common-srcs",
srcs: [
"device/android/net/NetworkFactory.java",
- "framework/android/net/util/NetUtils.java",
+ "framework/com/android/net/module/util/NetUtils.java",
],
visibility: [
"//frameworks/opt/net/wifi/service",
diff --git a/staticlibs/device/android/net/util/FdEventsReader.java b/staticlibs/device/com/android/net/module/util/FdEventsReader.java
similarity index 98%
rename from staticlibs/device/android/net/util/FdEventsReader.java
rename to staticlibs/device/com/android/net/module/util/FdEventsReader.java
index a5714aa..71ae13d 100644
--- a/staticlibs/device/android/net/util/FdEventsReader.java
+++ b/staticlibs/device/com/android/net/module/util/FdEventsReader.java
@@ -14,12 +14,14 @@
* limitations under the License.
*/
-// TODO : move this and PacketReader to com.android.net.module.util.
-package android.net.util;
+package com.android.net.module.util;
import static android.os.MessageQueue.OnFileDescriptorEventListener.EVENT_ERROR;
import static android.os.MessageQueue.OnFileDescriptorEventListener.EVENT_INPUT;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.net.util.SocketUtils;
import android.os.Handler;
import android.os.Looper;
import android.os.MessageQueue;
@@ -27,9 +29,6 @@
import android.system.OsConstants;
import android.util.Log;
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-
import com.android.internal.annotations.VisibleForTesting;
import java.io.FileDescriptor;
diff --git a/staticlibs/device/android/net/util/PacketReader.java b/staticlibs/device/com/android/net/module/util/PacketReader.java
similarity index 94%
rename from staticlibs/device/android/net/util/PacketReader.java
rename to staticlibs/device/com/android/net/module/util/PacketReader.java
index 61b3d6e..66c4788 100644
--- a/staticlibs/device/android/net/util/PacketReader.java
+++ b/staticlibs/device/com/android/net/module/util/PacketReader.java
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-// TODO : move this and FdEventsReader to com.android.net.module.util.
-package android.net.util;
+package com.android.net.module.util;
import static java.lang.Math.max;
diff --git a/staticlibs/device/android/net/util/Struct.java b/staticlibs/device/com/android/net/module/util/Struct.java
similarity index 99%
rename from staticlibs/device/android/net/util/Struct.java
rename to staticlibs/device/com/android/net/module/util/Struct.java
index 841829e..bc8761a 100644
--- a/staticlibs/device/android/net/util/Struct.java
+++ b/staticlibs/device/com/android/net/module/util/Struct.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.net.util;
+package com.android.net.module.util;
import android.annotation.NonNull;
@@ -293,7 +293,7 @@
*
* @param bigInteger The number to convert.
* @param order Indicate ByteBuffer is read as little-endian or big-endian.
- * @param type The annotation type.
+ * @param type The annotation U64 type.
*
* BigInteger#toByteArray returns a byte array containing the 2's complement representation
* of this BigInteger, in big-endian. If annotation type is U64 and ByteBuffer is read as
diff --git a/staticlibs/devicetests/com/android/testutils/TapPacketReader.java b/staticlibs/devicetests/com/android/testutils/TapPacketReader.java
index 001b709..b25b9f2 100644
--- a/staticlibs/devicetests/com/android/testutils/TapPacketReader.java
+++ b/staticlibs/devicetests/com/android/testutils/TapPacketReader.java
@@ -16,13 +16,13 @@
package com.android.testutils;
-import android.net.util.PacketReader;
import android.os.Handler;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.net.module.util.ArrayTrackRecord;
+import com.android.net.module.util.PacketReader;
import java.io.FileDescriptor;
import java.io.FileOutputStream;
diff --git a/staticlibs/framework/android/net/util/nsd/DnsSdTxtRecord.java b/staticlibs/framework/com/android/net/module/util/DnsSdTxtRecord.java
similarity index 99%
rename from staticlibs/framework/android/net/util/nsd/DnsSdTxtRecord.java
rename to staticlibs/framework/com/android/net/module/util/DnsSdTxtRecord.java
index 81768f7..760891b 100644
--- a/staticlibs/framework/android/net/util/nsd/DnsSdTxtRecord.java
+++ b/staticlibs/framework/com/android/net/module/util/DnsSdTxtRecord.java
@@ -19,7 +19,7 @@
- fix set() to replace existing values
*/
-package android.net.util.nsd;
+package com.android.net.module.util;
import android.os.Parcelable;
import android.os.Parcel;
diff --git a/staticlibs/framework/android/net/util/IpRange.java b/staticlibs/framework/com/android/net/module/util/IpRange.java
similarity index 99%
rename from staticlibs/framework/android/net/util/IpRange.java
rename to staticlibs/framework/com/android/net/module/util/IpRange.java
index 099770b..40b57b1 100644
--- a/staticlibs/framework/android/net/util/IpRange.java
+++ b/staticlibs/framework/com/android/net/module/util/IpRange.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.net.util;
+package com.android.net.module.util;
import static com.android.internal.annotations.VisibleForTesting.Visibility;
diff --git a/staticlibs/framework/android/net/util/LinkPropertiesUtils.java b/staticlibs/framework/com/android/net/module/util/LinkPropertiesUtils.java
similarity index 99%
rename from staticlibs/framework/android/net/util/LinkPropertiesUtils.java
rename to staticlibs/framework/com/android/net/module/util/LinkPropertiesUtils.java
index 282fa10..1565f2b 100644
--- a/staticlibs/framework/android/net/util/LinkPropertiesUtils.java
+++ b/staticlibs/framework/com/android/net/module/util/LinkPropertiesUtils.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.net.util;
+package com.android.net.module.util;
import android.annotation.NonNull;
import android.annotation.Nullable;
diff --git a/staticlibs/framework/android/net/util/MacAddressUtils.java b/staticlibs/framework/com/android/net/module/util/MacAddressUtils.java
similarity index 98%
rename from staticlibs/framework/android/net/util/MacAddressUtils.java
rename to staticlibs/framework/com/android/net/module/util/MacAddressUtils.java
index 969d127..bc11fa2 100644
--- a/staticlibs/framework/android/net/util/MacAddressUtils.java
+++ b/staticlibs/framework/com/android/net/module/util/MacAddressUtils.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.net.util;
+package com.android.net.module.util;
import android.annotation.NonNull;
import android.annotation.Nullable;
diff --git a/staticlibs/framework/android/net/util/NetUtils.java b/staticlibs/framework/com/android/net/module/util/NetUtils.java
similarity index 98%
rename from staticlibs/framework/android/net/util/NetUtils.java
rename to staticlibs/framework/com/android/net/module/util/NetUtils.java
index 302119e..4331b65 100644
--- a/staticlibs/framework/android/net/util/NetUtils.java
+++ b/staticlibs/framework/com/android/net/module/util/NetUtils.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.net.util;
+package com.android.net.module.util;
import android.annotation.NonNull;
import android.annotation.Nullable;
diff --git a/staticlibs/hostdevice/com/android/net/module/util/TrackRecord.kt b/staticlibs/hostdevice/com/android/net/module/util/TrackRecord.kt
index b647d99..efd77d1 100644
--- a/staticlibs/hostdevice/com/android/net/module/util/TrackRecord.kt
+++ b/staticlibs/hostdevice/com/android/net/module/util/TrackRecord.kt
@@ -19,6 +19,7 @@
import java.util.concurrent.TimeUnit
import java.util.concurrent.locks.Condition
import java.util.concurrent.locks.ReentrantLock
+import java.util.concurrent.locks.StampedLock
import kotlin.concurrent.withLock
/**
@@ -137,12 +138,6 @@
* instance can also be used concurrently. ReadHead maintains the current index that is
* the next to be read, and calls this the "mark".
*
- * A ReadHead delegates all TrackRecord methods to its associated ArrayTrackRecord, and
- * inherits its thread-safe properties. However, the additional methods that ReadHead
- * offers on top of TrackRecord do not share these properties and can only be used by
- * the thread that created the ReadHead. This is because by construction it does not
- * make sense to use a ReadHead on multiple threads concurrently (see below for details).
- *
* In a ReadHead, {@link poll(Long, (E) -> Boolean)} works similarly to a LinkedBlockingQueue.
* It can be called repeatedly and will return the elements as they arrive.
*
@@ -162,21 +157,43 @@
* The point is that the caller does not have to track the mark like it would have to if
* it was using ArrayTrackRecord directly.
*
- * Note that if multiple threads were using poll() concurrently on the same ReadHead, what
- * happens to the mark and the return values could be well defined, but it could not
- * be useful because there is no way to provide either a guarantee not to skip objects nor
- * a guarantee about the mark position at the exit of poll(). This is even more true in the
- * presence of a predicate to filter returned elements, because one thread might be
- * filtering out the events the other is interested in.
- * Instead, this use case is supported by creating multiple ReadHeads on the same instance
- * of ArrayTrackRecord. Each ReadHead is then guaranteed to see all events always and
- * guarantees are made on the value of the mark upon return. {@see poll(Long, (E) -> Boolean)}
- * for details. Be careful to create each ReadHead on the thread it is meant to be used on.
+ * Thread safety :
+ * A ReadHead delegates all TrackRecord methods to its associated ArrayTrackRecord, and
+ * inherits its thread-safe properties for all the TrackRecord methods.
*
- * Users of a ReadHead can ask for the current position of the mark at any time. This mark
- * can be used later to replay the history of events either on this ReadHead, on the associated
- * ArrayTrackRecord or on another ReadHead associated with the same ArrayTrackRecord. It
- * might look like this in the reader thread :
+ * Poll() operates under its own set of rules that only allow execution on multiple threads
+ * within constrained boundaries, and never concurrently or pseudo-concurrently. This is
+ * because concurrent calls to poll() fundamentally do not make sense. poll() will move
+ * the mark according to what events remained to be read by this read head, and therefore
+ * if multiple threads were calling poll() concurrently on the same ReadHead, what
+ * happens to the mark and the return values could not be useful because there is no way to
+ * provide either a guarantee not to skip objects nor a guarantee about the mark position at
+ * the exit of poll(). This is even more true in the presence of a predicate to filter
+ * returned elements, because one thread might be filtering out the events the other is
+ * interested in. For this reason, this class will fail-fast if any concurrent access is
+ * detected with ConcurrentAccessException.
+ * It is possible to use poll() on different threads as long as the following can be
+ * guaranteed : one thread must call poll() for the last time, then execute a write barrier,
+ * then the other thread must execute a read barrier before calling poll() for the first time.
+ * This allows in particular to call poll in @Before and @After methods in JUnit unit tests,
+ * because JUnit will enforce those barriers by creating the testing thread after executing
+ * @Before and joining the thread after executing @After.
+ *
+ * peek() can be used by multiple threads concurrently, but only if no thread is calling
+ * poll() outside of the boundaries above. For simplicity, it can be considered that peek()
+ * is safe to call only when poll() is safe to call.
+ *
+ * Polling concurrently from the same ArrayTrackRecord is supported by creating multiple
+ * ReadHeads on the same instance of ArrayTrackRecord (or of course by using ArrayTrackRecord
+ * directly). Each ReadHead is then guaranteed to see all events always and
+ * guarantees are made on the value of the mark upon return. {@see poll(Long, (E) -> Boolean)}
+ * for details. Be careful to create each ReadHead on the thread it is meant to be used on, or
+ * to have a clear synchronization point between creation and use.
+ *
+ * Users of a ReadHead can ask for the current position of the mark at any time, on a thread
+ * where it's safe to call peek(). This mark can be used later to replay the history of events
+ * either on this ReadHead, on the associated ArrayTrackRecord or on another ReadHead
+ * associated with the same ArrayTrackRecord. It might look like this in the reader thread :
*
* val markAtStart = record.mark
* // Start processing interesting events
@@ -190,22 +207,39 @@
* val specialElement = record.poll(timeout, markAtStart) { it.isSpecial() }
*/
inner class ReadHead : TrackRecord<E> by this@ArrayTrackRecord {
- private val owningThread = Thread.currentThread()
+ // This lock only controls access to the readHead member below. The ArrayTrackRecord
+ // object has its own synchronization following different (and more usual) semantics.
+ // See the comment on the ReadHead class for details.
+ private val slock = StampedLock()
private var readHead = 0
/**
* @return the current value of the mark.
*/
var mark
- get() = readHead.also { checkThread() }
+ get() = checkThread { readHead }
set(v: Int) = rewind(v)
fun rewind(v: Int) {
- checkThread()
+ val stamp = slock.tryWriteLock()
+ if (0L == stamp) concurrentAccessDetected()
readHead = v
+ slock.unlockWrite(stamp)
}
- private fun checkThread() = check(Thread.currentThread() == owningThread) {
- "Must be called by the thread that created this object"
+ private fun <T> checkThread(r: (Long) -> T): T {
+ // tryOptimisticRead is a read barrier, guarantees writes from other threads are visible
+ // after it
+ val stamp = slock.tryOptimisticRead()
+ val result = r(stamp)
+ // validate also performs a read barrier, guaranteeing that if validate returns true,
+ // then any change either happens-before tryOptimisticRead, or happens-after validate.
+ if (!slock.validate(stamp)) concurrentAccessDetected()
+ return result
+ }
+
+ private fun concurrentAccessDetected(): Nothing {
+ throw ConcurrentModificationException(
+ "ReadHeads can't be used concurrently. Check your threading model.")
}
/**
@@ -225,21 +259,27 @@
* @return an element matching the predicate, or null if timeout.
*/
fun poll(timeoutMs: Long, predicate: (E) -> Boolean = { true }): E? {
- checkThread()
- lock.withLock {
- val index = pollForIndexReadLocked(timeoutMs, readHead, predicate)
- readHead = if (index < 0) size else index + 1
- return getOrNull(index)
+ val stamp = slock.tryWriteLock()
+ if (0L == stamp) concurrentAccessDetected()
+ try {
+ lock.withLock {
+ val index = pollForIndexReadLocked(timeoutMs, readHead, predicate)
+ readHead = if (index < 0) size else index + 1
+ return getOrNull(index)
+ }
+ } finally {
+ slock.unlockWrite(stamp)
}
}
/**
* Returns the first element after the mark or null. This never blocks.
*
- * This method can only be used by the thread that created this ManagedRecordingQueue.
- * If used on another thread, this throws IllegalStateException.
+ * This method is subject to threading restrictions. It can be used concurrently on
+ * multiple threads but not if any other thread might be executing poll() at the same
+ * time. See the class comment for details.
*/
- fun peek(): E? = getOrNull(readHead).also { checkThread() }
+ fun peek(): E? = checkThread { getOrNull(readHead) }
}
}
diff --git a/staticlibs/jarjar-rules-shared.txt b/staticlibs/jarjar-rules-shared.txt
index 9e618db..a7fda7c 100644
--- a/staticlibs/jarjar-rules-shared.txt
+++ b/staticlibs/jarjar-rules-shared.txt
@@ -1,8 +1,2 @@
-# TODO: move the classes to the target package in java
-rule android.net.util.IpRange* com.android.net.module.util.IpRange@1
-rule android.net.util.MacAddressUtils* com.android.net.module.util.MacAddressUtils@1
-rule android.net.util.LinkPropertiesUtils* com.android.net.module.util.LinkPropertiesUtils@1
-rule android.net.util.NetUtils* com.android.net.module.util.NetUtils@1
-rule android.net.util.nsd.** com.android.net.module.util.nsd.@1
rule android.annotation.** com.android.net.module.annotation.@1
rule com.android.internal.annotations.** com.android.net.module.annotation.@1
diff --git a/staticlibs/tests/unit/Android.bp b/staticlibs/tests/unit/Android.bp
index c20b87d..537340e 100644
--- a/staticlibs/tests/unit/Android.bp
+++ b/staticlibs/tests/unit/Android.bp
@@ -16,7 +16,6 @@
"android.test.runner",
"android.test.base",
],
- jarjar_rules: "jarjar-rules-sharedlib.txt",
visibility: [
"//frameworks/base/packages/Tethering/tests/integration",
"//packages/modules/Connectivity/Tethering/tests/integration",
diff --git a/staticlibs/tests/unit/AndroidManifest.xml b/staticlibs/tests/unit/AndroidManifest.xml
index cc9e09e..c747c8a 100644
--- a/staticlibs/tests/unit/AndroidManifest.xml
+++ b/staticlibs/tests/unit/AndroidManifest.xml
@@ -17,6 +17,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.frameworks.libnet.tests">
+ <uses-permission android:name="android.permission.INTERNET" />
+
<application>
<uses-library android:name="android.test.runner" />
</application>
diff --git a/staticlibs/tests/unit/jarjar-rules-sharedlib.txt b/staticlibs/tests/unit/jarjar-rules-sharedlib.txt
deleted file mode 100644
index fceccfb..0000000
--- a/staticlibs/tests/unit/jarjar-rules-sharedlib.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# TODO: move the classes to the target package in java
-rule android.net.util.IpRange* com.android.net.module.util.IpRange@1
-rule android.net.util.MacAddressUtils* com.android.net.module.util.MacAddressUtils@1
-rule android.net.util.LinkPropertiesUtils* com.android.net.module.util.LinkPropertiesUtils@1
-rule android.net.util.NetUtils* com.android.net.module.util.NetUtils@1
-rule android.net.util.nsd.** com.android.net.module.util.nsd.@1
diff --git a/staticlibs/tests/unit/src/android/net/util/IpRangeTest.java b/staticlibs/tests/unit/src/android/net/util/IpRangeTest.java
index f4d07e9..677db69 100644
--- a/staticlibs/tests/unit/src/android/net/util/IpRangeTest.java
+++ b/staticlibs/tests/unit/src/android/net/util/IpRangeTest.java
@@ -28,6 +28,8 @@
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
+import com.android.net.module.util.IpRange;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/staticlibs/tests/unit/src/android/net/util/LinkPropertiesUtilsTest.java b/staticlibs/tests/unit/src/android/net/util/LinkPropertiesUtilsTest.java
index 2142090..e47c864 100644
--- a/staticlibs/tests/unit/src/android/net/util/LinkPropertiesUtilsTest.java
+++ b/staticlibs/tests/unit/src/android/net/util/LinkPropertiesUtilsTest.java
@@ -26,12 +26,14 @@
import android.net.LinkProperties;
import android.net.ProxyInfo;
import android.net.RouteInfo;
-import android.net.util.LinkPropertiesUtils.CompareOrUpdateResult;
-import android.net.util.LinkPropertiesUtils.CompareResult;
import android.util.ArraySet;
import androidx.test.runner.AndroidJUnit4;
+import com.android.net.module.util.LinkPropertiesUtils;
+import com.android.net.module.util.LinkPropertiesUtils.CompareOrUpdateResult;
+import com.android.net.module.util.LinkPropertiesUtils.CompareResult;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/staticlibs/tests/unit/src/android/net/util/MacAddressUtilsTest.java b/staticlibs/tests/unit/src/android/net/util/MacAddressUtilsTest.java
index ad63b3c..66d89ff 100644
--- a/staticlibs/tests/unit/src/android/net/util/MacAddressUtilsTest.java
+++ b/staticlibs/tests/unit/src/android/net/util/MacAddressUtilsTest.java
@@ -24,6 +24,8 @@
import androidx.test.runner.AndroidJUnit4;
+import com.android.net.module.util.MacAddressUtils;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/staticlibs/tests/unit/src/android/net/util/NetUtilsTest.java b/staticlibs/tests/unit/src/android/net/util/NetUtilsTest.java
index 903e80d..338d1c8 100644
--- a/staticlibs/tests/unit/src/android/net/util/NetUtilsTest.java
+++ b/staticlibs/tests/unit/src/android/net/util/NetUtilsTest.java
@@ -27,6 +27,8 @@
import androidx.test.runner.AndroidJUnit4;
+import com.android.net.module.util.NetUtils;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/staticlibs/tests/unit/src/com/android/net/module/util/PacketReaderTest.java b/staticlibs/tests/unit/src/com/android/net/module/util/PacketReaderTest.java
index 046a1d9..459801c 100644
--- a/staticlibs/tests/unit/src/com/android/net/module/util/PacketReaderTest.java
+++ b/staticlibs/tests/unit/src/com/android/net/module/util/PacketReaderTest.java
@@ -16,7 +16,6 @@
package com.android.net.module.util;
-import static android.net.util.PacketReader.DEFAULT_RECV_BUF_SIZE;
import static android.system.OsConstants.AF_INET6;
import static android.system.OsConstants.IPPROTO_UDP;
import static android.system.OsConstants.SOCK_DGRAM;
@@ -24,14 +23,13 @@
import static android.system.OsConstants.SOL_SOCKET;
import static android.system.OsConstants.SO_SNDTIMEO;
+import static com.android.net.module.util.PacketReader.DEFAULT_RECV_BUF_SIZE;
import static com.android.testutils.MiscAsserts.assertThrows;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import android.net.util.PacketReader;
import android.os.Handler;
import android.os.HandlerThread;
import android.system.ErrnoException;
@@ -93,8 +91,7 @@
Os.setsockoptTimeval(s, SOL_SOCKET, SO_SNDTIMEO, TIMEO);
} catch (ErrnoException | SocketException e) {
closeFd(s);
- fail();
- return null;
+ throw new RuntimeException("Failed to create FD", e);
}
mLocalSocket = s;
diff --git a/staticlibs/tests/unit/src/android/net/util/StructTest.java b/staticlibs/tests/unit/src/com/android/net/module/util/StructTest.java
similarity index 99%
rename from staticlibs/tests/unit/src/android/net/util/StructTest.java
rename to staticlibs/tests/unit/src/com/android/net/module/util/StructTest.java
index 59c94b2..1b03e75 100644
--- a/staticlibs/tests/unit/src/android/net/util/StructTest.java
+++ b/staticlibs/tests/unit/src/com/android/net/module/util/StructTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.net.util;
+package com.android.net.module.util;
import static com.android.testutils.MiscAsserts.assertThrows;
@@ -23,13 +23,13 @@
import static org.junit.Assert.assertTrue;
import android.net.IpPrefix;
-import android.net.util.Struct.Field;
-import android.net.util.Struct.Type;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
import com.android.internal.util.HexDump;
+import com.android.net.module.util.Struct.Field;
+import com.android.net.module.util.Struct.Type;
import org.junit.Test;
import org.junit.runner.RunWith;