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

Unverified Commit 30731c0d authored by Marcos Marado's avatar Marcos Marado Committed by Adrian DC
Browse files

Allow to define a default app to handle Wap Push

Android handles Wap Push messages by sending them to the default MMS
package, if one exists, and broadcasts it if not.

This patch creates an overlayable string which, if set, will announce
what should be the Wap Push receiver app. If that string (and package)
is available, then the message will be sent to it instead. If not, the
previous behavior is maintained: message will go to the default MMS
package (if there's one), or broadcasted.

RM-290

Issue: PAELLA-286
Change-Id: I0e4624dab4e51abfc4e3e048c2d88932aa4af616
parent d74bec80
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -78,4 +78,8 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    <!-- control to enable or disable call transfer feature -->
    <bool name="config_enable_calltransfer_over_ims">false</bool>

    <!-- pre-defined apps -->
    <!-- value should be in the format "com.package.name/com.package.name.MmsPushReceiver" -->
    <string name="default_wap_push_handler"></string>
</resources>
+12 −1
Original line number Diff line number Diff line
@@ -44,8 +44,10 @@ 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.ConfigResourceUtil;
import com.android.internal.telephony.uicc.IccUtils;
import com.google.android.mms.MmsException;
import com.google.android.mms.pdu.DeliveryInd;
@@ -292,9 +294,18 @@ public class WapPushOverSms implements ServiceConnection {
            intent.putExtra("contentTypeParameters", pduDecoder.getContentParameters());
            SubscriptionManager.putPhoneIdAndSubIdExtra(intent, phoneId);

            // Direct the intent to only the default WAP Push app. If none declared:
            // 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.
            ComponentName componentName = SmsApplication.getDefaultMmsApplication(mContext, true);
            ComponentName componentName = null;
            String fqcn = new ConfigResourceUtil().getStringValue(mContext, "default_wap_push_handler");
            if (!TextUtils.isEmpty(fqcn)) {
                componentName = ComponentName.unflattenFromString(fqcn);
            }
            if (componentName == null) {
                componentName = SmsApplication.getDefaultMmsApplication(mContext, true);
            }

            Bundle options = null;
            if (componentName != null) {
                // Deliver MMS message only to this receiver