Skip to content

Commit a94b276

Browse files
committed
Reduce flood of "Unsupported flag" warnings
1 parent 0a253bd commit a94b276

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

soot-infoflow-android/src/soot/jimple/infoflow/android/resources/ARSCFileParser.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,9 @@ public class ARSCFileParser extends AbstractResourceParser {
280280
private final Map<Integer, String> stringTable = new HashMap<>();
281281
private final List<ResPackage> packages = new ArrayList<>();
282282

283+
private boolean warnedUnsupportedWeak = false;
284+
private boolean warnedUnsupportedCompact = false;
285+
283286
public static class ResPackage {
284287
private int packageId;
285288
private String packageName;
@@ -2522,8 +2525,18 @@ else if (size == 0x10)
25222525
boolean flagsCompact = (flags & FLAG_COMPACT) == FLAG_COMPACT;
25232526

25242527
if (flagsWeak || flagsCompact) {
2525-
logger.warn("Unsupported ResTable entry flags encountered: {} {}", flagsWeak ? "FLAG_WEAK" : "",
2526-
flagsCompact ? "FLAG_COMPACT" : "");
2528+
boolean doWarn = false;
2529+
if (flagsWeak) {
2530+
doWarn = !warnedUnsupportedWeak;
2531+
warnedUnsupportedWeak = true;
2532+
}
2533+
if (flagsCompact) {
2534+
doWarn |= !warnedUnsupportedCompact;
2535+
warnedUnsupportedCompact = true;
2536+
}
2537+
if (doWarn)
2538+
logger.warn("Unsupported ResTable entry flags encountered: {} {}", flagsWeak ? "FLAG_WEAK" : "",
2539+
flagsCompact ? "FLAG_COMPACT" : "");
25272540
}
25282541

25292542
entry.key = readUInt32(data, offset);

0 commit comments

Comments
 (0)