Merge "Switch to HexEncoding from ByteStringUtils"
This commit is contained in:
@@ -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;
|
||||||
|
|
||||||
@@ -232,7 +231,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");
|
||||||
|
|||||||
@@ -16,12 +16,12 @@
|
|||||||
|
|
||||||
package com.android.server.pm.dex;
|
package com.android.server.pm.dex;
|
||||||
|
|
||||||
|
import static com.android.server.pm.dex.PackageDexUsage.DexUseInfo;
|
||||||
|
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.IPackageManager;
|
import android.content.pm.IPackageManager;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
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;
|
||||||
@@ -31,11 +31,11 @@ import com.android.internal.annotations.VisibleForTesting;
|
|||||||
import com.android.server.pm.Installer;
|
import com.android.server.pm.Installer;
|
||||||
import com.android.server.pm.Installer.InstallerException;
|
import com.android.server.pm.Installer.InstallerException;
|
||||||
|
|
||||||
|
import libcore.util.HexEncoding;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static com.android.server.pm.dex.PackageDexUsage.DexUseInfo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is responsible for logging data about secondary dex files.
|
* This class is responsible for logging data about secondary dex files.
|
||||||
* The data logged includes hashes of the name and content of each file.
|
* The data logged includes hashes of the name and content of each file.
|
||||||
@@ -91,7 +91,7 @@ public class DexLogger implements DexManager.Listener {
|
|||||||
String message = PackageUtils.computeSha256Digest(dexFileName.getBytes());
|
String message = PackageUtils.computeSha256Digest(dexFileName.getBytes());
|
||||||
// Valid SHA256 will be 256 bits, 32 bytes.
|
// Valid SHA256 will be 256 bits, 32 bytes.
|
||||||
if (hash.length == 32) {
|
if (hash.length == 32) {
|
||||||
message = message + ' ' + ByteStringUtils.toHexString(hash);
|
message = message + ' ' + HexEncoding.encodeToString(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
writeDclEvent(ownerUid, message);
|
writeDclEvent(ownerUid, message);
|
||||||
|
|||||||
Reference in New Issue
Block a user