版权声明:本文为博主原创文章,未经博主允许不得转载!
1.啥是xposed
额,这篇文章主要是讲解如何使用xposed的,并没有对xposed的二次开发或自己整个xposed这种大神级框架。
那么啥是xposed的呢?自己google一下。。。
2.玩转xposed
1.禁止三方应用发送短信、彩信等
先来个简单的例子,这也是我第一次用xposed时写出来的代码,基于项目是公司的,所以只留简单的框架代码。
//劫持应用发送短信 彩信 add by hxk
//短短信
Class<?> clsIccSmsInterfaceManager = null;
try {
clsIccSmsInterfaceManager = Class.forName("com.android.internal.telephony.IccSmsInterfaceManager");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
XposedHelpers.findAndHookMethod(clsIccSmsInterfaceManager, "sendTextInternal",
String.class,
String.class,
String.class,
String.class,
PendingIntent.class,
PendingIntent.class,
boolean.class,
new SendTextInternal());
//长短信
XposedHelpers.findAndHookMethod(clsIccSmsInterfaceManager, "sendMultipartText",
String.class,
String.class,
String.class,
List.class,
List.class,
List.class,
boolean.class,
new SendMultipartText());
XposedHelpers.findAndHookMethod(clsIccSmsInterfaceManager, "sendDataInternal",
String.class,
String.class,
String.class,
int.class,
byte[].class,
PendingIntent.class,
PendingIntent.class,
new SendDataInternal());
//彩信
Class<?> smsManager = null;
try {
smsManager = Class.forName("android.telephony.SmsManager");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
XposedHelpers.findAndHookMethod(smsManager, "sendMultimediaMessage",
Context.class,
Uri.class,
String.class,
Bundle.class,
PendingIntent.class,
new SendMultimediaMessage());
SendDataInternal
public class SendDataInternal extends XC_MethodHook {
public static String TAG = "pervent";
@Override
protected