aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-12-10 02:26:43 +0000
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-12-10 02:26:43 +0000
commitdb20c5e6ec931cfcc9efd4f9ec1983ab0036b187 (patch)
tree0450080c6c0e33d10af064c7294bbebd1cb2082d /src
parent553635e86c364c1126a1923316f6df488c4aed6c (diff)
downloadandroid_frameworks_opt_telephony-db20c5e6ec931cfcc9efd4f9ec1983ab0036b187.tar.gz
android_frameworks_opt_telephony-db20c5e6ec931cfcc9efd4f9ec1983ab0036b187.tar.bz2
android_frameworks_opt_telephony-db20c5e6ec931cfcc9efd4f9ec1983ab0036b187.zip
IccSmsInterfaceManager: Don't intercept short-code premium messages
For both charging and potential timing factors on emergency and carrier services, short codes should be delivered directly to the network. Change-Id: If9d288048f9925573f8c5f2e51f0c2df789277bd
Diffstat (limited to 'src')
-rw-r--r--src/java/com/android/internal/telephony/IccSmsInterfaceManager.java25
-rw-r--r--src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java10
2 files changed, 35 insertions, 0 deletions
diff --git a/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java b/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
index b1f893929..5bdd197f5 100644
--- a/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
+++ b/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
@@ -33,6 +33,7 @@ import android.os.Message;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.telephony.Rlog;
+import android.telephony.TelephonyManager;
import android.util.Log;
import com.android.internal.telephony.ISms;
@@ -823,4 +824,28 @@ public class IccSmsInterfaceManager extends ISms.Stub {
public String getImsSmsFormat() {
return mDispatcher.getImsSmsFormat();
}
+
+ /** @hide **/
+ public boolean isShortSMSCode(String destAddr) {
+ TelephonyManager telephonyManager;
+ int smsCategory = SmsUsageMonitor.CATEGORY_NOT_SHORT_CODE;
+
+ telephonyManager =(TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
+
+ String countryIso = telephonyManager.getSimCountryIso();
+ if (countryIso == null || countryIso.length() != 2) {
+ countryIso = telephonyManager.getNetworkCountryIso();
+ }
+
+ smsCategory = SmsUsageMonitor.mergeShortCodeCategories(smsCategory,
+ mPhone.mSmsUsageMonitor.checkDestination(destAddr, countryIso));
+
+ if (smsCategory == SmsUsageMonitor.CATEGORY_NOT_SHORT_CODE
+ || smsCategory == SmsUsageMonitor.CATEGORY_FREE_SHORT_CODE
+ || smsCategory == SmsUsageMonitor.CATEGORY_STANDARD_SHORT_CODE) {
+ return false; // not a premium short code
+ }
+
+ return true;
+ }
}
diff --git a/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java b/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java
index 43cacc8ee..8012880b9 100644
--- a/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java
+++ b/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java
@@ -186,6 +186,11 @@ public class IccSmsInterfaceManagerProxy extends ISms.Stub {
mContext.enforceCallingPermission(
android.Manifest.permission.SEND_SMS,
"Sending SMS message");
+ if (mIccSmsInterfaceManager.isShortSMSCode(destAddr)) {
+ mIccSmsInterfaceManager.sendText(callingPackage, destAddr, scAddr, text,
+ sentIntent, deliveryIntent);
+ return;
+ }
ArrayList<String> parts = new ArrayList<String>();
parts.add(text);
ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>();
@@ -203,6 +208,11 @@ public class IccSmsInterfaceManagerProxy extends ISms.Stub {
mContext.enforceCallingPermission(
android.Manifest.permission.SEND_SMS,
"Sending SMS message");
+ if (mIccSmsInterfaceManager.isShortSMSCode(destAddr)) {
+ mIccSmsInterfaceManager.sendMultipartText(callingPackage, destAddr, scAddr,
+ parts, sentIntents, deliveryIntents);
+ return;
+ }
broadcastOutgoingSms(callingPackage, destAddr, scAddr, true, new ArrayList<String>(parts),
new ArrayList<PendingIntent>(sentIntents), new ArrayList<PendingIntent>(deliveryIntents),
-1);