Loading src/java/com/android/internal/telephony/InboundSmsHandler.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -806,8 +806,7 @@ public abstract class InboundSmsHandler extends StateMachine { private boolean processMessagePartWithUserLocked(InboundSmsTracker tracker, private boolean processMessagePartWithUserLocked(InboundSmsTracker tracker, byte[][] pdus, int destPort) { byte[][] pdus, int destPort) { log("Credential-encrypted storage not available. Port: " + destPort); log("Credential-encrypted storage not available. Port: " + destPort); if (destPort == SmsHeader.PORT_WAP_PUSH) { if (destPort == SmsHeader.PORT_WAP_PUSH && mWapPush.isWapPushForMms(pdus[0], this)) { // TODO - for wap push, check whether it's for MMS. showNewMessageNotification(); showNewMessageNotification(); return false; return false; } } Loading src/java/com/android/internal/telephony/WapPushOverSms.java +160 −88 Original line number Original line Diff line number Diff line Loading @@ -47,6 +47,9 @@ import android.telephony.SubscriptionManager; import android.util.Log; import android.util.Log; import com.android.internal.telephony.uicc.IccUtils; import com.android.internal.telephony.uicc.IccUtils; import java.util.HashMap; import com.google.android.mms.MmsException; import com.google.android.mms.MmsException; import com.google.android.mms.pdu.DeliveryInd; import com.google.android.mms.pdu.DeliveryInd; import com.google.android.mms.pdu.GenericPdu; import com.google.android.mms.pdu.GenericPdu; Loading Loading @@ -110,16 +113,16 @@ public class WapPushOverSms implements ServiceConnection { } } /** /** * Dispatches inbound messages that are in the WAP PDU format. See * Decodes the wap push pdu. The decoded result is wrapped inside the {@link DecodedResult} * wap-230-wsp-20010705-a section 8 for details on the WAP PDU format. * object. The caller of this method should check {@link DecodedResult#statusCode} for the * decoding status. It can have the following values. * * * @param pdu The WAP PDU, made up of one or more SMS PDUs * Activity.RESULT_OK - the wap push pdu is successfully decoded and should be further processed * @return a result code from {@link android.provider.Telephony.Sms.Intents}, or * Intents.RESULT_SMS_HANDLED - the wap push pdu should be ignored. * {@link Activity#RESULT_OK} if the message has been broadcast * Intents.RESULT_SMS_GENERIC_ERROR - the pdu is invalid. * to applications */ */ public int dispatchWapPdu(byte[] pdu, BroadcastReceiver receiver, InboundSmsHandler handler) { private DecodedResult decodeWapPdu(byte[] pdu, InboundSmsHandler handler) { DecodedResult result = new DecodedResult(); if (DBG) Rlog.d(TAG, "Rx: " + IccUtils.bytesToHexString(pdu)); if (DBG) Rlog.d(TAG, "Rx: " + IccUtils.bytesToHexString(pdu)); try { try { Loading @@ -145,11 +148,13 @@ public class WapPushOverSms implements ServiceConnection { if ((pduType != WspTypeDecoder.PDU_TYPE_PUSH) if ((pduType != WspTypeDecoder.PDU_TYPE_PUSH) && (pduType != WspTypeDecoder.PDU_TYPE_CONFIRMED_PUSH)) { && (pduType != WspTypeDecoder.PDU_TYPE_CONFIRMED_PUSH)) { if (DBG) Rlog.w(TAG, "Received non-PUSH WAP PDU. Type = " + pduType); if (DBG) Rlog.w(TAG, "Received non-PUSH WAP PDU. Type = " + pduType); return Intents.RESULT_SMS_HANDLED; result.statusCode = Intents.RESULT_SMS_HANDLED; return result; } } } else { } else { if (DBG) Rlog.w(TAG, "Received non-PUSH WAP PDU. Type = " + pduType); if (DBG) Rlog.w(TAG, "Received non-PUSH WAP PDU. Type = " + pduType); return Intents.RESULT_SMS_HANDLED; result.statusCode = Intents.RESULT_SMS_HANDLED; return result; } } } } Loading @@ -163,7 +168,8 @@ public class WapPushOverSms implements ServiceConnection { */ */ if (pduDecoder.decodeUintvarInteger(index) == false) { if (pduDecoder.decodeUintvarInteger(index) == false) { if (DBG) Rlog.w(TAG, "Received PDU. Header Length error."); if (DBG) Rlog.w(TAG, "Received PDU. Header Length error."); return Intents.RESULT_SMS_GENERIC_ERROR; result.statusCode = Intents.RESULT_SMS_GENERIC_ERROR; return result; } } int headerLength = (int) pduDecoder.getValue32(); int headerLength = (int) pduDecoder.getValue32(); index += pduDecoder.getDecodedDataLength(); index += pduDecoder.getDecodedDataLength(); Loading @@ -184,7 +190,8 @@ public class WapPushOverSms implements ServiceConnection { */ */ if (pduDecoder.decodeContentType(index) == false) { if (pduDecoder.decodeContentType(index) == false) { if (DBG) Rlog.w(TAG, "Received PDU. Header Content-Type error."); if (DBG) Rlog.w(TAG, "Received PDU. Header Content-Type error."); return Intents.RESULT_SMS_GENERIC_ERROR; result.statusCode = Intents.RESULT_SMS_GENERIC_ERROR; return result; } } String mimeType = pduDecoder.getValueString(); String mimeType = pduDecoder.getValueString(); Loading Loading @@ -216,15 +223,11 @@ public class WapPushOverSms implements ServiceConnection { final NotificationInd nInd = (NotificationInd) parsedPdu; final NotificationInd nInd = (NotificationInd) parsedPdu; if (nInd.getFrom() != null if (nInd.getFrom() != null && BlockChecker.isBlocked(mContext, nInd.getFrom().getString())) { && BlockChecker.isBlocked(mContext, nInd.getFrom().getString())) { return Intents.RESULT_SMS_HANDLED; result.statusCode = Intents.RESULT_SMS_HANDLED; return result; } } } } if (SmsManager.getDefault().getAutoPersisting()) { // Store the wap push data in telephony writeInboxMessage(subId, parsedPdu); } /** /** * Seek for application ID field in WSP header. * Seek for application ID field in WSP header. * If application ID is found, WapPushManager substitute the message * If application ID is found, WapPushManager substitute the message Loading @@ -238,11 +241,58 @@ public class WapPushOverSms implements ServiceConnection { if (wapAppId == null) { if (wapAppId == null) { wapAppId = Integer.toString((int) pduDecoder.getValue32()); wapAppId = Integer.toString((int) pduDecoder.getValue32()); } } result.wapAppId = wapAppId; String contentType = ((mimeType == null) ? String contentType = ((mimeType == null) ? Long.toString(binaryContentType) : mimeType); Long.toString(binaryContentType) : mimeType); result.contentType = contentType; if (DBG) Rlog.v(TAG, "appid found: " + wapAppId + ":" + contentType); if (DBG) Rlog.v(TAG, "appid found: " + wapAppId + ":" + contentType); } result.subId = subId; result.phoneId = phoneId; result.parsedPdu = parsedPdu; result.mimeType = mimeType; result.transactionId = transactionId; result.pduType = pduType; result.header = header; result.intentData = intentData; result.contentTypeParameters = pduDecoder.getContentParameters(); result.statusCode = Activity.RESULT_OK; } catch (ArrayIndexOutOfBoundsException aie) { // 0-byte WAP PDU or other unexpected WAP PDU contents can easily throw this; // log exception string without stack trace and return false. Rlog.e(TAG, "ignoring dispatchWapPdu() array index exception: " + aie); result.statusCode = Intents.RESULT_SMS_GENERIC_ERROR; } return result; } /** * 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 * @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) { DecodedResult result = decodeWapPdu(pdu, handler); if (result.statusCode != Activity.RESULT_OK) { return result.statusCode; } if (SmsManager.getDefault().getAutoPersisting()) { // Store the wap push data in telephony writeInboxMessage(result.subId, result.parsedPdu); } /** * If the pdu has application ID, WapPushManager substitute the message * processing. Since WapPushManager is optional module, if WapPushManager * is not found, legacy message processing will be continued. */ if (result.wapAppId != null) { try { try { boolean processFurther = true; boolean processFurther = true; IWapPushManager wapPushMan = mWapPushManager; IWapPushManager wapPushMan = mWapPushManager; Loading @@ -254,15 +304,15 @@ public class WapPushOverSms implements ServiceConnection { mWapPushManagerPackage, 0, "mms-mgr"); mWapPushManagerPackage, 0, "mms-mgr"); Intent intent = new Intent(); Intent intent = new Intent(); intent.putExtra("transactionId", transactionId); intent.putExtra("transactionId", result.transactionId); intent.putExtra("pduType", pduType); intent.putExtra("pduType", result.pduType); intent.putExtra("header", header); intent.putExtra("header", result.header); intent.putExtra("data", intentData); intent.putExtra("data", result.intentData); intent.putExtra("contentTypeParameters", intent.putExtra("contentTypeParameters", result.contentTypeParameters); pduDecoder.getContentParameters()); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, result.phoneId); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, phoneId); int procRet = wapPushMan.processMessage( int procRet = wapPushMan.processMessage(wapAppId, contentType, intent); result.wapAppId, result.contentType, intent); if (DBG) Rlog.v(TAG, "procRet:" + procRet); if (DBG) Rlog.v(TAG, "procRet:" + procRet); if ((procRet & WapPushManagerParams.MESSAGE_HANDLED) > 0 if ((procRet & WapPushManagerParams.MESSAGE_HANDLED) > 0 && (procRet & WapPushManagerParams.FURTHER_PROCESSING) == 0) { && (procRet & WapPushManagerParams.FURTHER_PROCESSING) == 0) { Loading @@ -278,19 +328,19 @@ public class WapPushOverSms implements ServiceConnection { } } if (DBG) Rlog.v(TAG, "fall back to existing handler"); if (DBG) Rlog.v(TAG, "fall back to existing handler"); if (mimeType == null) { if (result.mimeType == null) { if (DBG) Rlog.w(TAG, "Header Content-Type error."); if (DBG) Rlog.w(TAG, "Header Content-Type error."); return Intents.RESULT_SMS_GENERIC_ERROR; return Intents.RESULT_SMS_GENERIC_ERROR; } } Intent intent = new Intent(Intents.WAP_PUSH_DELIVER_ACTION); Intent intent = new Intent(Intents.WAP_PUSH_DELIVER_ACTION); intent.setType(mimeType); intent.setType(result.mimeType); intent.putExtra("transactionId", transactionId); intent.putExtra("transactionId", result.transactionId); intent.putExtra("pduType", pduType); intent.putExtra("pduType", result.pduType); intent.putExtra("header", header); intent.putExtra("header", result.header); intent.putExtra("data", intentData); intent.putExtra("data", result.intentData); intent.putExtra("contentTypeParameters", pduDecoder.getContentParameters()); intent.putExtra("contentTypeParameters", result.contentTypeParameters); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, phoneId); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, result.phoneId); // Direct the intent to only the default MMS app. If we can't find a default MMS app // 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. // then sent it to all broadcast receivers. Loading @@ -311,15 +361,19 @@ public class WapPushOverSms implements ServiceConnection { } } } } handler.dispatchIntent(intent, getPermissionForType(mimeType), handler.dispatchIntent(intent, getPermissionForType(result.mimeType), getAppOpsPermissionForIntent(mimeType), options, receiver, UserHandle.SYSTEM); getAppOpsPermissionForIntent(result.mimeType), options, receiver, UserHandle.SYSTEM); return Activity.RESULT_OK; return Activity.RESULT_OK; } catch (ArrayIndexOutOfBoundsException aie) { // 0-byte WAP PDU or other unexpected WAP PDU contents can easily throw this; // log exception string without stack trace and return false. Rlog.e(TAG, "ignoring dispatchWapPdu() array index exception: " + aie); return Intents.RESULT_SMS_GENERIC_ERROR; } } /** * Check whether the pdu is a MMS WAP push pdu that should be dispatched to the SMS app. */ public boolean isWapPushForMms(byte[] pdu, InboundSmsHandler handler) { DecodedResult result = decodeWapPdu(pdu, handler); return result.statusCode == Activity.RESULT_OK && WspTypeDecoder.CONTENT_TYPE_B_MMS.equals(result.mimeType); } } private static boolean shouldParseContentDisposition(int subId) { private static boolean shouldParseContentDisposition(int subId) { Loading Loading @@ -511,4 +565,22 @@ public class WapPushOverSms implements ServiceConnection { } } return appOp; return appOp; } } /** * Place holder for decoded Wap pdu data. */ private final class DecodedResult { String mimeType; String contentType; int transactionId; int pduType; int phoneId; int subId; byte[] header; String wapAppId; byte[] intentData; HashMap<String, String> contentTypeParameters; GenericPdu parsedPdu; int statusCode; } } } Loading
src/java/com/android/internal/telephony/InboundSmsHandler.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -806,8 +806,7 @@ public abstract class InboundSmsHandler extends StateMachine { private boolean processMessagePartWithUserLocked(InboundSmsTracker tracker, private boolean processMessagePartWithUserLocked(InboundSmsTracker tracker, byte[][] pdus, int destPort) { byte[][] pdus, int destPort) { log("Credential-encrypted storage not available. Port: " + destPort); log("Credential-encrypted storage not available. Port: " + destPort); if (destPort == SmsHeader.PORT_WAP_PUSH) { if (destPort == SmsHeader.PORT_WAP_PUSH && mWapPush.isWapPushForMms(pdus[0], this)) { // TODO - for wap push, check whether it's for MMS. showNewMessageNotification(); showNewMessageNotification(); return false; return false; } } Loading
src/java/com/android/internal/telephony/WapPushOverSms.java +160 −88 Original line number Original line Diff line number Diff line Loading @@ -47,6 +47,9 @@ import android.telephony.SubscriptionManager; import android.util.Log; import android.util.Log; import com.android.internal.telephony.uicc.IccUtils; import com.android.internal.telephony.uicc.IccUtils; import java.util.HashMap; import com.google.android.mms.MmsException; import com.google.android.mms.MmsException; import com.google.android.mms.pdu.DeliveryInd; import com.google.android.mms.pdu.DeliveryInd; import com.google.android.mms.pdu.GenericPdu; import com.google.android.mms.pdu.GenericPdu; Loading Loading @@ -110,16 +113,16 @@ public class WapPushOverSms implements ServiceConnection { } } /** /** * Dispatches inbound messages that are in the WAP PDU format. See * Decodes the wap push pdu. The decoded result is wrapped inside the {@link DecodedResult} * wap-230-wsp-20010705-a section 8 for details on the WAP PDU format. * object. The caller of this method should check {@link DecodedResult#statusCode} for the * decoding status. It can have the following values. * * * @param pdu The WAP PDU, made up of one or more SMS PDUs * Activity.RESULT_OK - the wap push pdu is successfully decoded and should be further processed * @return a result code from {@link android.provider.Telephony.Sms.Intents}, or * Intents.RESULT_SMS_HANDLED - the wap push pdu should be ignored. * {@link Activity#RESULT_OK} if the message has been broadcast * Intents.RESULT_SMS_GENERIC_ERROR - the pdu is invalid. * to applications */ */ public int dispatchWapPdu(byte[] pdu, BroadcastReceiver receiver, InboundSmsHandler handler) { private DecodedResult decodeWapPdu(byte[] pdu, InboundSmsHandler handler) { DecodedResult result = new DecodedResult(); if (DBG) Rlog.d(TAG, "Rx: " + IccUtils.bytesToHexString(pdu)); if (DBG) Rlog.d(TAG, "Rx: " + IccUtils.bytesToHexString(pdu)); try { try { Loading @@ -145,11 +148,13 @@ public class WapPushOverSms implements ServiceConnection { if ((pduType != WspTypeDecoder.PDU_TYPE_PUSH) if ((pduType != WspTypeDecoder.PDU_TYPE_PUSH) && (pduType != WspTypeDecoder.PDU_TYPE_CONFIRMED_PUSH)) { && (pduType != WspTypeDecoder.PDU_TYPE_CONFIRMED_PUSH)) { if (DBG) Rlog.w(TAG, "Received non-PUSH WAP PDU. Type = " + pduType); if (DBG) Rlog.w(TAG, "Received non-PUSH WAP PDU. Type = " + pduType); return Intents.RESULT_SMS_HANDLED; result.statusCode = Intents.RESULT_SMS_HANDLED; return result; } } } else { } else { if (DBG) Rlog.w(TAG, "Received non-PUSH WAP PDU. Type = " + pduType); if (DBG) Rlog.w(TAG, "Received non-PUSH WAP PDU. Type = " + pduType); return Intents.RESULT_SMS_HANDLED; result.statusCode = Intents.RESULT_SMS_HANDLED; return result; } } } } Loading @@ -163,7 +168,8 @@ public class WapPushOverSms implements ServiceConnection { */ */ if (pduDecoder.decodeUintvarInteger(index) == false) { if (pduDecoder.decodeUintvarInteger(index) == false) { if (DBG) Rlog.w(TAG, "Received PDU. Header Length error."); if (DBG) Rlog.w(TAG, "Received PDU. Header Length error."); return Intents.RESULT_SMS_GENERIC_ERROR; result.statusCode = Intents.RESULT_SMS_GENERIC_ERROR; return result; } } int headerLength = (int) pduDecoder.getValue32(); int headerLength = (int) pduDecoder.getValue32(); index += pduDecoder.getDecodedDataLength(); index += pduDecoder.getDecodedDataLength(); Loading @@ -184,7 +190,8 @@ public class WapPushOverSms implements ServiceConnection { */ */ if (pduDecoder.decodeContentType(index) == false) { if (pduDecoder.decodeContentType(index) == false) { if (DBG) Rlog.w(TAG, "Received PDU. Header Content-Type error."); if (DBG) Rlog.w(TAG, "Received PDU. Header Content-Type error."); return Intents.RESULT_SMS_GENERIC_ERROR; result.statusCode = Intents.RESULT_SMS_GENERIC_ERROR; return result; } } String mimeType = pduDecoder.getValueString(); String mimeType = pduDecoder.getValueString(); Loading Loading @@ -216,15 +223,11 @@ public class WapPushOverSms implements ServiceConnection { final NotificationInd nInd = (NotificationInd) parsedPdu; final NotificationInd nInd = (NotificationInd) parsedPdu; if (nInd.getFrom() != null if (nInd.getFrom() != null && BlockChecker.isBlocked(mContext, nInd.getFrom().getString())) { && BlockChecker.isBlocked(mContext, nInd.getFrom().getString())) { return Intents.RESULT_SMS_HANDLED; result.statusCode = Intents.RESULT_SMS_HANDLED; return result; } } } } if (SmsManager.getDefault().getAutoPersisting()) { // Store the wap push data in telephony writeInboxMessage(subId, parsedPdu); } /** /** * Seek for application ID field in WSP header. * Seek for application ID field in WSP header. * If application ID is found, WapPushManager substitute the message * If application ID is found, WapPushManager substitute the message Loading @@ -238,11 +241,58 @@ public class WapPushOverSms implements ServiceConnection { if (wapAppId == null) { if (wapAppId == null) { wapAppId = Integer.toString((int) pduDecoder.getValue32()); wapAppId = Integer.toString((int) pduDecoder.getValue32()); } } result.wapAppId = wapAppId; String contentType = ((mimeType == null) ? String contentType = ((mimeType == null) ? Long.toString(binaryContentType) : mimeType); Long.toString(binaryContentType) : mimeType); result.contentType = contentType; if (DBG) Rlog.v(TAG, "appid found: " + wapAppId + ":" + contentType); if (DBG) Rlog.v(TAG, "appid found: " + wapAppId + ":" + contentType); } result.subId = subId; result.phoneId = phoneId; result.parsedPdu = parsedPdu; result.mimeType = mimeType; result.transactionId = transactionId; result.pduType = pduType; result.header = header; result.intentData = intentData; result.contentTypeParameters = pduDecoder.getContentParameters(); result.statusCode = Activity.RESULT_OK; } catch (ArrayIndexOutOfBoundsException aie) { // 0-byte WAP PDU or other unexpected WAP PDU contents can easily throw this; // log exception string without stack trace and return false. Rlog.e(TAG, "ignoring dispatchWapPdu() array index exception: " + aie); result.statusCode = Intents.RESULT_SMS_GENERIC_ERROR; } return result; } /** * 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 * @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) { DecodedResult result = decodeWapPdu(pdu, handler); if (result.statusCode != Activity.RESULT_OK) { return result.statusCode; } if (SmsManager.getDefault().getAutoPersisting()) { // Store the wap push data in telephony writeInboxMessage(result.subId, result.parsedPdu); } /** * If the pdu has application ID, WapPushManager substitute the message * processing. Since WapPushManager is optional module, if WapPushManager * is not found, legacy message processing will be continued. */ if (result.wapAppId != null) { try { try { boolean processFurther = true; boolean processFurther = true; IWapPushManager wapPushMan = mWapPushManager; IWapPushManager wapPushMan = mWapPushManager; Loading @@ -254,15 +304,15 @@ public class WapPushOverSms implements ServiceConnection { mWapPushManagerPackage, 0, "mms-mgr"); mWapPushManagerPackage, 0, "mms-mgr"); Intent intent = new Intent(); Intent intent = new Intent(); intent.putExtra("transactionId", transactionId); intent.putExtra("transactionId", result.transactionId); intent.putExtra("pduType", pduType); intent.putExtra("pduType", result.pduType); intent.putExtra("header", header); intent.putExtra("header", result.header); intent.putExtra("data", intentData); intent.putExtra("data", result.intentData); intent.putExtra("contentTypeParameters", intent.putExtra("contentTypeParameters", result.contentTypeParameters); pduDecoder.getContentParameters()); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, result.phoneId); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, phoneId); int procRet = wapPushMan.processMessage( int procRet = wapPushMan.processMessage(wapAppId, contentType, intent); result.wapAppId, result.contentType, intent); if (DBG) Rlog.v(TAG, "procRet:" + procRet); if (DBG) Rlog.v(TAG, "procRet:" + procRet); if ((procRet & WapPushManagerParams.MESSAGE_HANDLED) > 0 if ((procRet & WapPushManagerParams.MESSAGE_HANDLED) > 0 && (procRet & WapPushManagerParams.FURTHER_PROCESSING) == 0) { && (procRet & WapPushManagerParams.FURTHER_PROCESSING) == 0) { Loading @@ -278,19 +328,19 @@ public class WapPushOverSms implements ServiceConnection { } } if (DBG) Rlog.v(TAG, "fall back to existing handler"); if (DBG) Rlog.v(TAG, "fall back to existing handler"); if (mimeType == null) { if (result.mimeType == null) { if (DBG) Rlog.w(TAG, "Header Content-Type error."); if (DBG) Rlog.w(TAG, "Header Content-Type error."); return Intents.RESULT_SMS_GENERIC_ERROR; return Intents.RESULT_SMS_GENERIC_ERROR; } } Intent intent = new Intent(Intents.WAP_PUSH_DELIVER_ACTION); Intent intent = new Intent(Intents.WAP_PUSH_DELIVER_ACTION); intent.setType(mimeType); intent.setType(result.mimeType); intent.putExtra("transactionId", transactionId); intent.putExtra("transactionId", result.transactionId); intent.putExtra("pduType", pduType); intent.putExtra("pduType", result.pduType); intent.putExtra("header", header); intent.putExtra("header", result.header); intent.putExtra("data", intentData); intent.putExtra("data", result.intentData); intent.putExtra("contentTypeParameters", pduDecoder.getContentParameters()); intent.putExtra("contentTypeParameters", result.contentTypeParameters); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, phoneId); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, result.phoneId); // Direct the intent to only the default MMS app. If we can't find a default MMS app // 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. // then sent it to all broadcast receivers. Loading @@ -311,15 +361,19 @@ public class WapPushOverSms implements ServiceConnection { } } } } handler.dispatchIntent(intent, getPermissionForType(mimeType), handler.dispatchIntent(intent, getPermissionForType(result.mimeType), getAppOpsPermissionForIntent(mimeType), options, receiver, UserHandle.SYSTEM); getAppOpsPermissionForIntent(result.mimeType), options, receiver, UserHandle.SYSTEM); return Activity.RESULT_OK; return Activity.RESULT_OK; } catch (ArrayIndexOutOfBoundsException aie) { // 0-byte WAP PDU or other unexpected WAP PDU contents can easily throw this; // log exception string without stack trace and return false. Rlog.e(TAG, "ignoring dispatchWapPdu() array index exception: " + aie); return Intents.RESULT_SMS_GENERIC_ERROR; } } /** * Check whether the pdu is a MMS WAP push pdu that should be dispatched to the SMS app. */ public boolean isWapPushForMms(byte[] pdu, InboundSmsHandler handler) { DecodedResult result = decodeWapPdu(pdu, handler); return result.statusCode == Activity.RESULT_OK && WspTypeDecoder.CONTENT_TYPE_B_MMS.equals(result.mimeType); } } private static boolean shouldParseContentDisposition(int subId) { private static boolean shouldParseContentDisposition(int subId) { Loading Loading @@ -511,4 +565,22 @@ public class WapPushOverSms implements ServiceConnection { } } return appOp; return appOp; } } /** * Place holder for decoded Wap pdu data. */ private final class DecodedResult { String mimeType; String contentType; int transactionId; int pduType; int phoneId; int subId; byte[] header; String wapAppId; byte[] intentData; HashMap<String, String> contentTypeParameters; GenericPdu parsedPdu; int statusCode; } } }