Search in sources :

Example 1 with UserData

use of com.android.internal.telephony.cdma.sms.UserData in project android_frameworks_opt_telephony by LineageOS.

the class CdmaSMSDispatcher method getNewSubmitPduTracker.

/**
 * {@inheritDoc}
 */
@Override
protected 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) {
    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*/
    true);
}
Also used : UserData(com.android.internal.telephony.cdma.sms.UserData) HashMap(java.util.HashMap)

Example 2 with UserData

use of com.android.internal.telephony.cdma.sms.UserData in project android_frameworks_opt_telephony by LineageOS.

the class SMSDispatcher method getNewSubmitPduTracker.

/**
 * Create a new SubmitPdu and return the SMS tracker.
 */
private SmsTracker getNewSubmitPduTracker(String callingPackage, String destinationAddress, String scAddress, String message, SmsHeader smsHeader, int encoding, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean lastPart, AtomicInteger unsentPartCount, AtomicBoolean anyPartFailed, Uri messageUri, String fullMessageText, int priority, boolean expectMore, int validityPeriod, long messageId) {
    if (isCdmaMo()) {
        UserData uData = new UserData();
        uData.payloadStr = message;
        uData.userDataHeader = smsHeader;
        if (encoding == SmsConstants.ENCODING_7BIT) {
            uData.msgEncoding = isAscii7bitSupportedForLongMessage() ? UserData.ENCODING_7BIT_ASCII : UserData.ENCODING_GSM_7BIT_ALPHABET;
            Rlog.d(TAG, "Message encoding for proper 7 bit: " + uData.msgEncoding);
        } 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. */
        // TODO FIX
        SmsMessageBase.SubmitPduBase submitPdu = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(destinationAddress, uData, (deliveryIntent != null) && lastPart, priority);
        if (submitPdu != null) {
            HashMap map = getSmsTrackerMap(destinationAddress, scAddress, message, submitPdu);
            return getSmsTracker(callingPackage, map, sentIntent, deliveryIntent, getFormat(), unsentPartCount, anyPartFailed, messageUri, smsHeader, (!lastPart || expectMore), fullMessageText, true, /*isText*/
            true, /*persistMessage*/
            priority, validityPeriod, false, /* isForVvm */
            messageId);
        } else {
            Rlog.e(TAG, "CdmaSMSDispatcher.getNewSubmitPduTracker(): getSubmitPdu() returned " + "null" + " id: " + messageId);
            return null;
        }
    } else {
        SmsMessageBase.SubmitPduBase pdu = com.android.internal.telephony.gsm.SmsMessage.getSubmitPdu(scAddress, destinationAddress, message, deliveryIntent != null, SmsHeader.toByteArray(smsHeader), encoding, smsHeader.languageTable, smsHeader.languageShiftTable, validityPeriod);
        if (pdu != null) {
            HashMap map = getSmsTrackerMap(destinationAddress, scAddress, message, pdu);
            return getSmsTracker(callingPackage, map, sentIntent, deliveryIntent, getFormat(), unsentPartCount, anyPartFailed, messageUri, smsHeader, (!lastPart || expectMore), fullMessageText, true, /*isText*/
            false, /*persistMessage*/
            priority, validityPeriod, false, /* isForVvm */
            messageId);
        } else {
            Rlog.e(TAG, "GsmSMSDispatcher.getNewSubmitPduTracker(): getSubmitPdu() returned " + "null" + " id: " + messageId);
            return null;
        }
    }
}
Also used : UserData(com.android.internal.telephony.cdma.sms.UserData) HashMap(java.util.HashMap)

Example 3 with UserData

use of com.android.internal.telephony.cdma.sms.UserData in project XobotOS by xamarin.

the class SmsMessage method getSubmitPdu.

/**
     * TODO(cleanup): why do getSubmitPdu methods take an scAddr input
     * and do nothing with it?  GSM allows us to specify a SC (eg,
     * when responding to an SMS that explicitly requests the response
     * is sent to a specific SC), or pass null to use the default
     * value.  Is there no similar notion in CDMA? Or do we just not
     * have it hooked up?
     */
