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

Commit 31ef14d4 authored by Julian Odell's avatar Julian Odell
Browse files

Bug 17262099: MMS API changes (multi-project).

Move MMS api to using content provider rather than byte[] to pass MMS message contents.
Rebased and merged into TOT.

Change-Id: I3509b2774b1cb30a1c8100bb25d283140c963b6b
parent d9df4217
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -28849,23 +28849,23 @@ package android.telephony {
  }
  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 getSmsManagerForSubId(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>);
@@ -28876,6 +28876,8 @@ package android.telephony {
    method public void updateMmsSendStatus(int, boolean);
    method public void updateSmsSendStatus(int, boolean);
    method public boolean updateStoredMessageStatus(android.net.Uri, android.content.ContentValues);
    field public static final java.lang.String MESSAGE_STATUS_READ = "read";
    field public static final java.lang.String MESSAGE_STATUS_SEEN = "seen";
    field public static final java.lang.String MMS_CONFIG_ALIAS_ENABLED = "aliasEnabled";
    field public static final java.lang.String MMS_CONFIG_ALIAS_MAX_CHARS = "aliasMaxChars";
    field public static final java.lang.String MMS_CONFIG_ALIAS_MIN_CHARS = "aliasMinChars";
@@ -28904,10 +28906,9 @@ package android.telephony {
    field public static final java.lang.String MMS_CONFIG_UA_PROF_TAG_NAME = "uaProfTagName";
    field public static final java.lang.String MMS_CONFIG_UA_PROF_URL = "uaProfUrl";
    field public static final java.lang.String MMS_CONFIG_USER_AGENT = "userAgent";
    field public static final java.lang.String MESSAGE_STATUS_READ = "read";
    field public static final java.lang.String MESSAGE_STATUS_SEEN = "seen";
    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";
+16 −13
Original line number Diff line number Diff line
@@ -192,29 +192,30 @@ public class MmsServiceBroker extends SystemService {
    // 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 @@ public class MmsServiceBroker extends SystemService {
        }

        @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 @@ public class MmsServiceBroker extends SystemService {
                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 @@ public class MmsServiceBroker extends SystemService {
        }

        @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 @@ public class MmsServiceBroker extends SystemService {
                // while writing the TelephonyProvider
                return FAKE_MMS_DRAFT_URI;
            }
            return getServiceGuarded().addMultimediaMessageDraft(callingPkg, pdu);
            return getServiceGuarded().addMultimediaMessageDraft(callingPkg, contentUri);
        }

        @Override
+11 −8
Original line number Diff line number Diff line
@@ -30,7 +30,8 @@ interface IMms {
     *
     * @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 @@ interface IMms {
     * @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 @@ interface IMms {
     * @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 @@ interface IMms {
     *  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 @@ interface IMms {
      * 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 @@ interface IMms {
     * 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