summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Taylor <tomtaylor@google.com>2020-11-24 14:49:00 -0800
committerAmit Mahajan <amitmahajan@google.com>2021-02-18 04:58:47 +0000
commite8198d1dc009058df382721279e54afd7aa574f0 (patch)
treef373a05970605ad143bc8f024ede6a8cddd5303e
parent4b1d7b3703f9c58d84dbc49095ff4b817f17eaae (diff)
Add messageId to both of the MMS methods
There are two MMS-related methods in SmsManager, one to send a multimedia message and one to download a multimedia message. In R, a messageId parameter was added to the various SMS sending methods. The messageId allows for eventual increased reliablility. The messageId parameter was added to MmsManager for R, but MmsManager was ultimately hidden in R. This change applies the same treatment to the two MMS methods in S, that was applied to the SMS methods in R. Test: manual testing and atest MmsTest Bug: 163413552 Merged-in: Ic8e59b652967ab1296a92a1d5727dc226cb190fb Change-Id: Ic8e59b652967ab1296a92a1d5727dc226cb190fb
-rw-r--r--core/api/current.txt2
-rw-r--r--telephony/java/android/telephony/SmsManager.java68
2 files changed, 68 insertions, 2 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index c7710fcf7968..5296e7a660f5 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -41787,6 +41787,7 @@ package android.telephony {
method @NonNull public android.telephony.SmsManager createForSubscriptionId(int);
method public java.util.ArrayList<java.lang.String> divideMessage(String);
method public void downloadMultimediaMessage(android.content.Context, String, android.net.Uri, android.os.Bundle, android.app.PendingIntent);
+ method public void downloadMultimediaMessage(@NonNull android.content.Context, @NonNull String, @NonNull android.net.Uri, @Nullable android.os.Bundle, @Nullable android.app.PendingIntent, long);
method @NonNull public android.os.Bundle getCarrierConfigValues();
method @Deprecated public static android.telephony.SmsManager getDefault();
method public static int getDefaultSmsSubscriptionId();
@@ -41798,6 +41799,7 @@ package android.telephony {
method public void injectSmsPdu(byte[], String, android.app.PendingIntent);
method public void sendDataMessage(String, String, short, byte[], android.app.PendingIntent, android.app.PendingIntent);
method public void sendMultimediaMessage(android.content.Context, android.net.Uri, String, android.os.Bundle, android.app.PendingIntent);
+ method public void sendMultimediaMessage(@NonNull android.content.Context, @NonNull android.net.Uri, @Nullable String, @Nullable android.os.Bundle, @Nullable android.app.PendingIntent, long);
method public void sendMultipartTextMessage(String, String, java.util.ArrayList<java.lang.String>, java.util.ArrayList<android.app.PendingIntent>, java.util.ArrayList<android.app.PendingIntent>);
method public void sendMultipartTextMessage(@NonNull String, @Nullable String, @NonNull java.util.List<java.lang.String>, @Nullable java.util.List<android.app.PendingIntent>, @Nullable java.util.List<android.app.PendingIntent>, long);
method public void sendMultipartTextMessage(@NonNull String, @Nullable String, @NonNull java.util.List<java.lang.String>, @Nullable java.util.List<android.app.PendingIntent>, @Nullable java.util.List<android.app.PendingIntent>, @NonNull String, @Nullable String);
diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java
index 6c013df66840..4926687f6724 100644
--- a/telephony/java/android/telephony/SmsManager.java
+++ b/telephony/java/android/telephony/SmsManager.java
@@ -2649,6 +2649,37 @@ public final class SmsManager {
*/
public void sendMultimediaMessage(Context context, Uri contentUri, String locationUrl,
Bundle configOverrides, PendingIntent sentIntent) {
+ sendMultimediaMessage(context, contentUri, locationUrl, configOverrides, sentIntent,
+ 0L /* messageId */);
+ }
+
+ /**
+ * Send an MMS message
+ *
+ * Same as {@link #sendMultimediaMessage(Context context, Uri contentUri, String locationUrl,
+ * Bundle configOverrides, PendingIntent sentIntent)}, but adds an optional messageId.
+ * <p class="note"><strong>Note:</strong> If {@link #getDefault()} is used to instantiate this
+ * manager on a multi-SIM device, this operation may fail sending the MMS message because no
+ * suitable default subscription could be found. In this case, if {@code sentIntent} is
+ * non-null, then the {@link PendingIntent} will be sent with an error code
+ * {@code RESULT_NO_DEFAULT_SMS_APP}. See {@link #getDefault()} for more information on the
+ * conditions where this operation may fail.
+ * </p>
+ *
+ * @param context application context
+ * @param contentUri the content Uri from which the message pdu will be read
+ * @param locationUrl the optional location url where message should be sent to
+ * @param configOverrides the carrier-specific messaging configuration values to override for
+ * sending the message.
+ * @param sentIntent if not NULL this <code>PendingIntent</code> is
+ * broadcast when the message is successfully sent, or failed
+ * @param messageId an id that uniquely identifies the message requested to be sent.
+ * Used for logging and diagnostics purposes. The id may be 0.
+ * @throws IllegalArgumentException if contentUri is empty
+ */
+ public void sendMultimediaMessage(@NonNull Context context, @NonNull Uri contentUri,
+ @Nullable String locationUrl, @Nullable Bundle configOverrides,
+ @Nullable PendingIntent sentIntent, long messageId) {
if (contentUri == null) {
throw new IllegalArgumentException("Uri contentUri null");
}
@@ -2658,7 +2689,7 @@ public final class SmsManager {
@Override
public void onSuccess(int subId) {
m.sendMultimediaMessage(subId, contentUri, locationUrl, configOverrides,
- sentIntent, 0L /* messageId */);
+ sentIntent, messageId);
}
@Override
@@ -2692,6 +2723,39 @@ public final class SmsManager {
*/
public void downloadMultimediaMessage(Context context, String locationUrl, Uri contentUri,
Bundle configOverrides, PendingIntent downloadedIntent) {
+ downloadMultimediaMessage(context, locationUrl, contentUri, configOverrides,
+ downloadedIntent, 0L /* messageId */);
+ }
+
+ /**
+ * Download an MMS message from carrier by a given location URL
+ *
+ * Same as {@link #downloadMultimediaMessage(Context context, String locationUrl,
+ * Uri contentUri, Bundle configOverrides, PendingIntent downloadedIntent)},
+ * but adds an optional messageId.
+ * <p class="note"><strong>Note:</strong> If {@link #getDefault()} is used to instantiate this
+ * manager on a multi-SIM device, this operation may fail downloading the MMS message because no
+ * suitable default subscription could be found. In this case, if {@code downloadedIntent} is
+ * non-null, then the {@link PendingIntent} will be sent with an error code
+ * {@code RESULT_NO_DEFAULT_SMS_APP}. See {@link #getDefault()} for more information on the
+ * conditions where this operation may fail.
+ * </p>
+ *
+ * @param context application context
+ * @param locationUrl the location URL of the MMS message to be downloaded, usually obtained
+ * from the MMS WAP push notification
+ * @param contentUri the content uri to which the downloaded pdu will be written
+ * @param configOverrides the carrier-specific messaging configuration values to override for
+ * downloading the message.
+ * @param downloadedIntent if not NULL this <code>PendingIntent</code> is
+ * broadcast when the message is downloaded, or the download is failed
+ * @param messageId an id that uniquely identifies the message requested to be downloaded.
+ * Used for logging and diagnostics purposes. The id may be 0.
+ * @throws IllegalArgumentException if locationUrl or contentUri is empty
+ */
+ public void downloadMultimediaMessage(@NonNull Context context, @NonNull String locationUrl,
+ @NonNull Uri contentUri, @Nullable Bundle configOverrides,
+ @Nullable PendingIntent downloadedIntent, long messageId) {
if (TextUtils.isEmpty(locationUrl)) {
throw new IllegalArgumentException("Empty MMS location URL");
}
@@ -2704,7 +2768,7 @@ public final class SmsManager {
@Override
public void onSuccess(int subId) {
m.downloadMultimediaMessage(subId, locationUrl, contentUri, configOverrides,
- downloadedIntent, 0L /* messageId */);
+ downloadedIntent, messageId);
}
@Override