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

Commit 45edeae6 authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN
Browse files

Remove netlinkclient dependency on shared-srcs

This is causing FrameworksTelephonyTests to fail building because of a
conflict between classes in the shared-srcs and the jarjar rules of that
test.

Bug: 145146475
Test: m netlink-client FrameworksTelephonyTests
Change-Id: I57b2e470d5ec70bfc354d016555c0bbfb9ffdbe4
parent 243c3c9b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ java_library {
    name: "netlink-client",
    srcs: [
        "src/**/*.java",
        ":framework-networkstack-shared-srcs",
        ":framework-annotations",
    ],
    libs: [
        "androidx.annotation_annotation",
+20 −3
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.net.netlink;

import android.system.OsConstants;
import com.android.internal.util.HexDump;

import java.nio.ByteBuffer;

@@ -62,12 +61,12 @@ public class NetlinkConstants {

    public static String hexify(byte[] bytes) {
        if (bytes == null) { return "(null)"; }
        return HexDump.toHexString(bytes);
        return toHexString(bytes, 0, bytes.length);
    }

    public static String hexify(ByteBuffer buffer) {
        if (buffer == null) { return "(null)"; }
        return HexDump.toHexString(
        return toHexString(
                buffer.array(), buffer.position(), buffer.remaining());
    }

@@ -126,4 +125,22 @@ public class NetlinkConstants {
                return "unknown RTM type: " + String.valueOf(nlm_type);
        }
    }

    private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
            'A', 'B', 'C', 'D', 'E', 'F' };
    /**
     * Convert a byte array to a hexadecimal string.
     */
    public static String toHexString(byte[] array, int offset, int length) {
        char[] buf = new char[length * 2];

        int bufIndex = 0;
        for (int i = offset; i < offset + length; i++) {
            byte b = array[i];
            buf[bufIndex++] = HEX_DIGITS[(b >>> 4) & 0x0F];
            buf[bufIndex++] = HEX_DIGITS[b & 0x0F];
        }

        return new String(buf);
    }
}