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

Commit b4d5b259 authored by Hakjun Choi's avatar Hakjun Choi Committed by Android (Google) Code Review
Browse files

Merge "Add calling app name into outgoing sms/mms when they are sent via...

Merge "Add calling app name into outgoing sms/mms when they are sent via satellite service" into main
parents c4d2c119 5ffd40cb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -383,6 +383,8 @@ message OutgoingSms {
    optional bool is_mt_sms_polling = 21;
    optional bool is_nb_iot_ntn = 22;
    optional int32 pdu_length = 23;
    optional string calling_package_name = 24;
    optional int32 app_uid = 25;

    // Internal use only
    optional int32 hashCode = 10001;
+33 −29
Original line number Diff line number Diff line
@@ -409,14 +409,14 @@ public class IccSmsInterfaceManager {
     */
    public void sendDataWithSelfPermissions(String callingPackage, int callingUser,
            String callingAttributionTag, String destAddr, String scAddr, int destPort, byte[] data,
            PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) {
            PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm, int uid) {
        if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, callingAttributionTag,
                "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntent);
            return;
        }
        sendDataInternal(callingPackage, callingUser, destAddr, scAddr, destPort, data, sentIntent,
                deliveryIntent, isForVvm);
                deliveryIntent, isForVvm, uid);
    }

    /**
@@ -428,7 +428,7 @@ public class IccSmsInterfaceManager {
    public void sendData(String callingPackage, int callingUser, String destAddr, String scAddr,
            int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) {
        sendData(callingPackage, callingUser, null, destAddr, scAddr, destPort, data,
                sentIntent, deliveryIntent);
                sentIntent, deliveryIntent, android.os.Process.INVALID_UID);
    }

    /**
@@ -437,14 +437,14 @@ public class IccSmsInterfaceManager {
     */
    public void sendData(String callingPackage, int callingUser, String callingAttributionTag,
            String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent,
            PendingIntent deliveryIntent) {
            PendingIntent deliveryIntent, int uid) {
        if (!mSmsPermissions.checkCallingCanSendSms(callingPackage, callingAttributionTag,
                "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntent);
            return;
        }
        sendDataInternal(callingPackage, callingUser, destAddr, scAddr, destPort, data, sentIntent,
                deliveryIntent, false /* isForVvm */);
                deliveryIntent, false /* isForVvm */, uid);
    }

    /**
@@ -476,7 +476,7 @@ public class IccSmsInterfaceManager {

    private void sendDataInternal(String callingPackage, int callinUser, String destAddr,
            String scAddr, int destPort, byte[] data, PendingIntent sentIntent,
            PendingIntent deliveryIntent, boolean isForVvm) {
            PendingIntent deliveryIntent, boolean isForVvm, int uid) {
        if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
            log("sendData: destAddr=" + destAddr + " scAddr=" + scAddr + " destPort="
                    + destPort + " data='" + HexDump.toHexString(data)  + "' sentIntent="
@@ -484,7 +484,7 @@ public class IccSmsInterfaceManager {
        }
        destAddr = filterDestAddress(destAddr);
        mDispatchersController.sendData(callingPackage, callinUser, destAddr, scAddr,
                destPort, data, sentIntent, deliveryIntent, isForVvm);
                destPort, data, sentIntent, deliveryIntent, isForVvm, uid);
    }

    /**
@@ -494,12 +494,13 @@ public class IccSmsInterfaceManager {
     */
    public void sendText(String callingPackage, int callingUser, String destAddr, String scAddr,
            String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
            boolean persistMessageForNonDefaultSmsApp, long messageId, boolean skipShortCodeCheck) {
            boolean persistMessageForNonDefaultSmsApp, long messageId, boolean skipShortCodeCheck,
            int uid) {
        sendTextInternal(callingPackage, callingUser, destAddr, scAddr, text, sentIntent,
                deliveryIntent, persistMessageForNonDefaultSmsApp,
                SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */,
                SMS_MESSAGE_PERIOD_NOT_SPECIFIED, false /* isForVvm */,
                messageId, skipShortCodeCheck);
                messageId, skipShortCodeCheck, uid);
    }

    /**
@@ -509,7 +510,7 @@ public class IccSmsInterfaceManager {
    public void sendTextWithSelfPermissions(String callingPackage, int callingUser,
            String callingAttributeTag, String destAddr, String scAddr, String text,
            PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage,
            boolean isForVvm) {
            boolean isForVvm, int uid) {
        if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, callingAttributeTag,
                "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntent);
@@ -518,17 +519,17 @@ public class IccSmsInterfaceManager {
        sendTextInternal(callingPackage, callingUser, destAddr, scAddr, text, sentIntent,
                deliveryIntent, persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
                false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED,
                isForVvm, 0L /* messageId */);
                isForVvm, 0L /* messageId */, uid);
    }


    private void sendTextInternal(String callingPackage, int callingUser, String destAddr,
            String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
            boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore,
            int validityPeriod, boolean isForVvm, long messageId) {
            int validityPeriod, boolean isForVvm, long messageId, int uid) {
        sendTextInternal(callingPackage, callingUser, destAddr, scAddr, text, sentIntent,
                deliveryIntent, persistMessageForNonDefaultSmsApp, priority, expectMore,
                validityPeriod, isForVvm, messageId, false);
                validityPeriod, isForVvm, messageId, false, uid);
    }

    /**
@@ -583,7 +584,8 @@ public class IccSmsInterfaceManager {
    private void sendTextInternal(String callingPackage, int callingUser, String destAddr,
            String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
            boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore,
            int validityPeriod, boolean isForVvm, long messageId, boolean skipShortCodeCheck) {
            int validityPeriod, boolean isForVvm, long messageId, boolean skipShortCodeCheck,
            int uid) {
        if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
            log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr
                    + " text='" + text + "' sentIntent=" + sentIntent + " deliveryIntent="
@@ -595,7 +597,7 @@ public class IccSmsInterfaceManager {
        destAddr = filterDestAddress(destAddr);
        mDispatchersController.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent,
                null/*messageUri*/, callingPackage, callingUser, persistMessageForNonDefaultSmsApp,
                priority, expectMore, validityPeriod, isForVvm, messageId, skipShortCodeCheck);
                priority, expectMore, validityPeriod, isForVvm, messageId, skipShortCodeCheck, uid);
    }

    /**
@@ -648,7 +650,7 @@ public class IccSmsInterfaceManager {
            String callingAttributionTag, String destAddr, String scAddr, String text,
            PendingIntent sentIntent, PendingIntent deliveryIntent,
            boolean persistMessageForNonDefaultSmsApp, int priority,
            boolean expectMore, int validityPeriod) {
            boolean expectMore, int validityPeriod, int uid) {
        if (!mSmsPermissions.checkCallingCanSendText(persistMessageForNonDefaultSmsApp,
                    callingPackage, callingAttributionTag, "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntent);
@@ -656,7 +658,7 @@ public class IccSmsInterfaceManager {
        }
        sendTextInternal(callingPackage, callingUser, destAddr, scAddr, text, sentIntent,
                deliveryIntent, persistMessageForNonDefaultSmsApp, priority, expectMore,
                validityPeriod, false /* isForVvm */, 0L /* messageId */);
                validityPeriod, false /* isForVvm */, 0L /* messageId */, uid);
    }

    /**
@@ -725,12 +727,12 @@ public class IccSmsInterfaceManager {
    public void sendMultipartText(String callingPackage, int callingUser,
            String callingAttributionTag, String destAddr, String scAddr, List<String> parts,
            List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents,
            boolean persistMessageForNonDefaultSmsApp, long messageId) {
            boolean persistMessageForNonDefaultSmsApp, long messageId, int uid) {
        sendMultipartTextWithOptions(callingPackage, callingUser, callingAttributionTag, destAddr,
                scAddr, parts, sentIntents, deliveryIntents, persistMessageForNonDefaultSmsApp,
                SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */,
                SMS_MESSAGE_PERIOD_NOT_SPECIFIED,
                messageId);
                messageId, uid);
    }

    /**
@@ -786,7 +788,7 @@ public class IccSmsInterfaceManager {
            String callingAttributionTag, String destAddr, String scAddr, List<String> parts,
            List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents,
            boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore,
            int validityPeriod, long messageId) {
            int validityPeriod, long messageId, int uid) {
        if (!mSmsPermissions.checkCallingCanSendText(persistMessageForNonDefaultSmsApp,
                callingPackage, callingAttributionTag, "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntents);
@@ -828,7 +830,7 @@ public class IccSmsInterfaceManager {
                mDispatchersController.sendText(destAddr, scAddr, singlePart, singleSentIntent,
                        singleDeliveryIntent, null /* messageUri */, callingPackage, callingUser,
                        persistMessageForNonDefaultSmsApp, priority, expectMore, validityPeriod,
                        false /* isForVvm */, messageId);
                        false /* isForVvm */, messageId, uid);
            }
            return;
        }
