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

Commit fe9b32e4 authored by Neil Fuller's avatar Neil Fuller Committed by android-build-merger
Browse files

Merge "Switch from Byte.toHexString() to HexEncoding"

am: 1839e895

Change-Id: I9f4eb341877e4ddaa57824cbb24b53b1cd0a9b63
parents f4e40a5c 1839e895
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ import com.android.internal.util.BitUtils;
import com.android.internal.util.ObjectUtils;
import com.android.internal.util.Preconditions;

import libcore.util.HexEncoding;

import java.nio.ByteOrder;
import java.util.Arrays;
import java.util.Objects;
@@ -152,7 +154,7 @@ public final class BluetoothLeDeviceFilter implements DeviceFilter<ScanResult> {
            int initial = mRenameBytesReverseOrder ? endInclusive : startInclusive;
            int step = mRenameBytesReverseOrder ? -1 : 1;
            for (int i = initial; startInclusive <= i && i <= endInclusive; i += step) {
                sb.append(Byte.toHexString(bytes[i], true));
                sb.append(HexEncoding.encodeToString(bytes[i], true));
            }
        } else {
            sb.append(
+3 −1
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;

import libcore.util.HexEncoding;

import java.util.Arrays;

/**
@@ -146,7 +148,7 @@ public class ContextHubMessage implements Parcelable {
            ret += "data = 0x";
        }
        for (int i = 0; i < Math.min(length, DEBUG_LOG_NUM_BYTES); i++) {
            ret += Byte.toHexString(mData[i], true /* upperCase */);
            ret += HexEncoding.encodeToString(mData[i], true /* upperCase */);

            if ((i + 1) % 4 == 0) {
                ret += " ";
+3 −1
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;

import libcore.util.HexEncoding;

/**
 * A class describing messages send to or from nanoapps through the Context Hub Service.
 *
@@ -155,7 +157,7 @@ public final class NanoAppMessage implements Parcelable {
            ret += "data = 0x";
        }
        for (int i = 0; i < Math.min(length, DEBUG_LOG_NUM_BYTES); i++) {
            ret += Byte.toHexString(mMessageBody[i], true /* upperCase */);
            ret += HexEncoding.encodeToString(mMessageBody[i], true /* upperCase */);

            if ((i + 1) % 4 == 0) {
                ret += " ";
+3 −5
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import android.security.keystore.KeyPermanentlyInvalidatedException;
import android.util.ArrayMap;
import android.util.Log;

import libcore.util.HexEncoding;

import java.security.Key;
import java.security.SecureRandom;
import java.security.UnrecoverableKeyException;
@@ -71,11 +73,7 @@ public class RecoverySession implements AutoCloseable {
        SecureRandom secureRandom = new SecureRandom();
        byte[] sessionId = new byte[SESSION_ID_LENGTH_BYTES];
        secureRandom.nextBytes(sessionId);
        StringBuilder sb = new StringBuilder();
        for (byte b : sessionId) {
            sb.append(Byte.toHexString(b, /*upperCase=*/ false));
        }
        return sb.toString();
        return HexEncoding.encodeToString(sessionId, /*upperCase=*/ false);
    }

    /**
+4 −1
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;

import libcore.util.HexEncoding;

import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
@@ -1301,7 +1303,8 @@ public class ViewDebug {
                            if (type == int.class) {
                                fieldValue = formatIntToHexString((Integer) fieldValue);
                            } else if (type == byte.class) {
                                fieldValue = "0x" + Byte.toHexString((Byte) fieldValue, true);
                                fieldValue = "0x"
                                        + HexEncoding.encodeToString((Byte) fieldValue, true);
                            }
                        }
                    }
Loading