@@ -36,10 +36,7 @@ class AndroidLayoutXmlElement extends XmlElement {
3636/** An XML element that represents an editable text field. */
3737class AndroidEditableXmlElement extends AndroidLayoutXmlElement {
3838 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" )
4340 }
4441
4542 /** Gets the input type of this field, if any. */
@@ -59,25 +56,24 @@ private class FindViewMethod extends Method {
5956}
6057
6158/** 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 |
6461 id = "@+id/" + name and
65- findView .getMethod ( ) instanceof FindViewMethod and
62+ result .getMethod ( ) instanceof FindViewMethod and
6663 r_id .getEnclosingType ( ) .hasName ( "R" ) and
6764 r_id .hasName ( "id" ) and
6865 id_field .getDeclaringType ( ) = r_id and
6966 id_field .hasName ( name )
7067 |
71- DataFlow:: localExprFlow ( id_field .getAnAccess ( ) , findView .getArgument ( 0 ) ) and
72- result = findView
68+ DataFlow:: localExprFlow ( id_field .getAnAccess ( ) , result .getArgument ( 0 ) )
7369 )
7470}
7571
7672/** 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 ) {
7874 exists ( MethodAccess setInputType |
7975 setInputType .getMethod ( ) .hasQualifiedName ( "android.widget" , "TextView" , "setInputType" ) and
80- DataFlow:: localExprFlow ( getAUseOfId ( id ) , setInputType .getQualifier ( ) ) and
76+ DataFlow:: localExprFlow ( getAUseOfViewWithId ( id ) , setInputType .getQualifier ( ) ) and
8177 result = setInputType .getArgument ( 0 )
8278 )
8379}
@@ -90,11 +86,11 @@ private predicate inputTypeFieldNotCached(Field f) {
9086 or
9187 f .getName ( ) .matches ( "%PASSWORD%" )
9288 or
93- f .getName ( ) = "TYPE_TEXT_FLAG_NO_SUGGESTIONS"
89+ f .hasName ( "TYPE_TEXT_FLAG_NO_SUGGESTIONS" )
9490 )
9591}
9692
97- /** Configuration that finds uses of `setInputType` that for non cached fields. */
93+ /** Configuration that finds uses of `setInputType` for non cached fields. */
9894private class GoodInputTypeConf extends DataFlow:: Configuration {
9995 GoodInputTypeConf ( ) { this = "GoodInputTypeConf" }
10096
0 commit comments