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) {
Loading