android 发送短信的拦截问题探索

1.查看源码发现android发送短信方法在SmsManager类中

public void sendTextMessage(String destinationAddress, String scAddress,
String text, PendingIntent sentIntent, PendingIntent deliveryIntent)
{
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
}
}


通过aidl 去获取isms 服务类对外提供的接口,进步查看ServiceManager类的getService(“”)方法。

这个方法从启动缓存中获取已经启动的服务IBinder 

public static IBinder getService(String name)
{
try
{
IBinder service = sCache.get(name);
if (service != null)
{
return service;
} else
{
return getIServiceManager().getService(name);
}
} catch (RemoteException e)
{
Log.e(TAG, "error in getService", e);
}
return null;
}

如果没有获取到信息IBinder 会去IServiceManager获取,IServiceManager只是一个接口,ServiceManagerNative实现这个接口

private static IServiceManager getIServiceManager()
{
if (sServiceManager != null)
{
return sServiceManager;
}


// Find the service manager
sServiceManager = ServiceManagerNative.asInterface(BinderInternal
.getContextObject());

return sServiceManager;
}


ServiceManagerNative也只是一些实现方法,没有发现什么广播之类的代码!如果存在只有在信息服务类中


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值