public static void main(String[] args) throws IOException { String dexFile = args[0]; String declaredBy = args[1]; String memberName = args[2]; DexBuffer dex = new DexBuffer(new File(dexFile)); PrintWriter out = new PrintWriter(System.out); new FindUsages(dex, declaredBy, memberName, out).findUsages(); out.flush(); } }
/** * Returns the methods with {@code memberNameIndex} declared by {@code * declaringType} and its subtypes. */ private Set<Integer> getMethodIds(Dex dex, Set<Integer> memberNameIndexes, int declaringType) { Set<Integer> subtypes = findAssignableTypes(dex, declaringType); Set<Integer> methods = new HashSet<Integer>(); int methodIndex = 0; for (MethodId method : dex.methodIds()) { if (memberNameIndexes.contains(method.getNameIndex()) && subtypes.contains(method.getDeclaringClassIndex())) { methods.add(methodIndex); } methodIndex++; } return methods; }
continue; // this type name isn't used as a type in this dex methodIds.addAll(getMethodIds(dex, memberNameIndexes, typeIndex)); fieldIds.addAll(getFieldIds(dex, memberNameIndexes, typeIndex));
int fieldIndex = field.getFieldIndex(); if (fieldIds.contains(fieldIndex)) { out.println(location() + " field declared " + dex.fieldIds().get(fieldIndex)); int methodIndex = method.getMethodIndex(); if (methodIds.contains(methodIndex)) { out.println(location() + " method declared " + dex.methodIds().get(methodIndex));
break; } else if (arg.equals("--find-usages")) { com.android.dx.command.findusages.Main.main(without(args, i)); break; } else if (arg.equals("--version")) {
public static void main(String[] args) throws IOException { String dexFile = args[0]; String declaredBy = args[1]; String memberName = args[2]; Dex dex = new Dex(new File(dexFile)); PrintWriter out = new PrintWriter(System.out); new FindUsages(dex, declaredBy, memberName, out).findUsages(); out.flush(); } }
continue; // this type name isn't used as a type in this dex methodIds.addAll(getMethodIds(dex, memberNameIndexes, typeIndex)); fieldIds.addAll(getFieldIds(dex, memberNameIndexes, typeIndex));
/** * Returns the methods with {@code memberNameIndex} declared by {@code * declaringType} and its subtypes. */ private Set<Integer> getMethodIds(Dex dex, Set<Integer> memberNameIndexes, int declaringType) { Set<Integer> subtypes = findAssignableTypes(dex, declaringType); Set<Integer> methods = new HashSet<Integer>(); int methodIndex = 0; for (MethodId method : dex.methodIds()) { if (memberNameIndexes.contains(method.getNameIndex()) && subtypes.contains(method.getDeclaringClassIndex())) { methods.add(methodIndex); } methodIndex++; } return methods; }
int fieldIndex = field.getFieldIndex(); if (fieldIds.contains(fieldIndex)) { out.println(location() + " field declared " + dex.fieldIds().get(fieldIndex)); int methodIndex = method.getMethodIndex(); if (methodIds.contains(methodIndex)) { out.println(location() + " method declared " + dex.methodIds().get(methodIndex));
break; } else if (arg.equals("--find-usages")) { com.android.dx.command.findusages.Main.main(without(args, i)); break; } else if (arg.equals("--version")) {
public static void main(String[] args) throws IOException { String dexFile = args[0]; String declaredBy = args[1]; String memberName = args[2]; Dex dex = new Dex(new File(dexFile)); PrintWriter out = new PrintWriter(System.out); new FindUsages(dex, declaredBy, memberName, out).findUsages(); out.flush(); } }
continue; // this type name isn't used as a type in this dex methodIds.addAll(getMethodIds(dex, memberNameIndexes, typeIndex)); fieldIds.addAll(getFieldIds(dex, memberNameIndexes, typeIndex));
/** * Returns the methods with {@code memberNameIndex} declared by {@code * declaringType} and its subtypes. */ private Set<Integer> getMethodIds(DexBuffer dex, Set<Integer> memberNameIndexes, int declaringType) { Set<Integer> subtypes = findAssignableTypes(dex, declaringType); Set<Integer> methods = new HashSet<Integer>(); int methodIndex = 0; for (MethodId method : dex.methodIds()) { if (memberNameIndexes.contains(method.getNameIndex()) && subtypes.contains(method.getDeclaringClassIndex())) { methods.add(methodIndex); } methodIndex++; } return methods; }
int fieldIndex = field.getFieldIndex(); if (fieldIds.contains(fieldIndex)) { out.println(location() + " field declared " + dex.fieldIds().get(fieldIndex)); int methodIndex = method.getMethodIndex(); if (methodIds.contains(methodIndex)) { out.println(location() + " method declared " + dex.methodIds().get(methodIndex));
break; } else if (arg.equals("--find-usages")) { com.android.dx.command.findusages.Main.main(without(args, i)); break; } else if (arg.equals("--version")) {
public static void main(String[] args) throws IOException { String dexFile = args[0]; String declaredBy = args[1]; String memberName = args[2]; Dex dex = new Dex(new File(dexFile)); PrintWriter out = new PrintWriter(System.out); new FindUsages(dex, declaredBy, memberName, out).findUsages(); out.flush(); } }
continue; // this type name isn't used as a type in this dex methodIds.addAll(getMethodIds(dex, memberNameIndexes, typeIndex)); fieldIds.addAll(getFieldIds(dex, memberNameIndexes, typeIndex));
/** * Returns the methods with {@code memberNameIndex} declared by {@code * declaringType} and its subtypes. */ private Set<Integer> getMethodIds(Dex dex, Set<Integer> memberNameIndexes, int declaringType) { Set<Integer> subtypes = findAssignableTypes(dex, declaringType); Set<Integer> methods = new HashSet<Integer>(); int methodIndex = 0; for (MethodId method : dex.methodIds()) { if (memberNameIndexes.contains(method.getNameIndex()) && subtypes.contains(method.getDeclaringClassIndex())) { methods.add(methodIndex); } methodIndex++; } return methods; }
int fieldIndex = field.getFieldIndex(); if (fieldIds.contains(fieldIndex)) { out.println(location() + " field declared " + dex.fieldIds().get(fieldIndex)); int methodIndex = method.getMethodIndex(); if (methodIds.contains(methodIndex)) { out.println(location() + " method declared " + dex.methodIds().get(methodIndex));
break; } else if (arg.equals("--find-usages")) { com.android.dx.command.findusages.Main.main(without(args, i)); break; } else if (arg.equals("--version")) {