Class DexReferences
- java.lang.Object
-
- com.android.tools.apk.analyzer.dex.DexReferences
-
public class DexReferences extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Comparator<DexElementNode>NODE_COMPARATOR
-
Constructor Summary
Constructors Constructor Description DexReferences(org.jf.dexlib2.dexbacked.DexBackedDexFile[] files)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddReferencesForNode(DexElementNode node, boolean shallow)Finds references toreferencedand attaches them as tree nodes undernodeDexElementNodegetReferenceTreeFor(org.jf.dexlib2.iface.reference.Reference referenced)Build a full reference tree for the given DEX reference.DexElementNodegetReferenceTreeFor(org.jf.dexlib2.iface.reference.Reference referenced, boolean shallow)Build a reference tree for the given DEX reference.static booleanisAlreadyLoaded(DexElementNode node)Checks if the specified dex reference tree node has had its references evaluated and attached (if any) or if it still needs to be passed to#addReferencesForNode(DexElementNode, Reference, boolean)for lazy evaluation
-
-
-
Field Detail
-
NODE_COMPARATOR
public static final java.util.Comparator<DexElementNode> NODE_COMPARATOR
-
-
Method Detail
-
getReferenceTreeFor
public DexElementNode getReferenceTreeFor(@NonNull org.jf.dexlib2.iface.reference.Reference referenced)
Build a full reference tree for the given DEX reference.- Parameters:
referenced- the dex element you wish to find references for- Returns:
- the root of the reference tree
-
getReferenceTreeFor
public DexElementNode getReferenceTreeFor(@NonNull org.jf.dexlib2.iface.reference.Reference referenced, boolean shallow)
Build a reference tree for the given DEX reference. Depending on theshallowparameter this returns the full tree root or just the root with first level references evaluated.You can then lazy load deeper references using
#addReferencesForNode(DexElementNode node, Reference referenced, boolean shallow).To check if references were already loaded for a node use
isAlreadyLoaded(DexElementNode)- Parameters:
referenced- the dex element you wish to find references forshallow- false to to build the full tree, true to evaluate just the first level- Returns:
- the root of the reference tree
-
addReferencesForNode
public void addReferencesForNode(@NonNull DexElementNode node, boolean shallow)Finds references toreferencedand attaches them as tree nodes undernodeDepending on the
shallowparameter this attaches the full reference tree or stops evaluation at the first level- Parameters:
node- the root node under which you wish to attach referencesshallow- false to to build the full tree, true to evaluate just the first level
-
isAlreadyLoaded
public static boolean isAlreadyLoaded(DexElementNode node)
Checks if the specified dex reference tree node has had its references evaluated and attached (if any) or if it still needs to be passed to#addReferencesForNode(DexElementNode, Reference, boolean)for lazy evaluation- Parameters:
node- the reference tree node to check- Returns:
- true if this node is already evaluated
-
-