Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed30ec8d authored by Nucca Chen's avatar Nucca Chen Committed by Gerrit Code Review
Browse files

Merge "Add new netd event callback for changes to NAT64 prefix"

parents bc292422 6e81f2a7
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -44,6 +44,20 @@ oneway interface INetdEventCallback {
    void onDnsEvent(int netId, int eventType, int returnCode, String hostname,
            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.
+6 −0
Original line number Diff line number Diff line
@@ -31,6 +31,12 @@ public class BaseNetdEventCallback extends INetdEventCallback.Stub {
        // default no-op
    }

    @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) {
+13 −0
Original line number Diff line number Diff line
@@ -214,6 +214,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.