Refactor logging for chunks and sparse flags. (#3260)

* refactor: log each chunk in verbose mode

* refactor: drop unneeded ":" from log output

* refactor: spit out sparse message once
This commit is contained in:
Connor Tumbleson 2023-08-09 08:38:34 -04:00 committed by GitHub
parent 0d7a1bc3a8
commit 1243dd5546
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -256,8 +256,10 @@ public class ResTable {
}
public void setSparseResources(boolean flag) {
if (mApkInfo.sparseResources != flag) {
LOGGER.info("Sparsely packed resources detected.");
}
mApkInfo.sparseResources = flag;
}
public void clearSdkInfo() {

View File

@ -65,11 +65,16 @@ public class ARSCDecoder {
Set<ResPackage> pkgs = new LinkedHashSet<>();
ResTypeSpec typeSpec;
int chunkNumber = 1;
chunkLoop:
for (;;) {
nextChunk();
LOGGER.fine(String.format(
"Chunk #%d start: type=0x%04x chunkSize=0x%08x", chunkNumber++, mHeader.type, mHeader.chunkSize
));
switch (mHeader.type) {
case ARSCHeader.RES_NULL_TYPE:
readUnknownChunk();
@ -266,9 +271,6 @@ public class ARSCDecoder {
mHeader.checkForUnreadHeader(mIn);
if ((typeFlags & 0x01) != 0) {
LOGGER.fine("Sparse type flags detected: " + mTypeSpec.getName());
// We've detected sparse resources, lets record this so we can rebuild in that same format
mResTable.setSparseResources(true);
}

View File

@ -62,7 +62,7 @@ public class ResFileDecoder {
resFileMapping.put(inFilePath, outFilePath);
}
LOGGER.fine("Decoding file: " + inFilePath + " to: " + outFilePath);
LOGGER.fine("Decoding file " + inFilePath + " to " + outFilePath);
try {
if (typeName.equals("raw")) {