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

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

Merge "Allow MmsConfig override per request (1/3)" into lmp-dev

parents b673790e 63c00c43
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -29262,12 +29262,12 @@ package android.telephony {
  public class MessagingConfigurationManager {
    method public boolean getCarrierConfigBoolean(java.lang.String, boolean);
    method public boolean getCarrierConfigBoolean(long, java.lang.String, boolean);
    method public int getCarrierConfigInt(java.lang.String, int);
    method public int getCarrierConfigInt(long, java.lang.String, int);
    method public java.lang.String getCarrierConfigString(java.lang.String, java.lang.String);
    method public java.lang.String getCarrierConfigString(long, java.lang.String, java.lang.String);
    method public static android.telephony.MessagingConfigurationManager getDefault();
    method public void setCarrierConfigBoolean(java.lang.String, boolean);
    method public void setCarrierConfigInt(java.lang.String, int);
    method public void setCarrierConfigString(java.lang.String, java.lang.String);
    field public static final java.lang.String CONF_ALIAS_ENABLED = "aliasEnabled";
    field public static final java.lang.String CONF_ALIAS_MAX_CHARS = "aliasMaxChars";
    field public static final java.lang.String CONF_ALIAS_MIN_CHARS = "aliasMinChars";
@@ -29446,19 +29446,19 @@ package android.telephony {
    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.app.PendingIntent);
    method public void downloadMultimediaMessage(long, java.lang.String, android.app.PendingIntent);
    method public void downloadMultimediaMessage(java.lang.String, android.content.ContentValues, android.app.PendingIntent);
    method public void downloadMultimediaMessage(long, java.lang.String, android.content.ContentValues, android.app.PendingIntent);
    method public boolean getAutoPersisting();
    method public static android.telephony.SmsManager getDefault();
    method public android.net.Uri importMultimediaMessage(byte[], 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.app.PendingIntent);
    method public void sendMultimediaMessage(long, byte[], java.lang.String, android.app.PendingIntent);
    method public void sendMultimediaMessage(byte[], java.lang.String, android.content.ContentValues, android.app.PendingIntent);
    method public void sendMultimediaMessage(long, byte[], 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.app.PendingIntent);
    method public void sendStoredMultimediaMessage(long, android.net.Uri, android.app.PendingIntent);
    method public void sendStoredMultimediaMessage(android.net.Uri, android.content.ContentValues, android.app.PendingIntent);
    method public void sendStoredMultimediaMessage(long, 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>);
    method public void sendStoredMultipartTextMessage(long, android.net.Uri, java.lang.String, java.util.ArrayList<android.app.PendingIntent>, java.util.ArrayList<android.app.PendingIntent>);
    method public void sendStoredTextMessage(android.net.Uri, java.lang.String, android.app.PendingIntent, android.app.PendingIntent);
+16 −44
Original line number Diff line number Diff line
@@ -191,25 +191,28 @@ public class MmsServiceBroker extends SystemService {
    private final class BinderService extends IMms.Stub {
        @Override
        public void sendMessage(long subId, String callingPkg, byte[] pdu, String locationUrl,
                PendingIntent sentIntent) throws RemoteException {
                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, sentIntent);
            getServiceGuarded().sendMessage(subId, callingPkg, pdu, locationUrl, configOverrides,
                    sentIntent);
        }

        @Override
        public void downloadMessage(long subId, String callingPkg, String locationUrl,
                PendingIntent downloadedIntent) throws RemoteException {
                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, downloadedIntent);
            getServiceGuarded().downloadMessage(subId, callingPkg, locationUrl, configOverrides,
                    downloadedIntent);
        }

        @Override
@@ -225,53 +228,21 @@ public class MmsServiceBroker extends SystemService {
        }

        @Override
        public boolean getCarrierConfigBoolean(String name, boolean defaultValue)
                throws RemoteException {
            return getServiceGuarded().getCarrierConfigBoolean(name, defaultValue);
        }

        @Override
        public int getCarrierConfigInt(String name, int defaultValue) throws RemoteException {
            return getServiceGuarded().getCarrierConfigInt(name, defaultValue);
        }

        @Override
        public String getCarrierConfigString(String name, String defaultValue)
                throws RemoteException {
            return getServiceGuarded().getCarrierConfigString(name, defaultValue);
        }

        @Override
        public void setCarrierConfigBoolean(String callingPkg, String name, boolean value)
        public boolean getCarrierConfigBoolean(long subId, String name, boolean defaultValue)
                throws RemoteException {
            mContext.enforceCallingPermission(Manifest.permission.SEND_SMS, "Set MMS config");
            if (getAppOpsManager().noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
                    callingPkg) != AppOpsManager.MODE_ALLOWED) {
                return;
            }
            getServiceGuarded().setCarrierConfigBoolean(callingPkg, name, value);
            return getServiceGuarded().getCarrierConfigBoolean(subId, name, defaultValue);
        }

        @Override
        public void setCarrierConfigInt(String callingPkg, String name, int value)
        public int getCarrierConfigInt(long subId, String name, int defaultValue)
                throws RemoteException {
            mContext.enforceCallingPermission(Manifest.permission.SEND_SMS, "Set MMS config");
            if (getAppOpsManager().noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
                    callingPkg) != AppOpsManager.MODE_ALLOWED) {
                return;
            }
            getServiceGuarded().setCarrierConfigInt(callingPkg, name, value);
            return getServiceGuarded().getCarrierConfigInt(subId, name, defaultValue);
        }

        @Override
        public void setCarrierConfigString(String callingPkg, String name, String value)
        public String getCarrierConfigString(long subId, String name, String defaultValue)
                throws RemoteException {
            mContext.enforceCallingPermission(Manifest.permission.SEND_SMS, "Set MMS config");
            if (getAppOpsManager().noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
                    callingPkg) != AppOpsManager.MODE_ALLOWED) {
                return;
            }
            getServiceGuarded().setCarrierConfigString(callingPkg, name, value);
            return getServiceGuarded().getCarrierConfigString(subId, name, defaultValue);
        }

        @Override
