@@ -69,7 +69,7 @@ public static CommonTree getFirstUncleNamedOfType(int type, String name, CommonT
6969 }
7070 return null ;
7171 }
72-
72+
7373 public static CommonTree getFirstBackUncleNamedOfType (int type , String name , CommonTree t ) {
7474 CommonTree parent = (CommonTree ) t .getParent ();
7575 List <CommonTree > uncles = (List <CommonTree >)((CommonTree )parent .getParent ()).getChildren ();
@@ -116,13 +116,13 @@ public static CommonTree hasIPutAndIGet(CommonTree t) {
116116
117117 public static int [] isValidLocation (CommonTree t ){
118118 // if(t.getType()==159) {
119- // System.out.println(t.toStringTree());
120- // System.out.println(t.getType());
119+ // System.out.println(t.toStringTree());
120+ // System.out.println(t.getType());
121121 // System.out.println(t.getChild(2));
122122 // System.out.println(t.getChild(3));
123123 // System.out.println(t.getChild(2).toStringTree().equals("Ljava/net/URI;") && t.getChild(3).toStringTree().equals("<init>") );
124124 // }
125-
125+
126126 if (t .getType ()==smaliParser .I_STATEMENT_FORMAT35c_METHOD ) {
127127 ArrayList <Integer > resp = new ArrayList <Integer >();
128128 if (t .getFirstChildWithType (smaliParser .I_REGISTER_LIST ).getChildCount ()==3
@@ -164,11 +164,11 @@ public static int[] isValidLocation(CommonTree t){
164164 } else if (isNullOutputStream (t )) {
165165 resp .add (37 );
166166 }
167-
167+
168168 if (t .getChild (1 ).getChildCount ()>1 ) {
169169 resp .add (22 );
170170 }
171-
171+
172172 if (resp .size ()>0 ) {
173173 int [] ret = new int [resp .size ()];
174174 for (int i =0 ; i < ret .length ; i ++)
@@ -177,15 +177,25 @@ public static int[] isValidLocation(CommonTree t){
177177 }
178178 return ret ;
179179 }
180-
180+
181181 } else if (t .getType ()==191 ) {
182182 if (t .getText ().equals ("putExtra" )){ //InvalidKeyIntentPutExtra && NullValueIntentPutExtra
183183 return new int []{4 , 7 };
184- } else if (t .getText ().equals ("findViewById" ) && hasIPutAndIGet (t )!=null ) {
185- return new int []{26 , 29 };
186- } else if (t .getText ().equals ("findViewById" )) {
187- return new int []{27 , 31 };
188- }
184+ } else if (t .getText ().equals ("findViewById" )) {
185+ ArrayList <Integer > resp = new ArrayList <Integer >();
186+ resp .add (27 );
187+ resp .add (31 );
188+ if (hasIPutAndIGet (t )!=null ) {
189+ resp .add (26 );
190+ resp .add (29 );
191+ }
192+ int [] ret = new int [resp .size ()];
193+ for (int i =0 ; i < ret .length ; i ++)
194+ {
195+ ret [i ] = resp .get (i ).intValue ();
196+ }
197+ return ret ;
198+ }
189199 } else if (t .getType ()==161 ) {
190200 if (t .getChild (2 ).toStringTree ().equals ("Landroid/bluetooth/BluetoothAdapter;" )
191201 && t .getChild (3 ).toStringTree ().equals ("isEnabled" )
@@ -266,7 +276,7 @@ private static boolean isOnCreateMethod(CommonTree t) {
266276 }
267277 return resp ;
268278 }
269-
279+
270280 private static boolean isOnClickMethod (CommonTree t ) {
271281 boolean resp = t .getChild (0 ).toString ().equals ("onClick" );
272282 if (resp ) {
0 commit comments