diff options
author | Marcos Marado <mmarado@cyngn.com> | 2016-09-30 18:18:25 +0100 |
---|---|---|
committer | Ricardo Cerqueira <ricardo@cyngn.com> | 2016-10-03 14:48:47 +0100 |
commit | d85de45775a8e163625e3ce0f10e56038d66dd4b (patch) | |
tree | 902a7940fe143e48c1a31bea0322716e5240661a | |
parent | e8ed3af7e0dcba502deb3ef790b932b368c56167 (diff) | |
download | android_frameworks_opt_telephony-d85de45775a8e163625e3ce0f10e56038d66dd4b.tar.gz android_frameworks_opt_telephony-d85de45775a8e163625e3ce0f10e56038d66dd4b.tar.bz2 android_frameworks_opt_telephony-d85de45775a8e163625e3ce0f10e56038d66dd4b.zip |
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.
Issue: PAELLA-286
Change-Id: I0e4624dab4e51abfc4e3e048c2d88932aa4af616
-rw-r--r-- | resources/res/values/config.xml | 4 | ||||
-rwxr-xr-x | src/java/com/android/internal/telephony/WapPushOverSms.java | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/resources/res/values/config.xml b/resources/res/values/config.xml index d36b3a3ee..a567efc63 100644 --- a/resources/res/values/config.xml +++ b/resources/res/values/config.xml @@ -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> diff --git a/src/java/com/android/internal/telephony/WapPushOverSms.java b/src/java/com/android/internal/telephony/WapPushOverSms.java index 8b9d62962..97118ba27 100755 --- a/src/java/com/android/internal/telephony/WapPushOverSms.java +++ b/src/java/com/android/internal/telephony/WapPushOverSms.java @@ -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 |