一 插入字段
给某个SootClass插入字段,关键API为new SootField(String,Type,int);
//向sootclass添加静态Intent intent_for_ipc字段
SootField intent_for_ipc = new SootField("intent_for_ipc", intentSootClass.getType(),Modifier.STATIC);
sootclass.addField(intent_for_ipc);
注意:一般是在wjtp下给某个SootClass插入字段
二 构造方法
1. 构造没有参数的方法
SootMethod sm = new SootMethod("getIntent", Arrays.asList(new Type[]{}), RefType.v("java.lang.String"), Modifier.PUBLIC);
2. 构造对象为参数的方法
SootClass intentSootClass = Scene.v().getSootClass("android.content.Intent");
SootMethod sm = new SootMethod("getIntent", Arrays.asList(new Type[]{}), intentSootClass.getType(),Modifier.PUBLIC);