Expand description
The conditions of findrefs rules and callgraph endpoints on DEX code.
The syntax is the one both engines read (asc_query::rule); here are
the kinds and what their values mean:
method: ['=' | '*'] '{' rule '}' calls calls of the methods whose code matches the rule
['=' | '*'] '{@' PATH '}' calls calls of the methods listed in a file
['=' | '*'] '@' PATH calls the same
TARGET calls a method target, e.g. Lc;->m(I)V
in: '{' CONDITION '}' the methods of a class the condition matches
other: TEXT the kind's own syntax, e.g. a regex
calls := ( '[' constraint ( ',' constraint )* ']' )*
constraint := ( 'arg' N | 'this' ) ( '=' | '==' ) arg
| 'ret' ( '=' | '==' ) ( 'used' | 'unused' )
arg := '*' | INT | 'true' | 'false' | 'null' | '"' TEXT '"' | '~' REGEX
| 'param' [ K ] | 'class:' TYPE | 'new:' TYPE | 'ret:' METHOD | 'field:' FIELDA rule of one positive part is that condition; several parts make a
compound (Query::All) whose ! parts are its none list.
A {rule} or @PATH set also takes the calls that may dispatch to its
methods (Query::Virtual): those naming a method on a supertype of its
class, or on a subclass inheriting it. A supertype method more than
DEFAULT_FAN_OUT classes define is
not followed (the search notes it); * in front follows every one, =
keeps only the calls naming the set’s methods themselves.
Constraints keep the calls whose values they accept (Query::Call):
argN is the Nth declared parameter of the called method (from 0),
this its receiver, paramK the calling method’s own pK (smali
numbering), ret: / field: the result of a call / a field read the
target matches. Values are what the call site may hold: = keeps a site
the analysis cannot decide (marked ?), == drops it. * only shows
the values. A REGEX runs to the next , / ] outside () / {}, or is
quoted like TEXT (\", \\ escape).
Sets (method:{...}, in:{...}) nest at most MAX_DEPTH deep.
Constants§
- MAX_
DEPTH - Sets inside sets deeper than this are a mistake or hostile: each level is another pass over the code, and the parser recurses per level.
Functions§
- has_
constraints - Whether a method target carries call constraints (
X[arg0=1]). - parse_
condition_ in - Parse one condition (a rule of a single part without
!). - parse_
rule_ in - Parse a rule (see the module docs).
@PATHfiles are read relative todir(the current directory whenNone).