aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdnan Begovic <adnan@cyngn.com>2014-12-10 22:38:55 -0800
committerAdnan Begovic <adnan@cyngn.com>2015-01-26 13:18:17 -0800
commit5c16927dd2ffa59f62d6ea614bc16cf67b1e1128 (patch)
treee628d2afbdf0e8b6a84e4dcb72bb3dda5b4f3ba0
parenta1f8499300d893c5b105351ef8e2f5188000892d (diff)
downloadandroid_frameworks_opt_telephony-5c16927dd2ffa59f62d6ea614bc16cf67b1e1128.tar.gz
android_frameworks_opt_telephony-5c16927dd2ffa59f62d6ea614bc16cf67b1e1128.tar.bz2
android_frameworks_opt_telephony-5c16927dd2ffa59f62d6ea614bc16cf67b1e1128.zip
Telephony: Implement and override new Sms methods.
Change-Id: I15952dad6a79a02e718c245aa945d80339c58b93
-rw-r--r--src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java286
-rw-r--r--src/java/com/android/internal/telephony/PhoneProxy.java8
-rw-r--r--src/java/com/android/internal/telephony/ProxyController.java2
-rw-r--r--src/java/com/android/internal/telephony/UiccSmsController.java7
4 files changed, 267 insertions, 36 deletions
diff --git a/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java b/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java
index 188746f58..406b3c625 100644
--- a/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java
+++ b/src/java/com/android/internal/telephony/IccSmsInterfaceManagerProxy.java
@@ -27,15 +27,20 @@ import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.net.Uri;
import android.os.Handler;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.provider.Telephony.Sms.Intents;
+import android.telephony.Rlog;
import android.telephony.SmsMessage;
+import android.util.Log;
public class IccSmsInterfaceManagerProxy extends ISms.Stub {
+ static final String LOG_TAG = "IccSmsInterfaceManagerProxy";
+
private IccSmsInterfaceManager mIccSmsInterfaceManager;
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
@@ -56,6 +61,12 @@ public class IccSmsInterfaceManagerProxy extends ISms.Stub {
}
if (intent.getBooleanExtra("multipart", false)) {
+ if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
+ log("ProxiedMultiPartSms destAddr: " + destAddr +
+ "\n scAddr=" + scAddr +
+ "\n callingPackage=" + callingPackage +
+ "\n partsSize=" + parts.size());
+ }
mIccSmsInterfaceManager.sendMultipartText(callingPackage, destAddr, scAddr,
parts, sentIntents, deliveryIntents);
return;
@@ -73,6 +84,11 @@ public class IccSmsInterfaceManagerProxy extends ISms.Stub {
if (parts != null && parts.size() > 0) {
text = parts.get(0);
}
+ if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
+ log("ProxiedSms destAddr: " + destAddr +
+ "\n scAddr=" + scAddr +
+ "\n callingPackage=" + callingPackage);
+ }
mIccSmsInterfaceManager.sendText(callingPackage, destAddr, scAddr, text,
sentIntent, deliveryIntent);
}
@@ -99,6 +115,10 @@ public class IccSmsInterfaceManagerProxy extends ISms.Stub {
mWakeLock.setReferenceCounted(true);
}
+ private long getDefaultSmsSubId() {
+ return SubscriptionController.getInstance().getDefaultSmsSubId();
+ }
+
private Context mContext;
private PowerManager.WakeLock mWakeLock;
private static final int WAKE_LOCK_TIMEOUT = 5000;
@@ -106,10 +126,17 @@ public class IccSmsInterfaceManagerProxy extends ISms.Stub {
private void dispatchPdus(byte[][] pdus) {
Intent intent = new Intent(Intents.SMS_DELIVER_ACTION);
// Direct the intent to only the default SMS app. If we can't find a default SMS app
- // then sent it to all broadcast receivers.
+ // then send it to all broadcast receivers.
ComponentName componentName = SmsApplication.getDefaultSmsApplication(mContext, true);
if (componentName == null)
return;
+
+ if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
+ log("dispatchPdu pdus: " + pdus +
+ "\n componentName=" + componentName +
+ "\n format=" + SmsMessage.FORMAT_SYNTHETIC);
+ }
+
// Deliver SMS message only to this receiver
intent.setComponent(componentName);
intent.putExtra("pdus", pdus);
@@ -130,12 +157,15 @@ public class IccSmsInterfaceManagerProxy extends ISms.Stub {
mHandler, Activity.RESULT_OK, null, null);
}
- public void synthesizeMessages(String originatingAddress, String scAddress, List<String> messages, long timestampMillis) throws RemoteException {
+ public void synthesizeMessages(
+ String originatingAddress, String scAddress, List<String> messages,
+ long timestampMillis) throws RemoteException {
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);
+ SyntheticSmsMessage message = new SyntheticSmsMessage(originatingAddress,
+ scAddress, messages.get(i), timestampMillis);
pdus[i] = message.getPdu();
}
dispatchPdus(pdus);
@@ -160,15 +190,17 @@ public class IccSmsInterfaceManagerProxy extends ISms.Stub {
@Override
public void sendData(String callingPackage, String destAddr, String scAddr, int destPort,
- byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) {
- mIccSmsInterfaceManager.sendData(callingPackage, destAddr, scAddr, destPort, data,
- sentIntent, deliveryIntent);
+ byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent)
+ throws RemoteException {
+ sendDataForSubscriber(getDefaultSmsSubId(), callingPackage, destAddr, scAddr, destPort,
+ data, sentIntent, deliveryIntent);
}
- private void broadcastOutgoingSms(String callingPackage, String destAddr, String scAddr,
- boolean multipart, ArrayList<String> parts,
- ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents,
- int priority) {
+ private void broadcastOutgoingSms(
+ String callingPackage, String destAddr, String scAddr, boolean multipart,
+ ArrayList<String> parts, ArrayList<PendingIntent> sentIntents,
+ ArrayList<PendingIntent> deliveryIntents, int priority, boolean isExpectMore,
+ int validityPeriod) {
Intent broadcast = new Intent(Intent.ACTION_NEW_OUTGOING_SMS);
broadcast.putExtra("destAddr", destAddr);
broadcast.putExtra("scAddr", scAddr);
@@ -179,6 +211,22 @@ public class IccSmsInterfaceManagerProxy extends ISms.Stub {
broadcast.putParcelableArrayListExtra("sentIntents", sentIntents);
broadcast.putParcelableArrayListExtra("deliveryIntents", deliveryIntents);
broadcast.putExtra("priority", priority);
+ broadcast.putExtra("isExpectMore", isExpectMore);
+ broadcast.putExtra("validityPeriod", validityPeriod);
+
+ if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
+ log("Broadcasting sms destAddr: " + destAddr +
+ "\n scAddr=" + scAddr +
+ "\n multipart=" + multipart +
+ "\n callingPackager=" + callingPackage +
+ "\n callingUid=" + android.os.Binder.getCallingUid() +
+ "\n parts=" + parts.size() +
+ "\n sentIntents=" + sentIntents.size() +
+ "\n deliveryIntents=" + deliveryIntents.size() +
+ "\n priority=" + priority +
+ "\n isExpectMore=" + isExpectMore +
+ "\n validityPeriod=" + validityPeriod);
+ }
mContext.sendOrderedBroadcastAsUser(broadcast, UserHandle.OWNER,
android.Manifest.permission.INTERCEPT_SMS,
mReceiver, null, Activity.RESULT_OK, destAddr, null);
@@ -186,71 +234,247 @@ public class IccSmsInterfaceManagerProxy extends ISms.Stub {
@Override
public void sendText(String callingPackage, String destAddr, String scAddr,
- String text, PendingIntent sentIntent, PendingIntent deliveryIntent) {
+ String text, PendingIntent sentIntent, PendingIntent deliveryIntent)
+ throws RemoteException {
+ sendTextForSubscriber(getDefaultSmsSubId(), callingPackage, destAddr, scAddr,
+ text, sentIntent, deliveryIntent);
+ }
+
+ @Override
+ public void sendMultipartText(String callingPackage, String destAddr, String scAddr,
+ List<String> parts, List<PendingIntent> sentIntents,
+ List<PendingIntent> deliveryIntents) throws RemoteException{
+ sendMultipartTextForSubscriber(getDefaultSmsSubId(), callingPackage, destAddr,
+ scAddr, parts, sentIntents, deliveryIntents);
+ }
+
+ @Override
+ public List<SmsRawData> getAllMessagesFromIccEfForSubscriber(
+ long subId, String callingPkg) throws RemoteException {
+ return mIccSmsInterfaceManager.getAllMessagesFromIccEf(callingPkg);
+ }
+
+ @Override
+ public boolean updateMessageOnIccEfForSubscriber(
+ long subId, String callingPkg,
+ int messageIndex, int newStatus, byte[] pdu) throws RemoteException {
+ return mIccSmsInterfaceManager.updateMessageOnIccEf(callingPkg,
+ messageIndex, newStatus, pdu);
+ }
+
+ @Override
+ public boolean copyMessageToIccEfForSubscriber(
+ long subId, String callingPkg, int status,
+ byte[] pdu, byte[] smsc) throws RemoteException {
+ return mIccSmsInterfaceManager.copyMessageToIccEf(callingPkg, status, pdu, smsc);
+ }
+
+ @Override
+ public void sendDataForSubscriber(
+ long subId, String callingPkg, String destAddr,
+ String scAddr, int destPort, byte[] data, PendingIntent sentIntent,
+ PendingIntent deliveryIntent) throws RemoteException {
+ mIccSmsInterfaceManager.sendData(callingPkg, destAddr, scAddr, destPort, data,
+ sentIntent, deliveryIntent);
+ }
+
+ @Override
+ public void sendDataWithOrigPort(
+ String callingPkg, String destAddr, String scAddr,
+ int destPort, int origPort, byte[] data, PendingIntent sentIntent,
+ PendingIntent deliveryIntent) throws RemoteException {
+ sendDataWithOrigPortUsingSubscriber(getDefaultSmsSubId(), callingPkg, destAddr,
+ scAddr, destPort, origPort, data, sentIntent, deliveryIntent);
+ }
+
+ @Override
+ public void sendDataWithOrigPortUsingSubscriber(
+ long subId, String callingPkg, String destAddr, String scAddr,
+ int destPort, int origPort, byte[] data, PendingIntent sentIntent,
+ PendingIntent deliveryIntent) throws RemoteException {
+ mIccSmsInterfaceManager.sendDataWithOrigPort(callingPkg, destAddr, scAddr, destPort,
+ origPort, data, sentIntent, deliveryIntent);
+ }
+
+ @Override
+ public void sendTextForSubscriber(
+ long subId, String callingPkg, String destAddr, String scAddr, String text,
+ PendingIntent sentIntent, PendingIntent deliveryIntent) throws RemoteException {
+ sendTextWithOptionsUsingSubscriber(subId, callingPkg, destAddr, scAddr, text,
+ sentIntent, deliveryIntent, -1, false, -1);
+ }
+
+ @Override
+ public void sendTextWithOptionsUsingSubscriber(
+ long subId, String callingPkg, String destAddr, String scAddr, String text,
+ PendingIntent sentIntent, PendingIntent deliveryIntent, int priority,
+ boolean isExpectMore, int validityPeriod) throws RemoteException {
mContext.enforceCallingPermission(
android.Manifest.permission.SEND_SMS,
"Sending SMS message");
+ if (mIccSmsInterfaceManager.isShortSMSCode(destAddr)) {
+ mIccSmsInterfaceManager.sendTextWithOptions(callingPkg, destAddr, scAddr, text,
+ sentIntent, deliveryIntent, priority, isExpectMore, validityPeriod);
+ return;
+ }
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(callingPackage, destAddr, scAddr, false, parts, sentIntents,
- deliveryIntents, -1);
+ broadcastOutgoingSms(callingPkg, destAddr, scAddr, false, parts, sentIntents,
+ deliveryIntents, priority, isExpectMore, validityPeriod);
}
@Override
- public void sendMultipartText(String callingPackage, String destAddr, String scAddr,
- List<String> parts, List<PendingIntent> sentIntents,
- List<PendingIntent> deliveryIntents) {
- mContext.enforceCallingPermission(
- android.Manifest.permission.SEND_SMS,
- "Sending SMS message");
- broadcastOutgoingSms(callingPackage, destAddr, scAddr, true, new ArrayList<String>(parts),
- new ArrayList<PendingIntent>(sentIntents), new ArrayList<PendingIntent>(deliveryIntents),
- -1);
+ public void injectSmsPdu(byte[] pdu, String format,
+ PendingIntent receivedIntent) throws RemoteException {
+ injectSmsPduForSubscriber(getDefaultSmsSubId(), pdu, format, receivedIntent);
}
+ // FIXME: This needs to be by subscription
@Override
- public boolean enableCellBroadcast(int messageIdentifier) throws android.os.RemoteException {
- return mIccSmsInterfaceManager.enableCellBroadcast(messageIdentifier);
+ public void injectSmsPduForSubscriber(long subId, byte[] pdu, String format,
+ PendingIntent receivedIntent) throws RemoteException {
+ mIccSmsInterfaceManager.injectSmsPdu(pdu, format, receivedIntent);
}
@Override
- public boolean disableCellBroadcast(int messageIdentifier) throws android.os.RemoteException {
- return mIccSmsInterfaceManager.disableCellBroadcast(messageIdentifier);
+ public void updateSmsSendStatus(int messageRef, boolean success) throws RemoteException {
+ mIccSmsInterfaceManager.updateSmsSendStatus(messageRef, success);
}
@Override
+ public void sendMultipartTextForSubscriber(
+ long subId, String callingPkg, String destinationAddress,
+ String scAddress, List<String> parts, List<PendingIntent> sentIntents,
+ List<PendingIntent> deliveryIntents) throws RemoteException {
+ sendMultipartTextWithOptionsUsingSubscriber(subId, callingPkg, destinationAddress,
+ scAddress, parts, sentIntents, deliveryIntents, -1, false, -1);
+ }
+
+ @Override
+ public void sendMultipartTextWithOptionsUsingSubscriber(
+ long subId, String callingPkg, String destinationAddress, String scAddress,
+ List<String> parts, List<PendingIntent> sentIntents,
+ List<PendingIntent> deliveryIntents, int priority, boolean isExpectMore,
+ int validityPeriod) throws RemoteException {
+ mContext.enforceCallingPermission(
+ android.Manifest.permission.SEND_SMS,
+ "Sending SMS message");
+ if (mIccSmsInterfaceManager.isShortSMSCode(destinationAddress)) {
+ mIccSmsInterfaceManager.sendMultipartTextWithOptions(callingPkg, destinationAddress,
+ scAddress, parts, sentIntents, deliveryIntents, -1, false, -1);
+ return;
+ }
+ broadcastOutgoingSms(callingPkg, destinationAddress, scAddress, true,
+ parts != null ? new ArrayList<String>(parts) : null,
+ sentIntents != null ? new ArrayList<PendingIntent>(sentIntents) : null,
+ deliveryIntents != null ? new ArrayList<PendingIntent>(deliveryIntents) : null,
+ -1, false, -1);
+ }
+
+ public boolean enableCellBroadcast(int messageIdentifier) throws android.os.RemoteException {
+ return enableCellBroadcastForSubscriber(getDefaultSmsSubId(), messageIdentifier);
+ }
+
+ public boolean enableCellBroadcastForSubscriber(long subId, int messageIdentifier)
+ throws android.os.RemoteException {
+ return enableCellBroadcastRangeForSubscriber(subId, messageIdentifier, messageIdentifier);
+ }
+
public boolean enableCellBroadcastRange(int startMessageId, int endMessageId)
throws android.os.RemoteException {
+ return enableCellBroadcastRangeForSubscriber(getDefaultSmsSubId(), startMessageId,
+ endMessageId);
+ }
+
+ public boolean enableCellBroadcastRangeForSubscriber(
+ long subId, int startMessageId, int endMessageId) throws android.os.RemoteException {
return mIccSmsInterfaceManager.enableCellBroadcastRange(startMessageId, endMessageId);
}
- @Override
+
+ public boolean disableCellBroadcast(int messageIdentifier) throws android.os.RemoteException {
+ return disableCellBroadcastForSubscriber(getDefaultSmsSubId(), messageIdentifier);
+ }
+
+ public boolean disableCellBroadcastForSubscriber(long subId, int messageIdentifier)
+ throws android.os.RemoteException {
+ return disableCellBroadcastRangeForSubscriber(subId, messageIdentifier, messageIdentifier);
+ }
+
public boolean disableCellBroadcastRange(int startMessageId, int endMessageId)
throws android.os.RemoteException {
+ return disableCellBroadcastRangeForSubscriber(getDefaultSmsSubId(), startMessageId,
+ endMessageId);
+ }
+
+ public boolean disableCellBroadcastRangeForSubscriber(
+ long subId, int startMessageId, int endMessageId) throws android.os.RemoteException {
return mIccSmsInterfaceManager.disableCellBroadcastRange(startMessageId, endMessageId);
}
- @Override
public int getPremiumSmsPermission(String packageName) {
- return mIccSmsInterfaceManager.getPremiumSmsPermission(packageName);
+ return getPremiumSmsPermissionForSubscriber(getDefaultSmsSubId(), packageName);
}
@Override
+ public int getPremiumSmsPermissionForSubscriber(long subId, String packageName) {
+ return mIccSmsInterfaceManager.getPremiumSmsPermission(packageName);
+ }
+
public void setPremiumSmsPermission(String packageName, int permission) {
+ setPremiumSmsPermissionForSubscriber(getDefaultSmsSubId(), packageName, permission);
+ }
+
+ @Override
+ public void setPremiumSmsPermissionForSubscriber(long subId, String packageName,
+ int permission) {
mIccSmsInterfaceManager.setPremiumSmsPermission(packageName, permission);
}
+ public boolean isImsSmsSupported() {
+ return isImsSmsSupportedForSubscriber(getDefaultSmsSubId());
+ }
+
@Override
- public boolean isImsSmsSupported() throws RemoteException {
+ public boolean isImsSmsSupportedForSubscriber(long subId) {
return mIccSmsInterfaceManager.isImsSmsSupported();
}
+ public String getImsSmsFormat() {
+ return getImsSmsFormatForSubscriber(getDefaultSmsSubId());
+ }
+
@Override
- public String getImsSmsFormat() throws RemoteException {
+ public String getImsSmsFormatForSubscriber(long subId) {
return mIccSmsInterfaceManager.getImsSmsFormat();
}
+
+ @Override
+ public void sendStoredText(
+ long subId, String callingPkg, Uri messageUri, String scAddress,
+ PendingIntent sentIntent, PendingIntent deliveryIntent) throws RemoteException {
+ mIccSmsInterfaceManager.sendStoredText(callingPkg, messageUri, scAddress, sentIntent,
+ deliveryIntent);
+ }
+
+ @Override
+ public void sendStoredMultipartText(long subId, String callingPkg, Uri messageUri,
+ String scAddress, List<PendingIntent> sentIntents,
+ List<PendingIntent> deliveryIntents) {
+ mIccSmsInterfaceManager.sendStoredMultipartText(callingPkg, messageUri, scAddress,
+ sentIntents, deliveryIntents);
+ }
+
+ @Override
+ public int getSmsCapacityOnIccForSubscriber(long subId) throws RemoteException {
+ return mIccSmsInterfaceManager.getSmsCapacityOnIcc();
+ }
+
+ protected void log(String msg) {
+ Log.d(LOG_TAG, "[IccSmsInterfaceManagerProxy] " + msg);
+ }
}
diff --git a/src/java/com/android/internal/telephony/PhoneProxy.java b/src/java/com/android/internal/telephony/PhoneProxy.java
index 0d9130eb3..f359faf28 100644
--- a/src/java/com/android/internal/telephony/PhoneProxy.java
+++ b/src/java/com/android/internal/telephony/PhoneProxy.java
@@ -89,13 +89,13 @@ public class PhoneProxy extends Handler implements Phone {
mCommandsInterface.registerForVoiceRadioTechChanged(
this, EVENT_VOICE_RADIO_TECH_CHANGED, null);
mPhoneId = phone.getPhoneId();
- mIccCardProxy = new IccCardProxy(mActivePhone.getContext(),
- mCommandsInterface, mActivePhone.getPhoneId());
- mIccSmsInterfaceManager =
- new IccSmsInterfaceManager((PhoneBase)this.mActivePhone);
mIccSmsInterfaceManagerProxy =
new IccSmsInterfaceManagerProxy(mActivePhone.getContext(), mIccSmsInterfaceManager);
+ mIccSmsInterfaceManager =
+ new IccSmsInterfaceManager((PhoneBase)this.mActivePhone);
mIccSmsInterfaceManagerProxy.setmIccSmsInterfaceManager(mIccSmsInterfaceManager);
+ mIccCardProxy = new IccCardProxy(mActivePhone.getContext(),
+ mCommandsInterface, mActivePhone.getPhoneId());
if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) {
// For the purpose of IccCardProxy we only care about the technology family
diff --git a/src/java/com/android/internal/telephony/ProxyController.java b/src/java/com/android/internal/telephony/ProxyController.java
index 49f062d89..a3ed53668 100644
--- a/src/java/com/android/internal/telephony/ProxyController.java
+++ b/src/java/com/android/internal/telephony/ProxyController.java
@@ -101,7 +101,7 @@ public class ProxyController {
mDctController = DctController.makeDctController((PhoneProxy[])phoneProxy, t.getLooper());
mUiccPhoneBookController = new UiccPhoneBookController(mProxyPhones);
mPhoneSubInfoController = new PhoneSubInfoController(mProxyPhones);
- mUiccSmsController = new UiccSmsController(mProxyPhones);
+ //mUiccSmsController = new UiccSmsController(mProxyPhones);
// mSubscriptionManager = SubscriptionManager.getInstance(context, uiccController, ci);
logd("Constructor - Exit");
diff --git a/src/java/com/android/internal/telephony/UiccSmsController.java b/src/java/com/android/internal/telephony/UiccSmsController.java
index 45084d557..90a89ca82 100644
--- a/src/java/com/android/internal/telephony/UiccSmsController.java
+++ b/src/java/com/android/internal/telephony/UiccSmsController.java
@@ -37,6 +37,7 @@ import java.util.List;
* access Sms in Icc.
*/
public class UiccSmsController extends ISms.Stub {
+
static final String LOG_TAG = "RIL_UiccSmsController";
protected Phone[] mPhone;
@@ -340,6 +341,12 @@ public class UiccSmsController extends ISms.Stub {
getIccSmsInterfaceManager(subId).injectSmsPdu(pdu, format, receivedIntent);
}
+ @Override
+ public void synthesizeMessages(String originatingAddress,
+ String scAddress, List<String> messages,
+ long timestampMillis) throws RemoteException {
+ }
+
/**
* get sms interface manager object based on subscription.
**/