SIM卡满处理流程分析

SIM卡满处理流程分析

//框架层分析
// SMSDispatcher.java
   /** SIM/RUIM storage is full */
static final protected int EVENT_ICC_FULL = 6;

  @Override
    public void handleMessage(Message msg) {

。。。。。。
case EVENT_ICC_FULL:  //SIM卡满处理分支
     handleIccFull();
     break;

}

 /**
 * Called when SIM_FULL message is received from the RIL.  Notifies intereste
* parties that SIM storage for SMS messages is full.
*/
private void handleIccFull(){  //SIM卡满消息最初是发自RIL层
// broadcast SIM_FULL intent
Intent intent = new Intent(Intents.SIM_FULL_ACTION);
 mWakeLock.acquire(WAKE_LOCK_TIMEOUT);
 mContext.sendBroadcast(intent, "android.permission.RECEIVE_SMS");
}

//应用层分析:
//AndroidManifest.xml
   <receiver android:name=".transaction.SimFullReceiver">
            <intent-filter>
                <action android:name="android.provider.Telephony.SIM_FULL" />
            </intent-filter>
        </receiver>

// SimFullReceiver.java
/**
 * Receive Intent.SIM_FULL_ACTION.  Handle notification that SIM is full.
 */
public class SimFullReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if (Settings.Secure.getInt(context.getContentResolver(),
            Settings.Secure.DEVICE_PROVISIONED, 0) == 1 &&
            Telephony.Sms.Intents.SIM_FULL_ACTION.equals(intent.getAction())) {

            NotificationManager nm = (NotificationManager)
                context.getSystemService(Context.NOTIFICATION_SERVICE);

            Intent viewSimIntent = new Intent(context, ManageSimMessages.class);
            viewSimIntent.setAction(Intent.ACTION_VIEW);
            viewSimIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            PendingIntent pendingIntent = PendingIntent.getActivity(
                    context, 0, viewSimIntent, 0);

            Notification notification = new Notification();
            notification.icon = R.drawable.stat_sys_no_sim;
            notification.tickerText = context.getString(R.string.sim_full_title);
            notification.defaults = Notification.DEFAULT_ALL;

            notification.setLatestEventInfo(
                    context, context.getString(R.string.sim_full_title),
                    context.getString(R.string.sim_full_body),
                    pendingIntent);
            nm.notify(ManageSimMessages.SIM_FULL_NOTIFICATION_ID, notification);
       }
}


//ManageSimMessages.java
//ManageSimMessages管理SIM卡上的短信息。

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值