@@ -839,7 +841,7 @@ public class IccSmsInterfaceManager {
                (ArrayList<PendingIntent>) sentIntents,
                (ArrayList<PendingIntent>) deliveryIntents,
                null, callingPackage, callingUser, persistMessageForNonDefaultSmsApp,
                priority, expectMore, validityPeriod, messageId);
                priority, expectMore, validityPeriod, messageId, uid);

    }

@@ -1292,12 +1294,12 @@ public class IccSmsInterfaceManager {
    public void sendStoredText(String callingPkg, int callingUser, Uri messageUri, String scAddress,
            PendingIntent sentIntent, PendingIntent deliveryIntent) {
        sendStoredText(callingPkg, callingUser, null, messageUri,
                scAddress, sentIntent, deliveryIntent);
                scAddress, sentIntent, deliveryIntent, android.os.Process.INVALID_UID);
    }

    public void sendStoredText(String callingPkg, int callingUser, String callingAttributionTag,
            Uri messageUri, String scAddress, PendingIntent sentIntent,
            PendingIntent deliveryIntent) {
            PendingIntent deliveryIntent, int uid) {
        if (!mSmsPermissions.checkCallingCanSendSms(callingPkg, callingAttributionTag,
                "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntent);
@@ -1325,7 +1327,7 @@ public class IccSmsInterfaceManager {
                sentIntent, deliveryIntent, messageUri, callingPkg, callingUser,
                true /* persistMessageForNonDefaultSmsApp */, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
                false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED, false /* isForVvm */,
                0L /* messageId */);
                0L /* messageId */, uid);
    }

    /**
@@ -1338,12 +1340,13 @@ public class IccSmsInterfaceManager {
            Uri messageUri, String scAddress, List<PendingIntent> sentIntents,
            List<PendingIntent> deliveryIntents) {
        sendStoredMultipartText(callingPkg, callingUser, null,
                messageUri, scAddress, sentIntents, deliveryIntents);
                messageUri, scAddress, sentIntents, deliveryIntents,
                android.os.Process.INVALID_UID);
    }

    public void sendStoredMultipartText(String callingPkg, int callingUser,
            String callingAttributionTag, Uri messageUri, String scAddress,
            List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents) {
            List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents, int uid) {
        if (!mSmsPermissions.checkCallingCanSendSms(callingPkg, callingAttributionTag,
                "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntents);
@@ -1397,7 +1400,7 @@ public class IccSmsInterfaceManager {
                        callingUser, true  /* persistMessageForNonDefaultSmsApp */,
                        SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
                        false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED,
                        false /* isForVvm */, 0L /* messageId */);
                        false /* isForVvm */, 0L /* messageId */, uid);
            }
            return;
        }