/**
     * Get an SMS-SUBMIT PDU for a destination address and a message
     *
     * @param scAddr                Service Centre address.  Null means use default.
     * @param destAddr              Address of the recipient.
     * @param message               String representation of the message payload.
     * @param statusReportRequested Indicates whether a report is requested for this message.
     * @param smsHeader             Array containing the data for the User Data Header, preceded
     *                              by the Element Identifiers.
     * @return a <code>SubmitPdu</code> containing the encoded SC
     *         address, if applicable, and the encoded message.
     *         Returns null on encode error.
     * @hide
     */
public static SubmitPdu getSubmitPdu(String scAddr, String destAddr, String message, boolean statusReportRequested, SmsHeader smsHeader) {
    /**
         * TODO(cleanup): Do we really want silent failure like this?
         * Would it not be much more reasonable to make sure we don't
         * call this function if we really want nothing done?
         */
    if (message == null || destAddr == null) {
        return null;
    }
    UserData uData = new UserData();
    uData.payloadStr = message;
    uData.userDataHeader = smsHeader;
    return privateGetSubmitPdu(destAddr, statusReportRequested, uData);
}
Also used : UserData(com.android.internal.telephony.cdma.sms.UserData)

Example 4 with UserData

use of com.android.internal.telephony.cdma.sms.UserData in project XobotOS by xamarin.

the class SmsMessage method getSubmitPdu.

/**
     * Get an SMS-SUBMIT PDU for a data message to a destination address and port.
     *
     * @param scAddr Service Centre address. null == use default
     * @param destAddr the address of the destination for the message
     * @param destPort the port to deliver the message to at the
     *        destination
     * @param data the data for the message
     * @return a <code>SubmitPdu</code> containing the encoded SC
     *         address, if applicable, and the encoded message.
     *         Returns null on encode error.
     */
public static SubmitPdu getSubmitPdu(String scAddr, String destAddr, int destPort, byte[] data, boolean statusReportRequested) {
    /**
         * TODO(cleanup): this is not a general-purpose SMS creation
         * method, but rather something specialized to messages
         * containing OCTET encoded (meaning non-human-readable) user
         * data.  The name should reflect that, and not just overload.
         */
    SmsHeader.PortAddrs portAddrs = new SmsHeader.PortAddrs();
    portAddrs.destPort = destPort;
    portAddrs.origPort = 0;
    portAddrs.areEightBits = false;
    SmsHeader smsHeader = new SmsHeader();
    smsHeader.portAddrs = portAddrs;
    UserData uData = new UserData();
    uData.userDataHeader = smsHeader;
    uData.msgEncoding = UserData.ENCODING_OCTET;
    uData.msgEncodingSet = true;
    uData.payload = data;
    return privateGetSubmitPdu(destAddr, statusReportRequested, uData);
}
Also used : SmsHeader(com.android.internal.telephony.SmsHeader) UserData(com.android.internal.telephony.cdma.sms.UserData)

Example 5 with UserData

use of com.android.internal.telephony.cdma.sms.UserData in project XobotOS by xamarin.

the class CdmaSMSDispatcher method sendNewSubmitPdu.

/** {@inheritDoc} */
@Override
protected void sendNewSubmitPdu(String destinationAddress, String scAddress, String message, SmsHeader smsHeader, int encoding, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean lastPart) {
    UserData uData = new UserData();
    uData.payloadStr = message;
    uData.userDataHeader = smsHeader;
    if (encoding == android.telephony.SmsMessage.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);
    sendSubmitPdu(submitPdu, sentIntent, deliveryIntent);
}
Also used : UserData(com.android.internal.telephony.cdma.sms.UserData)

Aggregations

UserData (com.android.internal.telephony.cdma.sms.UserData)5 HashMap (java.util.HashMap)2 SmsHeader (com.android.internal.telephony.SmsHeader)1