summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYe Wen <ywen@google.com>2014-05-28 15:28:50 -0700
committerYe Wen <ywen@google.com>2014-06-04 10:52:16 -0700
commit2b05813054a7c94bd981a5ffcd420423faaa3876 (patch)
tree7aef3b9e738abac7c370d3fd7c5fa5f2666ff800
parent144df2c53c194ce94e4a99fce1f9ad8c49845189 (diff)
downloadmms-2b05813054a7c94bd981a5ffcd420423faaa3876.tar.gz
MMS API: simplified API and bug fixes
- Removed PendingIntents for delivery and read reports to simplify API definition. - Fixed a couple bugs related to downloading mms. b/14095333 Change-Id: I3c591c6b6fc2e3c3397908ac48f6bce01f95e373
-rw-r--r--src/java/android/telephony/MmsManager.java29
-rw-r--r--src/java/com/android/internal/telephony/mms/IMms.aidl14
2 files changed, 20 insertions, 23 deletions
diff --git a/src/java/android/telephony/MmsManager.java b/src/java/android/telephony/MmsManager.java
index 2b9a7f6..d486bb5 100644
--- a/src/java/android/telephony/MmsManager.java
+++ b/src/java/android/telephony/MmsManager.java
@@ -36,6 +36,16 @@ public final class MmsManager {
private static final MmsManager sInstance = new MmsManager();
+ // MMS send/download failure result codes
+
+ public static final int RESULT_ERROR_UNSPECIFIED = 1;
+ public static final int RESULT_ERROR_INVALID_APN = 2;
+ public static final int RESULT_ERROR_UNABLE_CONNECT_MMS = 3;
+ public static final int RESULT_ERROR_HTTP_FAILURE = 4;
+
+ // Intent extra name for result data
+ public static final String EXTRA_DATA = "data";
+
/**
* Get the default instance of the MmsManager
*
@@ -53,15 +63,11 @@ public final class MmsManager {
* Send an MMS message
*
* @param pdu the MMS message encoded in standard MMS PDU format
+ * @param locationUrl the optional location url where message should be sent to
* @param sentIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is successfully sent, or failed
- * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
- * broadcast when the message is delivered to the recipient
- * @param readIntent if not NULL this <code>PendingIntent</code> is
- * broadcast when the message is read by the recipient
*/
- public void sendMessage(byte[] pdu, PendingIntent sentIntent, PendingIntent deliveryIntent,
- PendingIntent readIntent) {
+ public void sendMessage(byte[] pdu, String locationUrl, PendingIntent sentIntent) {
if (pdu == null || pdu.length == 0) {
throw new IllegalArgumentException("Empty or zero length PDU");
}
@@ -71,7 +77,7 @@ public final class MmsManager {
Log.e(LOG_TAG, "Can not find Mms service");
return;
}
- iMms.sendMessage(pdu, sentIntent, deliveryIntent, readIntent);
+ iMms.sendMessage(pdu, locationUrl, sentIntent);
} catch (RemoteException e) {
// Ignore it
}
@@ -82,23 +88,20 @@ public final class MmsManager {
*
* @param locationUrl the location URL of the MMS message to be downloaded, usually obtained
* from the MMS WAP push notification
- * @param transactionId the transaction ID of the MMS message, usually obtained from the
- * MMS WAP push notification
* @param downloadedIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is downloaded, or the download is failed
*/
- public void downloadMessage(String locationUrl, String transactionId,
- PendingIntent downloadedIntent) {
+ public void downloadMessage(String locationUrl, PendingIntent downloadedIntent) {
if (TextUtils.isEmpty(locationUrl)) {
throw new IllegalArgumentException("Empty MMS location URL");
}
try {
final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService(SERVICE));
- if (iMms != null) {
+ if (iMms == null) {
Log.e(LOG_TAG, "Can not find Mms service");
return;
}
- iMms.downloadMessage(locationUrl, transactionId, downloadedIntent);
+ iMms.downloadMessage(locationUrl, downloadedIntent);
} catch (RemoteException e) {
// Ignore it
}
diff --git a/src/java/com/android/internal/telephony/mms/IMms.aidl b/src/java/com/android/internal/telephony/mms/IMms.aidl
index 6f410c2..3f5ed9d 100644
--- a/src/java/com/android/internal/telephony/mms/IMms.aidl
+++ b/src/java/com/android/internal/telephony/mms/IMms.aidl
@@ -26,25 +26,19 @@ interface IMms {
* Send an MMS message
*
* @param pdu the MMS message encoded in standard MMS PDU format
+ * @param locationUrl the optional location url for where this message should be sent to
* @param sentIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is successfully sent, or failed
- * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
- * broadcast when the message is delivered to the recipient
- * @param readIntent if not NULL this <code>PendingIntent</code> is
- * broadcast when the message is read by the recipient
*/
- void sendMessage(in byte[] pdu, in PendingIntent sentIntent, in PendingIntent deliveryIntent,
- in PendingIntent readIntent);
+ void sendMessage(in byte[] pdu, String locationUrl, in PendingIntent sentIntent);
/**
* Download an MMS message using known location and transaction id
*
- * @param location the location URL of the MMS message to be downloaded, usually obtained
+ * @param locationUrl the location URL of the MMS message to be downloaded, usually obtained
* from the MMS WAP push notification
- * @param transactionId the transaction ID of the MMS message, usually obtained from the
- * MMS WAP push notification
* @param downloadedIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is downloaded, or the download is failed
*/
- void downloadMessage(String location, String transactionId, in PendingIntent downloadedIntent);
+ void downloadMessage(String locationUrl, in PendingIntent downloadedIntent);
}