@@ -36,10 +36,7 @@ class AndroidLayoutXmlElement extends XmlElement {
36
36
/** An XML element that represents an editable text field. */
37
37
class AndroidEditableXmlElement extends AndroidLayoutXmlElement {
38
38
AndroidEditableXmlElement ( ) {
39
- exists ( Class editText |
40
- editText .hasQualifiedName ( "android.widget" , "EditText" ) and
41
- editText = this .getClass ( ) .getASourceSupertype * ( )
42
- )
39
+ this .getClass ( ) .getASourceSupertype * ( ) .hasQualifiedName ( "android.widget" , "EditText" )
43
40
}
44
41
45
42
/** Gets the input type of this field, if any. */
@@ -59,25 +56,24 @@ private class FindViewMethod extends Method {
59
56
}
60
57
61
58
/** Gets a use of the view that has the given id. */
62
- private Expr getAUseOfId ( string id ) {
63
- exists ( string name , MethodAccess findView , NestedClass r_id , Field id_field |
59
+ private MethodAccess getAUseOfViewWithId ( string id ) {
60
+ exists ( string name , NestedClass r_id , Field id_field |
64
61
id = "@+id/" + name and
65
- findView .getMethod ( ) instanceof FindViewMethod and
62
+ result .getMethod ( ) instanceof FindViewMethod and
66
63
r_id .getEnclosingType ( ) .hasName ( "R" ) and
67
64
r_id .hasName ( "id" ) and
68
65
id_field .getDeclaringType ( ) = r_id and
69
66
id_field .hasName ( name )
70
67
|
71
- DataFlow:: localExprFlow ( id_field .getAnAccess ( ) , findView .getArgument ( 0 ) ) and
72
- result = findView
68
+ DataFlow:: localExprFlow ( id_field .getAnAccess ( ) , result .getArgument ( 0 ) )
73
69
)
74
70
}
75
71
76
72
/** Gets the argument of a use of `setInputType` called on the view with the given id. */
77
- private Expr setInputTypeForId ( string id ) {
73
+ private Argument setInputTypeForId ( string id ) {
78
74
exists ( MethodAccess setInputType |
79
75
setInputType .getMethod ( ) .hasQualifiedName ( "android.widget" , "TextView" , "setInputType" ) and
80
- DataFlow:: localExprFlow ( getAUseOfId ( id ) , setInputType .getQualifier ( ) ) and
76
+ DataFlow:: localExprFlow ( getAUseOfViewWithId ( id ) , setInputType .getQualifier ( ) ) and
81
77
result = setInputType .getArgument ( 0 )
82
78
)
83
79
}
@@ -90,11 +86,11 @@ private predicate inputTypeFieldNotCached(Field f) {
90
86
or
91
87
f .getName ( ) .matches ( "%PASSWORD%" )
92
88
or
93
- f .getName ( ) = "TYPE_TEXT_FLAG_NO_SUGGESTIONS"
89
+ f .hasName ( "TYPE_TEXT_FLAG_NO_SUGGESTIONS" )
94
90
)
95
91
}
96
92
97
- /** Configuration that finds uses of `setInputType` that for non cached fields. */
93
+ /** Configuration that finds uses of `setInputType` for non cached fields. */
98
94
private class GoodInputTypeConf extends DataFlow:: Configuration {
99
95
GoodInputTypeConf ( ) { this = "GoodInputTypeConf" }
100
96
0 commit comments