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); } }
private void parseAttribute(int i) throws IOException { int attributeNS = is.readInt32(); int attributeName = is.readInt32(); int attributeRawValue = is.readInt32(); int attrValSize = is.readInt16(); if (attrValSize != 0x08) { die("attrValSize != 0x08 not supported"); } if (is.readInt8() != 0) { die("res0 is not 0"); } int attrValDataType = is.readInt8(); int attrValData = is.readInt32(); if (attributeNS != -1) { writer.add(nsPrefix).add(':'); } String attrName = strings[attributeName]; writer.add(attrName).add("=\""); String decodedAttr = attributes.decode(attrName, attrValData); if (decodedAttr != null) { writer.add(decodedAttr); } else { decodeAttribute(attributeNS, attrValDataType, attrValData); } }