Skip to content

Commit 63c00c4

Browse files
committed
Allow MmsConfig override per request (1/3)
Instead of providing ways to override MmsConfig globally, this allows the override per request, which is safer. Also added subId to the getter of MessagingConfigurationManager. b/16681649 Change-Id: Ia5ee391e2fa51fbdf87d111174d8df21f5f5e41f
1 parent bfa96fb commit 63c00c4

3 files changed

Lines changed: 43 additions & 85 deletions

File tree

api/current.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29258,12 +29258,12 @@ package android.telephony {
2925829258

2925929259
public class MessagingConfigurationManager {
2926029260
method public boolean getCarrierConfigBoolean(java.lang.String, boolean);
29261+
method public boolean getCarrierConfigBoolean(long, java.lang.String, boolean);
2926129262
method public int getCarrierConfigInt(java.lang.String, int);
29263+
method public int getCarrierConfigInt(long, java.lang.String, int);
2926229264
method public java.lang.String getCarrierConfigString(java.lang.String, java.lang.String);
29265+
method public java.lang.String getCarrierConfigString(long, java.lang.String, java.lang.String);
2926329266
method public static android.telephony.MessagingConfigurationManager getDefault();
29264-
method public void setCarrierConfigBoolean(java.lang.String, boolean);
29265-
method public void setCarrierConfigInt(java.lang.String, int);
29266-
method public void setCarrierConfigString(java.lang.String, java.lang.String);
2926729267
field public static final java.lang.String CONF_ALIAS_ENABLED = "aliasEnabled";
2926829268
field public static final java.lang.String CONF_ALIAS_MAX_CHARS = "aliasMaxChars";
2926929269
field public static final java.lang.String CONF_ALIAS_MIN_CHARS = "aliasMinChars";
@@ -29442,19 +29442,19 @@ package android.telephony {
2944229442
method public boolean deleteStoredConversation(long);
2944329443
method public boolean deleteStoredMessage(android.net.Uri);
2944429444
method public java.util.ArrayList<java.lang.String> divideMessage(java.lang.String);
29445-
method public void downloadMultimediaMessage(java.lang.String, android.app.PendingIntent);
29446-
method public void downloadMultimediaMessage(long, java.lang.String, android.app.PendingIntent);
29445+
method public void downloadMultimediaMessage(java.lang.String, android.content.ContentValues, android.app.PendingIntent);
29446+
method public void downloadMultimediaMessage(long, java.lang.String, android.content.ContentValues, android.app.PendingIntent);
2944729447
method public boolean getAutoPersisting();
2944829448
method public static android.telephony.SmsManager getDefault();
2944929449
method public android.net.Uri importMultimediaMessage(byte[], java.lang.String, long, boolean, boolean);
2945029450
method public android.net.Uri importTextMessage(java.lang.String, int, java.lang.String, long, boolean, boolean);
2945129451
method public void injectSmsPdu(byte[], java.lang.String, android.app.PendingIntent);
2945229452
method public void sendDataMessage(java.lang.String, java.lang.String, short, byte[], android.app.PendingIntent, android.app.PendingIntent);
29453-
method public void sendMultimediaMessage(byte[], java.lang.String, android.app.PendingIntent);
29454-
method public void sendMultimediaMessage(long, byte[], java.lang.String, android.app.PendingIntent);
29453+
method public void sendMultimediaMessage(byte[], java.lang.String, android.content.ContentValues, android.app.PendingIntent);
29454+
method public void sendMultimediaMessage(long, byte[], java.lang.String, android.content.ContentValues, android.app.PendingIntent);
2945529455
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>);
29456-
method public void sendStoredMultimediaMessage(android.net.Uri, android.app.PendingIntent);
29457-
method public void sendStoredMultimediaMessage(long, android.net.Uri, android.app.PendingIntent);
29456+
method public void sendStoredMultimediaMessage(android.net.Uri, android.content.ContentValues, android.app.PendingIntent);
29457+
method public void sendStoredMultimediaMessage(long, android.net.Uri, android.content.ContentValues, android.app.PendingIntent);
2945829458
method public void sendStoredMultipartTextMessage(android.net.Uri, java.lang.String, java.util.ArrayList<android.app.PendingIntent>, java.util.ArrayList<android.app.PendingIntent>);
2945929459
method public void sendStoredMultipartTextMessage(long, android.net.Uri, java.lang.String, java.util.ArrayList<android.app.PendingIntent>, java.util.ArrayList<android.app.PendingIntent>);
2946029460
method public void sendStoredTextMessage(android.net.Uri, java.lang.String, android.app.PendingIntent, android.app.PendingIntent);

services/core/java/com/android/server/MmsServiceBroker.java

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -191,25 +191,28 @@ private void enforceCarrierPrivilege() {
191191
private final class BinderService extends IMms.Stub {
192192
@Override
193193
public void sendMessage(long subId, String callingPkg, byte[] pdu, String locationUrl,
194-
PendingIntent sentIntent) throws RemoteException {
194+
ContentValues configOverrides, PendingIntent sentIntent) throws RemoteException {
195195
mContext.enforceCallingPermission(Manifest.permission.SEND_SMS, "Send MMS message");
196196
if (getAppOpsManager().noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
197197
callingPkg) != AppOpsManager.MODE_ALLOWED) {
198198
return;
199199
}
200-
getServiceGuarded().sendMessage(subId, callingPkg, pdu, locationUrl, sentIntent);
200+
getServiceGuarded().sendMessage(subId, callingPkg, pdu, locationUrl, configOverrides,
201+
sentIntent);
201202
}
202203

203204
@Override
204205
public void downloadMessage(long subId, String callingPkg, String locationUrl,
205-
PendingIntent downloadedIntent) throws RemoteException {
206+
ContentValues configOverrides, PendingIntent downloadedIntent)
207+
throws RemoteException {
206208
mContext.enforceCallingPermission(Manifest.permission.RECEIVE_MMS,
207209
"Download MMS message");
208210
if (getAppOpsManager().noteOp(AppOpsManager.OP_RECEIVE_MMS, Binder.getCallingUid(),
209211
callingPkg) != AppOpsManager.MODE_ALLOWED) {
210212
return;
211213
}
212-
getServiceGuarded().downloadMessage(subId, callingPkg, locationUrl, downloadedIntent);
214+
getServiceGuarded().downloadMessage(subId, callingPkg, locationUrl, configOverrides,
215+
downloadedIntent);
213216
}
214217

215218
@Override
@@ -225,53 +228,21 @@ public void updateMmsDownloadStatus(int messageRef, byte[] pdu) throws RemoteExc
225228
}
226229

227230
@Override
228-
public boolean getCarrierConfigBoolean(String name, boolean defaultValue)
229-
throws RemoteException {
230-
return getServiceGuarded().getCarrierConfigBoolean(name, defaultValue);
231-
}
232-
233-
@Override
234-
public int getCarrierConfigInt(String name, int defaultValue) throws RemoteException {
235-
return getServiceGuarded().getCarrierConfigInt(name, defaultValue);
236-
}
237-
238-
@Override
239-
public String getCarrierConfigString(String name, String defaultValue)
240-
throws RemoteException {
241-
return getServiceGuarded().getCarrierConfigString(name, defaultValue);
242-
}
243-
244-
@Override
245-
public void setCarrierConfigBoolean(String callingPkg, String name, boolean value)
231+
public boolean getCarrierConfigBoolean(long subId, String name, boolean defaultValue)
246232
throws RemoteException {
247-
mContext.enforceCallingPermission(Manifest.permission.SEND_SMS, "Set MMS config");
248-
if (getAppOpsManager().noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
249-
callingPkg) != AppOpsManager.MODE_ALLOWED) {
250-
return;
251-
}
252-
getServiceGuarded().setCarrierConfigBoolean(callingPkg, name, value);
233+
return getServiceGuarded().getCarrierConfigBoolean(subId, name, defaultValue);
253234
}
254235

255236
@Override
256-
public void setCarrierConfigInt(String callingPkg, String name, int value)
237+
public int getCarrierConfigInt(long subId, String name, int defaultValue)
257238
throws RemoteException {
258-
mContext.enforceCallingPermission(Manifest.permission.SEND_SMS, "Set MMS config");
259-
if (getAppOpsManager().noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
260-
callingPkg) != AppOpsManager.MODE_ALLOWED) {
261-
return;
262-
}
263-
getServiceGuarded().setCarrierConfigInt(callingPkg, name, value);
239+
return getServiceGuarded().getCarrierConfigInt(subId, name, defaultValue);
264240
}
265241

