GsmInboundSmsHandlerpublic class GsmInboundSmsHandler extends com.android.internal.telephony.InboundSmsHandler This class broadcasts incoming SMS messages to interested apps after storing them in
the SmsProvider "raw" table and ACKing them to the SMSC. After each message has been |
Fields Summary |
---|
private final UsimDataDownloadHandler | mDataDownloadHandlerHandler for SMS-PP data download messages to UICC. |
Methods Summary |
---|
protected void | acknowledgeLastIncomingSms(boolean success, int result, android.os.Message response)Send an acknowledge message.
mPhone.mCi.acknowledgeLastIncomingGsmSms(success, resultToCause(result), response);
| protected int | dispatchMessageRadioSpecific(com.android.internal.telephony.SmsMessageBase smsb)Handle type zero, SMS-PP data download, and 3GPP/CPHS MWI type SMS. Normal SMS messages
are handled by {@link #dispatchNormalMessage} in parent class.
SmsMessage sms = (SmsMessage) smsb;
if (sms.isTypeZero()) {
// 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");
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) {
return Intents.RESULT_SMS_HANDLED;
}
if (!mStorageMonitor.isStorageAvailable() &&
sms.getMessageClass() != SmsConstants.MessageClass.CLASS_0) {
// It's a storable message and there's no storage available. Bail.
// (See TS 23.038 for a description of class 0 messages.)
return Intents.RESULT_SMS_OUT_OF_MEMORY;
}
return dispatchNormalMessage(smsb);
| protected boolean | is3gpp2()Return true if this handler is for 3GPP2 messages; false for 3GPP format.
return false;
| public static com.android.internal.telephony.gsm.GsmInboundSmsHandler | makeInboundSmsHandler(android.content.Context context, com.android.internal.telephony.SmsStorageMonitor storageMonitor, com.android.internal.telephony.PhoneBase phone)Wait for state machine to enter startup state. We can't send any messages until then.
GsmInboundSmsHandler handler = new GsmInboundSmsHandler(context, storageMonitor, phone);
handler.start();
return handler;
| protected void | onQuitting()Unregister for GSM SMS.
mPhone.mCi.unSetOnNewGsmSms(getHandler());
mCellBroadcastHandler.dispose();
if (DBG) log("unregistered for 3GPP SMS");
super.onQuitting(); // release wakelock
| protected void | onUpdatePhoneObject(com.android.internal.telephony.PhoneBase phone)Called when the phone changes the default method updates mPhone
mStorageMonitor and mCellBroadcastHandler.updatePhoneObject.
Override if different or other behavior is desired.
super.onUpdatePhoneObject(phone);
log("onUpdatePhoneObject: dispose of old CellBroadcastHandler and make a new one");
mCellBroadcastHandler.dispose();
mCellBroadcastHandler = GsmCellBroadcastHandler
.makeGsmCellBroadcastHandler(mContext, phone);
| private static int | resultToCause(int rc)Convert Android result code to 3GPP SMS failure cause.
switch (rc) {
case Activity.RESULT_OK:
case Intents.RESULT_SMS_HANDLED:
// Cause code is ignored on success.
return 0;
case Intents.RESULT_SMS_OUT_OF_MEMORY:
return CommandsInterface.GSM_SMS_FAIL_CAUSE_MEMORY_CAPACITY_EXCEEDED;
case Intents.RESULT_SMS_GENERIC_ERROR:
default:
return CommandsInterface.GSM_SMS_FAIL_CAUSE_UNSPECIFIED_ERROR;
}
| void | updateMessageWaitingIndicator(int voicemailCount)
// range check
if (voicemailCount < 0) {
voicemailCount = -1;
} else if (voicemailCount > 0xff) {
// TS 23.040 9.2.3.24.2
// "The value 255 shall be taken to mean 255 or greater"
voicemailCount = 0xff;
}
// update voice mail count in GsmPhone
mPhone.setVoiceMessageCount(voicemailCount);
// store voice mail count in SIM & shared preferences
IccRecords records = UiccController.getInstance().getIccRecords(
mPhone.getPhoneId(), UiccController.APP_FAM_3GPP);
if (records != null) {
log("updateMessageWaitingIndicator: updating SIM Records");
records.setVoiceMessageWaiting(1, voicemailCount);
} else {
log("updateMessageWaitingIndicator: SIM Records not found");
}
storeVoiceMailCount();
|
|