从Android 4.4 kk版本之后,有将整个CB的处理都是放在mms 这个进程中的。
而小区广播是需要sim卡正常初始化后才能开启小区广播,而sim卡在搜网过程时,表示当前sim卡还没有初始化成功,这时是没有办法去开启小区广播的。
又由于小区广播跑在mms这个进程中,所以mms 进程就会发生运行异常,并报了“信息”停止
请在CellBroadcastCheckBox.java中做如下修改:
将如下方法:
private void setCBState(final boolean state) {
MmsLog.d(LOG_TAG, "setCBState start");
if (mListener != null) {
mListener.onStarted(CellBroadcastCheckBox.this, false);
}
new Thread(new Runnable() {
public void run() {
MmsLog.d(LOG_TAG, "activateCellBroadcastSms start");
boolean isSetSuccess = EncapsulatedSmsManager.activateCellBroadcastSms(state, mSlotId);
MmsLog.d(LOG_TAG, "activateCellBroadcastSms end isSetSuccess = " + isSetSuccess);
if (!isSetSuccess) {
handleSetStateResponse();
} else {
RecoverChannelSettings setting =
new RecoverChannelSettings(mSlotId, getContext().getContentResolver());
setting.updateChannelStatus();
if (mListener != null) {
mListener.onFinished(CellBroadcastCheckBox.this, false);
}
}
MmsLog.d(LOG_TAG, "setCBState end");
}
}).start();
}
修改为:
private void setCBState(final boolean state) {
MmsLog.d(LOG_TAG, "setCBState start");
if (mListener != null) {
mListener.onStarted(CellBroadcastCheckBox.this, false);
}
MmsLog.d(LOG_TAG, "activateCellBroadcastSms start");
boolean isSetSuccess = EncapsulatedSmsManager.activateCellBroadcastSms(state, mSlotId);
MmsLog.d(LOG_TAG, "activateCellBroadcastSms end isSetSuccess = " + isSetSuccess);
if (!isSetSuccess) {
handleSetStateResponse();
} else {
new Thread(new Runnable() {
public void run() {
RecoverChannelSettings setting =
new RecoverChannelSettings(mSlotId, getContext().getContentResolver());
setting.updateChannelStatus();
if (mListener != null) {
mListener.onFinished(CellBroadcastCheckBox.this, false);
}
MmsLog.d(LOG_TAG, "setCBState end");
}
}).start();
}
}