use of com.android.internal.telephony.uicc.UsimServiceTable in project android_frameworks_opt_telephony by LineageOS.
the class GsmInboundSmsHandler method dispatchMessageRadioSpecific.
/**
* Handle type zero, SMS-PP data download, and 3GPP/CPHS MWI type SMS. Normal SMS messages
* are handled by {@link #dispatchNormalMessage} in parent class.
*
* @param smsb the SmsMessageBase object from the RIL
* @return a result code from {@link android.provider.Telephony.Sms.Intents},
* or {@link Activity#RESULT_OK} for delayed acknowledgment to SMSC
*/
@Override
protected int dispatchMessageRadioSpecific(SmsMessageBase smsb) {
SmsMessage sms = (SmsMessage) smsb;
if (sms.isTypeZero()) {
// Some carriers will send visual voicemail SMS as type zero.
int destPort = -1;
SmsHeader smsHeader = sms.getUserDataHeader();
if (smsHeader != null && smsHeader.portAddrs != null) {
// The message was sent to a port.
destPort = smsHeader.portAddrs.destPort;
}
VisualVoicemailSmsFilter.filter(mContext, new byte[][] { sms.getPdu() }, SmsConstants.FORMAT_3GPP, destPort, mPhone.getSubId());
// As per 3GPP TS 23.040 9.2.3.9, Type Zero messages should not be
// Displayed/Stored/Notified. They should only be acknowledged.
log("Received short message type 0, Don't display or store it. Send Ack");
addSmsTypeZeroToMetrics();
return Intents.RESULT_SMS_HANDLED;
}
// Send SMS-PP data download messages to UICC. See 3GPP TS 31.111 section 7.1.1.
if (sms.isUsimDataDownload()) {
UsimServiceTable ust = mPhone.getUsimServiceTable();
return mDataDownloadHandler.handleUsimDataDownload(ust, sms);
}
boolean handled = false;
if (sms.isMWISetMessage()) {
updateMessageWaitingIndicator(sms.getNumOfVoicemails());
handled = sms.isMwiDontStore();
if (DBG)
log("Received voice mail indicator set SMS shouldStore=" + !handled);
} else if (sms.isMWIClearMessage()) {
updateMessageWaitingIndicator(0);
handled = sms.isMwiDontStore();
if (DBG)
log("Received voice mail indicator clear SMS shouldStore=" + !handled);
}
if (handled) {
addVoicemailSmsToMetrics();
return Intents.RESULT_SMS_HANDLED;
}
if (!mStorageMonitor.isStorageAvailable() && sms.getMessageClass() != SmsConstants.MessageClass.CLASS_0) {
// (See TS 23.038 for a description of class 0 messages.)
return Intents.RESULT_SMS_OUT_OF_MEMORY;
}
return dispatchNormalMessage(smsb);
}
use of com.android.internal.telephony.uicc.UsimServiceTable in project android_frameworks_opt_telephony by LineageOS.
the class UsimServiceTableTest method testUsimServiceTable.
@SmallTest
public void testUsimServiceTable() {
byte[] noServices = { 0x00 };
byte[] service1 = { 0x01, 0x00 };
byte[] service8 = { (byte) 0x80, 0x00, 0x00 };
byte[] service8And9 = { (byte) 0x80, 0x01 };
byte[] service28 = { 0x00, 0x00, 0x00, 0x08 };
byte[] service89To96 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0xff };
UsimServiceTable testTable1 = new UsimServiceTable(noServices);
assertFalse(testTable1.isAvailable(UsimServiceTable.UsimService.PHONEBOOK));
assertFalse(testTable1.isAvailable(UsimServiceTable.UsimService.FDN));
assertFalse(testTable1.isAvailable(UsimServiceTable.UsimService.NAS_CONFIG_BY_USIM));
UsimServiceTable testTable2 = new UsimServiceTable(service1);
assertTrue(testTable2.isAvailable(UsimServiceTable.UsimService.PHONEBOOK));
assertFalse(testTable2.isAvailable(UsimServiceTable.UsimService.FDN));
assertFalse(testTable2.isAvailable(UsimServiceTable.UsimService.NAS_CONFIG_BY_USIM));
UsimServiceTable testTable3 = new UsimServiceTable(service8);
assertFalse(testTable3.isAvailable(UsimServiceTable.UsimService.PHONEBOOK));
assertFalse(testTable3.isAvailable(UsimServiceTable.UsimService.BDN_EXTENSION));
assertTrue(testTable3.isAvailable(UsimServiceTable.UsimService.OUTGOING_CALL_INFO));
assertFalse(testTable3.isAvailable(UsimServiceTable.UsimService.INCOMING_CALL_INFO));
assertFalse(testTable3.isAvailable(UsimServiceTable.UsimService.NAS_CONFIG_BY_USIM));
UsimServiceTable testTable4 = new UsimServiceTable(service8And9);
assertFalse(testTable4.isAvailable(UsimServiceTable.UsimService.PHONEBOOK));
assertFalse(testTable4.isAvailable(UsimServiceTable.UsimService.BDN_EXTENSION));
assertTrue(testTable4.isAvailable(UsimServiceTable.UsimService.OUTGOING_CALL_INFO));
assertTrue(testTable4.isAvailable(UsimServiceTable.UsimService.INCOMING_CALL_INFO));
assertFalse(testTable4.isAvailable(UsimServiceTable.UsimService.SM_STORAGE));
assertFalse(testTable4.isAvailable(UsimServiceTable.UsimService.NAS_CONFIG_BY_USIM));
UsimServiceTable testTable5 = new UsimServiceTable(service28);
assertFalse(testTable5.isAvailable(UsimServiceTable.UsimService.PHONEBOOK));
assertTrue(testTable5.isAvailable(UsimServiceTable.UsimService.DATA_DL_VIA_SMS_PP));
assertFalse(testTable5.isAvailable(UsimServiceTable.UsimService.NAS_CONFIG_BY_USIM));
UsimServiceTable testTable6 = new UsimServiceTable(service89To96);
assertFalse(testTable6.isAvailable(UsimServiceTable.UsimService.PHONEBOOK));
assertFalse(testTable6.isAvailable(UsimServiceTable.UsimService.HPLMN_DIRECT_ACCESS));
assertTrue(testTable6.isAvailable(UsimServiceTable.UsimService.ECALL_DATA));
assertTrue(testTable6.isAvailable(UsimServiceTable.UsimService.SM_OVER_IP));
assertTrue(testTable6.isAvailable(UsimServiceTable.UsimService.UICC_ACCESS_TO_IMS));
assertTrue(testTable6.isAvailable(UsimServiceTable.UsimService.NAS_CONFIG_BY_USIM));
}
Aggregations