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

Commit 4df59963 authored by Hall Liu's avatar Hall Liu Committed by android-build-merger
Browse files

Merge "Deliver the sender address of WAP push message"

am: c00372cc

Change-Id: Ibe478ec78d1cac17e82d92380a5d246b63574a46
parents a5c6b0f0 c00372cc
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -793,6 +793,7 @@ public abstract class InboundSmsHandler extends StateMachine {
        byte[][] pdus;
        int destPort = tracker.getDestPort();
        boolean block = false;
        String address = tracker.getAddress();

        // Do not process when the message count is invalid.
        if (messageCount <= 0) {
@@ -810,7 +811,6 @@ public abstract class InboundSmsHandler extends StateMachine {
            Cursor cursor = null;
            try {
                // used by several query selection arguments
                String address = tracker.getAddress();
                String refNumber = Integer.toString(tracker.getReferenceNumber());
                String count = Integer.toString(tracker.getMessageCount());

@@ -917,7 +917,8 @@ public abstract class InboundSmsHandler extends StateMachine {
                }
                output.write(pdu, 0, pdu.length);
            }
            int result = mWapPush.dispatchWapPdu(output.toByteArray(), resultReceiver, this);
            int result = mWapPush.dispatchWapPdu(output.toByteArray(), resultReceiver,
                    this, address);
            if (DBG) log("dispatchWapPdu() returned " + result);
            // result is Activity.RESULT_OK if an ordered broadcast was sent
            if (result == Activity.RESULT_OK) {
+22 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.provider.Telephony.Sms.Intents;
import android.telephony.Rlog;
import android.telephony.SmsManager;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
import android.util.Log;

import com.android.internal.telephony.uicc.IccUtils;
@@ -325,6 +326,21 @@ public class WapPushOverSms implements ServiceConnection {
     *         to applications
     */
    public int dispatchWapPdu(byte[] pdu, BroadcastReceiver receiver, InboundSmsHandler handler) {
        return dispatchWapPdu(pdu, receiver, handler, null);
    }

    /**
     * Dispatches inbound messages that are in the WAP PDU format. See
     * wap-230-wsp-20010705-a section 8 for details on the WAP PDU format.
     *
     * @param pdu The WAP PDU, made up of one or more SMS PDUs
     * @param address The originating address
     * @return a result code from {@link android.provider.Telephony.Sms.Intents}, or
     *         {@link Activity#RESULT_OK} if the message has been broadcast
     *         to applications
     */
    public int dispatchWapPdu(byte[] pdu, BroadcastReceiver receiver, InboundSmsHandler handler,
            String address) {
        DecodedResult result = decodeWapPdu(pdu, handler);
        if (result.statusCode != Activity.RESULT_OK) {
            return result.statusCode;
@@ -360,6 +376,9 @@ public class WapPushOverSms implements ServiceConnection {
                    intent.putExtra("data", result.intentData);
                    intent.putExtra("contentTypeParameters", result.contentTypeParameters);
                    SubscriptionManager.putPhoneIdAndSubIdExtra(intent, result.phoneId);
                    if (!TextUtils.isEmpty(address)) {
                        intent.putExtra("address", address);
                    }

                    int procRet = wapPushMan.processMessage(
                        result.wapAppId, result.contentType, intent);
@@ -391,6 +410,9 @@ public class WapPushOverSms implements ServiceConnection {
        intent.putExtra("data", result.intentData);
        intent.putExtra("contentTypeParameters", result.contentTypeParameters);
        SubscriptionManager.putPhoneIdAndSubIdExtra(intent, result.phoneId);
        if (!TextUtils.isEmpty(address)) {
            intent.putExtra("address", address);
        }

        // Direct the intent to only the default MMS app. If we can't find a default MMS app
        // then sent it to all broadcast receivers.
+3 −2
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ public class WapPushOverSmsTest extends TelephonyTest {
                (byte) 0xFF
        };

        mWapPushOverSmsUT.dispatchWapPdu(pdu, null, mInboundSmsHandler);
        mWapPushOverSmsUT.dispatchWapPdu(pdu, null, mInboundSmsHandler, "123456");

        ArgumentCaptor<Intent> intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class);
        verify(mInboundSmsHandler).dispatchIntent(intentArgumentCaptor.capture(),
@@ -97,6 +97,7 @@ public class WapPushOverSmsTest extends TelephonyTest {
        assertEquals(Telephony.Sms.Intents.WAP_PUSH_DELIVER_ACTION, intent.getAction());
        assertEquals(0xFF, intent.getIntExtra("transactionId", 0));
        assertEquals(0x06, intent.getIntExtra("pduType", 0));
        assertEquals("123456", intent.getStringExtra("address"));

        byte[] header = intent.getByteArrayExtra("header");
        assertEquals(2, header.length);