266242
@Override
267-
public void setCarrierConfigString(String callingPkg, String name, String value)
243+
public String getCarrierConfigString(long subId, String name, String defaultValue)
268244
throws RemoteException {
269-
mContext.enforceCallingPermission(Manifest.permission.SEND_SMS, "Set MMS config");
270-
if (getAppOpsManager().noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
271-
callingPkg) != AppOpsManager.MODE_ALLOWED) {
272-
return;
273-
}
274-
getServiceGuarded().setCarrierConfigString(callingPkg, name, value);
245+
return getServiceGuarded().getCarrierConfigString(subId, name, defaultValue);
275246
}
276247

277248
@Override
@@ -370,14 +341,15 @@ public Uri addMultimediaMessageDraft(String callingPkg, byte[] pdu) throws Remot
370341

371342
@Override
372343
public void sendStoredMessage(long subId, String callingPkg, Uri messageUri,
373-
PendingIntent sentIntent) throws RemoteException {
344+
ContentValues configOverrides, PendingIntent sentIntent) throws RemoteException {
374345
mContext.enforceCallingPermission(Manifest.permission.SEND_SMS,
375346
"Send stored MMS message");
376347
if (getAppOpsManager().noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
377348
callingPkg) != AppOpsManager.MODE_ALLOWED) {
378349
return;
379350
}
380-
getServiceGuarded().sendStoredMessage(subId, callingPkg, messageUri, sentIntent);
351+
getServiceGuarded().sendStoredMessage(subId, callingPkg, messageUri, configOverrides,
352+
sentIntent);
381353
}
382354

383355
@Override

telephony/java/com/android/internal/telephony/IMms.aidl

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ interface IMms {
3131
* @param callingPkg the package name of the calling app
3232
* @param pdu the MMS message encoded in standard MMS PDU format
3333
* @param locationUrl the optional location url for where this message should be sent to
34+
* @param configOverrides the carrier-specific messaging configuration values to override for
35+
* sending the message. See {@link android.telephony.MessagingConfigurationManager} for the
36+
* value names and types.
3437
* @param sentIntent if not NULL this <code>PendingIntent</code> is
3538
* broadcast when the message is successfully sent, or failed
3639
*/
3740
void sendMessage(long subId, String callingPkg, in byte[] pdu, String locationUrl,
38-
in PendingIntent sentIntent);
41+
in ContentValues configOverrides, in PendingIntent sentIntent);
3942

4043
/**
4144
* Download an MMS message using known location and transaction id
@@ -44,11 +47,14 @@ interface IMms {
4447
* @param callingPkg the package name of the calling app
4548
* @param locationUrl the location URL of the MMS message to be downloaded, usually obtained
4649
* from the MMS WAP push notification
50+
* @param configOverrides the carrier-specific messaging configuration values to override for
51+
* downloading the message. See {@link android.telephony.MessagingConfigurationManager} for the
52+
* value names and types.
4753
* @param downloadedIntent if not NULL this <code>PendingIntent</code> is
4854
* broadcast when the message is downloaded, or the download is failed
4955
*/
5056
void downloadMessage(long subId, String callingPkg, String locationUrl,
51-
in PendingIntent downloadedIntent);
57+
in ContentValues configOverrides, in PendingIntent downloadedIntent);
5258

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

8390
/**
8491
* Get carrier-dependent configuration value as int. For example, the MMS message size limit.
8592
*
93+
* @param subId the SIM id
8694
* @param name the configuration name
8795
* @param defaultValue the default value if fail to find the name
8896
*/
89-
int getCarrierConfigInt(String name, int defaultValue);
97+
int getCarrierConfigInt(long subId, String name, int defaultValue);
9098

9199
/**
92100
* Get carrier-dependent configuration value as String. For example, extra HTTP headers for
93101
* MMS request.
94102
*
103+
* @param subId the SIM id
95104
* @param name the configuration name
96105
* @param defaultValue the default value if fail to find the name
97106
*/
98-
String getCarrierConfigString(String name, String defaultValue);
99-
100-
/**
101-
* Set carrier-dependent configuration value as boolean. For example, if multipart SMS
102-
* is supported.
103-
*
104-
* @param name the configuration name
105-
* @param value the configuration value
106-
*/
107-
void setCarrierConfigBoolean(String callingPkg, String name, boolean value);
108-
109-
/**
110-
* Set carrier-dependent configuration value as int. For example, the MMS message size limit.
111-
*
112-
* @param name the configuration name
113-
* @param value the configuration value
114-
*/
115-
void setCarrierConfigInt(String callingPkg, String name, int value);
116-
117-
/**
118-
* Set carrier-dependent configuration value as String. For example, extra HTTP headers for
119-
* MMS request.
120-
*
121-
* @param name the configuration name
122-
* @param value the configuration value
123-
*/
124-
void setCarrierConfigString(String callingPkg, String name, String value);
107+
String getCarrierConfigString(long subId, String name, String defaultValue);
125108

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

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

0 commit comments

Comments
 (0)