am 45ae7fb1: Merge "Bug 17262099: MMS API changes (multi-project)." into lmp-dev
* commit '45ae7fb1d9981f9b17871c30e210db2a10d19075':
Bug 17262099: MMS API changes (multi-project).
diff --git a/api/current.txt b/api/current.txt
index ce93382..15230c3 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -28855,23 +28855,23 @@
}
public final class SmsManager {
- method public android.net.Uri addMultimediaMessageDraft(byte[]);
+ method public android.net.Uri addMultimediaMessageDraft(android.net.Uri);
method public android.net.Uri addTextMessageDraft(java.lang.String, java.lang.String);
method public boolean archiveStoredConversation(long, boolean);
method public boolean deleteStoredConversation(long);
method public boolean deleteStoredMessage(android.net.Uri);
method public java.util.ArrayList<java.lang.String> divideMessage(java.lang.String);
- method public void downloadMultimediaMessage(java.lang.String, android.content.ContentValues, android.app.PendingIntent);
+ method public void downloadMultimediaMessage(java.lang.String, android.net.Uri, android.content.ContentValues, android.app.PendingIntent);
method public boolean getAutoPersisting();
method public android.os.Bundle getCarrierConfigValues();
method public static android.telephony.SmsManager getDefault();
method public static android.telephony.SmsManager getSmsManagerUsingSubId(long);
method public long getSubId();
- method public android.net.Uri importMultimediaMessage(byte[], java.lang.String, long, boolean, boolean);
+ method public android.net.Uri importMultimediaMessage(android.net.Uri, java.lang.String, long, boolean, boolean);
method public android.net.Uri importTextMessage(java.lang.String, int, java.lang.String, long, boolean, boolean);
method public void injectSmsPdu(byte[], java.lang.String, android.app.PendingIntent);
method public void sendDataMessage(java.lang.String, java.lang.String, short, byte[], android.app.PendingIntent, android.app.PendingIntent);
- method public void sendMultimediaMessage(byte[], java.lang.String, android.content.ContentValues, android.app.PendingIntent);
+ method public void sendMultimediaMessage(android.net.Uri, java.lang.String, android.content.ContentValues, android.app.PendingIntent);
method public void sendMultipartTextMessage(java.lang.String, java.lang.String, java.util.ArrayList<java.lang.String>, java.util.ArrayList<android.app.PendingIntent>, java.util.ArrayList<android.app.PendingIntent>);
method public void sendStoredMultimediaMessage(android.net.Uri, android.content.ContentValues, android.app.PendingIntent);
method public void sendStoredMultipartTextMessage(android.net.Uri, java.lang.String, java.util.ArrayList<android.app.PendingIntent>, java.util.ArrayList<android.app.PendingIntent>);
@@ -28914,6 +28914,7 @@
field public static final java.lang.String MMS_CONFIG_USER_AGENT = "userAgent";
field public static final int MMS_ERROR_HTTP_FAILURE = 4; // 0x4
field public static final int MMS_ERROR_INVALID_APN = 2; // 0x2
+ field public static final int MMS_ERROR_IO_ERROR = 5; // 0x5
field public static final int MMS_ERROR_UNABLE_CONNECT_MMS = 3; // 0x3
field public static final int MMS_ERROR_UNSPECIFIED = 1; // 0x1
field public static final java.lang.String MMS_EXTRA_DATA = "data";
diff --git a/services/core/java/com/android/server/MmsServiceBroker.java b/services/core/java/com/android/server/MmsServiceBroker.java
index 2830b5e..65ad1ce 100644
--- a/services/core/java/com/android/server/MmsServiceBroker.java
+++ b/services/core/java/com/android/server/MmsServiceBroker.java
@@ -192,29 +192,30 @@
// Service API calls implementation, proxied to the real MmsService in "com.android.mms.service"
private final class BinderService extends IMms.Stub {
@Override
- public void sendMessage(long subId, String callingPkg, byte[] pdu, String locationUrl,
- ContentValues configOverrides, PendingIntent sentIntent) throws RemoteException {
+ public void sendMessage(long subId, String callingPkg, Uri contentUri,
+ String locationUrl, ContentValues configOverrides, PendingIntent sentIntent)
+ throws RemoteException {
mContext.enforceCallingPermission(Manifest.permission.SEND_SMS, "Send MMS message");
if (getAppOpsManager().noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
callingPkg) != AppOpsManager.MODE_ALLOWED) {
return;
}
- getServiceGuarded().sendMessage(subId, callingPkg, pdu, locationUrl, configOverrides,
- sentIntent);
+ getServiceGuarded().sendMessage(subId, callingPkg, contentUri, locationUrl,
+ configOverrides, sentIntent);
}
@Override
public void downloadMessage(long subId, String callingPkg, String locationUrl,
- ContentValues configOverrides, PendingIntent downloadedIntent)
- throws RemoteException {
+ Uri contentUri, ContentValues configOverrides,
+ PendingIntent downloadedIntent) throws RemoteException {
mContext.enforceCallingPermission(Manifest.permission.RECEIVE_MMS,
"Download MMS message");
if (getAppOpsManager().noteOp(AppOpsManager.OP_RECEIVE_MMS, Binder.getCallingUid(),
callingPkg) != AppOpsManager.MODE_ALLOWED) {
return;
}
- getServiceGuarded().downloadMessage(subId, callingPkg, locationUrl, configOverrides,
- downloadedIntent);
+ getServiceGuarded().downloadMessage(subId, callingPkg, locationUrl, contentUri,
+ configOverrides, downloadedIntent);
}
@Override
@@ -249,8 +250,9 @@
}
@Override
- public Uri importMultimediaMessage(String callingPkg, byte[] pdu, String messageId,
- long timestampSecs, boolean seen, boolean read) throws RemoteException {
+ public Uri importMultimediaMessage(String callingPkg, Uri contentUri,
+ String messageId, long timestampSecs, boolean seen, boolean read)
+ throws RemoteException {
mContext.enforceCallingPermission(Manifest.permission.WRITE_SMS, "Import MMS message");
if (getAppOpsManager().noteOp(AppOpsManager.OP_WRITE_SMS, Binder.getCallingUid(),
callingPkg) != AppOpsManager.MODE_ALLOWED) {
@@ -259,7 +261,7 @@
return FAKE_MMS_SENT_URI;
}
return getServiceGuarded().importMultimediaMessage(
- callingPkg, pdu, messageId, timestampSecs, seen, read);
+ callingPkg, contentUri, messageId, timestampSecs, seen, read);
}
@Override
@@ -317,7 +319,8 @@
}
@Override
- public Uri addMultimediaMessageDraft(String callingPkg, byte[] pdu) throws RemoteException {
+ public Uri addMultimediaMessageDraft(String callingPkg, Uri contentUri)
+ throws RemoteException {
mContext.enforceCallingPermission(Manifest.permission.WRITE_SMS, "Add MMS draft");
if (getAppOpsManager().noteOp(AppOpsManager.OP_WRITE_SMS, Binder.getCallingUid(),
callingPkg) != AppOpsManager.MODE_ALLOWED) {
@@ -325,7 +328,7 @@
// while writing the TelephonyProvider
return FAKE_MMS_DRAFT_URI;
}
- return getServiceGuarded().addMultimediaMessageDraft(callingPkg, pdu);
+ return getServiceGuarded().addMultimediaMessageDraft(callingPkg, contentUri);
}
@Override
diff --git a/telephony/java/com/android/internal/telephony/IMms.aidl b/telephony/java/com/android/internal/telephony/IMms.aidl
index 2aeb42f..63b7a53 100644
--- a/telephony/java/com/android/internal/telephony/IMms.aidl
+++ b/telephony/java/com/android/internal/telephony/IMms.aidl
@@ -30,7 +30,8 @@
*
* @param subId the SIM id
* @param callingPkg the package name of the calling app
- * @param pdu the MMS message encoded in standard MMS PDU format
+ * @param contentUri the content uri from which to read MMS message encoded in standard MMS
+ * PDU format
* @param locationUrl the optional location url for where this message should be sent to
* @param configOverrides the carrier-specific messaging configuration values to override for
* sending the message. See {@link android.telephony.MessagingConfigurationManager} for the
@@ -38,8 +39,8 @@
* @param sentIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is successfully sent, or failed
*/
- void sendMessage(long subId, String callingPkg, in byte[] pdu, String locationUrl,
- in ContentValues configOverrides, in PendingIntent sentIntent);
+ void sendMessage(long subId, String callingPkg, in Uri contentUri,
+ String locationUrl, in ContentValues configOverrides, in PendingIntent sentIntent);
/**
* Download an MMS message using known location and transaction id
@@ -48,6 +49,7 @@
* @param callingPkg the package name of the calling app
* @param locationUrl the location URL of the MMS message to be downloaded, usually obtained
* from the MMS WAP push notification
+ * @param contentUri a contentUri to which the downloaded MMS message will be written
* @param configOverrides the carrier-specific messaging configuration values to override for
* downloading the message. See {@link android.telephony.MessagingConfigurationManager} for the
* value names and types.
@@ -55,7 +57,8 @@
* broadcast when the message is downloaded, or the download is failed
*/
void downloadMessage(long subId, String callingPkg, String locationUrl,
- in ContentValues configOverrides, in PendingIntent downloadedIntent);
+ in Uri contentUri, in ContentValues configOverrides,
+ in PendingIntent downloadedIntent);
/**
* Update the status of a pending (send-by-IP) MMS message handled by the carrier app.
@@ -104,14 +107,14 @@
* Import a multimedia message into system's MMS store
*
* @param callingPkg the package name of the calling app
- * @param pdu the PDU of the message to import
+ * @param contentUri the content uri from which to read PDU of the message to import
* @param messageId the optional message id
* @param timestampSecs the message timestamp in seconds
* @param seen if the message is seen
* @param read if the message is read
* @return the message URI, null if failed
*/
- Uri importMultimediaMessage(String callingPkg, in byte[] pdu, String messageId,
+ Uri importMultimediaMessage(String callingPkg, in Uri contentUri, String messageId,
long timestampSecs, boolean seen, boolean read);
/**
@@ -168,10 +171,10 @@
* Add a multimedia message draft to system MMS store
*
* @param callingPkg the package name of the calling app
- * @param pdu the PDU data of the draft MMS
+ * @param contentUri the content Uri from which to read PDU data of the draft MMS
* @return the URI of the stored draft message
*/
- Uri addMultimediaMessageDraft(String callingPkg, in byte[] pdu);
+ Uri addMultimediaMessageDraft(String callingPkg, in Uri contentUri);
/**
* Send a system stored MMS message