Java Code Examples for com.android.dex.Dex#methodIds()

The following examples show how to use com.android.dex.Dex#methodIds() . 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: FindUsages.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: FindUsages.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 3
Source File: FindUsages.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}