@@ -370,14 +341,15 @@ public class MmsServiceBroker extends SystemService {

        @Override
        public void sendStoredMessage(long subId, String callingPkg, Uri messageUri,
                PendingIntent sentIntent) throws RemoteException {
                ContentValues configOverrides, PendingIntent sentIntent) throws RemoteException {
            mContext.enforceCallingPermission(Manifest.permission.SEND_SMS,
                    "Send stored MMS message");
            if (getAppOpsManager().noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
                    callingPkg) != AppOpsManager.MODE_ALLOWED) {
                return;
            }
            getServiceGuarded().sendStoredMessage(subId, callingPkg, messageUri, sentIntent);
            getServiceGuarded().sendStoredMessage(subId, callingPkg, messageUri, configOverrides,
                    sentIntent);
        }

        @Override
+18 −32
Original line number Diff line number Diff line
@@ -31,11 +31,14 @@ interface IMms {
     * @param callingPkg the package name of the calling app
     * @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 configOverrides the carrier-specific messaging configuration values to override for
     *  sending the message. See {@link android.telephony.MessagingConfigurationManager} for the
     *  value names and types.
     * @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 PendingIntent sentIntent);
            in ContentValues configOverrides, in PendingIntent sentIntent);

    /**
     * Download an MMS message using known location and transaction id
@@ -44,11 +47,14 @@ 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 configOverrides the carrier-specific messaging configuration values to override for
     *  downloading the message. See {@link android.telephony.MessagingConfigurationManager} for the
     *  value names and types.
     * @param downloadedIntent if not NULL this <code>PendingIntent</code> is
     *  broadcast when the message is downloaded, or the download is failed
     */
    void downloadMessage(long subId, String callingPkg, String locationUrl,
            in PendingIntent downloadedIntent);
            in ContentValues configOverrides, in PendingIntent downloadedIntent);

    /**
     * Update the status of a pending (send-by-IP) MMS message handled by the carrier app.
@@ -75,53 +81,30 @@ interface IMms {
     * Get carrier-dependent configuration value as boolean. For example, if multipart SMS
     * is supported.
     *
     * @param subId the SIM id
     * @param name the configuration name
     * @param defaultValue the default value if fail to find the name
     */
    boolean getCarrierConfigBoolean(String name, boolean defaultValue);
    boolean getCarrierConfigBoolean(long subId, String name, boolean defaultValue);

    /**
     * Get carrier-dependent configuration value as int. For example, the MMS message size limit.
     *
     * @param subId the SIM id
     * @param name the configuration name
     * @param defaultValue the default value if fail to find the name
     */
    int getCarrierConfigInt(String name, int defaultValue);
    int getCarrierConfigInt(long subId, String name, int defaultValue);

    /**
     * Get carrier-dependent configuration value as String. For example, extra HTTP headers for
     * MMS request.
     *
     * @param subId the SIM id
     * @param name the configuration name
     * @param defaultValue the default value if fail to find the name
     */
    String getCarrierConfigString(String name, String defaultValue);

    /**
     * Set carrier-dependent configuration value as boolean. For example, if multipart SMS
     * is supported.
     *
     * @param name the configuration name
     * @param value the configuration value
     */
    void setCarrierConfigBoolean(String callingPkg, String name, boolean value);

    /**
     * Set carrier-dependent configuration value as int. For example, the MMS message size limit.
     *
     * @param name the configuration name
     * @param value the configuration value
     */
    void setCarrierConfigInt(String callingPkg, String name, int value);

    /**
     * Set carrier-dependent configuration value as String. For example, extra HTTP headers for
     * MMS request.
     *
     * @param name the configuration name
     * @param value the configuration value
     */
    void setCarrierConfigString(String callingPkg, String name, String value);
    String getCarrierConfigString(long subId, String name, String defaultValue);

    /**
     * Import a text message into system's SMS store
@@ -220,11 +203,14 @@ interface IMms {
     * @param subId the SIM id
     * @param callingPkg the package name of the calling app
     * @param messageUri the URI of the stored message
     * @param configOverrides the carrier-specific messaging configuration values to override for
     *  sending the message. See {@link android.telephony.MessagingConfigurationManager} for the
     *  value names and types.
     * @param sentIntent if not NULL this <code>PendingIntent</code> is
     *  broadcast when the message is successfully sent, or failed
     */
    void sendStoredMessage(long subId, String callingPkg, in Uri messageUri,
            in PendingIntent sentIntent);
            in ContentValues configOverrides, in PendingIntent sentIntent);

    /**
     * Turns on/off the flag to automatically write sent/received SMS/MMS messages into system