public final class GsmSMSDispatcher extends SMSDispatcher
SMSDispatcher.DataSmsSender, SMSDispatcher.SmsSender, SMSDispatcher.SmsSenderCallback, SMSDispatcher.SmsTracker, SMSDispatcher.TextSmsSender
Handler.Callback
Modifier and Type | Field and Description |
---|---|
protected UiccController |
mUiccController |
deliveryPendingList, EVENT_HANDLE_STATUS_REPORT, EVENT_ICC_CHANGED, EVENT_IMS_STATE_CHANGED, EVENT_IMS_STATE_DONE, EVENT_NEW_ICC_SMS, EVENT_RADIO_ON, EVENT_SEND_SMS_COMPLETE, mCi, mContext, mPhone, mResolver, mSmsCapable, mSmsSendDisabled, mTelephonyManager
Constructor and Description |
---|
GsmSMSDispatcher(Phone phone,
SmsUsageMonitor usageMonitor,
ImsSMSDispatcher imsSMSDispatcher,
GsmInboundSmsHandler gsmInboundSmsHandler) |
Modifier and Type | Method and Description |
---|---|
protected GsmAlphabet.TextEncodingDetails |
calculateLength(CharSequence messageBody,
boolean use7bitOnly)
Calculate the number of septets needed to encode the message.
|
void |
dispose()
Unregister for incoming SMS events.
|
protected String |
getFormat()
The format of the message PDU in the associated broadcast intent.
|
protected SMSDispatcher.SmsTracker |
getNewSubmitPduTracker(String destinationAddress,
String scAddress,
String message,
SmsHeader smsHeader,
int encoding,
PendingIntent sentIntent,
PendingIntent deliveryIntent,
boolean lastPart,
AtomicInteger unsentPartCount,
AtomicBoolean anyPartFailed,
Uri messageUri,
String fullMessageText)
Create a new SubmitPdu and return the SMS tracker.
|
protected UiccCardApplication |
getUiccCardApplication() |
void |
handleMessage(Message msg)
Handles 3GPP format-specific events coming from the phone stack.
|
protected void |
injectSmsPdu(byte[] pdu,
String format,
PendingIntent receivedIntent)
Inject an SMS PDU into the android platform.
|
protected void |
sendData(String destAddr,
String scAddr,
int destPort,
byte[] data,
PendingIntent sentIntent,
PendingIntent deliveryIntent)
Send a data based SMS to a specific application port.
|
protected void |
sendSms(SMSDispatcher.SmsTracker tracker)
Send the message along to the radio.
|
protected void |
sendSmsByPstn(SMSDispatcher.SmsTracker tracker)
Send the SMS via the PSTN network.
|
protected void |
sendSubmitPdu(SMSDispatcher.SmsTracker tracker)
Send an SMS PDU.
|
void |
sendText(String destAddr,
String scAddr,
String text,
PendingIntent sentIntent,
PendingIntent deliveryIntent,
Uri messageUri,
String callingPkg,
boolean persistMessage)
Send a text based SMS.
|
getCarrierAppPackageName, getImsSmsFormat, getNextConcatenatedRef, getNotInServiceError, getPremiumSmsPermission, getSmsTracker, getSmsTracker, getSmsTrackerMap, getSmsTrackerMap, getSubId, handleConfirmShortCode, handleNotInService, handleReachSentLimit, handleSendComplete, handleStatusReport, isIms, sendMultipartText, sendRawPdu, sendRetrySms, setPremiumSmsPermission, updatePhoneObject
dispatchMessage, dump, getLooper, getMessageName, getTraceName, hasCallbacks, hasMessages, hasMessages, obtainMessage, obtainMessage, obtainMessage, obtainMessage, obtainMessage, post, postAtFrontOfQueue, postAtTime, postAtTime, postDelayed, removeCallbacks, removeCallbacks, removeCallbacksAndMessages, removeMessages, removeMessages, runWithScissors, sendEmptyMessage, sendEmptyMessageAtTime, sendEmptyMessageDelayed, sendMessage, sendMessageAtFrontOfQueue, sendMessageAtTime, sendMessageDelayed, toString
protected UiccController mUiccController
public GsmSMSDispatcher(Phone phone, SmsUsageMonitor usageMonitor, ImsSMSDispatcher imsSMSDispatcher, GsmInboundSmsHandler gsmInboundSmsHandler)
public void dispose()
SMSDispatcher
dispose
in class SMSDispatcher
protected String getFormat()
SMSDispatcher
SmsMessage
which take an
extra format parameter. This is required in order to correctly decode the PDU on
devices which require support for both 3GPP and 3GPP2 formats at the same time,
such as CDMA/LTE devices and GSM/CDMA world phones.getFormat
in class SMSDispatcher
public void handleMessage(Message msg)
SMSDispatcher.handleMessage(android.os.Message)
.handleMessage
in class SMSDispatcher
msg
- the message to handleprotected void sendData(String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent)
sendData
in class SMSDispatcher
destAddr
- the address to send the message toscAddr
- is the service center address or null to use
the current default SMSCdestPort
- the port to deliver the message todata
- the body of the message to sendsentIntent
- if not NULL this PendingIntent
is
broadcast when the message is successfully sent, or failed.
The result code will be Activity.RESULT_OK for success,
or one of these errors:
RESULT_ERROR_GENERIC_FAILURE
RESULT_ERROR_RADIO_OFF
RESULT_ERROR_NULL_PDU
RESULT_ERROR_NO_SERVICE
.
For RESULT_ERROR_GENERIC_FAILURE
the sentIntent may include
the extra "errorCode" containing a radio technology specific value,
generally only useful for troubleshooting.
The per-application based SMS control checks sentIntent. If sentIntent
is NULL the caller will be checked against all unknown applications,
which cause smaller number of SMS to be sent in checking period.
deliveryIntent
- if not NULL this PendingIntent
is
broadcast when the message is delivered to the recipient. The
raw pdu of the status report is in the extended data ("pdu").public void sendText(String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, Uri messageUri, String callingPkg, boolean persistMessage)
sendText
in class SMSDispatcher
destAddr
- the address to send the message toscAddr
- is the service center address or null to use
the current default SMSCtext
- the body of the message to sendsentIntent
- if not NULL this PendingIntent
is
broadcast when the message is successfully sent, or failed.
The result code will be Activity.RESULT_OK for success,
or one of these errors:
RESULT_ERROR_GENERIC_FAILURE
RESULT_ERROR_RADIO_OFF
RESULT_ERROR_NULL_PDU
RESULT_ERROR_NO_SERVICE
.
For RESULT_ERROR_GENERIC_FAILURE
the sentIntent may include
the extra "errorCode" containing a radio technology specific value,
generally only useful for troubleshooting.
The per-application based SMS control checks sentIntent. If sentIntent
is NULL the caller will be checked against all unknown applications,
which cause smaller number of SMS to be sent in checking period.
deliveryIntent
- if not NULL this PendingIntent
is
broadcast when the message is delivered to the recipient. ThemessageUri
- optional URI of the message if it is already stored in the systemcallingPkg
- the calling package namepersistMessage
- whether to save the sent message into SMS DB for a
non-default SMS app.protected void injectSmsPdu(byte[] pdu, String format, PendingIntent receivedIntent)
injectSmsPdu
in class SMSDispatcher
pdu
- is the byte array of pdu to be injected into android telephony layerformat
- is the format of SMS pdu (3gpp or 3gpp2)receivedIntent
- if not NULL this PendingIntent
is
broadcast when the message is successfully received by the
android telephony layer. This intent is broadcasted at
the same time an SMS received from radio is responded back.protected GsmAlphabet.TextEncodingDetails calculateLength(CharSequence messageBody, boolean use7bitOnly)
calculateLength
in class SMSDispatcher
messageBody
- the message to encodeuse7bitOnly
- ignore (but still count) illegal characters if trueprotected SMSDispatcher.SmsTracker getNewSubmitPduTracker(String destinationAddress, String scAddress, String message, SmsHeader smsHeader, int encoding, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean lastPart, AtomicInteger unsentPartCount, AtomicBoolean anyPartFailed, Uri messageUri, String fullMessageText)
getNewSubmitPduTracker
in class SMSDispatcher
protected void sendSubmitPdu(SMSDispatcher.SmsTracker tracker)
SMSDispatcher
sendRawPdu
.sendSubmitPdu
in class SMSDispatcher
protected void sendSms(SMSDispatcher.SmsTracker tracker)
sendSms
in class SMSDispatcher
tracker
- holds the SMS message to sendprotected void sendSmsByPstn(SMSDispatcher.SmsTracker tracker)
sendSmsByPstn
in class SMSDispatcher
tracker
- holds the Sms tracker ready to be sentprotected UiccCardApplication getUiccCardApplication()