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

Commit 2ccba0e0 authored by Hugo Benichi's avatar Hugo Benichi
Browse files

Light refactors to packet wakeup events.

This patch uses the recently added MacAddress class in WakeupEvent and
WakeupStats for replacing the byte array representation of dest mac
addresses in packet wakeup events.

Bug: 28806131
Test: runtest frameworks-net
Merged-In: I5a3c76498a4b720f0d9308a65b5dd4b32377d0d1

(partial cherry pick from 884970e0)

Change-Id: I878d51d4cc53c6d9a2cc3c55faa15b86156afbd7
parent 06e314f6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ public class WakeupEvent {
    public String iface;
    public int uid;
    public int ethertype;
    public byte[] dstHwAddr;
    public MacAddress dstHwAddr;
    public String srcIp;
    public String dstIp;
    public int ipNextHeader;
@@ -44,7 +44,7 @@ public class WakeupEvent {
        j.add(iface);
        j.add("uid: " + Integer.toString(uid));
        j.add("eth=0x" + Integer.toHexString(ethertype));
        j.add("dstHw=" + MacAddress.stringAddrFromByteAddr(dstHwAddr));
        j.add("dstHw=" + dstHwAddr);
        if (ipNextHeader > 0) {
            j.add("ipNxtHdr=" + ipNextHeader);
            j.add("srcIp=" + srcIp);
+1 −2
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package android.net.metrics;

import android.net.MacAddress;
import android.os.Process;
import android.os.SystemClock;
import android.util.SparseIntArray;
@@ -80,7 +79,7 @@ public class WakeupStats {
                break;
        }

        switch (MacAddress.macAddressType(ev.dstHwAddr)) {
        switch (ev.dstHwAddr.addressType()) {
            case UNICAST:
                l2UnicastCount++;
                break;
+2 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.util.TimeUtils.NANOS_PER_MS;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.INetdEventCallback;
import android.net.MacAddress;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.metrics.ConnectStats;
@@ -242,7 +243,7 @@ public class NetdEventListenerService extends INetdEventListener.Stub {
        event.timestampMs = timestampMs;
        event.uid = uid;
        event.ethertype = ethertype;
        event.dstHwAddr = dstHw;
        event.dstHwAddr = new MacAddress(dstHw);
        event.srcIp = srcIp;
        event.dstIp = dstIp;
        event.ipNextHeader = ipNextHeader;