From 33af15efe67cf23e431f2b0515b3ce74e5125a93 Mon Sep 17 00:00:00 2001 From: Jun GAO Date: Wed, 16 Oct 2019 15:41:39 +0200 Subject: [PATCH] fixed 1. XML-based callback methods, e.g. android:onClick not found bug. 2. layout class cannot be found bug. --- .../android/callbacks/AbstractCallbackAnalyzer.java | 8 ++++++-- .../infoflow/android/config/SootConfigForAndroid.java | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/soot-infoflow-android/src/soot/jimple/infoflow/android/callbacks/AbstractCallbackAnalyzer.java b/soot-infoflow-android/src/soot/jimple/infoflow/android/callbacks/AbstractCallbackAnalyzer.java index 94508ae9c..52c36a1dd 100644 --- a/soot-infoflow-android/src/soot/jimple/infoflow/android/callbacks/AbstractCallbackAnalyzer.java +++ b/soot-infoflow-android/src/soot/jimple/infoflow/android/callbacks/AbstractCallbackAnalyzer.java @@ -526,8 +526,12 @@ protected boolean invokesSetContentView(InvokeExpr inv) { || curClass.getName().equals("android.support.v7.app.ActionBarActivity") || curClass.getName().equals("android.support.v7.app.AppCompatActivity")) return true; - if (curClass.declaresMethod("void setContentView(int)")) - return false; + // As long as the class is subclass of android.app.Activity, + // it can be sure that the setContentView method is what we expected. + // Following 2 statements make the overriding of method + // setContentView ignored. + // if (curClass.declaresMethod("void setContentView(int)")) + // return false; curClass = curClass.hasSuperclass() ? curClass.getSuperclass() : null; } return false; diff --git a/soot-infoflow-android/src/soot/jimple/infoflow/android/config/SootConfigForAndroid.java b/soot-infoflow-android/src/soot/jimple/infoflow/android/config/SootConfigForAndroid.java index d29e469af..3180c0913 100644 --- a/soot-infoflow-android/src/soot/jimple/infoflow/android/config/SootConfigForAndroid.java +++ b/soot-infoflow-android/src/soot/jimple/infoflow/android/config/SootConfigForAndroid.java @@ -25,7 +25,9 @@ public void setSootOptions(Options options, InfoflowConfiguration config) { List excludeList = new LinkedList(); excludeList.add("java.*"); excludeList.add("sun.*"); - excludeList.add("android.*"); + // exclude classes of android.* will cause layout class cannot be + // loaded for layout file based callback analysis. + // excludeList.add("android.*"); excludeList.add("org.apache.*"); excludeList.add("org.eclipse.*"); excludeList.add("soot.*");