<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div>Dear community,</div>
<div><br>
</div>
<div>I faced with an issue with Soot (Flowdroid) when I analyze an apk file that I do not see all the methods in a method call graph. Here are the details of the problem.</div>
<div><br>
</div>
<div>
<div>I am trying to build a method call graph with Soot. I am experimenting with apks from F-Droid, and I noticed that Soot seems to miss some methods. For example, for the arXiv apk
<a href="https://f-droid.org/repository/browse/?fdfilter=arXiv&fdid=com.commonsware.android.arXiv">
https://f-droid.org/repository/browse/?fdfilter=arXiv&fdid=com.commonsware.android.arXiv</a> in the class arXivDB the method deleteFeed() is not found by Soot.</div>
<div><br>
</div>
<div>To extract MCG nodes I use the following code:</div>
<div><br>
</div>
<div>       SetupApplication app = new SetupApplication(ANDROID_JAR, APK);</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>app.setCallbackFile("./lib_res/AndroidCallbacks.txt");</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>try {</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>    app.calculateSourcesSinksEntrypoints("./lib_res/SourcesAndSinks.txt");</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>} catch (Exception e) {</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>    e.printStackTrace();</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>soot.G.reset();</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>Options.v().set_src_prec(Options.src_prec_apk);</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>Options.v().set_process_dir(Collections.singletonList(APK));</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>Options.v().set_force_android_jar(ANDROID_JAR);</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>Options.v().set_whole_program(true);</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>Options.v().set_allow_phantom_refs(true);</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>Options.v().set_output_format(Options.output_format_none);</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>Options.v().setPhaseOption("cg.spark", "on");</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>new SootConfigForAndroid().setSootOptions(Options.v());</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>Scene.v().loadNecessaryClasses();</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>SootMethod entryPoint = app.getEntryPointCreator().createDummyMain();</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>entryPoint.getActiveBody().validate();</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>Options.v().set_main_class(entryPoint.getSignature());</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>Scene.v().setEntryPoints(Collections.singletonList(entryPoint));</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>// System.out.println(entryPoint.getActiveBody());</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>PackManager.v().runPacks();</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>CallGraph cg = Scene.v().getCallGraph();</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>int numOfNodes = 0;</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>for (Iterator<MethodOrMethodContext> mtds = cg.sourceMethods(); mtds.hasNext();) {</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>    SootMethod mtd = mtds.next().method();</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>    System.out.println(mtd.getSignature());</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>    numOfNodes++;</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>}</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>I have an assumption that there are some optimizations that reduce method call graph but I do not know where to look them for and how to disable them. Could you please help me?</div>
<div>Thank you in advance!</div>
<div><br>
</div>
<div><span>-- <br>
<div>Best Regards,</div>
<div>Yury Zhauniarovich</div>
</span></div>
<br clear="both">
CONFIDENTIALITY  NOTICE:<BR>
This email and any attachments transmitted with it are confidential and intended for the use of individual or entity to which it is addressed. If you have received this email in error, please delete it immediately and inform the sender. Unless you are the intended recipient, you may not use, disclose, copy or distribute this email or any attachments included. The contents of this email, including any attachments, may be subjected to copyright law. In such cases, the contents may not be copied, adapted, distributed or transmitted without the consent of the copyright owner.<BR>
</body>
</html>