小区广播这个东西对于做国内项目的人来说是可以毫不关心的,但是对于做国外项目的人来说就需要关注了。最近因为客户户需求做了几个关于小区广播的定制,所以想将过程中的一些心得分享一下,有一点得说明,因为我是做MTK平台的,故以下均是MTK平台小区广播方面的内容。
首先我们得先讲讲小区广播的概念:
小区广播短消息业务是移动通信系统提供的一项重要业务,主要用于将信息分发到特定地理位置区域内的移动用户。GSM/UMTS支持小区广播业务,小区广播是向客户按区域、按频道发送各种实时、动态的分类信息(如登机信息、天气状况等信息)的业务。
小区广播短消息业务是移动通信系统提供的一项重要业务,主要用于将信息分发到特定地理位置区域内的移动用户。GSM/UMTS支持小区广播业务,小区广播是向客户按区域、按频道发送各种实时、动态的分类信息(如登机信息、天气状况等信息)的业务。
GSM网络下:
在GSM网络下,一个cb消息最多可以包含15页,每一页cb message由88个字节组成,1-2字节表示序列号(Serial Number),3-4字节表示消息标识符(Message Identifier用户界面看到的channel),第5字节表示编码格式(Data Coding Scheme),第6字节表示cb消息页码参数(Page Parameter),第7-88字节表示cb消息内容(Content of Message)。上述字节按字节1到88顺序传输,每个字节按照最低位先传输的顺序。下面对这些字节所对应的内容进行简单介绍:
备注:同一个cb消息每页Message Identifier,GS,MessageCode相同,UpdateNumber为每页内容的不同,默认从0000自动加1。手机shall设置重复检测机制,检测时间根据MCC决定,有的是1小时,有的是24小时,即在重复检测时间范围内收到一条cb消息,如果该消息的这几个参数全部相同,则视为重复的cb消息,手机应该discard该消息。
UMTS网络下:UMTS网络下,cb message格式如上表所示,1字节表示消息类型(Message Type),2-3字节表示消息标识符(Message ID同GSM Message Identifier),第4-5字节表示序列号(Serial Number),第6字节表示编码格式(Data Coding Scheme),第7-N字节表示cb消息数据(CB Data)。上述字节按字节1到N顺序传输,每个字节按照最低位先传输的顺序。下面对这些字节所对应的内容进行简单介绍:
首先我们要说明一下小区广播的分类:
小区广播频道总范围为 0-65535 (0x0000-0xFFFF),其中紧急小区广播范围如下:
PWS(Public Warning System) as defined in 3GPP TS 22.268 : 4352-6399 (0x1100-0x18FF)
ETWS(Earthquake and Tsunami Warning System) 范围4352-4359(0x1100-0x1107), 其中4357-4359 (0x1105-0x1107) for future extension,
因此有效频道范围为4352-4356 (0x1100-0x1104)
CMAS(Commercial Mobile Alert System) 范围4370-4399 (0x1112-0x112F), 其中4396-4399 (0x112C-0x112F) for future versions,
因此有效频道范围为4370-4395(0x1112-0x112B)
PWS范围内除ETWS和CMAS以外, 4400-6399 (0x1130-0x18FF) for future versions, 目前没有被使用。
其他的我们都叫普通小区广播,也就是normal cellbroadcast,具体的每个信道如下:
0 - 999:
To be allocated by GSMA(see GSMA PRD SE.15 [25]). If a Message Identifier from this range is in the "search list", the ME shall attempt to receive such CBS message.
This version of 3GPP TS 23.041 does not prohibit networks from using Message Identifiers in the range 0000 - 03E7 (hex) for Cell Broadcast Data Download to the SIM.
1000: LCS CBS Message Identifier for E-OTD Assistance Data message.
1001: LCS CBS Message Identifier for DGPS Correction Data message.
1002: LCS CBS Message Identifier for GPS Ephemeris and Clock Correction Data message.
1003: LCS CBS Message Identifier for GPS Almanac and Other Data message.
1004 - 4095:
Intended for standardization in future versions of 3GPP TS 23.041. These values shall not be transmitted by networks that are compliant to this version of 3GPP TS 23.041. If a Message Identifier from this range is in the "search list", the ME shall attempt to receive this CBS message.
4096 - 4223:
Networks shall only use Message Identifiers from this range for Cell Broadcast Data Download in "clear" (i.e. unsecured) to the SIM (see 3GPP TS 11.14). If a message Identifier from this range is in the "search list", the ME shall attempt to receive this CBS message.
(Not settable by MMI)
4224 - 4351:
Networks shall only use Message Identifiers from this range for Cell Broadcast Data Download secured according to 3GPP TS 23.048 [15] to the SIM (see 3GPP TS 11.14). If a message Identifier from this range is in the "search list", the ME shall attempt to receive this CBS message.
(Not settable by MMI)
4352:
ETWS CBS Message Identifier for earthquake warning message.
4353:
ETWS CBS Message Identifier for tsunami warning message.
4354:
ETWS CBS Message Identifier for earthquake and tsunami combined warning message.
4355:
ETWS CBS Message Identifier for test message.
The UE silently discards this message. A UE specially designed for testing purposes may display its contents.
4356:
ETWS CBS Message Identifier for messages related to other emergency types.
4357 - 4359:
ETWS CBS Message Identifier for future extension.
4360 - 40959:
Intended for standardization in future versions of 3GPP TS 23.041. These values shall not be transmitted by networks that are compliant to this version of 3GPP TS 23.041. If a Message Identifier from this range is in the "search list", the ME shall attempt to receive this CBS message.
40960 - 45055:
PLMN operator specific range. The type of information provided by PLMN operators using these Message Identifiers is not guaranteed to be the same across different PLMNs. If a Message Identifier from this range is in the "search list", the ME shall attempt to receive this CBS message.
45056 - 61439:
Intended as PLMN operator specific range in future versions of 3GPP TS 23.041. These values shall not be transmitted by networks that are compliant to this version of 3GPP TS 23.041. If a Message Identifier from this range is in the "search list", then the ME shall attempt to receive this CBS message.
61440 65534:
Intended as PLMN operator specific range in future versions of 3GPP TS 23.041. These values shall not be transmitted by networks that are compliant to this version of 3GPP TS 23.041. If a Message Identifier from this range is in the "search list", then the ME shall attempt to receive this CBS message.
(Not settable by MMI.)
65535:
Reserved, and should not be used for new services, as this value is used on the SIM to indicate that no Message Identifier is stored in those two octets of the SIM. If this Message Identifier is in the "search list", the ME shall attempt to receive this CBS message.
(Not settable by MMI.)
一般可自由定制使用的channel是在1000以下的。
说完了分类,我们在讲讲具体的小区广播。
在小区广播部分8.0之前和之后是有很大差别的,这就导致了8.0之前对于信道是自己添加(不想找老手机了,用张老图):
而在8.0之后就大不一样的,它将对应的广播都合并成了一个个item:
可以看到分成了"AMBER alerts","Extreme threats","Severe threats"这些item,分别对应什么呢?这些都可以在alps/vendor/mediatek/proprietary/packages/apps/CellBroadcastReceiver/src/com/android/cellbroadcastreceiver/CellBroadcastConfigService.java 这个类中看到,比如说"AMBER alerts":
boolean enableEmergencyAlerts = enableForSub && prefs.getBoolean(
CellBroadcastSettings.KEY_ENABLE_EMERGENCY_ALERTS, true);
boolean enableCmasAmberAlerts = enableEmergencyAlerts && prefs.getBoolean(
CellBroadcastSettings.KEY_ENABLE_CMAS_AMBER_ALERTS, true);
这是我截取的获取"AMBER alerts"值的地方,可以看到他只是获取了"Allow alerts"的开关和"AMBER alerts"的开关,而在下面会有:
// Enable/Disable CDMA CMAS amber alert messages.
setCellBroadcastRange(manager, enableCmasAmberAlerts,
SmsManager.CELL_BROADCAST_RAN_TYPE_CDMA,
SmsEnvelope.SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY,
SmsEnvelope.SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY);
// Enable/Disable GSM CMAS amber alert messages (4379).
setCellBroadcastRange(manager, enableCmasAmberAlerts,
SmsManager.CELL_BROADCAST_RAN_TYPE_GSM,
SmsCbConstants.MESSAGE_ID_CMAS_ALERT_CHILD_ABDUCTION_EMERGENCY,
SmsCbConstants.MESSAGE_ID_CMAS_ALERT_CHILD_ABDUCTION_EMERGENCY);
// Enable/Disable GSM CMAS amber alert messages for additional languages (4392).
setCellBroadcastRange(manager, enableCmasAmberAlerts,
SmsManager.CELL_BROADCAST_RAN_TYPE_GSM,
SmsCbConstants.MESSAGE_ID_CMAS_ALERT_CHILD_ABDUCTION_EMERGENCY_LANGUAGE,
SmsCbConstants.MESSAGE_ID_CMAS_ALERT_CHILD_ABDUCTION_EMERGENCY_LANGUAGE);
可以看到"Allow alerts"所对应的信道是4379和4392,至于里面提供的常量都可以在framework下找到。
我们可以看到在8.0之后并没有添加和删除信道的功能(站在用户的层面上来说是如此),而且也只能控制紧急小区广播,其实关于普通小区广播的处理还是在短信中。
由于小区广播区分紧急小区广播,对于短信而言,只处理普通小区广播消息
SMS_CB_RECEIVED_ACTION = "android.provider.Telephony.SMS_CB_RECEIVED"
PWS紧急小区广播类包含CMAS和ETWS这两类,
AP都是处理 SMS_EMERGENCY_CB_RECEIVED_ACTION = "android.provider.Telephony.SMS_EMERGENCY_CB_RECEIVED"
说完了区别,那要怎么才能预置紧急小区apk呢?因为有两个apk都可以处理,一个Mtk的,一个Google的,这个根据自己需求选择。要预置哪个是根据 MTK_CMAS_SUPPORT(MTK的)和MTK_ETWS_SUPPORT(Google的):
(1) MTK_CMAS_SUPPORT宏的开启会增加 CMASReceiver.apk App名称为紧急警报
(2) MTK_ETWS_SUPPORT宏的开启会增加 CellBroadcastReceiver.apk App名称为灾难预警
但是不要两个一起开,为什么?一起开两个一起预置这要发给紧急广播过来不就有两个声音了嘛,这会导致导致PWS测试失败。
(在草稿箱呆了一个月了,终于写完了)