From 3df02a7df8488e04e31ae1d9d081ed1b881dd6ad Mon Sep 17 00:00:00 2001 From: Nikhil Kumar Date: Mon, 8 Jul 2024 17:01:09 +0100 Subject: Systemservice change to propagate userId to MMSService Convey the originating user ID across the nested binder calls to MMSService to validate the contentURI is coming from the same userId. For detailed design please follow: go/mms-failure-multiuser Bug: 350760118 Test: manually verfied the functionalities after the change (1) Incoming and outgoing SMS/MMS (2) Incoming and outgoing Voice calls Flag: EXEMPT this involves changing the method signature in aidl with flags its not possible currently as aidl doesn't support method overloading Change-Id: I9beb19f1a94aae76e6cd48a72feeb6c1dc47cf5a --- mms/java/android/telephony/MmsManager.java | 13 +++++++------ mms/java/com/android/internal/telephony/IMms.aidl | 12 ++++++++---- 2 files changed, 15 insertions(+), 10 deletions(-) (limited to 'mms') diff --git a/mms/java/android/telephony/MmsManager.java b/mms/java/android/telephony/MmsManager.java index b893b45611fb..ac2927711c9a 100644 --- a/mms/java/android/telephony/MmsManager.java +++ b/mms/java/android/telephony/MmsManager.java @@ -26,6 +26,7 @@ import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.UserHandle; import com.android.internal.telephony.IMms; @@ -69,9 +70,9 @@ public class MmsManager { return; } - iMms.sendMessage(subId, ActivityThread.currentPackageName(), contentUri, - locationUrl, configOverrides, sentIntent, messageId, - mContext.getAttributionTag()); + iMms.sendMessage(subId, /* placeholder callingUser= */ UserHandle.USER_NULL, + ActivityThread.currentPackageName(), contentUri, locationUrl, + configOverrides, sentIntent, messageId, mContext.getAttributionTag()); } catch (RemoteException e) { // Ignore it } @@ -101,9 +102,9 @@ public class MmsManager { if (iMms == null) { return; } - iMms.downloadMessage(subId, ActivityThread.currentPackageName(), - locationUrl, contentUri, configOverrides, downloadedIntent, - messageId, mContext.getAttributionTag()); + iMms.downloadMessage(subId, /* placeholder callingUser= */ UserHandle.USER_NULL, + ActivityThread.currentPackageName(), locationUrl, contentUri, + configOverrides, downloadedIntent, messageId, mContext.getAttributionTag()); } catch (RemoteException e) { // Ignore it } diff --git a/mms/java/com/android/internal/telephony/IMms.aidl b/mms/java/com/android/internal/telephony/IMms.aidl index 3cdde10e4fc2..1c7595164de2 100644 --- a/mms/java/com/android/internal/telephony/IMms.aidl +++ b/mms/java/com/android/internal/telephony/IMms.aidl @@ -29,6 +29,7 @@ interface IMms { * Send an MMS message with attribution tag. * * @param subId the SIM id + * @param callingUser user id of the calling app * @param callingPkg the package name of the calling app * @param contentUri the content uri from which to read MMS message encoded in standard MMS * PDU format @@ -40,7 +41,7 @@ interface IMms { * @param messageId An id that uniquely identifies the message requested to be sent. * @param attributionTag a tag that attributes the call to a client App. */ - void sendMessage(int subId, String callingPkg, in Uri contentUri, + void sendMessage(int subId, in int callingUser, String callingPkg, in Uri contentUri, String locationUrl, in Bundle configOverrides, in PendingIntent sentIntent, in long messageId, String attributionTag); @@ -48,6 +49,7 @@ interface IMms { * Download an MMS message using known location and transaction id * * @param subId the SIM id + * @param callingUser user id of the calling app * @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 @@ -60,7 +62,7 @@ interface IMms { * @param messageId An id that uniquely identifies the message requested to be downloaded. * @param attributionTag a tag that attributes the call to a client App. */ - void downloadMessage(int subId, String callingPkg, String locationUrl, + void downloadMessage(int subId, in int callingUser, String callingPkg, String locationUrl, in Uri contentUri, in Bundle configOverrides, in PendingIntent downloadedIntent, in long messageId, String attributionTag); @@ -82,6 +84,7 @@ interface IMms { /** * Import a multimedia message into system's MMS store * + * @param callingUser user id of the calling app * @param callingPkg the package name of the calling app * @param contentUri the content uri from which to read PDU of the message to import * @param messageId the optional message id @@ -90,7 +93,7 @@ interface IMms { * @param read if the message is read * @return the message URI, null if failed */ - Uri importMultimediaMessage(String callingPkg, in Uri contentUri, String messageId, + Uri importMultimediaMessage(in int callingUser, String callingPkg, in Uri contentUri, String messageId, long timestampSecs, boolean seen, boolean read); /** @@ -146,11 +149,12 @@ interface IMms { /** * Add a multimedia message draft to system MMS store * + * @param callingUser user id of the calling app * @param callingPkg the package name of the calling app * @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 Uri contentUri); + Uri addMultimediaMessageDraft(in int callingUser, String callingPkg, in Uri contentUri); /** * Send a system stored MMS message -- cgit v1.2.3-59-g8ed1b