Class AbstractComponentEntryPointCreator

All Implemented Interfaces:
IEntryPointCreator
Direct Known Subclasses:
ActivityEntryPointCreator, BroadcastReceiverEntryPointCreator, ContentProviderEntryPointCreator, FragmentEntryPointCreator, ServiceConnectionEntryPointCreator, ServiceEntryPointCreator

public abstract class AbstractComponentEntryPointCreator extends AbstractAndroidEntryPointCreator
Class for generating a dummy main method that represents the lifecycle of a single component
Author:
Steven Arzt
  • Field Details

    • component

      protected final soot.SootClass component
    • applicationClass

      protected final soot.SootClass applicationClass
    • callbacks

      protected Set<soot.SootMethod> callbacks
    • thisLocal

      protected soot.Local thisLocal
    • intentLocal

      protected soot.Local intentLocal
    • intentField

      protected soot.SootField intentField
  • Constructor Details

    • AbstractComponentEntryPointCreator

      public AbstractComponentEntryPointCreator(soot.SootClass component, soot.SootClass applicationClass, IManifestHandler manifest)
  • Method Details

    • setCallbacks

      public void setCallbacks(Set<soot.SootMethod> callbacks)
    • createAdditionalFields

      protected void createAdditionalFields()
      Overrides:
      createAdditionalFields in class BaseEntryPointCreator
    • createEmptyMainMethod

      protected void createEmptyMainMethod()
      Overrides:
      createEmptyMainMethod in class BaseEntryPointCreator
    • getDefaultMainMethodParams

      protected final List<soot.Type> getDefaultMainMethodParams()
      Gets the default parameter types that every component main method shall have
      Returns:
      The default parameter types that all component main methods have in common
    • getAdditionalMainMethodParams

      protected List<soot.Type> getAdditionalMainMethodParams()
      Derived classes can overwrite this method to add further parameters to the dummy main method
      Returns:
      A list with the parameter types to be added to the component's dummy main method, or null, if no additional parameters shall be added
    • getRequiredClasses

      public Collection<String> getRequiredClasses()
    • createDummyMainInternal

      protected soot.SootMethod createDummyMainInternal()
      Specified by:
      createDummyMainInternal in class BaseEntryPointCreator
    • instrumentDummyMainMethod

      protected void instrumentDummyMainMethod()
      Transfer Intent for such components that take an Intent as a parameter and do not leverage getIntent() method for retrieving the received Intent. Code adapted from FlowDroid v2.0.
    • assignIntent

      public void assignIntent(soot.SootClass hostComponent, soot.SootMethod method, int indexOfArgs)
      Method used in instrumentDummyMainMethod() to transfer Intent Code adapted from FlowDroid v2.0.
    • generateComponentLifecycle

      protected abstract void generateComponentLifecycle()
      Generates the component-specific portion of the lifecycle
    • getAdditionalMethods

      public Collection<soot.SootMethod> getAdditionalMethods()
    • getAdditionalFields

      public Collection<soot.SootField> getAdditionalFields()
    • addCallbackMethods

      protected boolean addCallbackMethods()
      Generates invocation statements for all callback methods which need to be invoked during the given class' run cycle.
      Returns:
      True if a matching callback has been found, otherwise false.
    • addCallbackMethods

      protected boolean addCallbackMethods(Set<soot.SootClass> referenceClasses, String callbackSignature)
      Generates invocation statements for all callback methods which need to be invoked during the given class' run cycle.
      Parameters:
      referenceClasses - The classes for which no new instances shall be created, but rather existing ones shall be used.
      callbackSignature - An empty string if calls to all callback methods for the given class shall be generated, otherwise the subsignature of the only callback method to generate.
      Returns:
      True if a matching callback has been found, otherwise false.
    • reset

      protected void reset()
      Overrides:
      reset in class BaseEntryPointCreator
    • getComponentInfo

      public ComponentEntryPointInfo getComponentInfo()
      Gets the data object that describes the generated entry point
      Returns:
      The data object that describes the generated entry point
    • createGetIntentMethod

      protected void createGetIntentMethod()
      Creates an implementation of getIntent() that returns the intent from our ICC model