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

Commit dea2c2ed authored by Arc Wang's avatar Arc Wang Committed by android-build-merger
Browse files

Merge "Send sentIntent back to APP when a MO SMS can't be sent to network."

am: f3a5580b

Change-Id: I2bf9032b921aa06637a88e18028a83c913261693
parents 2c6bdae4 f3a5580b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -338,6 +338,7 @@ public class IccSmsInterfaceManager {
    public void sendDataWithSelfPermissions(String callingPackage, String destAddr, String scAddr,
            int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) {
        if (!checkCallingOrSelfSendSmsPermission(callingPackage, "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntent);
            return;
        }
        sendDataInternal(destAddr, scAddr, destPort, data, sentIntent, deliveryIntent);
@@ -350,6 +351,7 @@ public class IccSmsInterfaceManager {
    public void sendData(String callingPackage, String destAddr, String scAddr, int destPort,
            byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) {
        if (!checkCallingSendSmsPermission(callingPackage, "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntent);
            return;
        }
        sendDataInternal(destAddr, scAddr, destPort, data, sentIntent, deliveryIntent);
@@ -402,6 +404,7 @@ public class IccSmsInterfaceManager {
            boolean persistMessageForNonDefaultSmsApp) {
        if (!checkCallingSendTextPermissions(
                persistMessageForNonDefaultSmsApp, callingPackage, "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntent);
            return;
        }
        sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent,
@@ -417,6 +420,7 @@ public class IccSmsInterfaceManager {
            String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
            boolean persistMessage) {
        if (!checkCallingOrSelfSendSmsPermission(callingPackage, "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntent);
            return;
        }
        sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent,
@@ -538,6 +542,7 @@ public class IccSmsInterfaceManager {
            boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore,
            int validityPeriod) {
        if (!checkCallingOrSelfSendSmsPermission(callingPackage, "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntent);
            return;
        }
        sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent,
@@ -666,6 +671,7 @@ public class IccSmsInterfaceManager {
            int priority, boolean expectMore, int validityPeriod) {
        if (!checkCallingSendTextPermissions(
                persistMessageForNonDefaultSmsApp, callingPackage, "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntents);
            return;
        }
        if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
@@ -1100,6 +1106,7 @@ public class IccSmsInterfaceManager {
    public void sendStoredText(String callingPkg, Uri messageUri, String scAddress,
            PendingIntent sentIntent, PendingIntent deliveryIntent) {
        if (!checkCallingSendSmsPermission(callingPkg, "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntent);
            return;
        }
        if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
@@ -1128,6 +1135,7 @@ public class IccSmsInterfaceManager {
    public void sendStoredMultipartText(String callingPkg, Uri messageUri, String scAddress,
            List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents) {
        if (!checkCallingSendSmsPermission(callingPkg, "Sending SMS message")) {
            returnUnspecifiedFailure(sentIntents);
            return;
        }
        final ContentResolver resolver = mContext.getContentResolver();
+11 −0
Original line number Diff line number Diff line
@@ -877,6 +877,16 @@ public abstract class SMSDispatcher extends Handler {
        }
    }

    private void triggerSentIntentForFailure(List<PendingIntent> sentIntents) {
        if (sentIntents == null) {
            return;
        }

        for (PendingIntent sentIntent : sentIntents) {
            triggerSentIntentForFailure(sentIntent);
        }
    }

    private boolean sendSmsByCarrierApp(boolean isDataSms, SmsTracker tracker ) {
        String carrierPackage = getCarrierAppPackageName();
        if (carrierPackage != null) {
@@ -1025,6 +1035,7 @@ public abstract class SMSDispatcher extends Handler {
        if (parts == null || trackers == null || trackers.length == 0
                || trackers[0] == null) {
            Rlog.e(TAG, "Cannot send multipart text. parts=" + parts + " trackers=" + trackers);
            triggerSentIntentForFailure(sentIntents);
            return;
        }

+12 −4
Original line number Diff line number Diff line
@@ -128,6 +128,7 @@ public class UiccSmsController extends ISmsImplBase {
        } else {
            Rlog.e(LOG_TAG,"sendText iccSmsIntMgr is null for" +
                          " Subscription: " + subId);
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_ERROR_GENERIC_FAILURE);
        }
    }

@@ -157,21 +158,23 @@ public class UiccSmsController extends ISmsImplBase {
        } else {
            Rlog.e(LOG_TAG,"sendText iccSmsIntMgr is null for" +
                          " Subscription: " + subId);
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_ERROR_GENERIC_FAILURE);
        }
    }

    @Override
    public void sendTextForSubscriberWithOptions(int subId, String callingPackage,
            String destAddr, String scAddr, String parts, PendingIntent sentIntents,
            PendingIntent deliveryIntents, boolean persistMessage, int priority,
            String destAddr, String scAddr, String parts, PendingIntent sentIntent,
            PendingIntent deliveryIntent, boolean persistMessage, int priority,
            boolean expectMore, int validityPeriod) {
        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null ) {
            iccSmsIntMgr.sendTextWithOptions(callingPackage, destAddr, scAddr, parts, sentIntents,
                    deliveryIntents, persistMessage,  priority, expectMore, validityPeriod);
            iccSmsIntMgr.sendTextWithOptions(callingPackage, destAddr, scAddr, parts, sentIntent,
                    deliveryIntent, persistMessage,  priority, expectMore, validityPeriod);
        } else {
            Rlog.e(LOG_TAG,"sendTextWithOptions iccSmsIntMgr is null for" +
                          " Subscription: " + subId);
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_ERROR_GENERIC_FAILURE);
        }
    }

@@ -203,6 +206,7 @@ public class UiccSmsController extends ISmsImplBase {
        } else {
            Rlog.e(LOG_TAG,"sendMultipartTextWithOptions iccSmsIntMgr is null for" +
                          " Subscription: " + subId);
            sendErrorInPendingIntents(sentIntents, SmsManager.RESULT_ERROR_GENERIC_FAILURE);
        }
    }

@@ -440,6 +444,10 @@ public class UiccSmsController extends ISmsImplBase {
    }

    private void sendErrorInPendingIntents(List<PendingIntent> intents, int errorCode) {
        if (intents == null) {
            return;
        }

        for (PendingIntent intent : intents) {
            sendErrorInPendingIntent(intent, errorCode);
        }