Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ed7418e authored by Tom Taylor's avatar Tom Taylor Committed by Android (Google) Code Review
Browse files

Merge "Add optional messageId methods for sending/receiving mms's"

parents c3f651ad 03079ec3
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -47070,8 +47070,8 @@ package android.telephony {
  }
  }
  public class MmsManager {
  public class MmsManager {
    method public void downloadMultimediaMessage(int, @NonNull String, @NonNull android.net.Uri, @Nullable android.os.Bundle, @Nullable android.app.PendingIntent);
    method public void downloadMultimediaMessage(int, @NonNull String, @NonNull android.net.Uri, @Nullable android.os.Bundle, @Nullable android.app.PendingIntent, long);
    method public void sendMultimediaMessage(int, @NonNull android.net.Uri, @Nullable String, @Nullable android.os.Bundle, @Nullable android.app.PendingIntent);
    method public void sendMultimediaMessage(int, @NonNull android.net.Uri, @Nullable String, @Nullable android.os.Bundle, @Nullable android.app.PendingIntent, long);
  }
  }
  @Deprecated public class NeighboringCellInfo implements android.os.Parcelable {
  @Deprecated public class NeighboringCellInfo implements android.os.Parcelable {
+10 −4
Original line number Original line Diff line number Diff line
@@ -55,10 +55,12 @@ public class MmsManager {
     *                        sending the message.
     *                        sending the message.
     * @param sentIntent if not NULL this <code>PendingIntent</code> is broadcast when the message
     * @param sentIntent if not NULL this <code>PendingIntent</code> is broadcast when the message
     *                   is successfully sent, or failed
     *                   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.
     */
     */
    public void sendMultimediaMessage(int subId, @NonNull Uri contentUri,
    public void sendMultimediaMessage(int subId, @NonNull Uri contentUri,
            @Nullable String locationUrl, @Nullable Bundle configOverrides,
            @Nullable String locationUrl, @Nullable Bundle configOverrides,
            @Nullable PendingIntent sentIntent) {
            @Nullable PendingIntent sentIntent, long messageId) {
        try {
        try {
            final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
            final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
            if (iMms == null) {
            if (iMms == null) {
@@ -66,7 +68,7 @@ public class MmsManager {
            }
            }


            iMms.sendMessage(subId, ActivityThread.currentPackageName(), contentUri,
            iMms.sendMessage(subId, ActivityThread.currentPackageName(), contentUri,
                    locationUrl, configOverrides, sentIntent);
                    locationUrl, configOverrides, sentIntent, messageId);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            // Ignore it
            // Ignore it
        }
        }
@@ -83,18 +85,22 @@ public class MmsManager {
     *  downloading the message.
     *  downloading the message.
     * @param downloadedIntent if not NULL this <code>PendingIntent</code> is
     * @param downloadedIntent if not NULL this <code>PendingIntent</code> is
     *  broadcast when the message is downloaded, or the download is failed
     *  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.
     *  downloaded.
     * @throws IllegalArgumentException if locationUrl or contentUri is empty
     * @throws IllegalArgumentException if locationUrl or contentUri is empty
     */
     */
    public void downloadMultimediaMessage(int subId, @NonNull String locationUrl,
    public void downloadMultimediaMessage(int subId, @NonNull String locationUrl,
            @NonNull Uri contentUri, @Nullable Bundle configOverrides,
            @NonNull Uri contentUri, @Nullable Bundle configOverrides,
            @Nullable PendingIntent downloadedIntent) {
            @Nullable PendingIntent downloadedIntent, long messageId) {
        try {
        try {
            final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
            final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
            if (iMms == null) {
            if (iMms == null) {
                return;
                return;
            }
            }
            iMms.downloadMessage(subId, ActivityThread.currentPackageName(),
            iMms.downloadMessage(subId, ActivityThread.currentPackageName(),
                    locationUrl, contentUri, configOverrides, downloadedIntent);
                    locationUrl, contentUri, configOverrides, downloadedIntent,
                    messageId);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            // Ignore it
            // Ignore it
        }
        }
+6 −3
Original line number Original line Diff line number Diff line
@@ -37,9 +37,11 @@ interface IMms {
     *  sending the message. See {@link android.telephony.SmsManager} for the value names and types.
     *  sending the message. See {@link android.telephony.SmsManager} for the value names and types.
     * @param sentIntent if not NULL this <code>PendingIntent</code> is
     * @param sentIntent if not NULL this <code>PendingIntent</code> is
     *  broadcast when the message is successfully sent, or failed
     *  broadcast when the message is successfully sent, or failed
     * @param messageId An id that uniquely identifies the message requested to be sent.
     */
     */
    void sendMessage(int subId, String callingPkg, in Uri contentUri,
    void sendMessage(int subId, String callingPkg, in Uri contentUri,
            String locationUrl, in Bundle configOverrides, in PendingIntent sentIntent);
            String locationUrl, in Bundle configOverrides, in PendingIntent sentIntent,
            in long messageId);


    /**
    /**
     * Download an MMS message using known location and transaction id
     * Download an MMS message using known location and transaction id
@@ -54,10 +56,11 @@ interface IMms {
     *  types.
     *  types.
     * @param downloadedIntent if not NULL this <code>PendingIntent</code> is
     * @param downloadedIntent if not NULL this <code>PendingIntent</code> is
     *  broadcast when the message is downloaded, or the download is failed
     *  broadcast when the message is downloaded, or the download is failed
     * @param messageId An id that uniquely identifies the message requested to be downloaded.
    */
    */
    void downloadMessage(int subId, String callingPkg, String locationUrl,
    void downloadMessage(int subId, String callingPkg, String locationUrl,
            in Uri contentUri, in Bundle configOverrides,
            in Uri contentUri, in Bundle configOverrides,
            in PendingIntent downloadedIntent);
            in PendingIntent downloadedIntent, in long messageId);


    /**
    /**
     * Import a text message into system's SMS store
     * Import a text message into system's SMS store
+9 −6
Original line number Original line Diff line number Diff line
@@ -128,13 +128,15 @@ public class MmsServiceBroker extends SystemService {


        @Override
        @Override
        public void sendMessage(int subId, String callingPkg, Uri contentUri, String locationUrl,
        public void sendMessage(int subId, String callingPkg, Uri contentUri, String locationUrl,
                Bundle configOverrides, PendingIntent sentIntent) throws RemoteException {
                Bundle configOverrides, PendingIntent sentIntent, long messageId)
                throws RemoteException {
            returnPendingIntentWithError(sentIntent);
            returnPendingIntentWithError(sentIntent);
        }
        }


        @Override
        @Override
        public void downloadMessage(int subId, String callingPkg, String locationUrl,
        public void downloadMessage(int subId, String callingPkg, String locationUrl,
                Uri contentUri, Bundle configOverrides, PendingIntent downloadedIntent)
                Uri contentUri, Bundle configOverrides, PendingIntent downloadedIntent,
                long messageId)
                throws RemoteException {
                throws RemoteException {
            returnPendingIntentWithError(downloadedIntent);
            returnPendingIntentWithError(downloadedIntent);
        }
        }
@@ -329,7 +331,8 @@ public class MmsServiceBroker extends SystemService {


        @Override
        @Override
        public void sendMessage(int subId, String callingPkg, Uri contentUri,
        public void sendMessage(int subId, String callingPkg, Uri contentUri,
                String locationUrl, Bundle configOverrides, PendingIntent sentIntent)
                String locationUrl, Bundle configOverrides, PendingIntent sentIntent,
                long messageId)
                throws RemoteException {
                throws RemoteException {
            Slog.d(TAG, "sendMessage() by " + callingPkg);
            Slog.d(TAG, "sendMessage() by " + callingPkg);
            mContext.enforceCallingPermission(Manifest.permission.SEND_SMS, "Send MMS message");
            mContext.enforceCallingPermission(Manifest.permission.SEND_SMS, "Send MMS message");
@@ -343,13 +346,13 @@ public class MmsServiceBroker extends SystemService {
                    Intent.FLAG_GRANT_READ_URI_PERMISSION,
                    Intent.FLAG_GRANT_READ_URI_PERMISSION,
                    subId);
                    subId);
            getServiceGuarded().sendMessage(subId, callingPkg, contentUri, locationUrl,
            getServiceGuarded().sendMessage(subId, callingPkg, contentUri, locationUrl,
                    configOverrides, sentIntent);
                    configOverrides, sentIntent, messageId);
        }
        }


        @Override
        @Override
        public void downloadMessage(int subId, String callingPkg, String locationUrl,
        public void downloadMessage(int subId, String callingPkg, String locationUrl,
                Uri contentUri, Bundle configOverrides,
                Uri contentUri, Bundle configOverrides,
                PendingIntent downloadedIntent) throws RemoteException {
                PendingIntent downloadedIntent, long messageId) throws RemoteException {
            Slog.d(TAG, "downloadMessage() by " + callingPkg);
            Slog.d(TAG, "downloadMessage() by " + callingPkg);
            mContext.enforceCallingPermission(Manifest.permission.RECEIVE_MMS,
            mContext.enforceCallingPermission(Manifest.permission.RECEIVE_MMS,
                    "Download MMS message");
                    "Download MMS message");
@@ -364,7 +367,7 @@ public class MmsServiceBroker extends SystemService {
                    subId);
                    subId);


            getServiceGuarded().downloadMessage(subId, callingPkg, locationUrl, contentUri,
            getServiceGuarded().downloadMessage(subId, callingPkg, locationUrl, contentUri,
                    configOverrides, downloadedIntent);
                    configOverrides, downloadedIntent, messageId);
        }
        }


        @Override
        @Override
+2 −2
Original line number Original line Diff line number Diff line
@@ -2543,7 +2543,7 @@ public final class SmsManager {
        MmsManager m = (MmsManager) context.getSystemService(Context.MMS_SERVICE);
        MmsManager m = (MmsManager) context.getSystemService(Context.MMS_SERVICE);
        if (m != null) {
        if (m != null) {
            m.sendMultimediaMessage(getSubscriptionId(), contentUri, locationUrl, configOverrides,
            m.sendMultimediaMessage(getSubscriptionId(), contentUri, locationUrl, configOverrides,
                    sentIntent);
                    sentIntent, 0L /* messageId */);
        }
        }
    }
    }


@@ -2581,7 +2581,7 @@ public final class SmsManager {
        MmsManager m = (MmsManager) context.getSystemService(Context.MMS_SERVICE);
        MmsManager m = (MmsManager) context.getSystemService(Context.MMS_SERVICE);
        if (m != null) {
        if (m != null) {
            m.downloadMultimediaMessage(getSubscriptionId(), locationUrl, contentUri,
            m.downloadMultimediaMessage(getSubscriptionId(), locationUrl, contentUri,
                    configOverrides, downloadedIntent);
                    configOverrides, downloadedIntent, 0L /* messageId */);
        }
        }
    }
    }