Merge "Switch to HexEncoding from ByteStringUtils" into qt-dev-plus-aosp

This commit is contained in:
Neil Fuller
2019-05-30 08:24:54 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 5 deletions

View File

@@ -38,7 +38,6 @@ import android.os.storage.StorageManager;
import android.provider.Settings; import android.provider.Settings;
import android.util.ArrayMap; import android.util.ArrayMap;
import android.util.AtomicFile; import android.util.AtomicFile;
import android.util.ByteStringUtils;
import android.util.PackageUtils; import android.util.PackageUtils;
import android.util.Slog; import android.util.Slog;
import android.util.SparseArray; import android.util.SparseArray;
@@ -52,6 +51,7 @@ import com.android.internal.util.ArrayUtils;
import com.android.internal.util.XmlUtils; import com.android.internal.util.XmlUtils;
import libcore.io.IoUtils; import libcore.io.IoUtils;
import libcore.util.HexEncoding;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
@@ -66,7 +66,6 @@ import java.nio.charset.StandardCharsets;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Set; import java.util.Set;
import java.util.function.Predicate; import java.util.function.Predicate;
@@ -234,7 +233,7 @@ class InstantAppRegistry {
@UserIdInt int userId) { @UserIdInt int userId) {
byte[] randomBytes = new byte[8]; byte[] randomBytes = new byte[8];
new SecureRandom().nextBytes(randomBytes); new SecureRandom().nextBytes(randomBytes);
String id = ByteStringUtils.toHexString(randomBytes).toLowerCase(Locale.US); String id = HexEncoding.encodeToString(randomBytes, false /* upperCase */);
File appDir = getInstantApplicationDir(packageName, userId); File appDir = getInstantApplicationDir(packageName, userId);
if (!appDir.exists() && !appDir.mkdirs()) { if (!appDir.exists() && !appDir.mkdirs()) {
Slog.e(LOG_TAG, "Cannot create instant app cookie directory"); Slog.e(LOG_TAG, "Cannot create instant app cookie directory");

View File

@@ -26,7 +26,6 @@ import android.os.FileUtils;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.storage.StorageManager; import android.os.storage.StorageManager;
import android.util.ByteStringUtils;
import android.util.EventLog; import android.util.EventLog;
import android.util.PackageUtils; import android.util.PackageUtils;
import android.util.Slog; import android.util.Slog;
@@ -38,6 +37,8 @@ import com.android.server.pm.Installer.InstallerException;
import com.android.server.pm.dex.PackageDynamicCodeLoading.DynamicCodeFile; import com.android.server.pm.dex.PackageDynamicCodeLoading.DynamicCodeFile;
import com.android.server.pm.dex.PackageDynamicCodeLoading.PackageDynamicCode; import com.android.server.pm.dex.PackageDynamicCodeLoading.PackageDynamicCode;
import libcore.util.HexEncoding;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
@@ -153,7 +154,7 @@ public class DynamicCodeLogger {
// Valid SHA256 will be 256 bits, 32 bytes. // Valid SHA256 will be 256 bits, 32 bytes.
if (hash != null && hash.length == 32) { if (hash != null && hash.length == 32) {
message = message + ' ' + ByteStringUtils.toHexString(hash); message = message + ' ' + HexEncoding.encodeToString(hash);
} else { } else {
Slog.d(TAG, "Got no hash for " + filePath); Slog.d(TAG, "Got no hash for " + filePath);
// File has probably been deleted. // File has probably been deleted.