Merge "Remove the reading of APK file."
This commit is contained in:
@@ -141,14 +141,6 @@ public class ArtStatsLogUtils {
|
|||||||
ArtStatsLog.ART_DATUM_REPORTED__KIND__ART_DATUM_DEX2OAT_RESULT_CODE,
|
ArtStatsLog.ART_DATUM_REPORTED__KIND__ART_DATUM_DEX2OAT_RESULT_CODE,
|
||||||
result,
|
result,
|
||||||
dexMetadataType);
|
dexMetadataType);
|
||||||
logger.write(
|
|
||||||
sessionId,
|
|
||||||
uid,
|
|
||||||
compilationReason,
|
|
||||||
compilerFilter,
|
|
||||||
ArtStatsLog.ART_DATUM_REPORTED__KIND__ART_DATUM_DEX2OAT_DEX_CODE_BYTES,
|
|
||||||
getDexBytes(path),
|
|
||||||
dexMetadataType);
|
|
||||||
logger.write(
|
logger.write(
|
||||||
sessionId,
|
sessionId,
|
||||||
uid,
|
uid,
|
||||||
@@ -159,34 +151,6 @@ public class ArtStatsLogUtils {
|
|||||||
dexMetadataType);
|
dexMetadataType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static long getDexBytes(String apkPath) {
|
|
||||||
StrictJarFile jarFile = null;
|
|
||||||
long dexBytes = 0;
|
|
||||||
try {
|
|
||||||
jarFile = new StrictJarFile(apkPath,
|
|
||||||
/*verify=*/ false,
|
|
||||||
/*signatureSchemeRollbackProtectionsEnforced=*/ false);
|
|
||||||
Iterator<ZipEntry> it = jarFile.iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
ZipEntry entry = it.next();
|
|
||||||
if (entry.getName().matches("classes(\\d)*[.]dex")) {
|
|
||||||
dexBytes += entry.getSize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return dexBytes;
|
|
||||||
} catch (IOException ignore) {
|
|
||||||
Slog.e(TAG, "Error when parsing APK " + apkPath);
|
|
||||||
return -1L;
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (jarFile != null) {
|
|
||||||
jarFile.close();
|
|
||||||
}
|
|
||||||
} catch (IOException ignore) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int getDexMetadataType(String dexMetadataPath) {
|
private static int getDexMetadataType(String dexMetadataPath) {
|
||||||
if (dexMetadataPath == null) {
|
if (dexMetadataPath == null) {
|
||||||
return ArtStatsLog.ART_DATUM_REPORTED__DEX_METADATA_TYPE__ART_DEX_METADATA_TYPE_NONE;
|
return ArtStatsLog.ART_DATUM_REPORTED__DEX_METADATA_TYPE__ART_DEX_METADATA_TYPE_NONE;
|
||||||
|
|||||||
@@ -240,14 +240,6 @@ public final class ArtStatsLogUtilsTest {
|
|||||||
ArtStatsLog.ART_DATUM_REPORTED__KIND__ART_DATUM_DEX2OAT_RESULT_CODE,
|
ArtStatsLog.ART_DATUM_REPORTED__KIND__ART_DATUM_DEX2OAT_RESULT_CODE,
|
||||||
RESULT_CODE,
|
RESULT_CODE,
|
||||||
dexMetadataType);
|
dexMetadataType);
|
||||||
inorder.verify(mockLogger).write(
|
|
||||||
SESSION_ID,
|
|
||||||
UID,
|
|
||||||
COMPILATION_REASON,
|
|
||||||
COMPILER_FILTER,
|
|
||||||
ArtStatsLog.ART_DATUM_REPORTED__KIND__ART_DATUM_DEX2OAT_DEX_CODE_BYTES,
|
|
||||||
DEX_CONTENT.length,
|
|
||||||
dexMetadataType);
|
|
||||||
inorder.verify(mockLogger).write(
|
inorder.verify(mockLogger).write(
|
||||||
SESSION_ID,
|
SESSION_ID,
|
||||||
UID,
|
UID,
|
||||||
|
|||||||
Reference in New Issue
Block a user