java.lang.Object
com.ibm.wala.dalvik.ipa.callgraph.androidModel.AndroidModel
All Implemented Interfaces:
com.ibm.wala.ipa.cha.IClassHierarchyDweller
Direct Known Subclasses:
ExternalModel, IntentModel, MicroModel, MiniModel, SystemServiceModel, UnknownTargetModel

public class AndroidModel extends Object implements com.ibm.wala.ipa.cha.IClassHierarchyDweller
The model to be executed at application start.

This method models the lifecycle of an Android Application. By doing so it calls all AndroidEntryPoints set in the AnalysisOptions.

Between the calls to the AndroidEntryPoints special behavior is inserted. You can change that behavior by implementing an AbstractAndroidModel or set one of the existing ones in the AnalysisOptions.

Additionally care of how types are instantiated is taken. You can change this behavior by setting the IInstanciationBehavior in the AnalysisOptions.

Smaller Models exist: * MiniModel calls all components of a specific type (for example all Activities) * MicroModel calls a single specific component * ExternalModel doesn't call anything but fiddles with the data on its own

All these Models are added to a synthetic AndroidModelClass.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected com.ibm.wala.ipa.summaries.VolatileMethodSummary
     
    protected boolean
     
    protected com.ibm.wala.ipa.callgraph.IAnalysisCacheView
     
    protected com.ibm.wala.ipa.cha.IClassHierarchy
     
    protected static boolean
     
    protected com.ibm.wala.classLoader.IClass
     
    protected com.ibm.wala.ipa.summaries.SummarizedMethod
     
    com.ibm.wala.types.MethodReference
     
    protected com.ibm.wala.ipa.callgraph.AnalysisOptions
     
    protected final com.ibm.wala.ipa.callgraph.AnalysisScope
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    AndroidModel(com.ibm.wala.ipa.cha.IClassHierarchy cha, com.ibm.wala.ipa.callgraph.AnalysisOptions options, com.ibm.wala.ipa.callgraph.IAnalysisCacheView cache)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    build(com.ibm.wala.core.util.strings.Atom name)
    Generates the model on a sub-set of Entrypoints.
    protected void
    build(com.ibm.wala.core.util.strings.Atom name, Collection<? extends AndroidEntryPoint> entrypoints)
    Generate the SummarizedMethod for the model (in this.model).
    com.ibm.wala.ipa.cha.IClassHierarchy
     
    com.ibm.wala.classLoader.IClass
    The class the Method representing this Model resides in.
    com.ibm.wala.types.Descriptor
     
    com.ibm.wala.ipa.summaries.SummarizedMethod
    Building the SummarizedMethod is delayed upon the first class to this method.
    com.ibm.wala.ipa.summaries.SummarizedMethod
    getMethodAs(com.ibm.wala.types.MethodReference asMethod, com.ibm.wala.types.TypeReference caller, IntentStarters.StartInfo info, com.ibm.wala.ipa.callgraph.CGNode callerNd)
    Get method of the Model in an other Signature.
    com.ibm.wala.classLoader.IMethod
    Creates an "encapsulated" version of the model.
    com.ibm.wala.core.util.strings.Atom
     
    com.ibm.wala.types.TypeName
     
    boolean
     
    protected boolean
    Overridden by models to restraint Entrypoints.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • mRef

      public com.ibm.wala.types.MethodReference mRef
    • cha

      protected com.ibm.wala.ipa.cha.IClassHierarchy cha
    • options

      protected com.ibm.wala.ipa.callgraph.AnalysisOptions options
    • cache

      protected com.ibm.wala.ipa.callgraph.IAnalysisCacheView cache
    • scope

      protected final com.ibm.wala.ipa.callgraph.AnalysisScope scope
    • body

      protected com.ibm.wala.ipa.summaries.VolatileMethodSummary body
    • doBoot

      protected static boolean doBoot
    • klass

      protected com.ibm.wala.classLoader.IClass klass
    • built

      protected boolean built
    • model

      protected com.ibm.wala.ipa.summaries.SummarizedMethod model
  • Constructor Details

    • AndroidModel

      public AndroidModel(com.ibm.wala.ipa.cha.IClassHierarchy cha, com.ibm.wala.ipa.callgraph.AnalysisOptions options, com.ibm.wala.ipa.callgraph.IAnalysisCacheView cache)
  • Method Details

    • build

      protected void build(com.ibm.wala.core.util.strings.Atom name) throws com.ibm.wala.util.CancelException
      Generates the model on a sub-set of Entrypoints.

      Asks selectEntryPoint(AndroidEntryPoint) for each EntryPoint known to the AndroidEntryPointManager, if the EntryPoint should be included in the model. Then calls build(Atom, Collection) on these.

      Parameters:
      name - The name the generated method will be known as
      Throws:
      com.ibm.wala.util.CancelException
    • getName

      public com.ibm.wala.core.util.strings.Atom getName()
    • isStatic

      public boolean isStatic()
    • getReturnType

      public com.ibm.wala.types.TypeName getReturnType()
    • getDescriptor

      public com.ibm.wala.types.Descriptor getDescriptor() throws com.ibm.wala.util.CancelException
      Throws:
      com.ibm.wala.util.CancelException
    • build

      protected void build(com.ibm.wala.core.util.strings.Atom name, Collection<? extends AndroidEntryPoint> entrypoints) throws com.ibm.wala.util.CancelException
      Generate the SummarizedMethod for the model (in this.model).

      The actual generated model depends on the on the properties of this overloaded class. Most generated methods should reside in the AndroidModelClass and take AndroidComponents as well as some parameters (these marked REUSE) to the EntryPoints of the components.

      Use getMethod() to retrieve the method generated here or getMethodAs to get a version which is wrapped to another signature.

      Parameters:
      name - The name the generated method will be known as
      entrypoints - The functions to call additionally to boot-code and XXX
      Throws:
      com.ibm.wala.util.CancelException
    • getMethod

      public com.ibm.wala.ipa.summaries.SummarizedMethod getMethod() throws com.ibm.wala.util.CancelException
      Building the SummarizedMethod is delayed upon the first class to this method.
      Returns:
      the method for this model as generated by build()
      Throws:
      com.ibm.wala.util.CancelException
    • getDeclaringClass

      public com.ibm.wala.classLoader.IClass getDeclaringClass()
      The class the Method representing this Model resides in.

      Most likely the AndroidModelClass.

    • selectEntryPoint

      protected boolean selectEntryPoint(AndroidEntryPoint ep)
      Overridden by models to restraint Entrypoints.

      For each entrypoint this method is queried if it should be part of the model.

      Parameters:
      ep - The EntryPoint in question
      Returns:
      if the given EntryPoint shall be part of the model
    • getMethodAs

      public com.ibm.wala.ipa.summaries.SummarizedMethod getMethodAs(com.ibm.wala.types.MethodReference asMethod, com.ibm.wala.types.TypeReference caller, IntentStarters.StartInfo info, com.ibm.wala.ipa.callgraph.CGNode callerNd) throws com.ibm.wala.util.CancelException
      Get method of the Model in an other Signature.

      Generates a new Method that wraps the model so it can be called using the given Signature. Flags control the behavior of that wrapper.

      Arguments to the wrapping function are "connected through" to the model based on their type only, so if there are multiple Arguments of the same type this may yield to unexpected connections.

      This method is called by the IntentCoentextInterpreter.

      Parameters:
      asMethod - The signature to generate
      caller - The class of the caller; only needed depending on the flags
      info - The IntentSterter used
      callerNd - CGNoodle of the caller - may be null
      Returns:
      A wrapper that calls the model
      Throws:
      com.ibm.wala.util.CancelException
      See Also:
    • getMethodEncap

      public com.ibm.wala.classLoader.IMethod getMethodEncap() throws com.ibm.wala.util.CancelException
      Creates an "encapsulated" version of the model.

      The generated method will take no parameters. New instances for REUSE-Parameters will be created.

      This variant is useful for the start of an analysis.

      Throws:
      com.ibm.wala.util.CancelException
    • getClassHierarchy

      public com.ibm.wala.ipa.cha.IClassHierarchy getClassHierarchy()
      Specified by:
      getClassHierarchy in interface com.ibm.wala.ipa.cha.IClassHierarchyDweller
    • toString

      public String toString()
      Overrides:
      toString in class Object