public final class AndroidEntryPointManager
extends java.lang.Object
implements java.io.Serializable
See the single settings for further description.
| Modifier and Type | Field and Description |
|---|---|
static java.util.Map<Intent,Intent> |
DEFAULT_INTENT_OVERRIDES |
static java.util.List<AndroidEntryPoint> |
ENTRIES |
static AndroidEntryPointManager |
MANAGER |
java.util.Map<Intent,Intent> |
overrideIntents
Overrides Intents.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCallSeen(com.ibm.wala.classLoader.CallSiteReference from,
Intent intent)
DO NOT CALL! - This is for IntentContextSelector.
|
boolean |
doFlatComponents()
Controlls the initialization of Components.
|
static boolean |
EPContainAny(AndroidComponent compo)
Determines if any EntryPoint extends the specified component.
|
boolean |
existsIntentFor(com.ibm.wala.types.TypeName clazz)
Searches Intent specifications for the occurrence of clazz.
|
static java.util.Set<com.ibm.wala.types.TypeReference> |
getComponents() |
boolean |
getDoBootSequence()
Whether to generate a global android environment.
|
IInstantiationBehavior |
getInstantiationBehavior(com.ibm.wala.ipa.cha.IClassHierarchy cha)
Controls the instantiation of variables in the model.
|
Intent |
getIntent(Intent intent)
Get Intent with applied overrides.
|
java.lang.Class<? extends AbstractAndroidModel> |
getModelBehavior()
The behavior set using setModelBehavior(Class).
|
java.lang.String |
getPackage()
Return the package of the analyzed app.
|
com.ibm.wala.util.MonitorUtil.IProgressMonitor |
getProgressMonitor()
Can be used to indicate the progress or to cancel operations.
|
java.util.Map<com.ibm.wala.classLoader.CallSiteReference,Intent> |
getSeen()
Return all Sites, that start Components based on Intents.
|
java.lang.String |
guessPackage()
Get the package of the analyzed app.
|
boolean |
isAllowIntentRerouting()
Controll modification of an Intents target after construction.
|
AbstractAndroidModel |
makeModelBehavior(com.ibm.wala.ipa.summaries.VolatileMethodSummary body,
com.ibm.wala.util.ssa.TypeSafeInstructionFactory insts,
com.ibm.wala.util.ssa.SSAValueManager paramManager,
java.lang.Iterable<? extends com.ibm.wala.ipa.callgraph.Entrypoint> entryPoints)
What special handling to insert into the model.
|
void |
registerIntent(Intent intent)
Set more information to an Intent.
|
void |
registerIntentForce(Intent intent)
Set intent possibly overwriting more specific information.
|
static void |
reset() |
boolean |
setAllowIntentRerouting(boolean allow)
Controll modification of an Intents target after construction.
|
boolean |
setDoBootSequence(boolean doBootSequence)
Whether to generate a global android environment.
|
boolean |
setDoFlatComponents(boolean flatComponents)
Controlls the initialization of Components.
|
IInstantiationBehavior |
setInstantiationBehavior(IInstantiationBehavior instantiation)
Controls the instantiation of variables in the model.
|
void |
setModelBehavior(java.lang.Class<? extends AbstractAndroidModel> abstractAndroidModel)
Set the class instantiated by makeModelBehavior.
|
void |
setOverride(Intent from,
Intent to)
Override target of an Intent (or add an alias).
|
void |
setOverrideForce(Intent from,
Intent to)
Just throw in the override.
|
void |
setOverrides(java.util.Map<Intent,Intent> overrides)
Set multiple overrides at the same time.
|
void |
setPackage(java.lang.String pack)
Set the package of the analyzed application.
|
com.ibm.wala.util.MonitorUtil.IProgressMonitor |
setProgressMonitor(com.ibm.wala.util.MonitorUtil.IProgressMonitor monitor)
Set the monitor returned by
getProgressMonitor(). |
public static AndroidEntryPointManager MANAGER
public static java.util.List<AndroidEntryPoint> ENTRIES
public final java.util.Map<Intent,Intent> overrideIntents
Intent,
IntentContextInterpreterpublic static boolean EPContainAny(AndroidComponent compo)
public static void reset()
public static java.util.Set<com.ibm.wala.types.TypeReference> getComponents()
public boolean doFlatComponents()
public boolean setDoFlatComponents(boolean flatComponents)
If flatComponents is active an Instance of each Component of the application is generated in the AndroidModelClass. Whenever the model requires a new instance of a component this "globalone" is used.
This resembles the seldomly used Flat-Setting of the start of components in Android. Activating this generates a more conservative model.
The default is to deactivate this behavior.
public IInstantiationBehavior getInstantiationBehavior(com.ibm.wala.ipa.cha.IClassHierarchy cha)
cha - Optional parameter given to the IInstantiationBehaviorpublic IInstantiationBehavior setInstantiationBehavior(IInstantiationBehavior instantiation)
Controlls on which occasions a new instance to a given type shall be generated and when to reuse an existing instance.
This also changes the parameters to the later model.
The default is DefaultInstantiationBehavior.
See setDoFlatComponents(boolean) for more instantiation settings that affect
components
for more
informationpublic com.ibm.wala.util.MonitorUtil.IProgressMonitor getProgressMonitor()
public com.ibm.wala.util.MonitorUtil.IProgressMonitor setProgressMonitor(com.ibm.wala.util.MonitorUtil.IProgressMonitor monitor)
getProgressMonitor().public boolean getDoBootSequence()
See the setDoBootSequence(boolean) documentation.
public boolean setDoBootSequence(boolean doBootSequence)
Inserts some code ath the start of the model to attach some Android-context. This is mainly interesting for inter-application communication.
It's possible to analyze android-applications without creating these structures and save some memory. In this case some calls to the OS (like getting the Activity-manager or so) will not be able to be resolved.
It is to be noted that the generated information is far from beeing complete.
The default is to insert the code.
public AbstractAndroidModel makeModelBehavior(com.ibm.wala.ipa.summaries.VolatileMethodSummary body, com.ibm.wala.util.ssa.TypeSafeInstructionFactory insts, com.ibm.wala.util.ssa.SSAValueManager paramManager, java.lang.Iterable<? extends com.ibm.wala.ipa.callgraph.Entrypoint> entryPoints)
At given points in the model (called labels) special code is inserted into it (like loops). This setting controls what code is inserted there.
java.lang.IllegalStateException - if initialization failsAbstractAndroidModel,
SequentialAndroidModel,
LoopAndroidModelpublic java.lang.Class<? extends AbstractAndroidModel> getModelBehavior()
Use makeModelBehavior(com.ibm.wala.ipa.summaries.VolatileMethodSummary, com.ibm.wala.util.ssa.TypeSafeInstructionFactory, com.ibm.wala.util.ssa.SSAValueManager, java.lang.Iterable<? extends com.ibm.wala.ipa.callgraph.Entrypoint>) to retrieve an instance of this class.
If no class was set it returns null, makeModelBehavior will generate a LoopAndroidModel by default.
public void setModelBehavior(java.lang.Class<? extends AbstractAndroidModel> abstractAndroidModel)
java.lang.IllegalArgumentException - if the abstractAndroidModel is nullpublic void setPackage(java.lang.String pack)
Setting the package of the application is completely optional. However if you do it it helps determining whether an Intent has an internal target.
If a AndroidManifest.xml is read this getts set automaticly.
pack - The package of the analyzed applicationjava.lang.IllegalArgumentException - if the package has already been set and the value of the
packages differ. Or if the given package is null.public java.lang.String getPackage()
This only returns a value other than null if the package has explicitly been set using setPackage (which is for example called when reading in the Manifest).
If you didn't read the manifest you can still try and retrieve the package name using guessPackage().
See: setPackage(String)
guessPackage()public java.lang.String guessPackage()
If the package has been set using setPackage() return this value. Else try and determine the package based on the first entrypoint.
getPackage()public void registerIntent(Intent intent)
You can call this method multiple times on the same Intent as long as you don't lower the associated information. So if you only want to change a specific value of it it is more safe to retrieve the Intent first and union it yourself before registering it.
intent - An Intent with more or the same information as known to the system before.java.lang.IllegalArgumentException - if you lower the information on an already registered Intent
or the information is incompatible.registerIntentForce(com.ibm.wala.dalvik.ipa.callgraph.propagation.cfa.Intent)public void registerIntentForce(Intent intent)
If you are sure that you want to override an existing registered Intent with information that is possibly incompatible with the information originally set.
public void setOverride(Intent from, Intent to)
Use this for example to add an internal target to an implicit Intent, add an alias to an Intent, resolve a System-name to an internal Intent, do weird stuff...
None of the Intents have to be registered before. However if the source is registered you may not lower information on it.
Currently only one target to an Intent is supported! If you want to emulate multiple Targets you may have to add a synthetic class and register it as an Intent. If the target is not set to Internal multiple targets may implicitly emulated. See the Documentation for these targets for detail.
If you only intend to make an Intent known see registerIntent(Intent).
from - the Intent to overrideto - the new Intent to resolve once 'from' is seenjava.lang.IllegalArgumentException - if you override an Intent with itselfsetOverrideForce(com.ibm.wala.dalvik.ipa.callgraph.propagation.cfa.Intent, com.ibm.wala.dalvik.ipa.callgraph.propagation.cfa.Intent)public void setOverrides(java.util.Map<Intent,Intent> overrides)
public Intent getIntent(Intent intent)
If there are no overrides or the Intent is not registered return it as is.
See setOverride(Intent, Intent). See registerIntent(Intent).
intent - The intent to resolveTODO: TODO: Malicious Intent-Table could cause endless loops
public boolean existsIntentFor(com.ibm.wala.types.TypeName clazz)
public void addCallSeen(com.ibm.wala.classLoader.CallSiteReference from,
Intent intent)
Add information that an Intent was called to the later summary. This is for information-purpose only and does not change any behavior.
Intents are added as seen - without any resolved overrides.
public java.util.Map<com.ibm.wala.classLoader.CallSiteReference,Intent> getSeen()
public boolean setAllowIntentRerouting(boolean allow)
After an Intent has been constructed its target may be changed using functions like setAction or setComponent. This setting controlls the behavior of the model on occurrence of such a function:
If set to false the Intent will be marked as unresolvable.
If set to true the first occurrence of such a function changes the target of the Intent unless:
* The Intent was explicit and the new action is not: The call gets ignored * The Intent was explicit and the new target is explicit: It becomes unresolvable * It's the second occurrence of such a function: It becomes unresolvable * It was resolvable: It becomes unresolvable
The default is to activate this behavior.
allow - Allow rerouting as describedpublic boolean isAllowIntentRerouting()