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

Commit 7a782be6 authored by Junyu Lai's avatar Junyu Lai Committed by android-build-merger
Browse files

Merge "Extend onDnsEvent callback to report more fields."

am: 89eb3e61

Change-Id: I9051489d16dd720eab9fa3a0c4d4a2c6ae07e7bd
parents 11a4d775 89eb3e61
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -28,6 +28,11 @@ oneway interface INetdEventCallback {
     * Reports a single DNS lookup function call.
     * This method must not block or perform long-running operations.
     *
     * @param netId the ID of the network the lookup was performed on.
     * @param eventType one of the EVENT_* constants in {@link INetdEventListener}.
     * @param returnCode the return value of the query, may vary based on {@code eventType}. See
     *        {@code getaddrinfo()}, {@code gethostbyaddr()} and {@code gethostbyname()} section in
     *        bionic/libc/include/netdb.h.
     * @param hostname the name that was looked up.
     * @param ipAddresses (possibly a subset of) the IP addresses returned.
     *        At most {@link #DNS_REPORTED_IP_ADDRESSES_LIMIT} addresses are logged.
@@ -36,8 +41,8 @@ oneway interface INetdEventCallback {
     * @param timestamp the timestamp at which the query was reported by netd.
     * @param uid the UID of the application that performed the query.
     */
    void onDnsEvent(String hostname, in String[] ipAddresses, int ipAddressesCount, long timestamp,
            int uid);
    void onDnsEvent(int netId, int eventType, int returnCode, String hostname,
            in String[] ipAddresses, int ipAddressesCount, long timestamp, int uid);

    /**
     * Represents a private DNS validation success or failure.
+2 −2
Original line number Diff line number Diff line
@@ -26,8 +26,8 @@ import android.net.INetdEventCallback;
 */
public class BaseNetdEventCallback extends INetdEventCallback.Stub {
    @Override
    public void onDnsEvent(String hostname, String[] ipAddresses,
            int ipAddressesCount, long timestamp, int uid) {
    public void onDnsEvent(int netId, int eventType, int returnCode, String hostname,
            String[] ipAddresses, int ipAddressesCount, long timestamp, int uid) {
        // default no-op
    }

+2 −1
Original line number Diff line number Diff line
@@ -208,7 +208,8 @@ public class NetdEventListenerService extends INetdEventListener.Stub {

        for (INetdEventCallback callback : mNetdEventCallbackList) {
            if (callback != null) {
                callback.onDnsEvent(hostname, ipAddresses, ipAddressesCount, timestamp, uid);
                callback.onDnsEvent(netId, eventType, returnCode, hostname, ipAddresses,
                        ipAddressesCount, timestamp, uid);
            }
        }
    }
+2 −2
Original line number Diff line number Diff line
@@ -142,8 +142,8 @@ public class NetworkWatchlistService extends INetworkWatchlistManager.Stub {

    private final INetdEventCallback mNetdEventCallback = new BaseNetdEventCallback() {
        @Override
        public void onDnsEvent(String hostname, String[] ipAddresses, int ipAddressesCount,
                long timestamp, int uid) {
        public void onDnsEvent(int netId, int eventType, int returnCode, String hostname,
                String[] ipAddresses, int ipAddressesCount, long timestamp, int uid) {
            if (!mIsLoggingEnabled) {
                return;
            }
+2 −2
Original line number Diff line number Diff line
@@ -53,8 +53,8 @@ final class NetworkLogger {

    private final INetdEventCallback mNetdEventCallback = new BaseNetdEventCallback() {
        @Override
        public void onDnsEvent(String hostname, String[] ipAddresses, int ipAddressesCount,
                long timestamp, int uid) {
        public void onDnsEvent(int netId, int eventType, int returnCode, String hostname,
                String[] ipAddresses, int ipAddressesCount, long timestamp, int uid) {
            if (!mIsLoggingEnabled.get()) {
                return;
            }
Loading