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

Commit c2c7ee19 authored by Tobias Thierer's avatar Tobias Thierer
Browse files

Replace uses of libcore.io.SizeOf with X.BYTES.

libcore.io.SizeOf is an internal API and is going away soon.

Note: The files touched by this CL have some other unused
imports which I did not touch. Therefore I had to use
"repo upload --no-verify" to upload this CL to gerrit.

Bug: 123174577
Test: Manually checked that this CL applies cleanly in internal
      master and that no other uses of SizeOf then remain in
      internal master's frameworks/base
Test: Treehugger
Change-Id: Ib29a195f3dda2f21ebbe2f7073e0af4dbb524b19
parent ca046e89
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import static java.nio.ByteOrder.BIG_ENDIAN;

import android.system.OsConstants;
import android.util.Log;
import libcore.io.SizeOf;

import java.net.Inet4Address;
import java.net.Inet6Address;
+1 −3
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.net.netlink;

import libcore.io.SizeOf;

import java.nio.ByteBuffer;


@@ -29,7 +27,7 @@ import java.nio.ByteBuffer;
 * @hide
 */
public class StructNfGenMsg {
    public static final int STRUCT_SIZE = 2 + SizeOf.SHORT;
    public static final int STRUCT_SIZE = 2 + Short.BYTES;

    public static final int NFNETLINK_V0 = 0;

+3 −4
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.net.netlink;

import android.net.netlink.NetlinkConstants;
import libcore.io.SizeOf;

import java.net.InetAddress;
import java.net.UnknownHostException;
@@ -117,7 +116,7 @@ public class StructNlAttr {
    public StructNlAttr(short type, short value, ByteOrder order) {
        this(order);
        nla_type = type;
        setValue(new byte[SizeOf.SHORT]);
        setValue(new byte[Short.BYTES]);
        getValueAsByteBuffer().putShort(value);
    }

@@ -128,7 +127,7 @@ public class StructNlAttr {
    public StructNlAttr(short type, int value, ByteOrder order) {
        this(order);
        nla_type = type;
        setValue(new byte[SizeOf.INT]);
        setValue(new byte[Integer.BYTES]);
        getValueAsByteBuffer().putInt(value);
    }

@@ -164,7 +163,7 @@ public class StructNlAttr {

    public int getValueAsInt(int defaultValue) {
        final ByteBuffer byteBuffer = getValueAsByteBuffer();
        if (byteBuffer == null || byteBuffer.remaining() != SizeOf.INT) {
        if (byteBuffer == null || byteBuffer.remaining() != Integer.BYTES) {
            return defaultValue;
        }
        return getValueAsByteBuffer().getInt();
+1 −2
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package android.net.netlink;

import android.net.netlink.NetlinkConstants;
import android.net.netlink.StructNlMsgHdr;
import libcore.io.SizeOf;

import java.nio.ByteBuffer;

@@ -31,7 +30,7 @@ import java.nio.ByteBuffer;
 * @hide
 */
public class StructNlMsgErr {
    public static final int STRUCT_SIZE = SizeOf.INT + StructNlMsgHdr.STRUCT_SIZE;
    public static final int STRUCT_SIZE = Integer.BYTES + StructNlMsgHdr.STRUCT_SIZE;

    public static boolean hasAvailableSpace(ByteBuffer byteBuffer) {
        return byteBuffer != null && byteBuffer.remaining() >= STRUCT_SIZE;