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

Commit 594dbf64 authored by Ramya Manoharan's avatar Ramya Manoharan Committed by Android (Google) Code Review
Browse files

Merge "Disabling user confirmation pop up for SEND_SMS_NO_CONFIRMATION...

Merge "Disabling user confirmation pop up for SEND_SMS_NO_CONFIRMATION permission when sms is sent via framework in CAtService"
parents 5daf4dc9 c46200b3
Loading
Loading
Loading
Loading
+15 −4
Original line number Original line Diff line number Diff line
@@ -457,11 +457,11 @@ public class IccSmsInterfaceManager {
     */
     */
    public void sendText(String callingPackage, String destAddr, String scAddr,
    public void sendText(String callingPackage, String destAddr, String scAddr,
            String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
            String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
            boolean persistMessageForNonDefaultSmsApp, long messageId) {
            boolean persistMessageForNonDefaultSmsApp, long messageId, boolean skipShortCodeCheck) {
        sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent,
        sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent,
                persistMessageForNonDefaultSmsApp, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
                persistMessageForNonDefaultSmsApp, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
                false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED, false /* isForVvm */,
                false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED, false /* isForVvm */,
                messageId);
                messageId, skipShortCodeCheck);
    }
    }


    /**
    /**
@@ -481,6 +481,16 @@ public class IccSmsInterfaceManager {
                SMS_MESSAGE_PERIOD_NOT_SPECIFIED, isForVvm, 0L /* messageId */);
                SMS_MESSAGE_PERIOD_NOT_SPECIFIED, isForVvm, 0L /* messageId */);
    }
    }



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

    /**
    /**
     * Send a text based SMS.
     * Send a text based SMS.
     *
     *
@@ -527,12 +537,13 @@ public class IccSmsInterfaceManager {
     *  Any Other values including negative considered as Invalid Validity Period of the message.
     *  Any Other values including negative considered as Invalid Validity Period of the message.
     * @param messageId An id that uniquely identifies the message requested to be sent.
     * @param messageId An id that uniquely identifies the message requested to be sent.
     *                 Used for logging and diagnostics purposes. The id may be 0.
     *                 Used for logging and diagnostics purposes. The id may be 0.
     * @param skipShortCodeCheck Skip check for short code type destination address.
     */
     */


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


    /**
    /**
+128 −13
Original line number Original line Diff line number Diff line
@@ -1386,6 +1386,116 @@ public abstract class SMSDispatcher extends Handler {
            String callingPkg, boolean persistMessage, int priority,
            String callingPkg, boolean persistMessage, int priority,
            boolean expectMore, int validityPeriod, boolean isForVvm,
            boolean expectMore, int validityPeriod, boolean isForVvm,
            long messageId) {
            long messageId) {
        sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, messageUri, callingPkg,
                persistMessage, priority, expectMore, validityPeriod, isForVvm, messageId, false);
    }

    /**
     * Send a text based SMS.
     *
     * @param destAddr the address to send the message to
     * @param scAddr is the service center address or null to use
     *  the current default SMSC
     * @param text the body of the message to send
     * @param sentIntent if not NULL this <code>PendingIntent</code> is
     *  broadcast when the message is successfully sent, or failed.
     *  The result code will be <code>Activity.RESULT_OK<code> for success,
     *  or one of these errors:<br>
     *  <code>SmsManager.RESULT_ERROR_GENERIC_FAILURE</code><br>
     *  <code>SmsManager.RESULT_ERROR_RADIO_OFF</code><br>
     *  <code>SmsManager.RESULT_ERROR_NULL_PDU</code><br>
     *  <code>SmsManager.RESULT_ERROR_NO_SERVICE</code><br>
     *  <code>SmsManager.RESULT_ERROR_LIMIT_EXCEEDED</code><br>
     *  <code>SmsManager.RESULT_ERROR_FDN_CHECK_FAILURE</code><br>
     *  <code>SmsManager.RESULT_ERROR_SHORT_CODE_NOT_ALLOWED</code><br>
     *  <code>SmsManager.RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED</code><br>
     *  <code>SmsManager.RESULT_RADIO_NOT_AVAILABLE</code><br>
     *  <code>SmsManager.RESULT_NETWORK_REJECT</code><br>
     *  <code>SmsManager.RESULT_INVALID_ARGUMENTS</code><br>
     *  <code>SmsManager.RESULT_INVALID_STATE</code><br>
     *  <code>SmsManager.RESULT_NO_MEMORY</code><br>
     *  <code>SmsManager.RESULT_INVALID_SMS_FORMAT</code><br>
     *  <code>SmsManager.RESULT_SYSTEM_ERROR</code><br>
     *  <code>SmsManager.RESULT_MODEM_ERROR</code><br>
     *  <code>SmsManager.RESULT_NETWORK_ERROR</code><br>
     *  <code>SmsManager.RESULT_ENCODING_ERROR</code><br>
     *  <code>SmsManager.RESULT_INVALID_SMSC_ADDRESS</code><br>
     *  <code>SmsManager.RESULT_OPERATION_NOT_ALLOWED</code><br>
     *  <code>SmsManager.RESULT_INTERNAL_ERROR</code><br>
     *  <code>SmsManager.RESULT_NO_RESOURCES</code><br>
     *  <code>SmsManager.RESULT_CANCELLED</code><br>
     *  <code>SmsManager.RESULT_REQUEST_NOT_SUPPORTED</code><br>
     *  <code>SmsManager.RESULT_NO_BLUETOOTH_SERVICE</code><br>
     *  <code>SmsManager.RESULT_INVALID_BLUETOOTH_ADDRESS</code><br>
     *  <code>SmsManager.RESULT_BLUETOOTH_DISCONNECTED</code><br>
     *  <code>SmsManager.RESULT_UNEXPECTED_EVENT_STOP_SENDING</code><br>
     *  <code>SmsManager.RESULT_SMS_BLOCKED_DURING_EMERGENCY</code><br>
     *  <code>SmsManager.RESULT_SMS_SEND_RETRY_FAILED</code><br>
     *  <code>SmsManager.RESULT_REMOTE_EXCEPTION</code><br>
     *  <code>SmsManager.RESULT_NO_DEFAULT_SMS_APP</code><br>
     *  <code>SmsManager.RESULT_RIL_RADIO_NOT_AVAILABLE</code><br>
     *  <code>SmsManager.RESULT_RIL_SMS_SEND_FAIL_RETRY</code><br>
     *  <code>SmsManager.RESULT_RIL_NETWORK_REJECT</code><br>
     *  <code>SmsManager.RESULT_RIL_INVALID_STATE</code><br>
     *  <code>SmsManager.RESULT_RIL_INVALID_ARGUMENTS</code><br>
     *  <code>SmsManager.RESULT_RIL_NO_MEMORY</code><br>
     *  <code>SmsManager.RESULT_RIL_REQUEST_RATE_LIMITED</code><br>
     *  <code>SmsManager.RESULT_RIL_INVALID_SMS_FORMAT</code><br>
     *  <code>SmsManager.RESULT_RIL_SYSTEM_ERR</code><br>
     *  <code>SmsManager.RESULT_RIL_ENCODING_ERR</code><br>
     *  <code>SmsManager.RESULT_RIL_INVALID_SMSC_ADDRESS</code><br>
     *  <code>SmsManager.RESULT_RIL_MODEM_ERR</code><br>
     *  <code>SmsManager.RESULT_RIL_NETWORK_ERR</code><br>
     *  <code>SmsManager.RESULT_RIL_INTERNAL_ERR</code><br>
     *  <code>SmsManager.RESULT_RIL_REQUEST_NOT_SUPPORTED</code><br>
     *  <code>SmsManager.RESULT_RIL_INVALID_MODEM_STATE</code><br>
     *  <code>SmsManager.RESULT_RIL_NETWORK_NOT_READY</code><br>
     *  <code>SmsManager.RESULT_RIL_OPERATION_NOT_ALLOWED</code><br>
     *  <code>SmsManager.RESULT_RIL_NO_RESOURCES</code><br>
     *  <code>SmsManager.RESULT_RIL_CANCELLED</code><br>
     *  <code>SmsManager.RESULT_RIL_SIM_ABSENT</code><br>
     *  <code>SmsManager.RESULT_RIL_SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED</code><br>
     *  <code>SmsManager.RESULT_RIL_ACCESS_BARRED</code><br>
     *  <code>SmsManager.RESULT_RIL_BLOCKED_DUE_TO_CALL</code><br>
     *  For <code>SmsManager.RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
     *  the sentIntent may include the extra "errorCode" containing a radio technology specific
     *  value, generally only useful for troubleshooting.<br>
     *  The per-application based SMS control checks sentIntent. If sentIntent
     *  is NULL the caller will be checked against all unknown applications,
     *  which cause smaller number of SMS to be sent in checking period.
     * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
     *  broadcast when the message is delivered to the recipient.  The
     * @param messageUri optional URI of the message if it is already stored in the system
     * @param callingPkg the calling package name
     * @param persistMessage whether to save the sent message into SMS DB for a
     *  non-default SMS app.
     *
     * @param priority Priority level of the message
     *  Refer specification See 3GPP2 C.S0015-B, v2.0, table 4.5.9-1
     *  ---------------------------------
     *  PRIORITY      | Level of Priority
     *  ---------------------------------
     *      '00'      |     Normal
     *      '01'      |     Interactive
     *      '10'      |     Urgent
     *      '11'      |     Emergency
     *  ----------------------------------
     *  Any Other values included Negative considered as Invalid Priority Indicator of the message.
     * @param expectMore is a boolean to indicate the sending messages through same link or not.
     * @param validityPeriod Validity Period of the message in mins.
     *  Refer specification 3GPP TS 23.040 V6.8.1 section 9.2.3.12.1.
     *  Validity Period(Minimum) -> 5 mins
     *  Validity Period(Maximum) -> 635040 mins(i.e.63 weeks).
     *  Any Other values included Negative considered as Invalid Validity Period of the message.
     * @param messageId An id that uniquely identifies the message requested to be sent.
     *                 Used for logging and diagnostics purposes. The id may be NULL.
     * @param skipShortCodeCheck Skip check for short code type destination address.
     */
    public void sendText(String destAddr, String scAddr, String text,
                         PendingIntent sentIntent, PendingIntent deliveryIntent, Uri messageUri,
                         String callingPkg, boolean persistMessage, int priority,
                         boolean expectMore, int validityPeriod, boolean isForVvm,
                         long messageId, boolean skipShortCodeCheck) {
        Rlog.d(TAG, "sendText id: " + SmsController.formatCrossStackMessageId(messageId));
        Rlog.d(TAG, "sendText id: " + SmsController.formatCrossStackMessageId(messageId));
        int messageRef = nextMessageRef();
        int messageRef = nextMessageRef();
        SmsMessageBase.SubmitPduBase pdu = getSubmitPdu(
        SmsMessageBase.SubmitPduBase pdu = getSubmitPdu(
@@ -1395,7 +1505,8 @@ public abstract class SMSDispatcher extends Handler {
            HashMap map = getSmsTrackerMap(destAddr, scAddr, text, pdu);
            HashMap map = getSmsTrackerMap(destAddr, scAddr, text, pdu);
            SmsTracker tracker = getSmsTracker(callingPkg, map, sentIntent, deliveryIntent,
            SmsTracker tracker = getSmsTracker(callingPkg, map, sentIntent, deliveryIntent,
                    getFormat(), messageUri, expectMore, text, true /*isText*/,
                    getFormat(), messageUri, expectMore, text, true /*isText*/,
                    persistMessage, priority, validityPeriod, isForVvm, messageId, messageRef);
                    persistMessage, priority, validityPeriod, isForVvm, messageId, messageRef,
                    skipShortCodeCheck);


            if (!sendSmsByCarrierApp(false /* isDataSms */, tracker)) {
            if (!sendSmsByCarrierApp(false /* isDataSms */, tracker)) {
                sendSubmitPdu(tracker);
                sendSubmitPdu(tracker);
@@ -1706,7 +1817,7 @@ public abstract class SMSDispatcher extends Handler {
                        getFormat(), unsentPartCount, anyPartFailed, messageUri, smsHeader,
                        getFormat(), unsentPartCount, anyPartFailed, messageUri, smsHeader,
                        (!lastPart || expectMore), fullMessageText, true /*isText*/,
                        (!lastPart || expectMore), fullMessageText, true /*isText*/,
                        true /*persistMessage*/, priority, validityPeriod, false /* isForVvm */,
                        true /*persistMessage*/, priority, validityPeriod, false /* isForVvm */,
                        messageId, messageRef);
                        messageId, messageRef, false);
            } else {
            } else {
                Rlog.e(TAG, "CdmaSMSDispatcher.getNewSubmitPduTracker(): getSubmitPdu() returned "
                Rlog.e(TAG, "CdmaSMSDispatcher.getNewSubmitPduTracker(): getSubmitPdu() returned "
                        + "null " + SmsController.formatCrossStackMessageId(messageId));
                        + "null " + SmsController.formatCrossStackMessageId(messageId));
@@ -1719,13 +1830,12 @@ public abstract class SMSDispatcher extends Handler {
                            SmsHeader.toByteArray(smsHeader), encoding, smsHeader.languageTable,
                            SmsHeader.toByteArray(smsHeader), encoding, smsHeader.languageTable,
                            smsHeader.languageShiftTable, validityPeriod, messageRef);
                            smsHeader.languageShiftTable, validityPeriod, messageRef);
            if (pdu != null) {
            if (pdu != null) {
                HashMap map =  getSmsTrackerMap(destinationAddress, scAddress,
                HashMap map = getSmsTrackerMap(destinationAddress, scAddress, message, pdu);
                        message, pdu);
                return getSmsTracker(callingPackage, map, sentIntent,
                return getSmsTracker(callingPackage, map, sentIntent,
                        deliveryIntent, getFormat(), unsentPartCount, anyPartFailed, messageUri,
                        deliveryIntent, getFormat(), unsentPartCount, anyPartFailed, messageUri,
                        smsHeader, (!lastPart || expectMore), fullMessageText, true /*isText*/,
                        smsHeader, (!lastPart || expectMore), fullMessageText, true /*isText*/,
                        false /*persistMessage*/, priority, validityPeriod, false /* isForVvm */,
                        false /*persistMessage*/, priority, validityPeriod, false /* isForVvm */,
                        messageId, messageRef);
                        messageId, messageRef, false);
            } else {
            } else {
                Rlog.e(TAG, "GsmSMSDispatcher.getNewSubmitPduTracker(): getSubmitPdu() returned "
                Rlog.e(TAG, "GsmSMSDispatcher.getNewSubmitPduTracker(): getSubmitPdu() returned "
                        + "null " + SmsController.formatCrossStackMessageId(messageId));
                        + "null " + SmsController.formatCrossStackMessageId(messageId));
@@ -1883,7 +1993,8 @@ public abstract class SMSDispatcher extends Handler {
     */
     */
    boolean checkDestination(SmsTracker[] trackers) {
    boolean checkDestination(SmsTracker[] trackers) {
        if (mContext.checkCallingOrSelfPermission(SEND_SMS_NO_CONFIRMATION)
        if (mContext.checkCallingOrSelfPermission(SEND_SMS_NO_CONFIRMATION)
                == PackageManager.PERMISSION_GRANTED || trackers[0].mIsForVvm) {
                == PackageManager.PERMISSION_GRANTED || trackers[0].mIsForVvm
                || trackers[0].mSkipShortCodeDestAddrCheck) {
            return true;            // app is pre-approved to send to short codes
            return true;            // app is pre-approved to send to short codes
        } else {
        } else {
            int rule = mPremiumSmsRule.get();
            int rule = mPremiumSmsRule.get();
@@ -2227,6 +2338,7 @@ public abstract class SMSDispatcher extends Handler {
        private Boolean mIsFromDefaultSmsApplication;
        private Boolean mIsFromDefaultSmsApplication;


        private int mCarrierId;
        private int mCarrierId;
        private boolean mSkipShortCodeDestAddrCheck;
        // SMS anomaly uuid -- unexpected error from RIL
        // SMS anomaly uuid -- unexpected error from RIL
        private final UUID mAnomalyUnexpectedErrorFromRilUUID =
        private final UUID mAnomalyUnexpectedErrorFromRilUUID =
                UUID.fromString("43043600-ea7a-44d2-9ae6-a58567ac7886");
                UUID.fromString("43043600-ea7a-44d2-9ae6-a58567ac7886");
@@ -2237,7 +2349,7 @@ public abstract class SMSDispatcher extends Handler {
                SmsHeader smsHeader, boolean expectMore, String fullMessageText, int subId,
                SmsHeader smsHeader, boolean expectMore, String fullMessageText, int subId,
                boolean isText, boolean persistMessage, int userId, int priority,
                boolean isText, boolean persistMessage, int userId, int priority,
                int validityPeriod, boolean isForVvm, long messageId, int carrierId,
                int validityPeriod, boolean isForVvm, long messageId, int carrierId,
                int messageRef) {
                int messageRef, boolean skipShortCodeDestAddrCheck) {
            mData = data;
            mData = data;
            mSentIntent = sentIntent;
            mSentIntent = sentIntent;
            mDeliveryIntent = deliveryIntent;
            mDeliveryIntent = deliveryIntent;
@@ -2263,6 +2375,7 @@ public abstract class SMSDispatcher extends Handler {
            mIsForVvm = isForVvm;
            mIsForVvm = isForVvm;
            mMessageId = messageId;
            mMessageId = messageId;
            mCarrierId = carrierId;
            mCarrierId = carrierId;
            mSkipShortCodeDestAddrCheck = skipShortCodeDestAddrCheck;
        }
        }


        public HashMap<String, Object> getData() {
        public HashMap<String, Object> getData() {
@@ -2538,7 +2651,7 @@ public abstract class SMSDispatcher extends Handler {
            AtomicInteger unsentPartCount, AtomicBoolean anyPartFailed, Uri messageUri,
            AtomicInteger unsentPartCount, AtomicBoolean anyPartFailed, Uri messageUri,
            SmsHeader smsHeader, boolean expectMore, String fullMessageText, boolean isText,
            SmsHeader smsHeader, boolean expectMore, String fullMessageText, boolean isText,
            boolean persistMessage, int priority, int validityPeriod, boolean isForVvm,
            boolean persistMessage, int priority, int validityPeriod, boolean isForVvm,
            long messageId, int messageRef) {
            long messageId, int messageRef, boolean skipShortCodeCheck) {
        // Get package info via packagemanager
        // Get package info via packagemanager
        UserHandle callingUser = UserHandle.getUserHandleForUid(Binder.getCallingUid());
        UserHandle callingUser = UserHandle.getUserHandleForUid(Binder.getCallingUid());
        final int userId = callingUser.getIdentifier();
        final int userId = callingUser.getIdentifier();
@@ -2555,7 +2668,8 @@ public abstract class SMSDispatcher extends Handler {
        return new SmsTracker(data, sentIntent, deliveryIntent, appInfo, destAddr, format,
        return new SmsTracker(data, sentIntent, deliveryIntent, appInfo, destAddr, format,
                unsentPartCount, anyPartFailed, messageUri, smsHeader, expectMore,
                unsentPartCount, anyPartFailed, messageUri, smsHeader, expectMore,
                fullMessageText, getSubId(), isText, persistMessage, userId, priority,
                fullMessageText, getSubId(), isText, persistMessage, userId, priority,
                validityPeriod, isForVvm, messageId, mPhone.getCarrierId(), messageRef);
                validityPeriod, isForVvm, messageId, mPhone.getCarrierId(), messageRef,
                skipShortCodeCheck);
    }
    }


    protected SmsTracker getSmsTracker(String callingPackage, HashMap<String, Object> data,
    protected SmsTracker getSmsTracker(String callingPackage, HashMap<String, Object> data,
@@ -2566,17 +2680,18 @@ public abstract class SMSDispatcher extends Handler {
                null/*unsentPartCount*/, null/*anyPartFailed*/, messageUri, null/*smsHeader*/,
                null/*unsentPartCount*/, null/*anyPartFailed*/, messageUri, null/*smsHeader*/,
                expectMore, fullMessageText, isText, persistMessage,
                expectMore, fullMessageText, isText, persistMessage,
                SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, SMS_MESSAGE_PERIOD_NOT_SPECIFIED, isForVvm,
                SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, SMS_MESSAGE_PERIOD_NOT_SPECIFIED, isForVvm,
                messageId, messageRef);
                messageId, messageRef, false);
    }
    }


    protected SmsTracker getSmsTracker(String callingPackage, HashMap<String, Object> data,
    protected SmsTracker getSmsTracker(String callingPackage, HashMap<String, Object> data,
            PendingIntent sentIntent, PendingIntent deliveryIntent, String format, Uri messageUri,
            PendingIntent sentIntent, PendingIntent deliveryIntent, String format, Uri messageUri,
            boolean expectMore, String fullMessageText, boolean isText, boolean persistMessage,
            boolean expectMore, String fullMessageText, boolean isText, boolean persistMessage,
            int priority, int validityPeriod, boolean isForVvm, long messageId, int messageRef) {
            int priority, int validityPeriod, boolean isForVvm, long messageId, int messageRef,
            boolean skipShortCodeCheck) {
        return getSmsTracker(callingPackage, data, sentIntent, deliveryIntent, format,
        return getSmsTracker(callingPackage, data, sentIntent, deliveryIntent, format,
                null/*unsentPartCount*/, null/*anyPartFailed*/, messageUri, null/*smsHeader*/,
                null/*unsentPartCount*/, null/*anyPartFailed*/, messageUri, null/*smsHeader*/,
                expectMore, fullMessageText, isText, persistMessage, priority, validityPeriod,
                expectMore, fullMessageText, isText, persistMessage, priority, validityPeriod,
                isForVvm, messageId, messageRef);
                isForVvm, messageId, messageRef, skipShortCodeCheck);
    }
    }


    protected HashMap<String, Object> getSmsTrackerMap(String destAddr, String scAddr,
    protected HashMap<String, Object> getSmsTrackerMap(String destAddr, String scAddr,
+15 −5
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@ import android.app.AppOpsManager;
import android.app.PendingIntent;
import android.app.PendingIntent;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.Context;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.net.Uri;
import android.os.BaseBundle;
import android.os.BaseBundle;
import android.os.Binder;
import android.os.Binder;
@@ -199,7 +200,7 @@ public class SmsController extends ISmsImplBase {
            boolean persistMessageForNonDefaultSmsApp, long messageId) {
            boolean persistMessageForNonDefaultSmsApp, long messageId) {
        sendTextForSubscriber(subId, callingPackage, callingAttributionTag, destAddr, scAddr,
        sendTextForSubscriber(subId, callingPackage, callingAttributionTag, destAddr, scAddr,
                text, sentIntent, deliveryIntent, persistMessageForNonDefaultSmsApp, messageId,
                text, sentIntent, deliveryIntent, persistMessageForNonDefaultSmsApp, messageId,
                false);
                false, false);


    }
    }


@@ -225,12 +226,20 @@ public class SmsController extends ISmsImplBase {
    public void sendTextForSubscriber(int subId, String callingPackage,
    public void sendTextForSubscriber(int subId, String callingPackage,
            String callingAttributionTag, String destAddr, String scAddr, String text,
            String callingAttributionTag, String destAddr, String scAddr, String text,
            PendingIntent sentIntent, PendingIntent deliveryIntent,
            PendingIntent sentIntent, PendingIntent deliveryIntent,
            boolean persistMessageForNonDefaultSmsApp, long messageId, boolean skipFdnCheck) {
            boolean persistMessageForNonDefaultSmsApp, long messageId, boolean skipFdnCheck,
            boolean skipShortCodeCheck) {
        if (callingPackage == null) {
        if (callingPackage == null) {
            callingPackage = getCallingPackage();
            callingPackage = getCallingPackage();
        }
        }
        Rlog.d(LOG_TAG, "sendTextForSubscriber caller=" + callingPackage);
        Rlog.d(LOG_TAG, "sendTextForSubscriber caller=" + callingPackage);


        if (skipFdnCheck || skipShortCodeCheck) {
            if (mContext.checkCallingOrSelfPermission(
                    android.Manifest.permission.MODIFY_PHONE_STATE)
                    != PackageManager.PERMISSION_GRANTED) {
                throw new SecurityException("Requires MODIFY_PHONE_STATE permission.");
            }
        }
        if (!getSmsPermissions(subId).checkCallingCanSendText(persistMessageForNonDefaultSmsApp,
        if (!getSmsPermissions(subId).checkCallingCanSendText(persistMessageForNonDefaultSmsApp,
                callingPackage, callingAttributionTag, "Sending SMS message")) {
                callingPackage, callingAttributionTag, "Sending SMS message")) {
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_ERROR_GENERIC_FAILURE);
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_ERROR_GENERIC_FAILURE);
@@ -255,7 +264,7 @@ public class SmsController extends ISmsImplBase {
            sendBluetoothText(info, destAddr, text, sentIntent, deliveryIntent);
            sendBluetoothText(info, destAddr, text, sentIntent, deliveryIntent);
        } else {
        } else {
            sendIccText(subId, callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent,
            sendIccText(subId, callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent,
                    persistMessageForNonDefaultSmsApp, messageId);
                    persistMessageForNonDefaultSmsApp, messageId, skipShortCodeCheck);
        }
        }
    }
    }


@@ -272,13 +281,14 @@ public class SmsController extends ISmsImplBase {


    private void sendIccText(int subId, String callingPackage, String destAddr,
    private void sendIccText(int subId, String callingPackage, String destAddr,
            String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
            String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
            boolean persistMessageForNonDefaultSmsApp, long messageId) {
            boolean persistMessageForNonDefaultSmsApp, long messageId, boolean skipShortCodeCheck) {
        Rlog.d(LOG_TAG, "sendTextForSubscriber iccSmsIntMgr"
        Rlog.d(LOG_TAG, "sendTextForSubscriber iccSmsIntMgr"
                + " Subscription: " + subId + " " + formatCrossStackMessageId(messageId));
                + " Subscription: " + subId + " " + formatCrossStackMessageId(messageId));
        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null) {
        if (iccSmsIntMgr != null) {
            iccSmsIntMgr.sendText(callingPackage, destAddr, scAddr, text, sentIntent,
            iccSmsIntMgr.sendText(callingPackage, destAddr, scAddr, text, sentIntent,
                    deliveryIntent, persistMessageForNonDefaultSmsApp, messageId);
                    deliveryIntent, persistMessageForNonDefaultSmsApp, messageId,
                    skipShortCodeCheck);
        } else {
        } else {
            Rlog.e(LOG_TAG, "sendTextForSubscriber iccSmsIntMgr is null for"
            Rlog.e(LOG_TAG, "sendTextForSubscriber iccSmsIntMgr is null for"
                    + " Subscription: " + subId + " " + formatCrossStackMessageId(messageId));
                    + " Subscription: " + subId + " " + formatCrossStackMessageId(messageId));
+109 −3

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Original line Diff line number Diff line
@@ -624,7 +624,7 @@ public class CatService extends Handler implements AppInterface {
        SmsController smsController = proxyController.getSmsController();
        SmsController smsController = proxyController.getSmsController();
        smsController.sendTextForSubscriber(subId, mContext.getOpPackageName(),
        smsController.sendTextForSubscriber(subId, mContext.getOpPackageName(),
                mContext.getAttributionTag(), destAddr, null, text, sentPendingIntent,
                mContext.getAttributionTag(), destAddr, null, text, sentPendingIntent,
                deliveryPendingIntent, false, 0L, true);
                deliveryPendingIntent, false, 0L, true, true);
    }
    }


    private class SmsBroadcastReceiver extends BroadcastReceiver {
    private class SmsBroadcastReceiver extends BroadcastReceiver {
Loading