android4.0.4源码修改监控短信发送信息


这里以发短信为例,打开/frameworks/base/telephony/java/android/telephony/SmsManager.java,修改源码:

1、增加:import android.util.Log;

2、函数sendTextMessage入口处增加打印log信息的代码:

    public void sendTextMessage(
            String destinationAddress, String scAddress, String text,
            PendingIntent sentIntent, PendingIntent deliveryIntent) {
	Log.v("[apkscan]","[SmsManager::sendTextMessage]destinationAddress: "+destinationAddress+" scAddress: "+scAddress+" text: "+text);
        if (TextUtils.isEmpty(destinationAddress)) {
            throw new IllegalArgumentException("Invalid destinationAddress");
        }

        if (TextUtils.isEmpty(text)) {
            throw new IllegalArgumentException("Invalid message body");
        }

        try {
            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
            if (iccISms != null) {
                iccISms.sendText(destinationAddress, scAddress, text, sentIntent, deliveryIntent);
            }
        } catch (RemoteException ex) {
            // ignore it
        }
    }
如图:

android4.0.4源码修改监控短信发送信息_第1张图片


3、编译,这个时候不需要全部编译的,只需要make systemimage来编译即可,大约十几分钟后复制出
/out/target/product/generic/system.img,替换掉android-sdk\system-images\android-15\armeabi-v7a目录下的system.img

4、运行模拟器,开启logcat捕获log信息,随便发送一个短信,截获到log:




你可能感兴趣的:(android4.0.4源码修改监控短信发送信息)