CdmaSMSDispatcherpublic class CdmaSMSDispatcher extends com.android.internal.telephony.SMSDispatcher
Fields Summary |
---|
private static final String | TAG | private static final boolean | VDBG |
Methods Summary |
---|
protected GsmAlphabet.TextEncodingDetails | calculateLength(java.lang.CharSequence messageBody, boolean use7bitOnly){@inheritDoc}
return SmsMessage.calculateLength(messageBody, use7bitOnly, false);
| protected java.lang.String | getFormat()
return SmsConstants.FORMAT_3GPP2;
| protected SmsTracker | getNewSubmitPduTracker(java.lang.String destinationAddress, java.lang.String scAddress, java.lang.String message, com.android.internal.telephony.SmsHeader smsHeader, int encoding, android.app.PendingIntent sentIntent, android.app.PendingIntent deliveryIntent, boolean lastPart, java.util.concurrent.atomic.AtomicInteger unsentPartCount, java.util.concurrent.atomic.AtomicBoolean anyPartFailed, android.net.Uri messageUri, java.lang.String fullMessageText){@inheritDoc}
UserData uData = new UserData();
uData.payloadStr = message;
uData.userDataHeader = smsHeader;
if (encoding == SmsConstants.ENCODING_7BIT) {
uData.msgEncoding = UserData.ENCODING_GSM_7BIT_ALPHABET;
} else { // assume UTF-16
uData.msgEncoding = UserData.ENCODING_UNICODE_16;
}
uData.msgEncodingSet = true;
/* By setting the statusReportRequested bit only for the
* last message fragment, this will result in only one
* callback to the sender when that last fragment delivery
* has been acknowledged. */
SmsMessage.SubmitPdu submitPdu = SmsMessage.getSubmitPdu(destinationAddress,
uData, (deliveryIntent != null) && lastPart);
HashMap map = getSmsTrackerMap(destinationAddress, scAddress,
message, submitPdu);
return getSmsTracker(map, sentIntent, deliveryIntent,
getFormat(), unsentPartCount, anyPartFailed, messageUri, smsHeader,
false /*isExpextMore*/, fullMessageText, true /*isText*/);
| void | handleCdmaStatusReport(SmsMessage sms)Called from parent class to handle status report from {@code CdmaInboundSmsHandler}.
for (int i = 0, count = deliveryPendingList.size(); i < count; i++) {
SmsTracker tracker = deliveryPendingList.get(i);
if (tracker.mMessageRef == sms.mMessageRef) {
// Found it. Remove from list and broadcast.
deliveryPendingList.remove(i);
// Update the message status (COMPLETE)
tracker.updateSentMessageStatus(mContext, Sms.STATUS_COMPLETE);
PendingIntent intent = tracker.mDeliveryIntent;
Intent fillIn = new Intent();
fillIn.putExtra("pdu", sms.getPdu());
fillIn.putExtra("format", getFormat());
try {
intent.send(mContext, Activity.RESULT_OK, fillIn);
} catch (CanceledException ex) {}
break; // Only expect to see one tracker matching this message.
}
}
| protected void | handleStatusReport(java.lang.Object o)
if (o instanceof SmsMessage) {
if (VDBG) Rlog.d(TAG, "calling handleCdmaStatusReport()");
handleCdmaStatusReport((SmsMessage) o);
} else {
Rlog.e(TAG, "handleStatusReport() called for object type " + o.getClass().getName());
}
| protected void | injectSmsPdu(byte[] pdu, java.lang.String format, android.app.PendingIntent receivedIntent){@inheritDoc}
throw new IllegalStateException("This method must be called only on ImsSMSDispatcher");
| protected void | sendData(java.lang.String destAddr, java.lang.String scAddr, int destPort, byte[] data, android.app.PendingIntent sentIntent, android.app.PendingIntent deliveryIntent){@inheritDoc}
SmsMessage.SubmitPdu pdu = SmsMessage.getSubmitPdu(
scAddr, destAddr, destPort, data, (deliveryIntent != null));
HashMap map = getSmsTrackerMap(destAddr, scAddr, destPort, data, pdu);
SmsTracker tracker = getSmsTracker(map, sentIntent, deliveryIntent, getFormat(),
null /*messageUri*/, false /*isExpectMore*/, null /*fullMessageText*/,
false /*isText*/);
String carrierPackage = getCarrierAppPackageName();
if (carrierPackage != null) {
Rlog.d(TAG, "Found carrier package.");
DataSmsSender smsSender = new DataSmsSender(tracker);
smsSender.sendSmsByCarrierApp(carrierPackage, new SmsSenderCallback(smsSender));
} else {
Rlog.v(TAG, "No carrier package.");
sendSubmitPdu(tracker);
}
| protected void | sendSms(SmsTracker tracker){@inheritDoc}
HashMap<String, Object> map = tracker.mData;
// byte[] smsc = (byte[]) map.get("smsc"); // unused for CDMA
byte[] pdu = (byte[]) map.get("pdu");
Rlog.d(TAG, "sendSms: "
+ " isIms()=" + isIms()
+ " mRetryCount=" + tracker.mRetryCount
+ " mImsRetry=" + tracker.mImsRetry
+ " mMessageRef=" + tracker.mMessageRef
+ " SS=" + mPhone.getServiceState().getState());
sendSmsByPstn(tracker);
| protected void | sendSmsByPstn(SmsTracker tracker){@inheritDoc}
int ss = mPhone.getServiceState().getState();
// if sms over IMS is not supported on data and voice is not available...
if (!isIms() && ss != ServiceState.STATE_IN_SERVICE) {
tracker.onFailed(mContext, getNotInServiceError(ss), 0/*errorCode*/);
return;
}
Message reply = obtainMessage(EVENT_SEND_SMS_COMPLETE, tracker);
byte[] pdu = (byte[]) tracker.mData.get("pdu");
int currentDataNetwork = mPhone.getServiceState().getDataNetworkType();
boolean imsSmsDisabled = (currentDataNetwork == TelephonyManager.NETWORK_TYPE_EHRPD
|| (currentDataNetwork == TelephonyManager.NETWORK_TYPE_LTE
&& !mPhone.getServiceStateTracker().isConcurrentVoiceAndDataAllowed()))
&& mPhone.getServiceState().getVoiceNetworkType()
== TelephonyManager.NETWORK_TYPE_1xRTT
&& ((CDMAPhone) mPhone).mCT.mState != PhoneConstants.State.IDLE;
// sms over cdma is used:
// if sms over IMS is not supported AND
// this is not a retry case after sms over IMS failed
// indicated by mImsRetry > 0
if (0 == tracker.mImsRetry && !isIms() || imsSmsDisabled) {
mCi.sendCdmaSms(pdu, reply);
} else {
mCi.sendImsCdmaSms(pdu, tracker.mImsRetry, tracker.mMessageRef, reply);
// increment it here, so in case of SMS_FAIL_RETRY over IMS
// next retry will be sent using IMS request again.
tracker.mImsRetry++;
}
| void | sendStatusReportMessage(SmsMessage sms)Send the SMS status report to the dispatcher thread to process.
if (VDBG) Rlog.d(TAG, "sending EVENT_HANDLE_STATUS_REPORT message");
sendMessage(obtainMessage(EVENT_HANDLE_STATUS_REPORT, sms));
| protected void | sendSubmitPdu(SmsTracker tracker)
if (SystemProperties.getBoolean(TelephonyProperties.PROPERTY_INECM_MODE, false)) {
if (VDBG) {
Rlog.d(TAG, "Block SMS in Emergency Callback mode");
}
tracker.onFailed(mContext, SmsManager.RESULT_ERROR_NO_SERVICE, 0/*errorCode*/);
return;
}
sendRawPdu(tracker);
| protected void | sendText(java.lang.String destAddr, java.lang.String scAddr, java.lang.String text, android.app.PendingIntent sentIntent, android.app.PendingIntent deliveryIntent, android.net.Uri messageUri, java.lang.String callingPkg){@inheritDoc}
SmsMessage.SubmitPdu pdu = SmsMessage.getSubmitPdu(
scAddr, destAddr, text, (deliveryIntent != null), null);
if (pdu != null) {
HashMap map = getSmsTrackerMap(destAddr, scAddr, text, pdu);
SmsTracker tracker = getSmsTracker(map, sentIntent, deliveryIntent, getFormat(),
messageUri, false /*isExpectMore*/, text, true /*isText*/);
String carrierPackage = getCarrierAppPackageName();
if (carrierPackage != null) {
Rlog.d(TAG, "Found carrier package.");
TextSmsSender smsSender = new TextSmsSender(tracker);
smsSender.sendSmsByCarrierApp(carrierPackage, new SmsSenderCallback(smsSender));
} else {
Rlog.v(TAG, "No carrier package.");
sendSubmitPdu(tracker);
}
} else {
Rlog.e(TAG, "CdmaSMSDispatcher.sendText(): getSubmitPdu() returned null");
}
|
|