summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/net/INetdEventCallback.aidl14
-rw-r--r--core/java/com/android/server/net/BaseNetdEventCallback.java6
-rw-r--r--services/core/java/com/android/server/connectivity/NetdEventListenerService.java13
3 files changed, 33 insertions, 0 deletions
diff --git a/core/java/android/net/INetdEventCallback.aidl b/core/java/android/net/INetdEventCallback.aidl
index 4b1a08ded9d6..0877a1a47e2b 100644
--- a/core/java/android/net/INetdEventCallback.aidl
+++ b/core/java/android/net/INetdEventCallback.aidl
@@ -45,6 +45,20 @@ oneway interface INetdEventCallback {
in String[] ipAddresses, int ipAddressesCount, long timestamp, int uid);
/**
+ * Represents adding or removing a NAT64 prefix.
+ * This method must not block or perform long-running operations.
+ *
+ * @param netId the ID of the network the prefix was performed on.
+ * @param added true if the NAT64 prefix was added, or false if the NAT64 prefix was removed.
+ * There is only one prefix at a time for each netId. If a prefix is added, it replaces
+ * the previous-added prefix.
+ * @param prefixString the detected NAT64 prefix as a string literal.
+ * @param prefixLength the prefix length associated with this NAT64 prefix.
+ */
+ void onNat64PrefixEvent(int netId, boolean added, @utf8InCpp String prefixString,
+ int prefixLength);
+
+ /**
* Represents a private DNS validation success or failure.
* This method must not block or perform long-running operations.
*
diff --git a/core/java/com/android/server/net/BaseNetdEventCallback.java b/core/java/com/android/server/net/BaseNetdEventCallback.java
index 97247aada49d..a65214a1edca 100644
--- a/core/java/com/android/server/net/BaseNetdEventCallback.java
+++ b/core/java/com/android/server/net/BaseNetdEventCallback.java
@@ -32,6 +32,12 @@ public class BaseNetdEventCallback extends INetdEventCallback.Stub {
}
@Override
+ public void onNat64PrefixEvent(int netId, boolean added, String prefixString,
+ int prefixLength) {
+ // default no-op
+ }
+
+ @Override
public void onPrivateDnsValidationEvent(int netId, String ipAddress,
String hostname, boolean validated) {
// default no-op
diff --git a/services/core/java/com/android/server/connectivity/NetdEventListenerService.java b/services/core/java/com/android/server/connectivity/NetdEventListenerService.java
index 422f5566eee1..e40949b785d9 100644
--- a/services/core/java/com/android/server/connectivity/NetdEventListenerService.java
+++ b/services/core/java/com/android/server/connectivity/NetdEventListenerService.java
@@ -217,6 +217,19 @@ public class NetdEventListenerService extends INetdEventListener.Stub {
@Override
// Called concurrently by multiple binder threads.
// This method must not block or perform long-running operations.
+ public synchronized void onNat64PrefixEvent(int netId,
+ boolean added, String prefixString, int prefixLength)
+ throws RemoteException {
+ for (INetdEventCallback callback : mNetdEventCallbackList) {
+ if (callback != null) {
+ callback.onNat64PrefixEvent(netId, added, prefixString, prefixLength);
+ }
+ }
+ }
+
+ @Override
+ // Called concurrently by multiple binder threads.
+ // This method must not block or perform long-running operations.
public synchronized void onPrivateDnsValidationEvent(int netId,
String ipAddress, String hostname, boolean validated)
throws RemoteException {