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

Commit e3a0f42e authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN Committed by Gerrit Code Review
Browse files

Merge "Add DhcpServer"

parents 0e162129 a13007ad
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -139,6 +139,8 @@ public class TrafficStats {
    public static final int TAG_SYSTEM_GPS = 0xFFFFFF44;
    /** @hide */
    public static final int TAG_SYSTEM_PAC = 0xFFFFFF45;
    /** @hide */
    public static final int TAG_SYSTEM_DHCP_SERVER = 0xFFFFFF46;

    private static INetworkStatsService sStatsService;

+1 −10
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ import android.annotation.Nullable;
import android.net.IpPrefix;
import android.net.MacAddress;
import android.net.util.SharedLog;
import android.os.SystemClock;
import android.net.dhcp.DhcpServer.Clock;
import android.util.ArrayMap;

import java.net.Inet4Address;
@@ -73,15 +73,6 @@ class DhcpLeaseRepository {
    private int mNumAddresses;
    private long mLeaseTimeMs;

    public static class Clock {
        /**
         * @see SystemClock#elapsedRealtime()
         */
        public long elapsedRealtime() {
            return SystemClock.elapsedRealtime();
        }
    }

    /**
     * Next timestamp when committed or declined leases should be checked for expired ones. This
     * will always be lower than or equal to the time for the first lease to expire: it's OK not to
+9 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ import android.os.Build;
import android.os.SystemProperties;
import android.system.OsConstants;
import android.text.TextUtils;

import com.android.internal.annotations.VisibleForTesting;

import java.io.UnsupportedEncodingException;
@@ -350,6 +351,14 @@ public abstract class DhcpPacket {
        return mClientId != null;
    }

    /**
     * Convenience method to return the client ID if it was set explicitly, or null otherwise.
     */
    @Nullable
    public byte[] getExplicitClientIdOrNull() {
        return hasExplicitClientId() ? getClientId() : null;
    }

    /**
     * Returns the client ID. If not set explicitly, this follows RFC 2132 and creates a client ID
     * based on the hardware address.
+511 −0

File added.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ public abstract class FdEventsReader<BufferType> {
        mBuffer = buffer;
    }

    public final void start() {
    public void start() {
        if (onCorrectThread()) {
            createAndRegisterFd();
        } else {
@@ -100,7 +100,7 @@ public abstract class FdEventsReader<BufferType> {
        }
    }

    public final void stop() {
    public void stop() {
        if (onCorrectThread()) {
            unregisterAndDestroyFd();
        } else {
Loading