Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c08850a7 authored by yanglv's avatar yanglv Committed by Ethan Chen
Browse files

Telephony: Add an API for getting recipient address of SubmitPdu

There is no API to get the recipient address of submit pdu for SIM
card message. getDisplayOriginatingAddress() return null for submit
pdu, it will cause applicatoin can not get address of sent message.
Thread ID can not be created for this invalid message record.

Add an API getRecipientAddress() for SubmitPdu in SmsMessage.

Change-Id: I8b8af6002b5b309cba5383adb37275642487f1f0
CRs-Fixed: 627278
parent 5dd6633e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -755,4 +755,13 @@ public class SmsMessage {
        int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
        return (PHONE_TYPE_CDMA == activePhone);
    }

    /**
     * {@hide}
     * Returns the recipient address(receiver) of this SMS message in String form or null if
     * unavailable.
     */
    public String getRecipientAddress() {
        return mWrappedSmsMessage.getRecipientAddress();
    }
}
+15 −0
Original line number Diff line number Diff line
@@ -33,6 +33,9 @@ public abstract class SmsMessageBase {
    /** {@hide} The address of the sender */
    protected SmsAddress mOriginatingAddress;

    /** {@hide} The address of the receiver */
    protected SmsAddress mRecipientAddress;

    /** {@hide} The message body as a string. May be null if the message isn't text */
    protected String mMessageBody;

@@ -346,4 +349,16 @@ public abstract class SmsMessageBase {
         mIsEmail = Telephony.Mms.isEmailAddress(mEmailFrom);
    }

    /**
     * {@hide}
     * Returns the receiver address of this SMS message in String
     * form or null if unavailable
     */
    public String getRecipientAddress() {
        if (mRecipientAddress == null) {
            return null;
        }

        return mRecipientAddress.getAddressString();
    }
}
+6 −1
Original line number Diff line number Diff line
@@ -703,6 +703,10 @@ public class SmsMessage extends SmsMessageBase {
                        }
                        addr.origBytes = data;
                        Rlog.i(LOG_TAG, "Originating Addr=" + addr.toString());
                        if (parameterId == DESTINATION_ADDRESS) {
                            env.destAddress = addr;
                            mRecipientAddress = addr;
                        }
                        break;
                    case ORIGINATING_SUB_ADDRESS:
                    case DESTINATION_SUB_ADDRESS:
@@ -822,7 +826,8 @@ public class SmsMessage extends SmsMessageBase {
                status = mBearerData.errorClass << 8;
                status |= mBearerData.messageStatus;
            }
        } else if (mBearerData.messageType != BearerData.MESSAGE_TYPE_DELIVER) {
        } else if ((mBearerData.messageType != BearerData.MESSAGE_TYPE_DELIVER)
                && (mBearerData.messageType != BearerData.MESSAGE_TYPE_SUBMIT)) {
            throw new RuntimeException("Unsupported message type: " + mBearerData.messageType);
        }

+0 −3
Original line number Diff line number Diff line
@@ -68,9 +68,6 @@ public class SmsMessage extends SmsMessageBase {
    // e.g. 23.040 9.2.2.1
    private boolean mReplyPathPresent = false;

    /** The address of the receiver. */
    private GsmSmsAddress mRecipientAddress;

    /**
     *  TP-Status - status of a previously submitted SMS.
     *  This field applies to SMS-STATUS-REPORT messages.  0 indicates success;