android CellbroadCast涉及的文件有哪些
UI相关文件:CBMessage.java
CBMessageItem.java
CBMessageListActivity.java
CBMessageListAdapter.java
CBMessageListItem.java
收发相关文件:
CBMessageReceiver.java
CBMessageReceiverService.java
CBMessagingNotification.java
GsmSMSDispatcher.java
Pdu解析:
GsmSmsCbMessage.java
开启宏MTK_CMAS_SUPPORT,会增加CMASReceiver.apk 即App 列表一个喇叭图标:Emergency alerts/紧急警报
ifeq ($(strip $(MTK_CMAS_SUPPORT)), yes)
PRODUCT_PACKAGES += CMASReceiver
/vendor/mediatek/proprietary/packages/apps/CMASReceiver/CellBroadcastConfigService.java
protected void onHandleIntent(Intent intent) 通过setCellBroadcastSmsConfig()下发CSCB命令开启CMAS信道
126 SmsManager manager = SmsManager.getDefault();
127 if (enableAlerts) {
128 SmsBroadcastConfigInfo[] infos = new SmsBroadcastConfigInfo[10];
129 infos[0] = new SmsBroadcastConfigInfo(
130 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL,
131 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL, -1, -1, true); // (4370,4370,-1,-1,true)
132 infos[1] = new SmsBroadcastConfigInfo(
133 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL_LANGUAGE,
134 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL_LANGUAGE, -1, -1, true); // (4383,4383,-1,-1,true)
…………// 省略其他信道的添加
ifeq ($(strip $(MTK_CMAS_SUPPORT)), yes)
PRODUCT_PACKAGES += CMASReceiver
/vendor/mediatek/proprietary/packages/apps/CMASReceiver/CellBroadcastConfigService.java
protected void onHandleIntent(Intent intent) 通过setCellBroadcastSmsConfig()下发CSCB命令开启CMAS信道
126 SmsManager manager = SmsManager.getDefault();
127 if (enableAlerts) {
128 SmsBroadcastConfigInfo[] infos = new SmsBroadcastConfigInfo[10];
129 infos[0] = new SmsBroadcastConfigInfo(
130 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL,
131 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL, -1, -1, true); // (4370,4370,-1,-1,true)
132 infos[1] = new SmsBroadcastConfigInfo(
133 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL_LANGUAGE,
134 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL_LANGUAGE, -1, -1, true); // (4383,4383,-1,-1,true)
…………// 省略其他信道的添加
174 isSetSuccess = manager.setCellBroadcastSmsConfig(infos, infos);
小区广播需求梳理:
区域公共 == > SW_GLOBAL_COMMON_039
收到小区广播消息时,不显示附件红色框中的信息
备注:
1)该信息提示不是运营商下发,会造成恐慌。
2)所有有小区广播功能的区域版本,如欧洲俄罗斯中亚版本,中东非洲版本,南太东南亚版本和拉美版本,此条需求必须满足。
/vendor/mediatek/proprietary/packages/apps/CMASReceiver/src/com/mediatek/cellbroadcastreceiver/CellBroadcastResources.java
52 if (cbm.isCmasMessage()) {
53 // CMAS category, response type, severity, urgency, certainty
54 appendCmasAlertDetails(context, buf, cbm.getCmasWarningInfo());
55 }
severity, urgency, certainty信息由方法appendCmasAlertDetails()方法弹出,
贵司若需要客制化不弹这三类信息,将此处注释即可。
52 if (cbm.isCmasMessage()) {
53 // CMAS category, response type, severity, urgency, certainty
54 appendCmasAlertDetails(context, buf, cbm.getCmasWarningInfo());
55 }
severity, urgency, certainty信息由方法appendCmasAlertDetails()方法弹出,
贵司若需要客制化不弹这三类信息,将此处注释即可。
http://192.168.32.203/gitweb/?p=huaqin/MT6753_L1_65C_BD2_HW.git;a=commit;h=eb46fd08e25369d2ef98a175d33fcaefe00b0f76
中东非洲 ==>
显示语言列表,输入法语言列表,时区列表去掉“以色列”字样。
显示语言列表,输入法语言列表不准出现希伯来语。
备注:不关注在阿语界面下在天气时钟中搜索出英语的“以色列”字样的问题
东南亚南太 ==> SW_GLOBAL_SPC_SEA_039
1.需要在所有制式下(2G,3G,4G)打开小区广播
2.如下需求做成大随卡 (仅首次开机需要实现随卡需求,后续再换卡,保持和首次开机一样的实现):
仅当插入台湾(466)的卡有如下要求,插入其他国家卡时小区广播所有通道默认关闭,振动、铃音默认即可。
台湾小区广播功能只针对4G网络测试,2G/3G不关注,因此下面需求对支持4G的手机适用。
台湾(466)小区广播需求:
5.14 公眾告警廣播簡訊功能(Public Warning System,PWS):
5.14.1 本項測試適用手持式行動臺設備。
5.14.2 小区广播预置的具体通道,通道是否默认打开,用户是否可以编辑等具体信息参考附件。
5.14.2.1 a.911通道名为“市民緊急訊息”;
b.919通道名为"Civil Emergency";
c.4370通道名为“總統級訊息”;
d.4383通道名为"Presidential";
e.4379通道名为“孩童綁架緊急訊息”;
f.4392通道名为"Child Abduction Emergency";
g.4380通道名为“RMT每月測試用訊息”;
h.4393通道名为"Required Monthly Test";
以上通道名不需要随系统语言变化,其他通道名默认。
<!-- cellbroadcast channel -->
<string-array name="pref_cellbroadcast_channel" translatable="false">
<item>市民緊急訊息</item><!-- 911 -->
<item>Civil Emergency</item><!-- 919 -->
<item>總統級訊息</item><!-- 4370 -->
<item>Presidential</item><!-- 4383 -->
<item>孩童綁架緊急訊息</item><!-- 4379 -->
<item>Child Abduction Emergency</item><!-- 4392 -->
<item>RMT每月測試用訊息</item><!-- 4380 -->
<item>Required Monthly Test</item><!-- 4393 -->
</string-array>
5.14.2.2 小区广播的振动,铃音提示follow手机系统设置,例:手机在静音模式时,收到小区广播消息,也不会有铃音,振动提示。
5.14.3 設備應具有特殊告警聲響信號,並符合下列規定:
5.14.3.1 告警聲響信號型式為2段聲響,並間隔0.5秒。每段聲響為2秒聲響後有2次1秒
聲響,每次聲響間隔0.5秒。
5.14.3.2 告警聲響信號須符合下列第5.14.3.2.1節或第5.14.3.2.2節之規定:
5.14.3.2.1 設備具有混音能力,必須同時以基頻853Hz和960Hz混音產生聲響傳送。
5.14.3.2.2 設備只有單音能力,必須以960Hz單音產生聲響傳送。
5.14.3.3 告警聲響信號僅限使用於公眾告警廣播簡訊功能。
5.14.4 設備應具有特殊告警振動信號,並符合下列規定:
5.14.4.1 告警振動信號型式為2段振動,並間隔0.5秒。每段振動為2秒振動後有2次1秒
振動,每次振動間隔0.5秒。
5.14.4.2 告警振動信號僅限使用於公眾告警廣播簡訊功能。
5.14.4.3 告警聲響信號與告警振動信號間得不同步。
5.14.5 公眾告警廣播簡訊之接收處理必須優先於設備其他功能。
拉美渠道 ==> SW_GLOBAL_LATINAMERICAN_035
按照附件随卡匹配小区广播,巴西和智利的小区广播差异不大。
智利
"For Chile (MCC: 730) : Open by default 919 and 4370, the other channels are not required
1)Open the two channels 919 and 4370, and the user can not delete or close these two channels;
2)When we receive cell broadcast messages,display a pop-up box, In Spanish the title should be: ""Alerta de Emergencia"", other languages do not concer.Unless the user manually closes, otherwise the message box should always be placed in the foreground.
3)Default message reminder should have ring and vibration.Sound and vibration intensity level default setting is maximum.
4)Use sound file ""CBS sound.mp3""as message ringtone.Ring and vibrate Ring size, vibration intensity required to set to maximum level the mobile phone can support.Unless the user does any phone operation,the alert should not stop.
Example:
1.After receiving cell broadcast, the user makes a call, the cell broadcast event will be ended, ring tones and vibration will be ended.
2.When user receives a call the cell broadcast event should not be interrupted. The incoming call ringtone should automatically mute.
3.When users plays music or answers the phone, the occurrence of cell broadcast event should automatically mute music or call, the phone starts playing the ring tones and cell broadcast vibration.
* About ring tones and vibration frequency requirements, please view the attachment Chile SPECIFICATIONS OF SOUND AND VIBRATION.docx.
4)Each cell broadcast messages to support maximum 90 characters;
Reference questionnaire: DTS2014070201043"
1)Open the two channels 919 and 4370, and the user can not delete or close these two channels;
2)When we receive cell broadcast messages,display a pop-up box, In Spanish the title should be: ""Alerta de Emergencia"", other languages do not concer.Unless the user manually closes, otherwise the message box should always be placed in the foreground.
3)Default message reminder should have ring and vibration.Sound and vibration intensity level default setting is maximum.
4)Use sound file ""CBS sound.mp3""as message ringtone.Ring and vibrate Ring size, vibration intensity required to set to maximum level the mobile phone can support.Unless the user does any phone operation,the alert should not stop.
Example:
1.After receiving cell broadcast, the user makes a call, the cell broadcast event will be ended, ring tones and vibration will be ended.
2.When user receives a call the cell broadcast event should not be interrupted. The incoming call ringtone should automatically mute.
3.When users plays music or answers the phone, the occurrence of cell broadcast event should automatically mute music or call, the phone starts playing the ring tones and cell broadcast vibration.
* About ring tones and vibration frequency requirements, please view the attachment Chile SPECIFICATIONS OF SOUND AND VIBRATION.docx.
4)Each cell broadcast messages to support maximum 90 characters;
Reference questionnaire: DTS2014070201043"
1、默认激活919和4370信道,并且用户不能删除或者关闭这两个信道;
2、当有新消息到来时,弹框显示,并且要求提示框标题字符串在所有系统语言下都为“Alerta de Emergencia”;除非用户手动关闭,否则消息框应始终被置于前台。
3、使用附件中提供的音乐文件作为消息铃音;响铃的同时必须震动;铃音大小、震动强度需设为手机能支持的最大级别;铃音和震动需设为最高优先级的事件,除非是用户对手机进行任意操作,否则不会被中断;
例如,收到小区广播后,用户去拨打电话,证明小区广播事件已结束,铃音和震动终止;
收到小区广播响铃震动时有来电,来电铃声应自动静音,小区广播事件不应被打断;
用户播放音乐或者接听电话时,发生小区广播事件,音乐或通话应自动静音,手机开始播放小区广播的铃音并且震动。
*关于铃音和震动频率的要求,请查看附件DOC文档。
4、要求至少能够接收90个字节的小区广播消息。
2、当有新消息到来时,弹框显示,并且要求提示框标题字符串在所有系统语言下都为“Alerta de Emergencia”;除非用户手动关闭,否则消息框应始终被置于前台。
3、使用附件中提供的音乐文件作为消息铃音;响铃的同时必须震动;铃音大小、震动强度需设为手机能支持的最大级别;铃音和震动需设为最高优先级的事件,除非是用户对手机进行任意操作,否则不会被中断;
例如,收到小区广播后,用户去拨打电话,证明小区广播事件已结束,铃音和震动终止;
收到小区广播响铃震动时有来电,来电铃声应自动静音,小区广播事件不应被打断;
用户播放音乐或者接听电话时,发生小区广播事件,音乐或通话应自动静音,手机开始播放小区广播的铃音并且震动。
*关于铃音和震动频率的要求,请查看附件DOC文档。
4、要求至少能够接收90个字节的小区广播消息。
具体修改包含:
1.在西语下:收到广播显示为: it shows a pop-up when receive a CBS messgae, with the title: “Alerta de Emergencia”;
2.收到小区广播,小区广播响铃震动,并且始终置于所有应用之上,除非用户点击 ok键,小区广播才会消失。并且当黑屏时来广播时,点亮屏幕,响铃震动,但是如果此时用户将屏幕按黑,则响铃会继续,但是震动会停止,此暂不修改。
3.当收到小区广播,响铃当来电话时,小区广播弹框始终置于电话界面之上,需要先将小区广播弹框 ok掉,才能接听来电。
4.当来电话有电话铃音时,用户未接通电话,此时来小区广播,则小区广播响铃震动会混合电话铃音一起响。
5.当接听电话或者打电话时,在电话未挂断前,来小区广播仅有震动,当电话挂断后,伴随小区广播响铃响起。如果用户通过接近光感应(即:当用户接听电话,来广播,然后从耳朵拿下手机,屏幕自动点亮,然后如果不管小区广播弹框,再次放到耳机上,则小区广播震动消失,当电话挂断后,伴随小区广播响铃响起)
其中 4.的概率毕竟很小,虽然用户体验差,但是由于对音量控制是在驱动层控制的,而驱动层修改音量控制只能针对某种数据流修改,如果修改驱动层,则会影响所有使用和小区广播同样的数据流的音量。因此,考虑到概率小的情况,并且小区广播在智利的特殊性,先修改如此。
1.在西语下:收到广播显示为: it shows a pop-up when receive a CBS messgae, with the title: “Alerta de Emergencia”;
2.收到小区广播,小区广播响铃震动,并且始终置于所有应用之上,除非用户点击 ok键,小区广播才会消失。并且当黑屏时来广播时,点亮屏幕,响铃震动,但是如果此时用户将屏幕按黑,则响铃会继续,但是震动会停止,此暂不修改。
3.当收到小区广播,响铃当来电话时,小区广播弹框始终置于电话界面之上,需要先将小区广播弹框 ok掉,才能接听来电。
4.当来电话有电话铃音时,用户未接通电话,此时来小区广播,则小区广播响铃震动会混合电话铃音一起响。
5.当接听电话或者打电话时,在电话未挂断前,来小区广播仅有震动,当电话挂断后,伴随小区广播响铃响起。如果用户通过接近光感应(即:当用户接听电话,来广播,然后从耳朵拿下手机,屏幕自动点亮,然后如果不管小区广播弹框,再次放到耳机上,则小区广播震动消失,当电话挂断后,伴随小区广播响铃响起)
其中 4.的概率毕竟很小,虽然用户体验差,但是由于对音量控制是在驱动层控制的,而驱动层修改音量控制只能针对某种数据流修改,如果修改驱动层,则会影响所有使用和小区广播同样的数据流的音量。因此,考虑到概率小的情况,并且小区广播在智利的特殊性,先修改如此。
俄罗斯中亚 ==> SW_GLOBAL_EUROPE_087
1、小区广播打开,信道为 从4370 到 4379,4383 到 4399,919,921, 920, 922,
备注:小区广播语言按《华为Android终端语言清单发文》要求支持。
这个是最新的支持语言发文:
2、荷兰的小区广播的功能要求,此需求要求随卡匹配,荷兰sim卡(mcc204):
(1)打开CMAS 4371信道,并且命名为 NL-Alert.
(2)关闭CBS 919信道
特殊需求:
收到小区广播后振动铃声
cb用的是平台的notification.使用该notification是会受静音影响的.不建议贵司修改.如要修改,在来cb的时候,就不能使用notification进行播放铃声了.
至于如何让铃声不受静音影响.贵司可以尝试以下方法:
静音模式下,会将受静音影响的铃声类型的音量设为0,如果希望某种铃声不受静音模式的影响,可以先做如下修改:
1,AudioService.java:中 mRingerModeAffectedStreams保存着静音模式时会影响的streamType,因此如果希望某种类型的声音在静音模式下也能够有声音,就应该将其从mRingerModeAffectedStreams移出:
1)如,希望通知铃STREAM_NOTIFCATION声在静音下不受影响,添加如下一句:
private void readPersistedSettings() {
.....
mRingerModeAffectedStreams &= ~(1 << AudioSystem.STREAM_SYSTEM_ENFORCED);/*Add this line*/
Settings.System.putIntForUser(cr,
Settings.System.MODE_RINGER_STREAMS_AFFECTED,
mRingerModeAffectedStreams,
UserHandle.USER_CURRENT
2) private class SettingsObserver extends ContentObserver {
....
public void onChange(boolean selfChange) {
....
ringerModeAffectedStreams&= ~(1 << AudioSystem.STREAM_SYSTEM_ENFORCED);/*Add this line*/
if (ringerModeAffectedStreams != mRingerModeAffectedStreams) {
/*
* Ensure all stream types that should be affected by ringer mode
* are in the proper state.
*/
mRingerModeAffectedStreams = ringerModeAffectedStreams;
setRingerModeInt(getRingerMode(), false);
}
2,对应的播放铃声时就是用上面从mRingerModeAffectedStreams移出不受静音影响的类型,如上面将AudioSystem.STREAM_SYSTEM_ENFORCED从mRingerModeAffectedStreams移出不受静音影响,则Application中使用ringtone播放时设置的streamtype为STREAM_SYSTEM_ENFORCED。
3,贵司可以在CBMessagingNotification.updateNotification的适当位置添加播放铃声的code.比如:
AudioProfileManager mProfileManager = (AudioProfileManager) context.getSystemService(Context.AUDIOPROFILE_SERVICE);
String mActiveProfileKey = mProfileManager.getActiveProfileKey();
if(mActiveProfileKey!=null){
Log.d("mtk_debug", " MessagingNotification.updateNotification 1241 mActiveProfileKey="+mActiveProfileKey); // modify by mtk_debug 2013-12-18;
if(mActiveProfileKey.equals("mtk_audioprofile_silent")){
Log.d("mtk_debug", " MessagingNotification.updateNotification 1243 "); // modify by mtk_debug 2013-12-18;
// Ringtone r=RingtoneManager.getRingtone(context, Uri.parse(NotificationPreferenceActivity.NOTIFICATION_RINGTONE),7);
//
Ringtone r = new Ringtone(context, true);
r.setStreamType(AudioSystem.STREAM_SYSTEM_ENFORCED);
Log.d("mtk_debug", " MessagingNotification.updateNotification 1253 ringtoneStr="+ringtoneStr); // modify by mtk_debug 2013-12-18;
r.setUri(Uri.parse(ringtoneStr));
r.play();
Log.d("mtk_debug", " MessagingNotification.updateNotification 1246 "); // modify by mtk_debug 2013-12-18;
}
至于如何让铃声不受静音影响.贵司可以尝试以下方法:
静音模式下,会将受静音影响的铃声类型的音量设为0,如果希望某种铃声不受静音模式的影响,可以先做如下修改:
1,AudioService.java:中 mRingerModeAffectedStreams保存着静音模式时会影响的streamType,因此如果希望某种类型的声音在静音模式下也能够有声音,就应该将其从mRingerModeAffectedStreams移出:
1)如,希望通知铃STREAM_NOTIFCATION声在静音下不受影响,添加如下一句:
private void readPersistedSettings() {
.....
mRingerModeAffectedStreams &= ~(1 << AudioSystem.STREAM_SYSTEM_ENFORCED);/*Add this line*/
Settings.System.putIntForUser(cr,
Settings.System.MODE_RINGER_STREAMS_AFFECTED,
mRingerModeAffectedStreams,
UserHandle.USER_CURRENT
2) private class SettingsObserver extends ContentObserver {
....
public void onChange(boolean selfChange) {
....
ringerModeAffectedStreams&= ~(1 << AudioSystem.STREAM_SYSTEM_ENFORCED);/*Add this line*/
if (ringerModeAffectedStreams != mRingerModeAffectedStreams) {
/*
* Ensure all stream types that should be affected by ringer mode
* are in the proper state.
*/
mRingerModeAffectedStreams = ringerModeAffectedStreams;
setRingerModeInt(getRingerMode(), false);
}
2,对应的播放铃声时就是用上面从mRingerModeAffectedStreams移出不受静音影响的类型,如上面将AudioSystem.STREAM_SYSTEM_ENFORCED从mRingerModeAffectedStreams移出不受静音影响,则Application中使用ringtone播放时设置的streamtype为STREAM_SYSTEM_ENFORCED。
3,贵司可以在CBMessagingNotification.updateNotification的适当位置添加播放铃声的code.比如:
AudioProfileManager mProfileManager = (AudioProfileManager) context.getSystemService(Context.AUDIOPROFILE_SERVICE);
String mActiveProfileKey = mProfileManager.getActiveProfileKey();
if(mActiveProfileKey!=null){
Log.d("mtk_debug", " MessagingNotification.updateNotification 1241 mActiveProfileKey="+mActiveProfileKey); // modify by mtk_debug 2013-12-18;
if(mActiveProfileKey.equals("mtk_audioprofile_silent")){
Log.d("mtk_debug", " MessagingNotification.updateNotification 1243 "); // modify by mtk_debug 2013-12-18;
// Ringtone r=RingtoneManager.getRingtone(context, Uri.parse(NotificationPreferenceActivity.NOTIFICATION_RINGTONE),7);
//
Ringtone r = new Ringtone(context, true);
r.setStreamType(AudioSystem.STREAM_SYSTEM_ENFORCED);
Log.d("mtk_debug", " MessagingNotification.updateNotification 1253 ringtoneStr="+ringtoneStr); // modify by mtk_debug 2013-12-18;
r.setUri(Uri.parse(ringtoneStr));
r.play();
Log.d("mtk_debug", " MessagingNotification.updateNotification 1246 "); // modify by mtk_debug 2013-12-18;
}