@@ -1414,7 +1417,8 @@ public class IccSmsInterfaceManager {
                SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
                false /* expectMore */,
                SMS_MESSAGE_PERIOD_NOT_SPECIFIED,
                0L /* messageId */);
                0L /* messageId */,
                uid);
    }

    public int getSmsCapacityOnIcc(String callingPackage, String callingFeatureId) {
+6 −2
Original line number Diff line number Diff line
@@ -250,7 +250,9 @@ public class ImsSmsDispatcher extends SMSDispatcher {
                        tracker.getInterval(),
                        mTelephonyManager.isEmergencyNumber(tracker.mDestAddress),
                        tracker.isMtSmsPollingMessage(mContext),
                        tracker.getPduLength());
                        tracker.getPduLength(),
                        tracker.getAppPackageName(),
                        tracker.getAppUid());
                if (mPhone != null) {
                    TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics();
                    if (telephonyAnalytics != null) {
@@ -670,7 +672,9 @@ public class ImsSmsDispatcher extends SMSDispatcher {
                    tracker.getInterval(),
                    mTelephonyManager.isEmergencyNumber(tracker.mDestAddress),
                    tracker.isMtSmsPollingMessage(mContext),
                    tracker.getPduLength());
                    tracker.getPduLength(),
                    tracker.getAppPackageName(),
                    tracker.getAppUid());
            if (mPhone != null) {
                TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics();
                if (telephonyAnalytics != null) {
+45 −24

File changed.

Preview size limit exceeded, changes collapsed.

+32 −23
Original line number Diff line number Diff line
@@ -177,6 +177,7 @@ public class SmsController extends ISmsImplBase {
            callingPackage = getCallingPackage();
        }
        UserHandle callingUser = Binder.getCallingUserHandle();
        int uid = Binder.getCallingUid();

        Rlog.d(LOG_TAG, "sendDataForSubscriber caller=" + callingPackage);

@@ -184,7 +185,7 @@ public class SmsController extends ISmsImplBase {
        if (!TelephonyPermissions.checkSubscriptionAssociatedWithUser(mContext, subId,
                callingUser, destAddr)) {
            TelephonyUtils.showSwitchToManagedProfileDialogIfAppropriate(mContext, subId,
                    Binder.getCallingUid(), callingPackage);
                    uid, callingPackage);
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_USER_NOT_ALLOWED);
            return;
        }
@@ -199,7 +200,7 @@ public class SmsController extends ISmsImplBase {
        if (iccSmsIntMgr != null) {
            iccSmsIntMgr.sendData(callingPackage, callingUser.getIdentifier(),
                    callingAttributionTag, destAddr, scAddr, destPort,
                    data, sentIntent, deliveryIntent);
                    data, sentIntent, deliveryIntent, uid);
        } else {
            Rlog.e(LOG_TAG, "sendDataForSubscriber iccSmsIntMgr is null for"
                    + " Subscription: " + subId);
@@ -211,12 +212,12 @@ public class SmsController extends ISmsImplBase {
    private void sendDataForSubscriberWithSelfPermissionsInternal(int subId, String callingPackage,
            int callingUser, String callingAttributionTag, String destAddr, String scAddr,
            int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent,
            boolean isForVvm) {
            boolean isForVvm, int uid) {
        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null) {
            iccSmsIntMgr.sendDataWithSelfPermissions(callingPackage, callingUser,
                    callingAttributionTag, destAddr, scAddr, destPort, data, sentIntent,
                    deliveryIntent, isForVvm);
                    deliveryIntent, isForVvm, uid);
        } else {
            Rlog.e(LOG_TAG, "sendText iccSmsIntMgr is null for"
                    + " Subscription: " + subId);
@@ -272,7 +273,7 @@ public class SmsController extends ISmsImplBase {
            callingPackage = getCallingPackage();
        }
        UserHandle callingUser = Binder.getCallingUserHandle();

        int uid = Binder.getCallingUid();

        Rlog.d(LOG_TAG, "sendTextForSubscriber caller=" + callingPackage);

@@ -321,7 +322,7 @@ public class SmsController extends ISmsImplBase {
            } else {
                sendIccText(subId, callingPackage, callingUser.getIdentifier(), destAddr, scAddr,
                        text, sentIntent, deliveryIntent, persistMessageForNonDefaultSmsApp,
                        messageId, skipShortCodeCheck);
                        messageId, skipShortCodeCheck, uid);
            }
        } finally {
            Binder.restoreCallingIdentity(token);
@@ -341,14 +342,15 @@ public class SmsController extends ISmsImplBase {

    private void sendIccText(int subId, String callingPackage, int callingUser, String destAddr,
            String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
            boolean persistMessageForNonDefaultSmsApp, long messageId, boolean skipShortCodeCheck) {
            boolean persistMessageForNonDefaultSmsApp, long messageId, boolean skipShortCodeCheck,
            int uid) {
        Rlog.d(LOG_TAG, "sendTextForSubscriber iccSmsIntMgr"
                + " Subscription: " + subId + " " + formatCrossStackMessageId(messageId));
        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null) {
            iccSmsIntMgr.sendText(callingPackage, callingUser, destAddr, scAddr, text, sentIntent,
                    deliveryIntent, persistMessageForNonDefaultSmsApp, messageId,
                    skipShortCodeCheck);
                    skipShortCodeCheck, uid);
        } else {
            Rlog.e(LOG_TAG, "sendTextForSubscriber iccSmsIntMgr is null for"
                    + " Subscription: " + subId + " " + formatCrossStackMessageId(messageId));
@@ -359,12 +361,12 @@ public class SmsController extends ISmsImplBase {
    private void sendTextForSubscriberWithSelfPermissionsInternal(int subId, String callingPackage,
            int callingUser, String callingAttributeTag, String destAddr, String scAddr,
            String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
            boolean persistMessage, boolean isForVvm) {
            boolean persistMessage, boolean isForVvm, int uid) {
        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null) {
            iccSmsIntMgr.sendTextWithSelfPermissions(callingPackage, callingUser,
                    callingAttributeTag, destAddr, scAddr, text, sentIntent, deliveryIntent,
                    persistMessage, isForVvm);
                    persistMessage, isForVvm, uid);
        } else {
            Rlog.e(LOG_TAG, "sendText iccSmsIntMgr is null for"
                    + " Subscription: " + subId);
@@ -381,6 +383,7 @@ public class SmsController extends ISmsImplBase {
            callingPackage = getCallingPackage();
        }
        UserHandle callingUser = Binder.getCallingUserHandle();
        int uid = Binder.getCallingUid();

        Rlog.d(LOG_TAG, "sendTextForSubscriberWithOptions caller=" + callingPackage);

@@ -388,7 +391,7 @@ public class SmsController extends ISmsImplBase {
        if (!TelephonyPermissions.checkSubscriptionAssociatedWithUser(mContext, subId,
                Binder.getCallingUserHandle(), destAddr)) {
            TelephonyUtils.showSwitchToManagedProfileDialogIfAppropriate(mContext, subId,
                    Binder.getCallingUid(), callingPackage);
                    uid, callingPackage);
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_USER_NOT_ALLOWED);
            return;
        }
@@ -403,7 +406,7 @@ public class SmsController extends ISmsImplBase {
        if (iccSmsIntMgr != null) {
            iccSmsIntMgr.sendTextWithOptions(callingPackage, callingUser.getIdentifier(),
                    callingAttributionTag, destAddr, scAddr, parts, sentIntent, deliveryIntent,
                    persistMessage, priority, expectMore, validityPeriod);
                    persistMessage, priority, expectMore, validityPeriod, uid);
        } else {
            Rlog.e(LOG_TAG, "sendTextWithOptions iccSmsIntMgr is null for"
                    + " Subscription: " + subId);
@@ -420,6 +423,7 @@ public class SmsController extends ISmsImplBase {
        // returned by getCallPackage() for backward-compatibility.
        callingPackage = getCallingPackage();
        UserHandle callingUser = Binder.getCallingUserHandle();
        int uid = Binder.getCallingUid();

        Rlog.d(LOG_TAG, "sendMultipartTextForSubscriber caller=" + callingPackage);

@@ -427,7 +431,7 @@ public class SmsController extends ISmsImplBase {
        if (!TelephonyPermissions.checkSubscriptionAssociatedWithUser(mContext, subId,
                Binder.getCallingUserHandle(), destAddr)) {
            TelephonyUtils.showSwitchToManagedProfileDialogIfAppropriate(mContext, subId,
                    Binder.getCallingUid(), callingPackage);
                    uid, callingPackage);
            sendErrorInPendingIntents(sentIntents, SmsManager.RESULT_USER_NOT_ALLOWED);
            return;
        }
@@ -444,7 +448,7 @@ public class SmsController extends ISmsImplBase {
        if (iccSmsIntMgr != null) {
            iccSmsIntMgr.sendMultipartText(callingPackage, callingUser.getIdentifier(),
                    callingAttributionTag, destAddr, scAddr, parts, sentIntents, deliveryIntents,
                    persistMessageForNonDefaultSmsApp, messageId);
                    persistMessageForNonDefaultSmsApp, messageId, uid);
        } else {
            Rlog.e(LOG_TAG, "sendMultipartTextForSubscriber iccSmsIntMgr is null for"
                    + " Subscription: " + subId + " " + formatCrossStackMessageId(messageId));
@@ -461,6 +465,7 @@ public class SmsController extends ISmsImplBase {
            callingPackage = getCallingPackage();
        }
        UserHandle callingUser = Binder.getCallingUserHandle();
        int uid = Binder.getCallingUid();

        Rlog.d(LOG_TAG, "sendMultipartTextForSubscriberWithOptions caller=" + callingPackage);

@@ -468,7 +473,7 @@ public class SmsController extends ISmsImplBase {
        if (!TelephonyPermissions.checkSubscriptionAssociatedWithUser(mContext, subId,
                Binder.getCallingUserHandle(), destAddr)) {
            TelephonyUtils.showSwitchToManagedProfileDialogIfAppropriate(mContext, subId,
                    Binder.getCallingUid(), callingPackage);
                    uid, callingPackage);
            sendErrorInPendingIntents(sentIntents, SmsManager.RESULT_USER_NOT_ALLOWED);
            return;
        }
@@ -483,7 +488,7 @@ public class SmsController extends ISmsImplBase {
        if (iccSmsIntMgr != null) {
            iccSmsIntMgr.sendMultipartTextWithOptions(callingPackage, callingUser.getIdentifier(),
                    callingAttributionTag, destAddr, scAddr, parts, sentIntents, deliveryIntents,
                    persistMessage, priority, expectMore, validityPeriod, 0L /* messageId */);
                    persistMessage, priority, expectMore, validityPeriod, 0L /* messageId */, uid);
        } else {
            Rlog.e(LOG_TAG, "sendMultipartTextWithOptions iccSmsIntMgr is null for"
                    + " Subscription: " + subId);
@@ -736,15 +741,16 @@ public class SmsController extends ISmsImplBase {
            PendingIntent deliveryIntent) {
        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        UserHandle callingUser = Binder.getCallingUserHandle();
        final int uid = Binder.getCallingUid();
        if (!getCallingPackage().equals(callingPkg)) {
            throw new SecurityException("sendStoredText: Package " + callingPkg
                    + "does not belong to " + Binder.getCallingUid());
                    + "does not belong to " + uid);
        }
        Rlog.d(LOG_TAG, "sendStoredText caller=" + callingPkg);

        if (iccSmsIntMgr != null) {
            iccSmsIntMgr.sendStoredText(callingPkg, callingUser.getIdentifier(),
                    callingAttributionTag, messageUri, scAddress, sentIntent, deliveryIntent);
                    callingAttributionTag, messageUri, scAddress, sentIntent, deliveryIntent, uid);
        } else {
            Rlog.e(LOG_TAG, "sendStoredText iccSmsIntMgr is null for subscription: " + subId);
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_ERROR_GENERIC_FAILURE);
@@ -757,16 +763,18 @@ public class SmsController extends ISmsImplBase {
            List<PendingIntent> deliveryIntents) {
        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        UserHandle callingUser = Binder.getCallingUserHandle();
        final int uid = Binder.getCallingUid();

        if (!getCallingPackage().equals(callingPkg)) {
            throw new SecurityException("sendStoredMultipartText: Package " + callingPkg
                    + " does not belong to " + Binder.getCallingUid());
                    + " does not belong to " + uid);
        }
        Rlog.d(LOG_TAG, "sendStoredMultipartText caller=" + callingPkg);

        if (iccSmsIntMgr != null) {
            iccSmsIntMgr.sendStoredMultipartText(callingPkg, callingUser.getIdentifier(),
                    callingAttributionTag, messageUri, scAddress, sentIntents, deliveryIntents);
                    callingAttributionTag, messageUri, scAddress, sentIntents, deliveryIntents,
                    uid);
        } else {
            Rlog.e(LOG_TAG, "sendStoredMultipartText iccSmsIntMgr is null for subscription: "
                    + subId);
@@ -1012,11 +1020,12 @@ public class SmsController extends ISmsImplBase {
            return;
        }

        int uid = Binder.getCallingUid();
        // Check if user is associated with the subscription
        if (!TelephonyPermissions.checkSubscriptionAssociatedWithUser(mContext, subId,
                Binder.getCallingUserHandle(), number)) {
            TelephonyUtils.showSwitchToManagedProfileDialogIfAppropriate(mContext, subId,
                    Binder.getCallingUid(), callingPackage);
                    uid, callingPackage);
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_USER_NOT_ALLOWED);
            return;
        }
@@ -1024,12 +1033,12 @@ public class SmsController extends ISmsImplBase {
        if (port == 0) {
            sendTextForSubscriberWithSelfPermissionsInternal(subId, callingPackage, callingUser,
                    callingAttributionTag, number, null, text, sentIntent, null, false,
                    true /* isForVvm */);
                    true /* isForVvm */, uid);
        } else {
            byte[] data = text.getBytes(StandardCharsets.UTF_8);
            sendDataForSubscriberWithSelfPermissionsInternal(subId, callingPackage, callingUser,
                    callingAttributionTag, number, null, (short) port, data, sentIntent, null,
                    true /* isForVvm */);
                    true /* isForVvm */, uid);
        }
    }

Loading