Exemple #1
0
  public BinaryXMLParser(RootNode root) {
    try {
      try {
        Class<?> rStyleCls = Class.forName(ANDROID_R_STYLE_CLS);
        for (Field f : rStyleCls.getFields()) {
          styleMap.put(f.getInt(f.getType()), f.getName());
        }
      } catch (Throwable th) {
        LOG.error("R class loading failed", th);
      }
      // add application constants
      for (DexNode dexNode : root.getDexNodes()) {
        for (Map.Entry<Object, FieldNode> entry : dexNode.getConstFields().entrySet()) {
          Object key = entry.getKey();
          FieldNode field = entry.getValue();
          if (field.getType().equals(ArgType.INT) && key instanceof Integer) {
            localStyleMap.put((Integer) key, field);
          }
        }
      }

      resNames = root.getResourcesNames();

      attributes = new ManifestAttributes();
      attributes.parse();
    } catch (Exception e) {
      throw new JadxRuntimeException("BinaryXMLParser init error", e);
    }
  }
 public void parseAll() throws Exception {
   parse(loadXML(ATTR_XML));
   parse(loadXML(MANIFEST_ATTR_XML));
   LOG.debug("Loaded android attributes count: {}", attrMap.size());
 }