summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk1
-rw-r--r--src/java/com/android/internal/telephony/ISms.aidl2
-rw-r--r--src/java/com/android/internal/telephony/ISmsMiddleware.aidl12
-rw-r--r--src/java/com/android/internal/telephony/IccSmsInterfaceManager.java21
-rw-r--r--src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java110
-rw-r--r--src/java/com/android/internal/telephony/PhoneProxy.java9
6 files changed, 87 insertions, 68 deletions
diff --git a/Android.mk b/Android.mk
index fa7bbeb..9e07849 100644
--- a/Android.mk
+++ b/Android.mk
@@ -19,7 +19,6 @@ include $(CLEAR_VARS)
LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/src/java
LOCAL_SRC_FILES := \
src/java/com/android/internal/telephony/ISms.aidl \
- src/java/com/android/internal/telephony/ISmsMiddleware.aidl \
src/java/com/android/internal/telephony/IIccPhoneBook.aidl \
src/java/com/android/internal/telephony/EventLogTags.logtags \
diff --git a/src/java/com/android/internal/telephony/ISms.aidl b/src/java/com/android/internal/telephony/ISms.aidl
index 0f50ff0..88a92df 100644
--- a/src/java/com/android/internal/telephony/ISms.aidl
+++ b/src/java/com/android/internal/telephony/ISms.aidl
@@ -18,7 +18,6 @@ package com.android.internal.telephony;
import android.app.PendingIntent;
import com.android.internal.telephony.SmsRawData;
-import com.android.internal.telephony.ISmsMiddleware;
import java.util.List;
@@ -37,7 +36,6 @@ import java.util.List;
*/
interface ISms {
- void registerSmsMiddleware(String name, ISmsMiddleware middleware);
void synthesizeMessages(String originatingAddress, String scAddress, in List<String> messages, long timestampMillis);
/**
diff --git a/src/java/com/android/internal/telephony/ISmsMiddleware.aidl b/src/java/com/android/internal/telephony/ISmsMiddleware.aidl
deleted file mode 100644
index 1268f2e..0000000
--- a/src/java/com/android/internal/telephony/ISmsMiddleware.aidl
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.android.internal.telephony;
-
-import android.app.PendingIntent;
-
-interface ISmsMiddleware {
- boolean onSendText(in String destAddr, in String scAddr, in String text,
- in PendingIntent sentIntent, in PendingIntent deliveryIntent);
-
- boolean onSendMultipartText(in String destinationAddress, in String scAddress,
- in List<String> parts, in List<PendingIntent> sentIntents,
- in List<PendingIntent> deliveryIntents);
-} \ No newline at end of file
diff --git a/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java b/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
index b4d13fd..dec58e6 100644
--- a/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
+++ b/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
@@ -18,6 +18,7 @@ package com.android.internal.telephony;
import android.app.PendingIntent;
import android.content.Context;
+import android.os.Binder;
import android.os.RemoteException;
import android.util.Log;
@@ -50,10 +51,6 @@ public abstract class IccSmsInterfaceManager extends ISms.Stub {
}
@Override
- public void registerSmsMiddleware(String name, ISmsMiddleware middleware) throws android.os.RemoteException {
- }
-
- @Override
public void synthesizeMessages(String originatingAddress, String scAddress, List<String> messages, long timestampMillis) throws RemoteException {
}
@@ -121,9 +118,11 @@ public abstract class IccSmsInterfaceManager extends ISms.Stub {
*/
public void sendText(String destAddr, String scAddr,
String text, PendingIntent sentIntent, PendingIntent deliveryIntent) {
- mPhone.getContext().enforceCallingPermission(
- "android.permission.SEND_SMS",
- "Sending SMS message");
+ if (Binder.getCallingPid() != android.os.Process.myPid()) {
+ mPhone.getContext().enforceCallingPermission(
+ "android.permission.SEND_SMS",
+ "Sending SMS message");
+ }
if (Log.isLoggable("SMS", Log.VERBOSE)) {
log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr +
" text='"+ text + "' sentIntent=" +
@@ -159,9 +158,11 @@ public abstract class IccSmsInterfaceManager extends ISms.Stub {
*/
public void sendMultipartText(String destAddr, String scAddr, List<String> parts,
List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents) {
- mPhone.getContext().enforceCallingPermission(
- "android.permission.SEND_SMS",
- "Sending SMS message");
+ if (Binder.getCallingPid() != android.os.Process.myPid()) {
+ mPhone.getContext().enforceCallingPermission(
+ "android.permission.SEND_SMS",
+ "Sending SMS message");
+ }
if (Log.isLoggable("SMS", Log.VERBOSE)) {
int i = 0;
for (String part : parts) {
diff --git a/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java b/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java
index 44882ef..6d824ba 100644
--- a/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java
+++ b/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java
@@ -16,23 +16,58 @@
package com.android.internal.telephony;
-import java.util.Hashtable;
+import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.app.PendingIntent;
+import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.SystemProperties;
+import android.os.UserHandle;
import android.provider.Telephony.Sms.Intents;
import android.telephony.SmsMessage;
public class IccSmsInterfaceManagerProxy extends ISms.Stub {
private IccSmsInterfaceManager mIccSmsInterfaceManager;
- private Hashtable<String, ISmsMiddleware> mMiddleware = new Hashtable<String, ISmsMiddleware>();
+
+ private BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ public void onReceive(Context context, Intent intent) {
+ // check if the message was aborted
+ if (getResultCode() != Activity.RESULT_OK) {
+ return;
+ }
+ String destAddr = getResultData();
+ String scAddr = intent.getStringExtra("scAddr");
+ ArrayList<String> parts = intent.getStringArrayListExtra("parts");
+ ArrayList<PendingIntent> sentIntents = intent.getParcelableArrayListExtra("sentIntents");
+ ArrayList<PendingIntent> deliveryIntents = intent.getParcelableArrayListExtra("deliveryIntents");
+
+ if (intent.getBooleanExtra("multipart", false)) {
+ mIccSmsInterfaceManager.sendMultipartText(destAddr, scAddr,
+ parts, sentIntents, deliveryIntents);
+ return;
+ }
+
+ PendingIntent sentIntent = null;
+ if (sentIntents != null && sentIntents.size() > 0) {
+ sentIntent = sentIntents.get(0);
+ }
+ PendingIntent deliveryIntent = null;
+ if (deliveryIntents != null && deliveryIntents.size() > 0) {
+ deliveryIntent = deliveryIntents.get(0);
+ }
+ String text = null;
+ if (parts != null && parts.size() > 0) {
+ text = parts.get(0);
+ }
+ mIccSmsInterfaceManager.sendText(destAddr, scAddr, text,
+ sentIntent, deliveryIntent);
+ }
+ };
public IccSmsInterfaceManagerProxy(Context context,
IccSmsInterfaceManager iccSmsInterfaceManager) {
@@ -51,19 +86,10 @@ public class IccSmsInterfaceManagerProxy extends ISms.Stub {
private void createWakelock() {
PowerManager pm = (PowerManager)mContext.getSystemService(Context.POWER_SERVICE);
- mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "SMSDispatcher");
+ mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "IccSmsInterfaceManager");
mWakeLock.setReferenceCounted(true);
}
- @Override
- public void registerSmsMiddleware(String name, ISmsMiddleware middleware) throws android.os.RemoteException {
- if (!"1".equals(SystemProperties.get("persist.sys.sms_debug", "0"))) {
- mContext.enforceCallingPermission(
- "android.permission.INTERCEPT_SMS", "");
- }
- mMiddleware.put(name, middleware);
- }
-
private Context mContext;
private PowerManager.WakeLock mWakeLock;
private static final int WAKE_LOCK_TIMEOUT = 5000;
@@ -83,11 +109,8 @@ public class IccSmsInterfaceManagerProxy extends ISms.Stub {
@Override
public void synthesizeMessages(String originatingAddress, String scAddress, List<String> messages, long timestampMillis) throws RemoteException {
- // if not running in debug mode
- if (!"1".equals(SystemProperties.get("persist.sys.sms_debug", "0"))) {
- mContext.enforceCallingPermission(
- "android.permission.BROADCAST_SMS", "");
- }
+ mContext.enforceCallingPermission(
+ android.Manifest.permission.BROADCAST_SMS, "");
byte[][] pdus = new byte[messages.size()][];
for (int i = 0; i < messages.size(); i++) {
SyntheticSmsMessage message = new SyntheticSmsMessage(originatingAddress, scAddress, messages.get(i), timestampMillis);
@@ -116,34 +139,43 @@ public class IccSmsInterfaceManagerProxy extends ISms.Stub {
sentIntent, deliveryIntent);
}
+ private void broadcastOutgoingSms(String destAddr, String scAddr,
+ boolean multipart, ArrayList<String> parts,
+ ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents) {
+ Intent broadcast = new Intent(Intent.ACTION_NEW_OUTGOING_SMS);
+ broadcast.putExtra("destAddr", destAddr);
+ broadcast.putExtra("scAddr", scAddr);
+ broadcast.putExtra("multipart", multipart);
+ broadcast.putStringArrayListExtra("parts", parts);
+ broadcast.putParcelableArrayListExtra("sentIntents", sentIntents);
+ broadcast.putParcelableArrayListExtra("deliveryIntents", deliveryIntents);
+ mContext.sendOrderedBroadcastAsUser(broadcast, UserHandle.OWNER,
+ android.Manifest.permission.INTERCEPT_SMS,
+ mReceiver, null, Activity.RESULT_OK, destAddr, null);
+ }
+
public void sendText(String destAddr, String scAddr,
String text, PendingIntent sentIntent, PendingIntent deliveryIntent) {
- for (ISmsMiddleware middleware: mMiddleware.values()) {
- try {
- if (middleware.onSendText(destAddr, scAddr, text, sentIntent, deliveryIntent))
- return;
- }
- catch (Exception e) {
- // TOOD: remove the busted middleware?
- }
- }
- mIccSmsInterfaceManager.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent);
+ mContext.enforceCallingPermission(
+ android.Manifest.permission.SEND_SMS,
+ "Sending SMS message");
+ ArrayList<String> parts = new ArrayList<String>();
+ parts.add(text);
+ ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>();
+ sentIntents.add(sentIntent);
+ ArrayList<PendingIntent> deliveryIntents = new ArrayList<PendingIntent>();
+ deliveryIntents.add(deliveryIntent);
+ broadcastOutgoingSms(destAddr, scAddr, false, parts, sentIntents, deliveryIntents);
}
public void sendMultipartText(String destAddr, String scAddr,
List<String> parts, List<PendingIntent> sentIntents,
List<PendingIntent> deliveryIntents) throws android.os.RemoteException {
- for (ISmsMiddleware middleware: mMiddleware.values()) {
- try {
- if (middleware.onSendMultipartText(destAddr, scAddr, parts, sentIntents, deliveryIntents))
- return;
- }
- catch (Exception e) {
- // TOOD: remove the busted middleware?
- }
- }
- mIccSmsInterfaceManager.sendMultipartText(destAddr, scAddr,
- parts, sentIntents, deliveryIntents);
+ mContext.enforceCallingPermission(
+ android.Manifest.permission.SEND_SMS,
+ "Sending SMS message");
+ broadcastOutgoingSms(destAddr, scAddr, true, new ArrayList<String>(parts),
+ new ArrayList<PendingIntent>(sentIntents), new ArrayList<PendingIntent>(deliveryIntents));
}
public boolean enableCellBroadcast(int messageIdentifier) throws android.os.RemoteException {
diff --git a/src/java/com/android/internal/telephony/PhoneProxy.java b/src/java/com/android/internal/telephony/PhoneProxy.java
index a1a8d88..38fe68d 100644
--- a/src/java/com/android/internal/telephony/PhoneProxy.java
+++ b/src/java/com/android/internal/telephony/PhoneProxy.java
@@ -31,7 +31,6 @@ import android.telephony.CellInfo;
import android.telephony.CellLocation;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
-import android.telephony.TelephonyManager;
import android.util.Log;
import com.android.internal.telephony.cdma.CDMAPhone;
@@ -56,6 +55,8 @@ public class PhoneProxy extends Handler implements Phone {
private boolean mResetModemOnRadioTechnologyChange = false;
private int mRilVersion;
+ private boolean mRilV7NeedsCDMALTEPhone = SystemProperties.getBoolean(
+ "telephony.rilV7NeedCDMALTEPhone", false);
private static final int EVENT_VOICE_RADIO_TECH_CHANGED = 1;
private static final int EVENT_RADIO_ON = 2;
@@ -147,10 +148,10 @@ public class PhoneProxy extends Handler implements Phone {
private void updatePhoneObject(int newVoiceRadioTech) {
if (mActivePhone != null) {
- int phoneType = TelephonyManager.getPhoneType(TelephonyManager.getDefault().getNetworkType());
- if(mRilVersion >= 6 && getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE && phoneType != PhoneConstants.PHONE_TYPE_GSM) {
+ if((mRilVersion == 6 && getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE) ||
+ mRilV7NeedsCDMALTEPhone) {
/*
- * On v6 RIL or greater, when LTE_ON_CDMA is TRUE, always create CDMALTEPhone
+ * On v6 RIL, when LTE_ON_CDMA is TRUE, always create CDMALTEPhone
* irrespective of the voice radio tech reported.
*/
if (mActivePhone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {