summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Taylor <tomtaylor@google.com>2020-01-30 17:20:08 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-01-30 17:20:08 +0000
commit3c8aa7b586b7e603ac99c8e4f0a9e4adf06cd034 (patch)
tree2916dee9c3e5a0269bc2cd918039a211c9ee610e
parent19b1642d3085e70df28b3e438cc5f0a334ae5956 (diff)
parent3e08db98482dd381753d74c0d4704b3efd98fe49 (diff)
downloadMms-3c8aa7b586b7e603ac99c8e4f0a9e4adf06cd034.tar.gz
Merge "Add optional messageId methods for sending/receiving mms's"
-rw-r--r--src/com/android/mms/service/DownloadRequest.java49
-rw-r--r--src/com/android/mms/service/MmsRequest.java33
-rw-r--r--src/com/android/mms/service/MmsService.java16
-rw-r--r--src/com/android/mms/service/SendRequest.java62
-rw-r--r--tests/robotests/src/com/android/mms/service/MmsServiceRoboTest.java6
5 files changed, 107 insertions, 59 deletions
diff --git a/src/com/android/mms/service/DownloadRequest.java b/src/com/android/mms/service/DownloadRequest.java
index 8079fa4..e4d386e 100644
--- a/src/com/android/mms/service/DownloadRequest.java
+++ b/src/com/android/mms/service/DownloadRequest.java
@@ -59,8 +59,8 @@ public class DownloadRequest extends MmsRequest {
public DownloadRequest(RequestManager manager, int subId, String locationUrl,
Uri contentUri, PendingIntent downloadedIntent, String creator,
- Bundle configOverrides, Context context) {
- super(manager, subId, creator, configOverrides, context);
+ Bundle configOverrides, Context context, long messageId) {
+ super(manager, subId, creator, configOverrides, context, messageId);
mLocationUrl = locationUrl;
mDownloadedIntent = downloadedIntent;
mContentUri = contentUri;
@@ -72,8 +72,9 @@ public class DownloadRequest extends MmsRequest {
final String requestId = getRequestId();
final MmsHttpClient mmsHttpClient = netMgr.getOrCreateHttpClient();
if (mmsHttpClient == null) {
- LogUtil.e(requestId, "MMS network is not ready!");
- throw new MmsHttpException(0/*statusCode*/, "MMS network is not ready");
+ LogUtil.e(requestId, "MMS network is not ready! messageId: " + mMessageId);
+ throw new MmsHttpException(0/*statusCode*/, "MMS network is not ready. messageId: "
+ + mMessageId);
}
return mmsHttpClient.execute(
mLocationUrl,
@@ -106,9 +107,9 @@ public class DownloadRequest extends MmsRequest {
if (!mRequestManager.getAutoPersistingPref()) {
return null;
}
- LogUtil.d(requestId, "persistIfRequired");
+ LogUtil.d(requestId, "persistIfRequired. messageId: " + mMessageId);
if (response == null || response.length < 1) {
- LogUtil.e(requestId, "persistIfRequired: empty response");
+ LogUtil.e(requestId, "persistIfRequired: empty response. messageId: " + mMessageId);
return null;
}
final long identity = Binder.clearCallingIdentity();
@@ -117,13 +118,15 @@ public class DownloadRequest extends MmsRequest {
mMmsConfig.getBoolean(SmsManager.MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION);
final GenericPdu pdu = (new PduParser(response, supportMmsContentDisposition)).parse();
if (pdu == null || !(pdu instanceof RetrieveConf)) {
- LogUtil.e(requestId, "persistIfRequired: invalid parsed PDU");
+ LogUtil.e(requestId, "persistIfRequired: invalid parsed PDU. messageId: "
+ + mMessageId);
return null;
}
final RetrieveConf retrieveConf = (RetrieveConf) pdu;
final int status = retrieveConf.getRetrieveStatus();
if (status != PduHeaders.RETRIEVE_STATUS_OK) {
- LogUtil.e(requestId, "persistIfRequired: retrieve failed " + status);
+ LogUtil.e(requestId, "persistIfRequired: retrieve failed " + status
+ + ", messageId: " + mMessageId);
// Update the retrieve status of the NotificationInd
final ContentValues values = new ContentValues(1);
values.put(Telephony.Mms.RETRIEVE_STATUS, status);
@@ -148,7 +151,8 @@ public class DownloadRequest extends MmsRequest {
true/*groupMmsEnabled*/,
null/*preOpenedFiles*/);
if (messageUri == null) {
- LogUtil.e(requestId, "persistIfRequired: can not persist message");
+ LogUtil.e(requestId, "persistIfRequired: can not persist message. messageId: "
+ + mMessageId);
return null;
}
// Update some of the properties of the message
@@ -167,7 +171,8 @@ public class DownloadRequest extends MmsRequest {
values,
null/*where*/,
null/*selectionArg*/) != 1) {
- LogUtil.e(requestId, "persistIfRequired: can not update message");
+ LogUtil.e(requestId, "persistIfRequired: can not update message. messageId: "
+ + mMessageId);
}
// Delete the corresponding NotificationInd
SqliteWrapper.delete(context,
@@ -181,11 +186,14 @@ public class DownloadRequest extends MmsRequest {
return messageUri;
} catch (MmsException e) {
- LogUtil.e(requestId, "persistIfRequired: can not persist message", e);
+ LogUtil.e(requestId, "persistIfRequired: can not persist message. messageId: "
+ + mMessageId, e);
} catch (SQLiteException e) {
- LogUtil.e(requestId, "persistIfRequired: can not update message", e);
+ LogUtil.e(requestId, "persistIfRequired: can not update message. messageId: "
+ + mMessageId, e);
} catch (RuntimeException e) {
- LogUtil.e(requestId, "persistIfRequired: can not parse response", e);
+ LogUtil.e(requestId, "persistIfRequired: can not parse response. messageId: "
+ + mMessageId, e);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -277,9 +285,11 @@ public class DownloadRequest extends MmsRequest {
CarrierDownloadCompleteCallback carrierDownloadCallback) {
mCarrierDownloadCallback = carrierDownloadCallback;
if (bindToCarrierMessagingService(context, carrierMessagingServicePackage)) {
- LogUtil.v("bindService() for carrier messaging service succeeded");
+ LogUtil.v("bindService() for carrier messaging service succeeded. messageId: "
+ + mMessageId);
} else {
- LogUtil.e("bindService() for carrier messaging service failed");
+ LogUtil.e("bindService() for carrier messaging service failed. messageId: "
+ + mMessageId);
carrierDownloadCallback.onDownloadMmsComplete(
CarrierMessagingService.DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK);
}
@@ -291,7 +301,8 @@ public class DownloadRequest extends MmsRequest {
downloadMms(mContentUri, mSubId, Uri.parse(mLocationUrl),
mCarrierDownloadCallback);
} catch (RuntimeException e) {
- LogUtil.e("Exception downloading MMS using the carrier messaging service: " + e, e);
+ LogUtil.e("Exception downloading MMS for messageId " + mMessageId
+ + " using the carrier messaging service: " + e, e);
mCarrierDownloadCallback.onDownloadMmsComplete(
CarrierMessagingService.DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK);
}
@@ -315,12 +326,14 @@ public class DownloadRequest extends MmsRequest {
@Override
public void onSendMmsComplete(int result, byte[] sendConfPdu) {
- LogUtil.e("Unexpected onSendMmsComplete call with result: " + result);
+ LogUtil.e("Unexpected onSendMmsComplete call with result: " + result
+ + ", messageId: " + mMessageId);
}
@Override
public void onDownloadMmsComplete(int result) {
- LogUtil.d("Carrier app result for download: " + result);
+ LogUtil.d("Carrier app result for download: " + result
+ + ", messageId: " + mMessageId);
mCarrierDownloadManager.disposeConnection(mContext);
if (!maybeFallbackToRegularDelivery(result)) {
diff --git a/src/com/android/mms/service/MmsRequest.java b/src/com/android/mms/service/MmsRequest.java
index 9f3e620..baf9292 100644
--- a/src/com/android/mms/service/MmsRequest.java
+++ b/src/com/android/mms/service/MmsRequest.java
@@ -83,15 +83,17 @@ public abstract class MmsRequest {
protected Bundle mMmsConfigOverrides;
// Context used to get TelephonyManager.
protected Context mContext;
+ protected long mMessageId;
public MmsRequest(RequestManager requestManager, int subId, String creator,
- Bundle configOverrides, Context context) {
+ Bundle configOverrides, Context context, long messageId) {
mRequestManager = requestManager;
mSubId = subId;
mCreator = creator;
mMmsConfigOverrides = configOverrides;
mMmsConfig = null;
mContext = context;
+ mMessageId = messageId;
}
public int getSubId() {
@@ -133,7 +135,7 @@ public abstract class MmsRequest {
* @param networkManager The network manager to use
*/
public void execute(Context context, MmsNetworkManager networkManager) {
- final String requestId = this.toString();
+ final String requestId = this.getRequestId();
LogUtil.i(requestId, "Executing...");
int result = SmsManager.MMS_ERROR_UNSPECIFIED;
int httpStatusCode = 0;
@@ -206,7 +208,7 @@ public abstract class MmsRequest {
/**
* Process the result of the completed request, including updating the message status
* in database and sending back the result via pending intents.
- * @param context The context
+ * @param context The context
* @param result The result code of execution
* @param response The response body
* @param httpStatusCode The optional http status code in case of http failure
@@ -214,6 +216,14 @@ public abstract class MmsRequest {
public void processResult(Context context, int result, byte[] response, int httpStatusCode) {
final Uri messageUri = persistIfRequired(context, result, response);
+ final String requestId = this.getRequestId();
+ // As noted in the @param comment above, the httpStatusCode is only set when there's
+ // an http failure. On success, such as an http code of 200, the value here will be 0.
+ // It's disconcerting in the log to see httpStatusCode: 0 when the mms succeeded. That
+ // is why an httpStatusCode of zero is now reported in the log as "success".
+ LogUtil.i(requestId, "processResult: " + result + ", httpStatusCode: "
+ + (httpStatusCode != 0 ? httpStatusCode : "success (0)"));
+
// Return MMS HTTP request result via PendingIntent
final PendingIntent pendingIntent = getPendingIntent();
if (pendingIntent != null) {
@@ -235,7 +245,7 @@ public abstract class MmsRequest {
}
pendingIntent.send(context, result, fillIn);
} catch (PendingIntent.CanceledException e) {
- LogUtil.e(this.toString(), "Sending pending intent canceled", e);
+ LogUtil.e(requestId, "Sending pending intent canceled", e);
}
}
@@ -251,7 +261,8 @@ public abstract class MmsRequest {
== CarrierMessagingService.SEND_STATUS_RETRY_ON_CARRIER_NETWORK
|| carrierMessagingAppResult
== CarrierMessagingService.DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK) {
- LogUtil.d(this.toString(), "Sending/downloading MMS by IP failed.");
+ LogUtil.d(this.toString(), "Sending/downloading MMS by IP failed. messageId: "
+ + mMessageId);
mRequestManager.addSimRequest(MmsRequest.this);
return true;
} else {
@@ -275,7 +286,8 @@ public abstract class MmsRequest {
@Override
public String toString() {
- return getClass().getSimpleName() + '@' + Integer.toHexString(hashCode());
+ return getClass().getSimpleName() + '@' + Integer.toHexString(hashCode())
+ + " messageId: " + mMessageId;
}
@@ -344,17 +356,20 @@ public abstract class MmsRequest {
protected abstract class CarrierMmsActionCallback extends CarrierMessagingCallbackWrapper {
@Override
public void onSendSmsComplete(int result, int messageRef) {
- LogUtil.e("Unexpected onSendSmsComplete call with result: " + result);
+ LogUtil.e("Unexpected onSendSmsComplete call for messageId " + mMessageId
+ + " with result: " + result);
}
@Override
public void onSendMultipartSmsComplete(int result, int[] messageRefs) {
- LogUtil.e("Unexpected onSendMultipartSmsComplete call with result: " + result);
+ LogUtil.e("Unexpected onSendMultipartSmsComplete call for messageId " + mMessageId
+ + " with result: " + result);
}
@Override
public void onFilterComplete(int result) {
- LogUtil.e("Unexpected onFilterComplete call with result: " + result);
+ LogUtil.e("Unexpected onFilterComplete call for messageId " + mMessageId
+ + " with result: " + result);
}
}
}
diff --git a/src/com/android/mms/service/MmsService.java b/src/com/android/mms/service/MmsService.java
index f94ae8a..277f0b7 100644
--- a/src/com/android/mms/service/MmsService.java
+++ b/src/com/android/mms/service/MmsService.java
@@ -181,8 +181,9 @@ public class MmsService extends Service implements MmsRequest.RequestManager {
private IMms.Stub mStub = new IMms.Stub() {
@Override
public void sendMessage(int subId, String callingPkg, Uri contentUri,
- String locationUrl, Bundle configOverrides, PendingIntent sentIntent) {
- LogUtil.d("sendMessage");
+ String locationUrl, Bundle configOverrides, PendingIntent sentIntent,
+ long messageId) {
+ LogUtil.d("sendMessage messageId: " + messageId);
enforceSystemUid();
// Make sure the subId is correct
@@ -202,7 +203,8 @@ public class MmsService extends Service implements MmsRequest.RequestManager {
}
final SendRequest request = new SendRequest(MmsService.this, subId, contentUri,
- locationUrl, sentIntent, callingPkg, configOverrides, MmsService.this);
+ locationUrl, sentIntent, callingPkg, configOverrides, MmsService.this,
+ messageId);
final String carrierMessagingServicePackage =
getCarrierMessagingServicePackageIfExists(subId);
@@ -232,11 +234,12 @@ public class MmsService extends Service implements MmsRequest.RequestManager {
@Override
public void downloadMessage(int subId, String callingPkg, String locationUrl,
Uri contentUri, Bundle configOverrides,
- PendingIntent downloadedIntent) {
+ PendingIntent downloadedIntent, long messageId) {
// If the subId is no longer active it could be caused by an MVNO using multiple
// subIds, so we should try to download anyway.
// TODO: Fail fast when downloading will fail (i.e. SIM swapped)
- LogUtil.d("downloadMessage: " + MmsHttpClient.redactUrlForNonVerbose(locationUrl));
+ LogUtil.d("downloadMessage: " + MmsHttpClient.redactUrlForNonVerbose(locationUrl) +
+ ", messageId: " + messageId);
enforceSystemUid();
@@ -251,7 +254,8 @@ public class MmsService extends Service implements MmsRequest.RequestManager {
}
final DownloadRequest request = new DownloadRequest(MmsService.this, subId, locationUrl,
- contentUri, downloadedIntent, callingPkg, configOverrides, MmsService.this);
+ contentUri, downloadedIntent, callingPkg, configOverrides, MmsService.this,
+ messageId);
final String carrierMessagingServicePackage =
getCarrierMessagingServicePackageIfExists(subId);
diff --git a/src/com/android/mms/service/SendRequest.java b/src/com/android/mms/service/SendRequest.java
index fefbbc0..ebbfd6c 100644
--- a/src/com/android/mms/service/SendRequest.java
+++ b/src/com/android/mms/service/SendRequest.java
@@ -57,8 +57,9 @@ public class SendRequest extends MmsRequest {
private final PendingIntent mSentIntent;
public SendRequest(RequestManager manager, int subId, Uri contentUri, String locationUrl,
- PendingIntent sentIntent, String creator, Bundle configOverrides, Context context) {
- super(manager, subId, creator, configOverrides, context);
+ PendingIntent sentIntent, String creator, Bundle configOverrides, Context context,
+ long messageId) {
+ super(manager, subId, creator, configOverrides, context, messageId);
mPduUri = contentUri;
mPduData = null;
mLocationUrl = locationUrl;
@@ -71,8 +72,9 @@ public class SendRequest extends MmsRequest {
final String requestId = getRequestId();
final MmsHttpClient mmsHttpClient = netMgr.getOrCreateHttpClient();
if (mmsHttpClient == null) {
- LogUtil.e(requestId, "MMS network is not ready!");
- throw new MmsHttpException(0/*statusCode*/, "MMS network is not ready");
+ String notReady = "MMS network is not ready! messageId: " + mMessageId;
+ LogUtil.e(requestId, notReady);
+ throw new MmsHttpException(0/*statusCode*/, notReady);
}
final GenericPdu parsedPdu = parsePdu();
notifyIfEmergencyContactNoThrow(parsedPdu);
@@ -93,14 +95,14 @@ public class SendRequest extends MmsRequest {
final String requestId = getRequestId();
try {
if (mPduData == null) {
- LogUtil.w(requestId, "Empty PDU raw data");
+ LogUtil.w(requestId, "Empty PDU raw data. messageId: " + mMessageId);
return null;
}
final boolean supportContentDisposition =
mMmsConfig.getBoolean(SmsManager.MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION);
return new PduParser(mPduData, supportContentDisposition).parse();
} catch (final Exception e) {
- LogUtil.w(requestId, "Failed to parse PDU raw data");
+ LogUtil.w(requestId, "Failed to parse PDU raw data. messageId: " + mMessageId);
}
return null;
}
@@ -113,7 +115,7 @@ public class SendRequest extends MmsRequest {
try {
notifyIfEmergencyContact(parsedPdu);
} catch (Exception e) {
- LogUtil.w(getRequestId(), "Error in notifyIfEmergencyContact", e);
+ LogUtil.w(getRequestId(), "Error in notifyIfEmergencyContact. messageId: " + mMessageId, e);
}
}
@@ -122,7 +124,8 @@ public class SendRequest extends MmsRequest {
SendReq sendReq = (SendReq) parsedPdu;
for (EncodedStringValue encodedStringValue : sendReq.getTo()) {
if (isEmergencyNumber(encodedStringValue.getString())) {
- LogUtil.i(getRequestId(), "Notifying emergency contact");
+ LogUtil.i(getRequestId(), "Notifying emergency contact. messageId: "
+ + mMessageId);
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... voids) {
@@ -130,7 +133,8 @@ public class SendRequest extends MmsRequest {
notifyEmergencyContact(mContext);
} catch (Exception e) {
LogUtil.e(getRequestId(),
- "Exception notifying emergency contact: " + e);
+ "Exception notifying emergency contact. messageId: "
+ + mMessageId + e);
}
return null;
}
@@ -167,9 +171,9 @@ public class SendRequest extends MmsRequest {
// Not required to persist
return null;
}
- LogUtil.d(requestId, "persistIfRequired");
+ LogUtil.d(requestId, "persistIfRequired. messageId: " + mMessageId);
if (mPduData == null) {
- LogUtil.e(requestId, "persistIfRequired: empty PDU");
+ LogUtil.e(requestId, "persistIfRequired: empty PDU. messageId: " + mMessageId);
return null;
}
final long identity = Binder.clearCallingIdentity();
@@ -179,11 +183,12 @@ public class SendRequest extends MmsRequest {
// Persist the request PDU first
GenericPdu pdu = (new PduParser(mPduData, supportContentDisposition)).parse();
if (pdu == null) {
- LogUtil.e(requestId, "persistIfRequired: can't parse input PDU");
+ LogUtil.e(requestId, "persistIfRequired: can't parse input PDU. messageId: "
+ + mMessageId);
return null;
}
if (!(pdu instanceof SendReq)) {
- LogUtil.d(requestId, "persistIfRequired: not SendReq");
+ LogUtil.d(requestId, "persistIfRequired: not SendReq. messageId: " + mMessageId);
return null;
}
final PduPersister persister = PduPersister.getPduPersister(context);
@@ -194,7 +199,8 @@ public class SendRequest extends MmsRequest {
true/*groupMmsEnabled*/,
null/*preOpenedFiles*/);
if (messageUri == null) {
- LogUtil.e(requestId, "persistIfRequired: can not persist message");
+ LogUtil.e(requestId, "persistIfRequired: can not persist message. messageId: "
+ + mMessageId);
return null;
}
// Update the additional columns based on the send result
@@ -232,13 +238,16 @@ public class SendRequest extends MmsRequest {
values.put(Telephony.Mms.SUBSCRIPTION_ID, mSubId);
if (SqliteWrapper.update(context, context.getContentResolver(), messageUri, values,
null/*where*/, null/*selectionArg*/) != 1) {
- LogUtil.e(requestId, "persistIfRequired: failed to update message");
+ LogUtil.e(requestId, "persistIfRequired: failed to update message. messageId: "
+ + mMessageId);
}
return messageUri;
} catch (MmsException e) {
- LogUtil.e(requestId, "persistIfRequired: can not persist message", e);
+ LogUtil.e(requestId, "persistIfRequired: can not persist message. messageId: "
+ + mMessageId, e);
} catch (RuntimeException e) {
- LogUtil.e(requestId, "persistIfRequired: unexpected parsing failure", e);
+ LogUtil.e(requestId, "persistIfRequired: unexpected parsing failure. messageId: "
+ + mMessageId, e);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -253,11 +262,12 @@ public class SendRequest extends MmsRequest {
private void updateDestinationAddress(final GenericPdu pdu) {
final String requestId = getRequestId();
if (pdu == null) {
- LogUtil.e(requestId, "updateDestinationAddress: can't parse input PDU");
+ LogUtil.e(requestId, "updateDestinationAddress: can't parse input PDU. messageId: "
+ + mMessageId);
return ;
}
if (!(pdu instanceof SendReq)) {
- LogUtil.i(requestId, "updateDestinationAddress: not SendReq");
+ LogUtil.i(requestId, "updateDestinationAddress: not SendReq. messageId: " + mMessageId);
return;
}
@@ -390,9 +400,11 @@ public class SendRequest extends MmsRequest {
CarrierSendCompleteCallback carrierSendCompleteCallback) {
mCarrierSendCompleteCallback = carrierSendCompleteCallback;
if (bindToCarrierMessagingService(context, carrierMessagingServicePackage)) {
- LogUtil.v("bindService() for carrier messaging service succeeded");
+ LogUtil.v("bindService() for carrier messaging service succeeded. messageId: "
+ + mMessageId);
} else {
- LogUtil.e("bindService() for carrier messaging service failed");
+ LogUtil.e("bindService() for carrier messaging service failed. messageId: "
+ + mMessageId);
carrierSendCompleteCallback.onSendMmsComplete(
CarrierMessagingService.SEND_STATUS_RETRY_ON_CARRIER_NETWORK,
null /* no sendConfPdu */);
@@ -408,7 +420,8 @@ public class SendRequest extends MmsRequest {
}
sendMms(mPduUri, mSubId, locationUri, mCarrierSendCompleteCallback);
} catch (RuntimeException e) {
- LogUtil.e("Exception sending MMS using the carrier messaging service: " + e, e);
+ LogUtil.e("Exception sending MMS using the carrier messaging service. messageId: "
+ + mMessageId + e, e);
mCarrierSendCompleteCallback.onSendMmsComplete(
CarrierMessagingService.SEND_STATUS_RETRY_ON_CARRIER_NETWORK,
null /* no sendConfPdu */);
@@ -432,7 +445,7 @@ public class SendRequest extends MmsRequest {
@Override
public void onSendMmsComplete(int result, byte[] sendConfPdu) {
- LogUtil.d("Carrier app result for send: " + result);
+ LogUtil.d("Carrier app result for sending messageId " + mMessageId + ": " + result);
mCarrierSendManager.disposeConnection(mContext);
if (!maybeFallbackToRegularDelivery(result)) {
@@ -443,7 +456,8 @@ public class SendRequest extends MmsRequest {
@Override
public void onDownloadMmsComplete(int result) {
- LogUtil.e("Unexpected onDownloadMmsComplete call with result: " + result);
+ LogUtil.e("Unexpected onDownloadMmsComplete call for messageId " + mMessageId
+ + " with result: " + result);
}
}
diff --git a/tests/robotests/src/com/android/mms/service/MmsServiceRoboTest.java b/tests/robotests/src/com/android/mms/service/MmsServiceRoboTest.java
index 5e4c309..c43fa74 100644
--- a/tests/robotests/src/com/android/mms/service/MmsServiceRoboTest.java
+++ b/tests/robotests/src/com/android/mms/service/MmsServiceRoboTest.java
@@ -56,13 +56,15 @@ public final class MmsServiceRoboTest {
public void testSendMessage_DoesNotThrowIfSystemUid() throws RemoteException {
ShadowBinder.setCallingUid(Process.SYSTEM_UID);
binder.sendMessage(/* subId= */ 0, "callingPkg", Uri.parse("contentUri"),
- "locationUrl", /* configOverrides= */ null, /* sentIntent= */ null);
+ "locationUrl", /* configOverrides= */ null, /* sentIntent= */ null,
+ /* messageId= */ 0L);
}
@Test
public void testSendMessageThrows_IfNotSystemUid() {
assertThrows(SecurityException.class,
() -> binder.sendMessage(/* subId= */ 0, "callingPkg", Uri.parse("contentUri"),
- "locationUrl", /* configOverrides= */ null, /* sentIntent= */ null));
+ "locationUrl", /* configOverrides= */ null, /* sentIntent= */ null,
+ /* messageId= */ 0L));
}
}