Package com.ibm.wala.dalvik.ipa.callgraph.androidModel
It generates a new synthetic class (AndroidModelClass) containing all methods necessary to do so.
To model add a lifecycle-model one has to do the following steps:
1. Scan for the Entrypoints of the application AndroidEntryPointLocator epl = new
AndroidEntryPointLocator(options); List<AndroidEntryPoint> entrypoints = epl.getEntryPoints(cha);
AndroidEntryPointManager.ENTRIES = entrypoints;
2. Optionally read in the AndroidManifest.xml
final AndroidManifestXMLReader reader = new AndroidManifestXMLReader(manifestFile);
3.
Optionally change the order of entrypoints and change the instantiation behaviour 4. Create the
model and use it as the new entrypoint of the analysis IMethod model = new
AndroidModel(cha, p.options, p.scfg.cache).getMethod();
The model generated that way will "start" all components of the App. The various start-calls occurring in these components will not yet call anything useful. To change this there are two possibilities
* Insert a MethodTargetSelector: This works context-insensitive so if a call of "startActivity" is encountered a new model starting _all_ the Activities is generated.
TODO: This is about to change! AnalysisOptions options; ActivityMiniModel activities =
new ActivityMiniModel(cha, p.options, p.scfg.cache); options.setSelector(new
DelegatingMethodTargetSelector(activities.overrideAll(), options.getMethodTargetSelector()));
* Resolve the calls context-sensitive: In Android all calls to different components use an Intent. The IntentContextSelector remembers all Intents generated in the course of the analysis and attaches them to the start-calls as Context.
The IntentContextInterpreter then replaces the IR of the start-calls to start only the
resolved component (or a placeholder like startExternalACTIVITY) final ContextSelector
contextSelector = new IntentContextSelector(new DefaultContextSelector(options, cha)) final
SSAContextInterpreter contextInterpreter = new FallbackContextInterpreter(new
DelegatingSSAContextInterpreter( new IntentContextInterpreter(cha, options, cache), new
DefaultSSAInterpreter(options, cache)));
For the context-sensitive stuff to be able to resolve the targets either the AndroidManifest.xml should have been read or overrides been placed manually (or both).
- Since:
- 2013-10-25
- Author:
- Tobias Blaschke <code@tobiasblaschke.de>
-
ClassDescriptionThe model to be executed at application start.Encapsulates synthetic methods for modeling Androids lifecycle.Like MicroModel but includes CallBacks.Model for single Target Class.Models all classes derived from the given AndroidComponent.