public class ImsSMSDispatcher extends SMSDispatcher
SMSDispatcher.DataSmsSender, SMSDispatcher.SmsSender, SMSDispatcher.SmsSenderCallback, SMSDispatcher.SmsTracker, SMSDispatcher.TextSmsSender
Handler.Callback
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 |
---|
ImsSMSDispatcher(Phone phone,
SmsStorageMonitor storageMonitor,
SmsUsageMonitor usageMonitor) |
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.
|
String |
getImsSmsFormat() |
protected SMSDispatcher.SmsTracker |
getNewSubmitPduTracker(String destinationAddress,
String scAddress,
String message,
SmsHeader smsHeader,
int format,
PendingIntent sentIntent,
PendingIntent deliveryIntent,
boolean lastPart,
AtomicInteger unsentPartCount,
AtomicBoolean anyPartFailed,
Uri messageUri,
String fullMessageText)
Create a new SubmitPdu and return the SMS tracker.
|
void |
handleMessage(Message msg)
Handles events coming from the phone stack.
|
void |
injectSmsPdu(byte[] pdu,
String format,
PendingIntent receivedIntent)
Inject an SMS PDU into the android platform.
|
boolean |
isIms() |
void |
sendData(String destAddr,
String scAddr,
int destPort,
byte[] data,
PendingIntent sentIntent,
PendingIntent deliveryIntent)
Send a data based SMS to a specific application port.
|
void |
sendMultipartText(String destAddr,
String scAddr,
ArrayList<String> parts,
ArrayList<PendingIntent> sentIntents,
ArrayList<PendingIntent> deliveryIntents,
Uri messageUri,
String callingPkg,
boolean persistMessage)
Send a multi-part text based SMS.
|
void |
sendRetrySms(SMSDispatcher.SmsTracker tracker)
Retry the message along to the radio.
|
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.
|
protected void |
updatePhoneObject(Phone phone) |
getCarrierAppPackageName, getNextConcatenatedRef, getNotInServiceError, getPremiumSmsPermission, getSmsTracker, getSmsTracker, getSmsTrackerMap, getSmsTrackerMap, getSubId, handleConfirmShortCode, handleNotInService, handleReachSentLimit, handleSendComplete, handleStatusReport, sendRawPdu, setPremiumSmsPermission
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
public ImsSMSDispatcher(Phone phone, SmsStorageMonitor storageMonitor, SmsUsageMonitor usageMonitor)
protected void updatePhoneObject(Phone phone)
updatePhoneObject
in class SMSDispatcher
public void dispose()
SMSDispatcher
dispose
in class SMSDispatcher
public void handleMessage(Message msg)
handleMessage
in class SMSDispatcher
msg
- the message to handlepublic void sendData(String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent)
SMSDispatcher
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 sendMultipartText(String destAddr, String scAddr, ArrayList<String> parts, ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents, Uri messageUri, String callingPkg, boolean persistMessage)
SMSDispatcher
sendMultipartText
in class SMSDispatcher
destAddr
- the address to send the message toscAddr
- is the service center address or null to use
the current default SMSCparts
- an ArrayList
of strings that, in order,
comprise the original messagesentIntents
- if not null, an ArrayList
of
PendingIntent
s (one for each message part) that is
broadcast when the corresponding message part has been sent.
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
.
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.
deliveryIntents
- if not null, an ArrayList
of
PendingIntent
s (one for each message part) that is
broadcast when the corresponding message part has been delivered
to the recipient. The raw pdu of the status report is in 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 sendSms(SMSDispatcher.SmsTracker tracker)
SMSDispatcher
sendSms
in class SMSDispatcher
tracker
- holds the SMS message to sendprotected void sendSmsByPstn(SMSDispatcher.SmsTracker tracker)
SMSDispatcher
sendSmsByPstn
in class SMSDispatcher
tracker
- holds the Sms tracker ready to be sentpublic void sendText(String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent, Uri messageUri, String callingPkg, boolean persistMessage)
SMSDispatcher
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.public void injectSmsPdu(byte[] pdu, String format, PendingIntent receivedIntent)
SMSDispatcher
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.public void sendRetrySms(SMSDispatcher.SmsTracker tracker)
SMSDispatcher
sendRetrySms
in class SMSDispatcher
tracker
- holds the SMS message to sendprotected void sendSubmitPdu(SMSDispatcher.SmsTracker tracker)
SMSDispatcher
sendRawPdu
.sendSubmitPdu
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
protected GsmAlphabet.TextEncodingDetails calculateLength(CharSequence messageBody, boolean use7bitOnly)
SMSDispatcher
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 format, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean lastPart, AtomicInteger unsentPartCount, AtomicBoolean anyPartFailed, Uri messageUri, String fullMessageText)
SMSDispatcher
getNewSubmitPduTracker
in class SMSDispatcher
public boolean isIms()
isIms
in class SMSDispatcher
public String getImsSmsFormat()
getImsSmsFormat
in class SMSDispatcher