Java Code Examples for org.jf.dexlib2.dexbacked.DexBackedClassDef#getType()
The following examples show how to use
org.jf.dexlib2.dexbacked.DexBackedClassDef#getType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SmaliDiffUtils.java From atlas with Apache License 2.0 | 6 votes |
public static Set<String> buildCode(File smaliDir, File dexFile, DexDiffInfo info) throws IOException, RecognitionException { Set<String> classes = new HashSet<String>(); Set<DexBackedClassDef> classDefs = new HashSet<DexBackedClassDef>(); classDefs.addAll(info.getModifiedClasses()); classDefs.addAll(info.getAddedClasses()); final ClassFileNameHandler outFileNameHandler = new ClassFileNameHandler(smaliDir, ".smali"); final ClassFileNameHandler inFileNameHandler = new ClassFileNameHandler(smaliDir, ".smali"); DexBuilder dexBuilder = new DexBuilder(Opcodes.getDefault()); File smaliFile; String className; for (DexBackedClassDef classDef : classDefs) { ApkPatch.currentClassType = classDef.getType(); className = TypeGenUtil.newType(classDef.getType()); AfBakSmali.disassembleClass(classDef, outFileNameHandler, getBuildOption(classDefs, 19), false, false); smaliFile = inFileNameHandler.getUniqueFilenameForClass(className); classes.add(className.substring(1, className.length() - 1).replace('/', '.')); SmaliMod.assembleSmaliFile(smaliFile, dexBuilder, true, true); } dexBuilder.writeTo(new FileDataStore(dexFile)); return classes; }
Example 2
Source File: SmaliDiffUtils.java From atlas with Apache License 2.0 | 6 votes |
public static Set<DexBackedClassDef> scanClasses(File smaliDir, List<File> newFiles) throws PatchException { Set<DexBackedClassDef> classes = Sets.newHashSet(); try { for (File newFile : newFiles) { DexBackedDexFile newDexFile = DexFileFactory.loadDexFile(newFile, Opcodes.getDefault()); Set<? extends DexBackedClassDef> dexClasses = newDexFile.getClasses(); classes.addAll(dexClasses); } final ClassFileNameHandler outFileNameHandler = new ClassFileNameHandler(smaliDir, ".smali"); final ClassFileNameHandler inFileNameHandler = new ClassFileNameHandler(smaliDir, ".smali"); for (DexBackedClassDef classDef : classes) { String className = classDef.getType(); ApkPatch.currentClassType = null; AfBakSmali.disassembleClass(classDef, outFileNameHandler, getBuildOption(classes, 19), true, true); File smaliFile = inFileNameHandler.getUniqueFilenameForClass(className); } } catch (Exception e) { throw new PatchException(e); } return classes; }
Example 3
Source File: DexFile.java From apkfile with Apache License 2.0 | 5 votes |
private synchronized void cacheLocalClasses(DexBackedDexFile dexFile) { /* * Must collect all local classes before any analysis because an API method is defined as * any non-local method. In multi-dex situations, there many be many API calls which are not * local to a single DEX. */ for (DexBackedClassDef classDef : dexFile.getClasses()) { String classPath = classDef.getType(); LOCAL_CLASS_PATHS.add(classPath); } }
Example 4
Source File: SmaliDiffUtils.java From atlas with Apache License 2.0 | 5 votes |
public static File disassemble(File smaliDir, DexBackedClassDef dexBackedClassDef) throws PatchException { Set<DexBackedClassDef> classes = Sets.newHashSet(); classes.add(dexBackedClassDef); final ClassFileNameHandler outFileNameHandler = new ClassFileNameHandler(smaliDir, ".smali"); final ClassFileNameHandler inFileNameHandler = new ClassFileNameHandler(smaliDir, ".smali"); String className = dexBackedClassDef.getType(); AfBakSmali.disassembleClass(dexBackedClassDef, outFileNameHandler, getBuildOption(classes, 19), true, false); File smaliFile = inFileNameHandler.getUniqueFilenameForClass(className); return smaliFile; }