|
40 | 40 | import soot.Unit; |
41 | 41 | import soot.jimple.Stmt; |
42 | 42 | import soot.jimple.infoflow.AbstractInfoflow; |
| 43 | +import soot.jimple.infoflow.AnalysisPhase; |
43 | 44 | import soot.jimple.infoflow.BackwardsInfoflow; |
44 | 45 | import soot.jimple.infoflow.IInfoflow; |
45 | 46 | import soot.jimple.infoflow.Infoflow; |
|
93 | 94 | import soot.jimple.infoflow.handlers.ResultsAvailableHandler; |
94 | 95 | import soot.jimple.infoflow.handlers.TaintPropagationHandler; |
95 | 96 | import soot.jimple.infoflow.ipc.IIPCManager; |
| 97 | +import soot.jimple.infoflow.memory.AbstractSolverWatcher; |
96 | 98 | import soot.jimple.infoflow.memory.FlowDroidMemoryWatcher; |
97 | 99 | import soot.jimple.infoflow.memory.FlowDroidTimeoutWatcher; |
98 | 100 | import soot.jimple.infoflow.memory.IMemoryBoundedSolver; |
@@ -156,6 +158,7 @@ public class SetupApplication implements ITaintWrapperDataFlowAnalysis { |
156 | 158 | protected Set<ResultsAvailableHandler> resultsAvailableHandlers = new HashSet<>(); |
157 | 159 | protected TaintPropagationHandler taintPropagationHandler = null; |
158 | 160 | protected TaintPropagationHandler aliasPropagationHandler = null; |
| 161 | + protected MultiMap<AnalysisPhase, AbstractSolverWatcher> customWatchers = new HashMultiMap<>(); |
159 | 162 |
|
160 | 163 | protected IUsageContextProvider usageContextProvider = null; |
161 | 164 |
|
@@ -1772,6 +1775,7 @@ public void performCodeInstrumentationAfterDCE(InfoflowManager manager, |
1772 | 1775 | info.setTaintPropagationHandler(taintPropagationHandler); |
1773 | 1776 | info.setAliasPropagationHandler(aliasPropagationHandler); |
1774 | 1777 | info.setUsageContextProvider(usageContextProvider); |
| 1778 | + info.addSolverWatchers(customWatchers); |
1775 | 1779 |
|
1776 | 1780 | // We use a specialized memory manager that knows about Android |
1777 | 1781 | info.setMemoryManagerFactory(new IMemoryManagerFactory() { |
@@ -2089,4 +2093,15 @@ protected void tagUserCodeClasses() { |
2089 | 2093 | appClass.addTag(FlowDroidUserClass.v()); |
2090 | 2094 | } |
2091 | 2095 | } |
| 2096 | + |
| 2097 | + /** |
| 2098 | + * Registers an analysis watcher with the data flow engine |
| 2099 | + * |
| 2100 | + * @param watcher The watcher to register |
| 2101 | + * @param analysisPhase The analysis phase for which the watcher is applicable |
| 2102 | + */ |
| 2103 | + public void addSolverWatcher(AbstractSolverWatcher watcher, AnalysisPhase analysisPhase) { |
| 2104 | + this.customWatchers.put(analysisPhase, watcher); |
| 2105 | + } |
| 2106 | + |
2092 | 2107 | } |
0 commit comments