use of android.telephony.SmsCbMessage in project android_frameworks_opt_telephony by LineageOS.
the class CdmaSmsCbTest method testCmasUnsupportedCharSet.
// VZW requirement is to discard message with unsupported charset. Verify that we return null
// for this unsupported character set.
@FlakyTest
@Ignore
@Test
@SmallTest
public void testCmasUnsupportedCharSet() throws Exception {
SmsMessage msg = createCmasSmsMessage(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT, 12345, BearerData.PRIORITY_EMERGENCY, BearerData.LANGUAGE_ENGLISH, 0x1F, EXTREME_ALERT, -1, -1, -1, -1, -1);
SmsCbMessage cbMessage = msg.parseBroadcastSms("", 0, 1);
assertNull("expected null for unsupported charset", cbMessage);
}
use of android.telephony.SmsCbMessage in project android_frameworks_opt_telephony by LineageOS.
the class CdmaSmsCbTest method doTestCmasBroadcast.
private static void doTestCmasBroadcast(int serviceCategory, int messageClass, String body) throws Exception {
SmsMessage msg = createCmasSmsMessage(serviceCategory, 1234, BearerData.PRIORITY_EMERGENCY, BearerData.LANGUAGE_ENGLISH, UserData.ENCODING_7BIT_ASCII, body, -1, -1, -1, -1, -1);
SmsCbMessage cbMessage = msg.parseBroadcastSms("", 0, 1);
verifyCbValues(cbMessage);
assertEquals(serviceCategory, cbMessage.getServiceCategory());
assertEquals(1234, cbMessage.getSerialNumber());
assertEquals(SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY, cbMessage.getMessagePriority());
assertEquals("en", cbMessage.getLanguageCode());
assertEquals(body, cbMessage.getMessageBody());
assertEquals(true, cbMessage.isEmergencyMessage());
assertEquals(true, cbMessage.isCmasMessage());
SmsCbCmasInfo cmasInfo = cbMessage.getCmasWarningInfo();
assertEquals(messageClass, cmasInfo.getMessageClass());
assertEquals(SmsCbCmasInfo.CMAS_CATEGORY_UNKNOWN, cmasInfo.getCategory());
assertEquals(SmsCbCmasInfo.CMAS_RESPONSE_TYPE_UNKNOWN, cmasInfo.getResponseType());
assertEquals(SmsCbCmasInfo.CMAS_SEVERITY_UNKNOWN, cmasInfo.getSeverity());
assertEquals(SmsCbCmasInfo.CMAS_URGENCY_UNKNOWN, cmasInfo.getUrgency());
assertEquals(SmsCbCmasInfo.CMAS_CERTAINTY_UNKNOWN, cmasInfo.getCertainty());
}
use of android.telephony.SmsCbMessage in project android_frameworks_opt_telephony by LineageOS.
the class GsmSmsCbTest method testGetMessageBody7BitFullUmts.
@Test
@SmallTest
public void testGetMessageBody7BitFullUmts() {
byte[] pdu = { (byte) 0x01, (byte) 0x00, (byte) 0x32, (byte) 0xC0, (byte) 0x00, (byte) 0x40, (byte) 0x01, (byte) 0x41, (byte) 0xD0, (byte) 0x71, (byte) 0xDA, (byte) 0x04, (byte) 0x91, (byte) 0xCB, (byte) 0xE6, (byte) 0x70, (byte) 0x9D, (byte) 0x4D, (byte) 0x07, (byte) 0x85, (byte) 0xD9, (byte) 0x70, (byte) 0x74, (byte) 0x58, (byte) 0x5C, (byte) 0xA6, (byte) 0x83, (byte) 0xDA, (byte) 0xE5, (byte) 0xF9, (byte) 0x3C, (byte) 0x7C, (byte) 0x2E, (byte) 0x83, (byte) 0xC4, (byte) 0xE5, (byte) 0xB4, (byte) 0xFB, (byte) 0x0C, (byte) 0x2A, (byte) 0xE3, (byte) 0xC3, (byte) 0x63, (byte) 0x3A, (byte) 0x3B, (byte) 0x0F, (byte) 0xCA, (byte) 0xCD, (byte) 0x40, (byte) 0x63, (byte) 0x74, (byte) 0x58, (byte) 0x1E, (byte) 0x1E, (byte) 0xD3, (byte) 0xCB, (byte) 0xF2, (byte) 0x39, (byte) 0x88, (byte) 0xFD, (byte) 0x76, (byte) 0x9F, (byte) 0x59, (byte) 0xA0, (byte) 0x76, (byte) 0x39, (byte) 0xEC, (byte) 0x4E, (byte) 0xBB, (byte) 0xCF, (byte) 0x20, (byte) 0x3A, (byte) 0xBA, (byte) 0x2C, (byte) 0x2F, (byte) 0x83, (byte) 0xD2, (byte) 0x73, (byte) 0x90, (byte) 0xFB, (byte) 0x0D, (byte) 0x82, (byte) 0x87, (byte) 0xC9, (byte) 0xE4, (byte) 0xB4, (byte) 0xFB, (byte) 0x1C, (byte) 0x02, (byte) 0x52 };
SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected 7-bit string decoded", "A GSM default alphabet message being exactly 93 characters long, " + "meaning there is no padding!", msg.getMessageBody());
}
use of android.telephony.SmsCbMessage in project android_frameworks_opt_telephony by LineageOS.
the class GsmSmsCbTest method testGetMessageBodyUcs2WithLanguageInBodyUmts.
@Test
@SmallTest
public void testGetMessageBodyUcs2WithLanguageInBodyUmts() {
byte[] pdu = { (byte) 0x01, (byte) 0x00, (byte) 0x32, (byte) 0xC0, (byte) 0x00, (byte) 0x11, (byte) 0x01, (byte) 0x78, (byte) 0x3C, (byte) 0x00, (byte) 0x41, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x55, (byte) 0x00, (byte) 0x43, (byte) 0x00, (byte) 0x53, (byte) 0x00, (byte) 0x32, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x6D, (byte) 0x00, (byte) 0x65, (byte) 0x00, (byte) 0x73, (byte) 0x00, (byte) 0x73, (byte) 0x00, (byte) 0x61, (byte) 0x00, (byte) 0x67, (byte) 0x00, (byte) 0x65, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x63, (byte) 0x00, (byte) 0x6F, (byte) 0x00, (byte) 0x6E, (byte) 0x00, (byte) 0x74, (byte) 0x00, (byte) 0x61, (byte) 0x00, (byte) 0x69, (byte) 0x00, (byte) 0x6E, (byte) 0x00, (byte) 0x69, (byte) 0x00, (byte) 0x6E, (byte) 0x00, (byte) 0x67, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x61, (byte) 0x00, (byte) 0x20, (byte) 0x04, (byte) 0x34, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x63, (byte) 0x00, (byte) 0x68, (byte) 0x00, (byte) 0x61, (byte) 0x00, (byte) 0x72, (byte) 0x00, (byte) 0x61, (byte) 0x00, (byte) 0x63, (byte) 0x00, (byte) 0x74, (byte) 0x00, (byte) 0x65, (byte) 0x00, (byte) 0x72, (byte) 0x00, (byte) 0x0D, (byte) 0x50 };
SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected 7-bit string decoded", "A UCS2 message containing a \u0434 character", msg.getMessageBody());
assertEquals("Unexpected language indicator decoded", "xx", msg.getLanguageCode());
}
use of android.telephony.SmsCbMessage in project android_frameworks_opt_telephony by LineageOS.
the class GsmSmsCbTest method doTestGeographicalScopeValue.
private void doTestGeographicalScopeValue(byte[] pdu, byte b, int expectedGs) {
pdu[0] = b;
SmsCbMessage msg = createFromPdu(pdu);
assertEquals("Unexpected geographical scope decoded", expectedGs, msg.getGeographicalScope());
}
Aggregations