Search in sources :

Example 1 with ConstStorage

use of jadx.core.dex.info.ConstStorage in project jadx by skylot.

the class AndroidResourcesUtils method fillResFieldsMap.

@NotNull
private static Map<Integer, FieldNode> fillResFieldsMap(ClassNode resCls) {
    Map<Integer, FieldNode> resFieldsMap = new HashMap<>();
    ConstStorage constStorage = resCls.root().getConstValues();
    Map<Object, FieldNode> constFields = constStorage.getGlobalConstFields();
    for (Map.Entry<Object, FieldNode> entry : constFields.entrySet()) {
        Object key = entry.getKey();
        FieldNode field = entry.getValue();
        AccessInfo accessFlags = field.getAccessFlags();
        if (field.getType().equals(ArgType.INT) && accessFlags.isStatic() && accessFlags.isFinal() && key instanceof Integer) {
            resFieldsMap.put((Integer) key, field);
        }
    }
    return resFieldsMap;
}
Also used : FieldNode(jadx.core.dex.nodes.FieldNode) HashMap(java.util.HashMap) AccessInfo(jadx.core.dex.info.AccessInfo) ConstStorage(jadx.core.dex.info.ConstStorage) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap) Map(java.util.Map) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

AccessInfo (jadx.core.dex.info.AccessInfo)1 ConstStorage (jadx.core.dex.info.ConstStorage)1 FieldNode (jadx.core.dex.nodes.FieldNode)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 NotNull (org.jetbrains.annotations.NotNull)1