OSDN Git Service

Add support for CMAS warning notifications over CDMA.
authorJake Hamby <jhamby@google.com>
Mon, 6 Feb 2012 22:53:43 +0000 (14:53 -0800)
committerJake Hamby <jhamby@google.com>
Wed, 29 Feb 2012 00:49:17 +0000 (16:49 -0800)
commit0c49f03a0429b5c0c4a619256f7bca86a4997ae8
tree04c4c18c8546d2be09b8975980504f0be3108fa2
parent6fa13b5a02464281df56919009fa3af5a3f9026b
Add support for CMAS warning notifications over CDMA.

Refactor SMS Cell Broadcast support to enable receiving CMAS warning
notifications over CDMA. The CellBroadcastReceiver app must also be
updated with the corresponding change. All cell broadcasts are now
delivered as a Parcelable SmsCbMessage object in the "message" extra
of the SMS_CB_RECEIVED_ACTION or SMS_EMERGENCY_CB_RECEIVED_ACTION,
instead of as a GSM/UMTS "pdu" byte array.

Existing functionality for ETWS and CMAS alerts over GSM/UMTS continues
to be supported using the new radio-technology independent SmsCbMessage
and related objects. Test cases are added to verify that valid and
invalid broadcast data is handled appropriately.

Unit testing discovered a bug in the BitwiseOutputStream utility class
used by the added test cases. When the BitwiseOutputStream object must be
expanded (in the private possExpand() method), the mEnd field is not
updated to the new array size. This causes a new array to be allocated
on every new write, and for all data beyond the original array allocation
to be replaced with zeroes. Fixed by adding a line to possExpand() to
update mEnd. Added a test case to BitwiseStreamsTest to verify the fix.
Besides the test cases, BitwiseOutputStream is only used by BearerData in
two places, both of which allocate a sufficient initial buffer. So the
bug in BitwiseOutputStream is not critical to fix for normal operation,
but should be fixed so that the test cases using it function correctly.

Bug: 5856308
Change-Id: Ie3e6af747976ce9b8a3e71e76fec71709cf86545
20 files changed:
core/java/android/provider/Telephony.java
core/java/com/android/internal/util/BitwiseOutputStream.java
core/tests/coretests/src/com/android/internal/util/BitwiseStreamsTest.java
telephony/java/android/telephony/SmsCbCmasInfo.java [new file with mode: 0644]
telephony/java/android/telephony/SmsCbEtwsInfo.java [new file with mode: 0644]
telephony/java/android/telephony/SmsCbLocation.java [new file with mode: 0644]
telephony/java/android/telephony/SmsCbMessage.java
telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.java [new file with mode: 0644]
telephony/java/com/android/internal/telephony/SMSDispatcher.java
telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
telephony/java/com/android/internal/telephony/cdma/sms/SmsEnvelope.java
telephony/java/com/android/internal/telephony/cdma/sms/UserData.java
telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java
telephony/java/com/android/internal/telephony/gsm/GsmSmsCbMessage.java [new file with mode: 0644]
telephony/java/com/android/internal/telephony/gsm/SmsCbConstants.java [moved from telephony/java/android/telephony/SmsCbConstants.java with 84% similarity]
telephony/java/com/android/internal/telephony/gsm/SmsCbHeader.java
telephony/tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsCbTest.java [new file with mode: 0644]
telephony/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsCbTest.java [moved from telephony/tests/telephonytests/src/com/android/internal/telephony/GsmSmsCbTest.java with 89% similarity]